83 lines
2.5 KiB
GDScript
83 lines
2.5 KiB
GDScript
extends Node2D
|
|
|
|
const camera1 = Vector2( - 500.0, 0.0)
|
|
const scale1 = Vector2(1.3, 1.3)
|
|
const camera2 = Vector2( - 700.0, 0.0)
|
|
const scale2 = Vector2(1.7, 1.7)
|
|
const zoomingTime1 = 2.0
|
|
const zoomingTime2 = 2.0
|
|
|
|
|
|
func _ready():
|
|
if not get_tree().root.has_node("Root"):
|
|
return ;
|
|
|
|
if Dialogic.get_variable("ItIsDay") == "true":
|
|
$day.visible = true
|
|
$night.visible = false
|
|
if int(Dialogic.get_variable("RainDay")) == 1:
|
|
var sfxPath = "res://resources/audio/sfx/Mayak_dayrain.ogg"
|
|
get_tree().root.get_node("Root").SetSFXforBGM(sfxPath)
|
|
$day / rain.visible = true
|
|
else :
|
|
var sfxPath = "res://resources/audio/sfx/Mayak_day.ogg"
|
|
get_tree().root.get_node("Root").SetSFXforBGM(sfxPath)
|
|
$day / rain.visible = false
|
|
|
|
GallerySingleton.AddBackground("Mayak_Back")
|
|
else :
|
|
$day.visible = false
|
|
$night.visible = true
|
|
|
|
var sfxPath = "";
|
|
var value = Dialogic.get_variable("TimelineSave");
|
|
if value == "Timeline_120_lighthouse" or value == "timeline_140_lighthouse":
|
|
sfxPath = "res://resources/audio/sfx/Rain Loop.ogg"
|
|
else :
|
|
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");
|
|
$night / Lightning.Init(3, player);
|
|
|
|
GallerySingleton.AddBackground("Mayak_Back_n")
|
|
|
|
var dialogicNode = get_parent().get_parent().get_node("Game").get_child(0).get_child(0)
|
|
dialogicNode.connect("dialogic_signal", self, "_dialogic_listener")
|
|
|
|
func InitForGallery()->Array:
|
|
scale = Vector2(0.5, 0.5)
|
|
|
|
$day.visible = true
|
|
$day / rain.visible = false;
|
|
$night.visible = false;
|
|
|
|
if not GallerySingleton.HaveBackground("Mayak_Back_n"):
|
|
return [];
|
|
|
|
return ["ui_day", "ui_night"]
|
|
|
|
func SetSettings(setting):
|
|
if setting == tr("ui_day"):
|
|
$day.visible = true
|
|
$day / rain.visible = false;
|
|
$night.visible = false;
|
|
else :
|
|
$day.visible = false
|
|
$day / rain.visible = false;
|
|
$night.visible = true;
|
|
$night / rain.visible = true;
|
|
|
|
func _dialogic_listener(string):
|
|
match string:
|
|
"zoom1":
|
|
$Tween.remove_all()
|
|
$Tween.interpolate_property(self, "scale", self.scale, scale1, zoomingTime1, Tween.TRANS_LINEAR, 0)
|
|
$Tween.interpolate_property(self, "position", self.position, camera1, zoomingTime1, Tween.TRANS_LINEAR, 0)
|
|
$Tween.start()
|
|
"zoom2":
|
|
$Tween.remove_all()
|
|
$Tween.interpolate_property(self, "scale", self.scale, scale2, zoomingTime2, Tween.TRANS_LINEAR, 0)
|
|
$Tween.interpolate_property(self, "position", self.position, camera2, zoomingTime2, Tween.TRANS_LINEAR, 0)
|
|
$Tween.start()
|