mirror of
https://github.com/thegatesbrowser/thegates.git
synced 2025-08-24 11:17:26 -04:00
hide special button during onboarding
This commit is contained in:
parent
ca10a8482d
commit
cd7168527f
5 changed files with 39 additions and 4 deletions
|
@ -2,32 +2,45 @@ extends Control
|
|||
class_name BookmarkUI
|
||||
|
||||
@export var gate_events: GateEvents
|
||||
@export var ui_events: UiEvents
|
||||
@export var icon: TextureRect
|
||||
@export var title: Label
|
||||
@export var button: Button
|
||||
@export var button_special: Button
|
||||
|
||||
var url: String
|
||||
var is_special: bool
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
button.pressed.connect(on_pressed)
|
||||
button_special.pressed.connect(on_pressed)
|
||||
ui_events.onboarding_started.connect(update_button_type)
|
||||
ui_events.onboarding_finished.connect(update_button_type)
|
||||
|
||||
|
||||
func fill(gate: Gate) -> void:
|
||||
if gate == null: return
|
||||
|
||||
button.visible = not gate.is_special
|
||||
button_special.visible = gate.is_special
|
||||
|
||||
url = gate.url
|
||||
is_special = gate.is_special
|
||||
title.text = "Unnamed" if gate.title.is_empty() else gate.title
|
||||
update_button_type()
|
||||
|
||||
var icon_path = gate.icon
|
||||
if icon_path.is_empty(): icon_path = await FileDownloader.download(gate.icon_url)
|
||||
|
||||
icon.texture = FileTools.load_external_tex(icon_path)
|
||||
|
||||
|
||||
|
||||
func update_button_type() -> void:
|
||||
if ui_events.is_onboarding_started:
|
||||
button.visible = true
|
||||
button_special.visible = false
|
||||
else:
|
||||
button.visible = not is_special
|
||||
button_special.visible = is_special
|
||||
|
||||
|
||||
func on_pressed() -> void:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue