2024-07-31 13:57:37 +00:00
|
|
|
extends MarginContainer
|
|
|
|
|
2024-09-15 18:18:48 +00:00
|
|
|
var rd_web_button:= Button.new()
|
|
|
|
var rd_changelog_button:= Button.new()
|
|
|
|
var rd_wiki_button:= Button.new()
|
|
|
|
var rd_credits_button:= Button.new()
|
|
|
|
var rd_donate_button:= Button.new()
|
|
|
|
var rd_contactus_button:= Button.new()
|
|
|
|
var rd_licenses_button:= Button.new()
|
2024-09-11 18:23:05 +00:00
|
|
|
var app_data:= AppData.new()
|
2024-09-15 18:18:48 +00:00
|
|
|
var button_array: Array = [rd_web_button, rd_changelog_button, rd_wiki_button, rd_credits_button, rd_donate_button, rd_contactus_button, rd_licenses_button]
|
|
|
|
var web_id: Array = ["rd_web", "rd_changelog", "rd_wiki", "rd_credits", "rd_donate", "rd_contactus", "rd_licenses"]
|
2024-08-20 20:57:49 +00:00
|
|
|
|
2024-07-31 13:57:37 +00:00
|
|
|
func _ready():
|
2024-08-02 19:08:14 +00:00
|
|
|
#tk_about = class_functions.import_csv_data("res://tk_about.txt")
|
2024-09-11 18:23:05 +00:00
|
|
|
app_data = data_handler.app_data
|
2024-07-31 13:57:37 +00:00
|
|
|
_connect_signals()
|
2024-09-05 18:04:56 +00:00
|
|
|
create_buttons()
|
|
|
|
|
|
|
|
func _connect_signals() -> void:
|
2024-09-15 18:18:48 +00:00
|
|
|
for i in button_array.size():
|
|
|
|
button_array[i].pressed.connect(_about_button_pressed.bind(web_id[i], button_array[i]))
|
|
|
|
|
2024-09-05 18:04:56 +00:00
|
|
|
func _about_button_pressed(id: String, button: Button) -> void:
|
2024-09-10 13:09:42 +00:00
|
|
|
var tmp_txt = button.text
|
2024-09-15 18:18:48 +00:00
|
|
|
if class_functions.desktop_mode != "gamescope":
|
|
|
|
class_functions.logger("i","Loading website for " + id)
|
2024-09-22 16:15:09 +00:00
|
|
|
class_functions.launch_help(button.get_meta("url"))
|
2024-09-15 18:18:48 +00:00
|
|
|
else:
|
|
|
|
button.text = "Help only in Desktop Mode"
|
|
|
|
await class_functions.wait(3.0)
|
|
|
|
button.text = tmp_txt
|
2024-09-05 18:04:56 +00:00
|
|
|
|
|
|
|
func create_buttons() -> void:
|
2024-09-15 18:18:48 +00:00
|
|
|
for i in button_array.size():
|
|
|
|
var button = button_array[i]
|
2024-09-05 18:04:56 +00:00
|
|
|
%GridContainer.add_child(button)
|
2024-09-15 18:18:48 +00:00
|
|
|
var id = web_id[i]
|
|
|
|
if id in app_data.about_links:
|
|
|
|
var web_data: Link = app_data.about_links[id]
|
|
|
|
_setup_button(button, web_data)
|
|
|
|
|
|
|
|
func _setup_button(button: Button, web_data: Link) -> void:
|
2024-09-23 20:57:11 +00:00
|
|
|
button.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
|
|
|
button.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
2024-09-15 18:18:48 +00:00
|
|
|
button.text = web_data.name
|
2024-09-23 20:57:11 +00:00
|
|
|
var vect2 = Vector2(200,100)
|
|
|
|
button.custom_minimum_size = vect2
|
2024-09-22 16:15:09 +00:00
|
|
|
#button.tooltip_text = web_data.description
|
2024-09-15 18:18:48 +00:00
|
|
|
button.icon = ResourceLoader.load(web_data.icon)
|
2024-09-22 16:15:09 +00:00
|
|
|
button.set_meta("url", web_data.url)
|
|
|
|
button.set_meta("description", web_data.description)
|
2024-09-15 18:18:48 +00:00
|
|
|
button.icon_alignment = HORIZONTAL_ALIGNMENT_LEFT
|
|
|
|
button.vertical_icon_alignment = VERTICAL_ALIGNMENT_CENTER
|
2024-09-23 20:57:11 +00:00
|
|
|
button.add_theme_constant_override("icon_max_width", 64)
|
|
|
|
button.icon_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
|
|
|
button.alignment = HORIZONTAL_ALIGNMENT_CENTER
|
|
|
|
button.vertical_icon_alignment = VERTICAL_ALIGNMENT_TOP
|