Removed hardcoded GSH endpoint from signalr server list updater, moved direct connect button to the right of the server list, added a slight gradient to buttons so their not totally flat.

This commit is contained in:
2024-03-17 11:29:39 -05:00
parent 80d1fa865c
commit 67c52c84a1
4 changed files with 30 additions and 17 deletions

View File

@@ -262,6 +262,8 @@ class W3DHub
#! === Server List API === !# #! === Server List API === !#
SERVER_LIST_ENDPOINT = "https://gsh.w3dhub.com".freeze SERVER_LIST_ENDPOINT = "https://gsh.w3dhub.com".freeze
# SERVER_LIST_ENDPOINT = "https://gsh.w3d.cyberarm.dev".freeze
# SERVER_LIST_ENDPOINT = "http://127.0.0.1:9292".freeze
GSH_CONNECTION = Excon.new(SERVER_LIST_ENDPOINT, persistent: true) GSH_CONNECTION = Excon.new(SERVER_LIST_ENDPOINT, persistent: true)
def self.get(url, headers = DEFAULT_HEADERS, body = nil, api = :api) def self.get(url, headers = DEFAULT_HEADERS, body = nil, api = :api)

View File

@@ -35,7 +35,7 @@ class W3DHub
puts e puts e
puts e.backtrace puts e.backtrace
sleep 10 sleep 30
retry retry
end end
end end
@@ -48,12 +48,18 @@ class W3DHub
@auto_reconnect = false @auto_reconnect = false
logger.debug(LOG_TAG) { "Requesting connection token..." } logger.debug(LOG_TAG) { "Requesting connection token..." }
response = Excon.post("https://gsh.w3dhub.com/listings/push/v2/negotiate?negotiateVersion=1", headers: Api::DEFAULT_HEADERS, body: "") response = Api.post("#{Api::SERVER_LIST_ENDPOINT}/listings/push/v2/negotiate?negotiateVersion=1", Api::DEFAULT_HEADERS, "", :gsh)
if response.status != 200
@auto_reconnect = true
return
end
data = JSON.parse(response.body, symbolize_names: true) data = JSON.parse(response.body, symbolize_names: true)
@invocation_id = 0 if @invocation_id > 9095 @invocation_id = 0 if @invocation_id > 9095
id = data[:connectionToken] id = data[:connectionToken]
endpoint = "https://gsh.w3dhub.com/listings/push/v2?id=#{id}" endpoint = "#{Api::SERVER_LIST_ENDPOINT}/listings/push/v2?id=#{id}"
logger.debug(LOG_TAG) { "Connecting to websocket..." } logger.debug(LOG_TAG) { "Connecting to websocket..." }
this = self this = self

View File

@@ -63,19 +63,13 @@ class W3DHub
populate_server_list populate_server_list
end end
end end
# button get_image("#{GAME_ROOT_PATH}/media/ui_icons/return.png"), tip: I18n.t(:"server_browser.refresh"), image_height: 1.0, margin_left: 16, padding_left: 2, padding_right: 2, padding_top: 2, padding_bottom: 2 do
# fetch_server_list
# end
flow(fill: true)
button "Direct Connect", height: 1.0, padding_top: 4, padding_bottom: 4 do
push_state(W3DHub::States::DirectConnectDialog)
end
end end
flow(min_width: 372, width: 0.38, max_width: 512, height: 1.0) do |container| flow(min_width: 372, width: 0.38, max_width: 512, height: 1.0) do |container|
button "Direct Connect", height: 1.0, padding_top: 4, padding_bottom: 4 do
push_state(W3DHub::States::DirectConnectDialog)
end
flow(fill: true) flow(fill: true)
para "#{I18n.t(:"server_browser.nickname")}:" para "#{I18n.t(:"server_browser.nickname")}:"

View File

@@ -80,15 +80,15 @@ class W3DHub
padding_bottom: 8, padding_bottom: 8,
border_thickness: 2, border_thickness: 2,
border_color: Gosu::Color::NONE, border_color: Gosu::Color::NONE,
background: 0xff_0074e0, background: 0xff_0074e0..0xff_0052c0,
hover: { hover: {
color: 0xff_f2f2f2, color: 0xff_f2f2f2,
background: 0xff_004c94, background: 0xff_0052c0..0xff_0030a0,
border_color: 0xff_0074e0 border_color: 0xff_0074e0
}, },
active: { active: {
color: 0xff_aaaaaa, color: 0xff_aaaaaa,
background: 0xff_005aad, background: 0xff_0030a0..0xff_0052c0,
border_color: 0xff_0074e0 border_color: 0xff_0074e0
} }
}, },
@@ -151,7 +151,18 @@ class W3DHub
MenuItem: { MenuItem: {
width: 1.0, width: 1.0,
text_left: :left, text_left: :left,
margin: 0 margin: 0,
border_color: Gosu::Color::NONE,
background: 0xff_0074e0,
hover: {
color: 0xff_f2f2f2,
background: 0xff_0052c0,
border_color: Gosu::Color::NONE
},
active: {
background: 0xff_0030a0,
border_color: Gosu::Color::NONE
}
} }
} }
end end