mirror of
https://github.com/cyberarm/w3d_hub_linux_launcher.git
synced 2025-12-16 09:12:35 +00:00
Initial support for offline mode
This commit is contained in:
@@ -54,6 +54,8 @@ class W3DHub
|
||||
|
||||
@progressbar.value = @fraction
|
||||
|
||||
load_offline_applications_list if @offline_mode
|
||||
|
||||
push_state(States::Interface) if @offline_mode || (@progressbar.value >= 1.0 && @task_index == @tasks.size)
|
||||
|
||||
return if @offline_mode
|
||||
@@ -188,6 +190,42 @@ class W3DHub
|
||||
@tasks[:server_list][:complete] = true
|
||||
end
|
||||
end
|
||||
|
||||
def load_offline_applications_list
|
||||
hash = {
|
||||
applications: []
|
||||
}
|
||||
|
||||
Store.settings[:games].each do |key, game|
|
||||
app_id, channel_id = key.to_s.split("_")
|
||||
|
||||
app = hash[:applications].find { |a| a[:id] == app_id }
|
||||
app_in_array = !app.nil?
|
||||
app ||= {
|
||||
id: app_id,
|
||||
name: game[:name],
|
||||
type: "",
|
||||
category: "games",
|
||||
"studio-id": "",
|
||||
channels: [],
|
||||
"web-links": [],
|
||||
"extended-data": [{ name: "colour", value: "#353535" }]
|
||||
}
|
||||
|
||||
channel = {
|
||||
id: channel_id,
|
||||
name: channel_id,
|
||||
"user-level": "",
|
||||
"current-version": game[:installed_version]
|
||||
}
|
||||
|
||||
app[:channels] << channel
|
||||
|
||||
hash[:applications] << app unless app_in_array
|
||||
end
|
||||
|
||||
Store.applications = Api::Applications.new(hash.to_json)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -76,13 +76,23 @@ class W3DHub
|
||||
end
|
||||
|
||||
@account_container = flow(width: 256, height: 1.0) do
|
||||
stack(width: 1.0, height: 1.0) do
|
||||
tagline "<b>#{I18n.t(:"interface.not_logged_in")}</b>", text_wrap: :none
|
||||
if Store.offline_mode
|
||||
stack(width: 1.0, height: 1.0) do
|
||||
flow(fill: true)
|
||||
|
||||
flow(width: 1.0) do
|
||||
link(I18n.t(:"interface.log_in"), text_size: 16, width: 0.5) { page(W3DHub::Pages::Login) }
|
||||
link I18n.t(:"interface.register"), text_size: 16, width: 0.49 do
|
||||
Launchy.open("https://secure.w3dhub.com/forum/index.php?app=core&module=global§ion=register")
|
||||
title "<b>OFFLINE</b>", text_wrap: :none, width: 1.0, text_align: :center
|
||||
|
||||
flow(fill: true)
|
||||
end
|
||||
else
|
||||
stack(width: 1.0, height: 1.0) do
|
||||
tagline "<b>#{I18n.t(:"interface.not_logged_in")}</b>", text_wrap: :none
|
||||
|
||||
flow(width: 1.0) do
|
||||
link(I18n.t(:"interface.log_in"), text_size: 16, width: 0.5) { page(W3DHub::Pages::Login) }
|
||||
link I18n.t(:"interface.register"), text_size: 16, width: 0.49 do
|
||||
Launchy.open("https://secure.w3dhub.com/forum/index.php?app=core&module=global§ion=register")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user