Made Join Server button have a different colored background for non-release servers, added small download icon next to a game's icon when it is not installed, updated Update Now string to Install Update, selected app and channel are now saved to the settings- possibly removing an unnecessary click

This commit is contained in:
2021-12-22 18:14:26 -06:00
parent 6b82fad794
commit 961b61c0ce
5 changed files with 32 additions and 10 deletions

View File

@@ -3,7 +3,8 @@ class W3DHub
class Games < Page
def setup
@game_news ||= {}
@focused_game ||= Store.applications.games.first
@focused_game ||= Store.applications.games.find { |g| g.id == Store.settings[:last_selected_app] }
@focused_channel ||= @focused_game.channels.find { |c| c.id == Store.settings[:last_selected_channel] }
body.clear do
# Games List
@@ -15,7 +16,7 @@ class W3DHub
end
end
populate_game_page(@focused_game, @focused_game.channels.first)
populate_game_page(@focused_game, @focused_channel)
populate_games_list
end
@@ -35,8 +36,9 @@ class W3DHub
flow(width: 1.0, height: 48) do
stack(width: 0.3) do
image "#{GAME_ROOT_PATH}/media/ui_icons/return.png", width: 1.0, color: Gosu::Color::GRAY if Store.application_manager.updateable?(game.id, game.channels.first.id)
image "#{GAME_ROOT_PATH}/media/ui_icons/import.png", width: 0.5, color: 0x88_ffffff unless Store.application_manager.installed?(game.id, game.channels.first.id)
end
image "#{GAME_ROOT_PATH}/media/icons/#{game.id}.png", height: 48, color: Store.application_manager.installed?(game.id, game.channels.first.id) ? 0xff_ffffff : 0xee_444444
image "#{GAME_ROOT_PATH}/media/icons/#{game.id}.png", height: 48, color: Store.application_manager.installed?(game.id, game.channels.first.id) ? 0xff_ffffff : 0x88_ffffff
end
inscription game.name, width: 1.0, text_align: :center
end
@@ -55,6 +57,10 @@ class W3DHub
def populate_game_page(game, channel)
@focused_game = game
@focused_channel = channel
Store.settings[:last_selected_app] = game.id
Store.settings[:last_selected_channel] = channel.id
@game_page_container.clear do
background game.color
@@ -123,7 +129,7 @@ class W3DHub
if Store.application_manager.installed?(game.id, channel.id)
if Store.application_manager.updateable?(game.id, channel.id)
button "<b>#{I18n.t(:"interface.update_now")}</b>", margin_left: 24, background: 0xff_ffac00 do
button "<b>#{I18n.t(:"interface.install_update")}</b>", margin_left: 24, **UPDATE_BUTTON do
Store.application_manager.update(game.id, channel.id)
end
else

View File

@@ -128,6 +128,7 @@ class W3DHub
Store.server_list.each do |server|
next unless @filters[server.game.to_sym]
next unless server.region == @filter_region || @filter_region == "Any"
next unless server.channel == "release"
i += 1
@@ -203,10 +204,11 @@ 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&.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)
game_installed = Store.application_manager.installed?(server.game, server.channel)
game_updatable = Store.application_manager.updateable?(server.game, server.channel)
style = server.channel != "release" ? TESTING_BUTTON : {}
button "<b>#{I18n.t(:"server_browser.join_server")}</b>", enabled: (game_installed && !game_updatable) do
button "<b>#{I18n.t(:"server_browser.join_server")}</b>", enabled: (game_installed && !game_updatable), **style do
# Check for nickname
# prompt for nickname
# !abort unless nickname set
@@ -427,7 +429,7 @@ class W3DHub
Store.application_manager.join_server(
server.game,
Store.applications.games.find { |g| g.id == server.game }.channels.first.id, server, password
server.channel, server, password
)
else
window.push_state(W3DHub::States::MessageDialog, type: "?", title: "?", message: "?")

View File

@@ -13,7 +13,9 @@ class W3DHub
server_list_region: "Any",
account: {},
applications: {},
games: {}
games: {},
last_selected_app: "ren",
last_selected_channel: "release"
}
end

View File

@@ -2,6 +2,18 @@ class W3DHub
REGULAR_FONT = "#{GAME_ROOT_PATH}/media/fonts/NotoSans-Regular.ttf"
BOLD_FONT = "#{GAME_ROOT_PATH}/media/fonts/NotoSans-Bold.ttf"
TESTING_BUTTON = {
background: 0xff_ff8800,
hover: {
background: 0xff_ffaa00
},
active: {
background: 0xff_ffec00
}
}
UPDATE_BUTTON = TESTING_BUTTON
THEME = {
ToolTip: {
background: 0xff_dedede,