Fixed boot saving in a thread causing png based icons to be blank, improvements to server browser to show same team and score data as android app, fixed settings page not using a find height for containers causing them to not position properly on initial gui regeneration, task fail fast now checks for write access to target path, fail fast now raises an exception to prevent incorrect fail fast check from being reported.

This commit is contained in:
2022-02-21 09:29:40 -06:00
parent 9be118b1ad
commit 8ba577d5fd
8 changed files with 72 additions and 49 deletions

View File

@@ -170,7 +170,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"
# next unless server.channel == "release"
i += 1
@@ -251,7 +251,7 @@ class W3DHub
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), **style do
button "<b>#{I18n.t(:"server_browser.join_server")}</b>", margin_left: 96, enabled: (game_installed && !game_updatable), **style do
# Check for nickname
# prompt for nickname
# !abort unless nickname set
@@ -310,19 +310,24 @@ class W3DHub
game_balance = server_game_balance(server)
flow(width: 1.0, height: 0.05) do
stack(width: 0.465, height: 1.0) do
para "<b>#{server.status.teams[0].name}</b>", width: 1.0, text_align: :center
flow(width: 1.0, height: 0.1, border_thickness_bottom: 2, border_color_bottom: 0x44_ffffff) do
stack(width: 0.4, height: 1.0) do
para "<b>#{server.status.teams[0].name} (#{server.status.players.select { |pl| pl.team == 0 }.count})</b>", width: 1.0, text_align: :center
para game_balance[:team_0_score].to_i.to_s, width: 1.0, text_align: :center
end
image game_balance[:icon], height: 1.0, tip: game_balance[:message], color: game_balance[:color]
stack(width: 0.2, height: 1.0) do
image game_balance[:icon], height: 0.5, margin_left: 20, tip: game_balance[:message], color: game_balance[:color]
para game_balance[:ratio].round(2).to_s, width: 1.0, text_align: :center
end
stack(width: 0.46, height: 1.0) do
para "<b>#{server.status.teams[1].name}</b>", width: 1.0, text_align: :center
stack(width: 0.4, height: 1.0) do
para "<b>#{server.status.teams[1].name} (#{server.status.players.select { |pl| pl.team == 1 }.count})</b>", width: 1.0, text_align: :center
para game_balance[:team_1_score].to_i.to_s, width: 1.0, text_align: :center
end
end
flow(width: 1.0, height: 0.65, scroll: true) do
flow(width: 1.0, height: 0.60, scroll: true) do
stack(width: 0.5) do
server.status.players.select { |ply| ply.team == 0 }.sort_by { |ply| ply.score }.reverse.each do |player|
flow(width: 1.0, height: 18) do
@@ -392,14 +397,24 @@ class W3DHub
}
# team 0 is left side
team_0_score = server.status.players.select { |ply| ply.team == 0 }.map(&:score).sum.to_f
team_0_score = server.status.teams[0].score
team_0_score = nil if team_0_score.zero?
team_0_score ||= server.status.players.select { |ply| ply.team == 0 }.map(&:score).sum
team_0_score = team_0_score.to_f
# team 1 is right side
team_1_score = server.status.players.select { |ply| ply.team == 1 }.map(&:score).sum.to_f
team_1_score = server.status.teams[1].score
team_1_score = nil if team_1_score.zero?
team_1_score ||= server.status.players.select { |ply| ply.team == 1 }.map(&:score).sum
team_1_score = team_1_score.to_f
ratio = 1.0 / (team_0_score / team_1_score)
ratio = 1.0 if ratio.to_s == "NaN"
data[:ratio] = ratio
data[:team_0_score] = team_0_score
data[:team_1_score] = team_1_score
data[:icon] = if server.status.players.size < 20 && server.game != "ren"
data[:color] = 0xff_600000
data[:message] = "Too few players for a balanced game"

View File

@@ -5,18 +5,18 @@ class W3DHub
body.clear do
stack(width: 1.0, height: 1.0, padding: 16, scroll: true) do
para "<b>Language</b>"
flow(width: 1.0) do
para "<b>Launcher Language</b>", width: 0.249
flow(width: 1.0, height: 0.12) do
para "<b>Launcher Language</b>", width: 0.249, margin_left: 32, margin_top: 12
stack(width: 0.75) do
@language_menu = list_box items: I18n.available_locales.map { |l| expand_language_code(l.to_s) }, choose: expand_language_code(Store.settings[:language]), width: 1.0
inscription "Select the UI language you'd like to use in the W3D Hub Launcher. You should restart the launcher after changing this setting before the UI will update"
inscription "Select the UI language you'd like to use in the W3D Hub Launcher."
end
end
para "<b>Folder Paths</b>", margin_top: 32
stack(width: 1.0) do
flow(width: 1.0) do
para "<b>App Install Folder</b>", width: 0.249
para "<b>Folder Paths</b>", margin_top: 8, padding_top: 8, border_thickness_top: 2, border_color_top: 0xee_ffffff, width: 1.0
stack(width: 1.0, height: 0.3) do
flow(width: 1.0, height: 0.5) do
para "<b>App Install Folder</b>", width: 0.249, margin_left: 32, margin_top: 12
stack(width: 0.75) do
@app_install_dir_input = edit_line Store.settings[:app_install_dir], width: 1.0
@@ -25,7 +25,7 @@ class W3DHub
end
flow(width: 1.0, margin_top: 16) do
para "<b>Package Cache Folder</b>", width: 0.249
para "<b>Package Cache Folder</b>", width: 0.249, margin_left: 32, margin_top: 12
stack(width: 0.75) do
@package_cache_dir_input = edit_line Store.settings[:package_cache_dir], width: 1.0
@@ -35,17 +35,17 @@ class W3DHub
end
if true # W3DHub.unix?
para "<b>Wine</b>", margin_top: 32
flow(width: 1.0) do
para "<b>Wine Command</b>", width: 0.249
para "<b>Wine</b>", margin_top: 8, padding_top: 8, border_thickness_top: 2, border_color_top: 0xee_ffffff, width: 1.0
flow(width: 1.0, height: 0.12) do
para "<b>Wine Command</b>", width: 0.249, margin_left: 32, margin_top: 12
stack(width: 0.75) do
@wine_command_input = edit_line Store.settings[:wine_command], width: 1.0
inscription "Command to use to for Windows compatiblity layer"
end
end
flow(width: 1.0, margin_top: 16) do
para "<b>Wine Prefix</b>", width: 0.249
flow(width: 1.0, height: 0.13, margin_top: 16) do
para "<b>Wine Prefix</b>", width: 0.249, margin_left: 32, margin_top: 12
stack(width: 0.75) do
@wine_prefix_toggle = toggle_button checked: Store.settings[:wine_prefix]
inscription "Whether each game gets its own prefix. Uses global/default prefix by default."