mirror of
https://github.com/thegatesbrowser/thegates.git
synced 2025-08-24 11:17:26 -04:00
onboarding check shown
This commit is contained in:
parent
a2e1121fec
commit
f24e5fd929
1 changed files with 17 additions and 1 deletions
|
@ -1,5 +1,8 @@
|
|||
extends Control
|
||||
|
||||
const SECTION: String = "onboarding"
|
||||
const KEY: String = "shown"
|
||||
|
||||
const INITIAL_DELAY = 1.0
|
||||
const SHOWN = Color(1, 1, 1, 1)
|
||||
const HIDDEN = Color(1, 1, 1, 0)
|
||||
|
@ -9,6 +12,9 @@ const HIDDEN = Color(1, 1, 1, 0)
|
|||
@export var fade_in: float = 0.2
|
||||
@export var fade_out: float = 0.2
|
||||
|
||||
@export_group("Debug")
|
||||
@export var show_always: bool
|
||||
|
||||
var tween: Tween
|
||||
|
||||
|
||||
|
@ -19,6 +25,13 @@ func _ready() -> void:
|
|||
root.visible = false
|
||||
root.modulate = HIDDEN
|
||||
|
||||
try_show_onboarding()
|
||||
|
||||
|
||||
func try_show_onboarding() -> void:
|
||||
var is_shown = DataSaver.get_value(SECTION, KEY, false)
|
||||
if is_shown and not show_always: return
|
||||
|
||||
await get_tree().create_timer(INITIAL_DELAY).timeout
|
||||
show_onboarding()
|
||||
|
||||
|
@ -39,6 +52,9 @@ func hide_onboarding() -> void:
|
|||
if is_instance_valid(tween): tween.stop()
|
||||
tween = create_tween()
|
||||
tween.tween_property(root, "modulate", HIDDEN, fade_out)
|
||||
await tween.finished
|
||||
|
||||
await tween.finished
|
||||
root.visible = false
|
||||
|
||||
DataSaver.set_value(SECTION, KEY, true)
|
||||
DataSaver.save_data()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue