104 lines
2.8 KiB
GDScript
104 lines
2.8 KiB
GDScript
extends Node2D
|
|
|
|
func _ready():
|
|
if not get_tree().root.has_node("Root"):
|
|
return ;
|
|
|
|
InitWater();
|
|
if Dialogic.get_variable("ItIsDay") == "true":
|
|
$Day.visible = true;
|
|
$Night.visible = false;
|
|
|
|
if Dialogic.get_variable("PristanCat") == "1":
|
|
$Cat.Init(99, 4);
|
|
$Cat.position = Vector2(760, 690);
|
|
$Cat.visible = true;
|
|
else :
|
|
$Cat.Init(99, 10);
|
|
$Cat.position = Vector2(760, 690);
|
|
$Cat.visible = true;
|
|
|
|
if Dialogic.get_variable("TwinsNPC") == "fish":
|
|
$Day / Fisher.visible = true;
|
|
|
|
$rain.visible = false
|
|
|
|
var sfxPath = "res://resources/audio/sfx/Mayak_day.ogg"
|
|
get_tree().root.get_node("Root").SetSFXforBGM(sfxPath)
|
|
|
|
GallerySingleton.AddBackground("Pristan");
|
|
else :
|
|
$Day.visible = false;
|
|
$Night.visible = true;
|
|
$rain.visible = true
|
|
|
|
|
|
var sfxPath = "res://resources/audio/sfx/Mayak_night.ogg"
|
|
|
|
get_tree().root.get_node("Root").SetSFXforBGM(sfxPath)
|
|
|
|
var player = get_tree().root.get_node("/root/BgmScene/TweenBGMsfx/BGMStreamPlayer");
|
|
$Lightning.Init(4, player);
|
|
$Lightning.SetPosition(Vector2( - 400, 0), Vector2(0.25, 0.25));
|
|
|
|
$Lightning2.Init(3, player);
|
|
$Lightning2.SetPosition(Vector2(700, 0), Vector2(0.25, 0.25));
|
|
|
|
GallerySingleton.AddBackground("Pristan_n")
|
|
|
|
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:
|
|
"add_cat":
|
|
Dialogic.set_variable("PristanCat", "1");
|
|
$Cat.Init(99, 4);
|
|
$Cat.position = Vector2(760, 690);
|
|
$Cat.visible = true;
|
|
|
|
func InitWater():
|
|
SceneLoader.connect("on_scene_loaded", self, "WaterLoaded");
|
|
if Dialogic.get_variable("ItIsDay") == "true":
|
|
SceneLoader.load_scene("res://resources/customControls/Water/Pristan/WaterDay.tscn");
|
|
else :
|
|
SceneLoader.load_scene("res://resources/customControls/Water/Pristan/WaterNight.tscn");
|
|
|
|
func WaterLoaded(obj):
|
|
if obj.path != "res://resources/customControls/Water/Pristan/WaterDay.tscn" and obj.path != "res://resources/customControls/Water/Pristan/WaterNight.tscn":
|
|
return ;
|
|
|
|
if Dialogic.get_variable("ItIsDay") == "true":
|
|
$Day.add_child(obj.instance);
|
|
$Day.move_child(obj.instance, 0);
|
|
else :
|
|
$Night.add_child(obj.instance);
|
|
$Night.move_child(obj.instance, 0);
|
|
obj.instance.play("default");
|
|
|
|
SceneLoader.disconnect("on_scene_loaded", self, "WaterLoaded");
|
|
|
|
|
|
func InitForGallery()->Array:
|
|
$Cat.visible = false;
|
|
scale = Vector2(0.5, 0.5)
|
|
$Day.visible = true
|
|
$Night.visible = false;
|
|
$rain.visible = false;
|
|
|
|
|
|
|
|
if not GallerySingleton.HaveBackground("Pristan_n"):
|
|
return [];
|
|
|
|
return ["ui_day", "ui_night"]
|
|
|
|
func SetSettings(setting):
|
|
if setting == tr("ui_day"):
|
|
$Day.visible = true;
|
|
$Night.visible = false;
|
|
$rain.visible = false;
|
|
else :
|
|
$Day.visible = false;
|
|
$Night.visible = true;
|
|
$rain.visible = true;
|