Improved server list to show server release channel and to use correct channel for launch game, disable update interval manager due to current implementation being a bit janky looking

This commit is contained in:
2021-12-22 15:48:51 -06:00
parent d2723c82ab
commit 6b82fad794
3 changed files with 10 additions and 6 deletions

View File

@@ -1,7 +1,7 @@
class W3DHub
class Api
class ServerListServer
attr_reader :id, :game, :address, :port, :region, :status
attr_reader :id, :game, :address, :port, :region, :channel, :status
def initialize(hash)
@data = hash
@@ -11,6 +11,7 @@ class W3DHub
@address = @data[:address]
@port = @data[:port]
@region = @data[:region]
@channel = @data[:channel] || "release"
@status = @data[:status] ? Status.new(@data[:status]) : nil
end

View File

@@ -140,8 +140,8 @@ class W3DHub
inscription "<b>#{server&.status&.name}</b>"
flow(width: 1.0, height: 1.0) do
inscription "Release", margin_right: 64, text_size: 14
inscription "#{server.region}", text_size: 14
inscription server.channel, margin_right: 64, text_size: 14
inscription server.region, text_size: 14
end
end
@@ -203,8 +203,8 @@ class W3DHub
end
stack(width: 1.0, height: 0.25) do
game_installed = Store.application_manager.installed?(server.game, Store.applications.games.find { |g| g.id == server.game }.channels.first.id)
game_updatable = Store.application_manager.updateable?(server.game, Store.applications.games.find { |g| g.id == server.game }.channels.first.id)
game_installed = Store.application_manager.installed?(server.game, Store.applications.games.find { |g| g.id == server.game }&.channels&.find { |c| c.id == server.channel }&.id)
game_updatable = Store.application_manager.updateable?(server.game, Store.applications.games.find { |g| g.id == server.game }&.channels&.find { |c| c.id == server.channel }&.id)
button "<b>#{I18n.t(:"server_browser.join_server")}</b>", enabled: (game_installed && !game_updatable) do
# Check for nickname
@@ -248,7 +248,7 @@ class W3DHub
stack(width: 1.0, height: 0.55, margin_top: 16) do
flow(width: 1.0, height: 0.33) do
inscription "<b>#{I18n.t(:"server_browser.game")}</b>", width: 0.28, text_wrap: :none
inscription "#{game_name(server.game)} (branch)", width: 0.71, text_wrap: :none
inscription "#{game_name(server.game)} (#{server.channel})", width: 0.71, text_wrap: :none
end
flow(width: 1.0, height: 0.33) do

View File

@@ -42,7 +42,10 @@ class W3DHub
end
def manage_update_interval
return # Wait for #gain/lose_focus callbacks to be merged into Gosu
@last_interaction = Gosu.milliseconds if @last_mouse_position.x != mouse_x || @last_mouse_position.y != mouse_y
@last_interaction = Gosu.milliseconds if mouse_x.between?(0, width) && mouse_y.between?(0, height)
self.update_interval = if Gosu.milliseconds - @last_interaction >= 1_000
1000.0 / 10