Websocket based server list updater now works, gui needs a bit of work to not flash when refreshing list

This commit is contained in:
2021-12-27 20:48:30 -06:00
parent 92f6a76381
commit 0f943252c5
4 changed files with 60 additions and 24 deletions

View File

@@ -16,6 +16,18 @@ class W3DHub
@status = @data[:status] ? Status.new(@data[:status]) : nil
end
def update(hash)
if @status
@status.instance_variable_set(:@name, hash[:name])
@status.instance_variable_set(:@password, hash[:password] || false)
@status.instance_variable_set(:@map, hash[:map])
@status.instance_variable_set(:@max_players, hash[:maxplayers])
@status.instance_variable_set(:@player_count, hash[:numplayers] || 0)
@status.instance_variable_set(:@started, hash[:started])
@status.instance_variable_set(:@remaining, hash[:remaining])
end
end
class Status
attr_reader :name, :password, :map, :max_players, :player_count, :started, :remaining, :teams, :players