diff --git a/lib/api/server_list_server.rb b/lib/api/server_list_server.rb index 0c8bb26..5f4cce2 100644 --- a/lib/api/server_list_server.rb +++ b/lib/api/server_list_server.rb @@ -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 diff --git a/lib/pages/server_browser.rb b/lib/pages/server_browser.rb index 55712fa..c8224a6 100644 --- a/lib/pages/server_browser.rb +++ b/lib/pages/server_browser.rb @@ -140,8 +140,8 @@ class W3DHub inscription "#{server&.status&.name}" 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 "#{I18n.t(:"server_browser.join_server")}", 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 "#{I18n.t(:"server_browser.game")}", 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 diff --git a/lib/window.rb b/lib/window.rb index 87797ed..01025e0 100644 --- a/lib/window.rb +++ b/lib/window.rb @@ -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