67 lines
1.6 KiB
GDScript
67 lines
1.6 KiB
GDScript
extends Node2D
|
|
|
|
func _ready():
|
|
if not get_tree().root.has_node("Root"):
|
|
return ;
|
|
|
|
GallerySingleton.AddBackground("Room_Agatha")
|
|
|
|
$Cat.Init(2, 8);
|
|
$Cat.position = Vector2(1423, 725);
|
|
|
|
|
|
call_deferred("VisibleBug");
|
|
|
|
var dialogicNode = get_parent().get_parent().get_node("Game").get_child(0).get_child(0)
|
|
dialogicNode.connect("dialogic_signal", self, "_lights_listener")
|
|
|
|
func VisibleBug():
|
|
yield (get_tree().create_timer(0.2), "timeout");
|
|
|
|
if Dialogic.get_variable("LightsOn") == "1":
|
|
$lights_on.visible = true
|
|
$lights_off.visible = false
|
|
else :
|
|
$lights_on.visible = false
|
|
$lights_off.visible = true
|
|
|
|
func _lights_listener(string):
|
|
match string:
|
|
"lights_on":
|
|
Dialogic.set_variable("LightsOn", 1)
|
|
$lights_on.visible = true
|
|
$lights_off.visible = false
|
|
"lights_off":
|
|
Dialogic.set_variable("LightsOn", 0)
|
|
$lights_on.visible = false
|
|
$lights_off.visible = true
|
|
|
|
func InitForGallery()->Array:
|
|
$Cat.visible = false;
|
|
scale = Vector2(0.5, 0.5);
|
|
|
|
FUCKVisibile();
|
|
|
|
return ["ui_gallery_light"];
|
|
|
|
func SetToggleSettings(button):
|
|
if button.pressed:
|
|
$lights_on.visible = true;
|
|
$lights_off.visible = false;
|
|
else :
|
|
$lights_on.visible = false;
|
|
$lights_off.visible = true;
|
|
|
|
func FUCKVisibile():
|
|
var timer = Timer.new();
|
|
add_child(timer);
|
|
timer.set_wait_time(0.1);
|
|
timer.set_one_shot(true);
|
|
timer.start();
|
|
timer.connect("timeout", self, "FUCKFUCK", [timer]);
|
|
|
|
func FUCKFUCK(timer):
|
|
$lights_on.call_deferred("set_visible", false);
|
|
$lights_off.call_deferred("set_visible", true);
|
|
timer.disconnect("timeout", self, "FUCKFUCK")
|
|
remove_child(timer);
|