47 lines
1.1 KiB
GDScript
47 lines
1.1 KiB
GDScript
extends Node2D
|
|
|
|
func _ready():
|
|
if not get_tree().root.has_node("Root"):
|
|
return ;
|
|
|
|
GallerySingleton.AddBackground("Tretii_etaj")
|
|
|
|
$Cat.Init(2, 9);
|
|
$Cat.position = Vector2(510, 650);
|
|
$Cat.Scale(0.4);
|
|
|
|
if int(Dialogic.get_variable("LightsOn")) == 1:
|
|
$lights_on.visible = true
|
|
$lights_off.visible = false
|
|
else :
|
|
$lights_on.visible = false
|
|
$lights_off.visible = true
|
|
|
|
var dialogicNode = get_parent().get_parent().get_node("Game").get_child(0).get_child(0)
|
|
dialogicNode.connect("dialogic_signal", self, "_lights_listener")
|
|
|
|
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)
|
|
$lights_off.visible = false;
|
|
|
|
return ["ui_lights_on", "ui_lights_off"];
|
|
|
|
func SetSettings(setting):
|
|
if setting == tr("ui_lights_on"):
|
|
$lights_on.visible = true;
|
|
$lights_off.visible = false;
|
|
else :
|
|
$lights_on.visible = false;
|
|
$lights_off.visible = true;
|