Fix up app filters on server browser, make it possible to join server from server browser

This commit is contained in:
2026-09-18 13:51:46 -05:00
parent 6707f260c9
commit f8ceb69402
4 changed files with 35 additions and 16 deletions

View File

@@ -24,11 +24,23 @@ module W3DHubLauncher
env,
"#{wine_command(app)}#{exe_path} -launcher #{args.join(' ')}"
)
Process.detach(pid)
end
def self.join_server(app, server, password: nil, token: nil)
def self.join_server(app, server, password: nil, token: nil, multi: false)
parameters = []
parameters << format("+connect %s:%s", server.address, server.port)
parameters << format("+netplayername \"%s\"", "cyberarm")
parameters << format("+password \"%s\"", password) if password
parameters << format("+userkey \"%s\"", token) if token
parameters << "+multi" if multi
run(
app,
parameters.join(" ")
)
end
end
end

View File

@@ -16,15 +16,16 @@ module W3DHubLauncher
w.subscribe(:clicked_left_mouse_button) do
@games_filter.clear
@app_filters_container.children.each { |c| c.enabled = true }
populate_server_list
end
end
flow(fill: true, height: 1.0, background_nine_slice: NINE_SLICE_ROUNDED, background_nine_slice_from_edge: NINE_SLICE_EDGE, background_nine_slice_color: ALPHA_GRAY, margin_left: PADDING) do
@app_filters_container = flow(fill: true, height: 1.0, background_nine_slice: NINE_SLICE_ROUNDED, background_nine_slice_from_edge: NINE_SLICE_EDGE, background_nine_slice_color: ALPHA_GRAY, margin_left: PADDING) do
MemCache[:applications].each do |app|
next unless app.game?
button(safe_get_image("#{CACHE_PATH}/icon_#{app.id}.png"), style_class: [:app_icon_button], tip: app.name) do |btn|
button(safe_get_image("#{CACHE_PATH}/icon_#{app.id}.png"), style_class: [:app_icon_button], tag: :"app_filter_#{app.id}", tip: app.name) do |btn|
if shift_down?
@games_filter << app.id
@games_filter.uniq!
@@ -33,6 +34,10 @@ module W3DHubLauncher
@games_filter << app.id
end
buttons = btn.parent.children
filters = @games_filter.map { |f| :"app_filter_#{f}" }
buttons.each { |e| e.enabled = !filters.include?(e.style.tag) }
btn.enabled = false
populate_server_list

View File

@@ -159,14 +159,16 @@ module W3DHubLauncher
def populate_server_information(server)
return unless @server_details_container.visible?
application = MemCache[:settings].applications.find { |app| app.id == server.game && app.channel == server.channel }
@server_details_container.clear do
tagline server.name, width: 1.0, text_wrap: :none, tip: server.name
image safe_get_image("#{ROOT_PATH}/media/default_map_preview.png"), width: 1.0, tip: server.current_map, margin_bottom: PADDING
image safe_get_image("#{ROOT_PATH}/media/default_map_preview.png"), width: 1.0, aspect_ratio: 16 / 9.0, tip: server.current_map, margin_bottom: PADDING
flow(width: 1.0) do
stack(fill: true)
button "JOIN SERVER", **CTA_BUTTON_THEME, width: 1.0, enabled: false, tip: "Game not installed I guess..."
stack(fill: true)
button "JOIN SERVER", **CTA_BUTTON_THEME, width: 1.0, enabled: !application.nil?, tip: application.nil? ? "Application not installed" : "" do
ApplicationHelper.join_server(application, server)
end
end
stack(width: 1.0, fill: true, scroll: true, margin_top: PADDING) do