67 lines
1.7 KiB
GDScript
67 lines
1.7 KiB
GDScript
extends Node2D
|
|
|
|
func _ready():
|
|
if not get_tree().root.has_node("Root"):
|
|
return ;
|
|
|
|
GallerySingleton.AddBackground("Room_Emiliya")
|
|
|
|
|
|
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("ItIsDay") == "true":
|
|
$lights_on.visible = false
|
|
$lights_off.visible = false
|
|
$morning.visible = true
|
|
GallerySingleton.AddBackground("Room_Emiliya_morning")
|
|
elif int(Dialogic.get_variable("LightsOn")) == 1:
|
|
$lights_on.visible = true
|
|
$lights_off.visible = false
|
|
$morning.visible = false
|
|
else :
|
|
$lights_on.visible = false
|
|
$lights_off.visible = true
|
|
$morning.visible = false
|
|
|
|
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:
|
|
scale = Vector2(0.5, 0.5);
|
|
|
|
$lights_on.visible = true;
|
|
$lights_off.visible = false;
|
|
$morning.visible = false;
|
|
|
|
if GallerySingleton.HaveImage("Room_Emiliya_morning"):
|
|
return ["ui_lights_on", "ui_lights_off", "ui_morning"];
|
|
|
|
return ["ui_lights_on", "ui_lights_off"];
|
|
|
|
func SetSettings(setting):
|
|
if setting == tr("ui_lights_on"):
|
|
$lights_on.visible = true;
|
|
$lights_off.visible = false;
|
|
$morning.visible = false;
|
|
elif setting == tr("ui_lights_off"):
|
|
$lights_on.visible = false;
|
|
$lights_off.visible = true;
|
|
$morning.visible = false;
|
|
else :
|
|
$lights_on.visible = false;
|
|
$lights_off.visible = false;
|
|
$morning.visible = true;
|