One_Eleven_Android/scripts/backround_scenes_scripts/Stol.gd
2024-11-10 03:34:28 +03:00

316 lines
10 KiB
GDScript

extends Node2D
const nonSpeakColor = Color(0.5, 0.5, 0.5, 1)
const nonVisibleColor = Color(0.5, 0.5, 0.5, 0)
var aliveNotVisible = []
func _ready():
if not get_tree().root.has_node("Root"):
return ;
if Dialogic.get_variable("SleepingBlue") == "1":
$chars / Blue_F.texture = load("res://resources/graphics/backgrounds/stol/sleeping blue.webp")
else :
$chars / Blue_F.texture = load("res://resources/graphics/backgrounds/stol/1 11 (13) синяя 1.webp")
if not get_tree().root.has_node("Root"):
return ;
GallerySingleton.AddBackground("Stol")
if int(Dialogic.get_variable("Food")) == 0:
$NoFood.visible = true
if int(Dialogic.get_variable("Is_White_Dead")) == 0:
aliveNotVisible.push_back("White")
if int(Dialogic.get_variable("Is_Gray_Dead")) == 0:
aliveNotVisible.push_back("Gray")
if int(Dialogic.get_variable("Is_Pink_Dead")) == 0:
aliveNotVisible.push_back("Pink")
if int(Dialogic.get_variable("Is_Yellow_Dead")) == 0:
aliveNotVisible.push_back("Yellow")
if int(Dialogic.get_variable("Is_Orange_Dead")) == 0:
aliveNotVisible.push_back("Orange")
if int(Dialogic.get_variable("Is_Black_Dead")) == 0:
aliveNotVisible.push_back("Black")
if int(Dialogic.get_variable("Is_Red_Dead")) == 0:
aliveNotVisible.push_back("Red")
if int(Dialogic.get_variable("Is_Blue_M_Dead")) == 0:
aliveNotVisible.push_back("Blue_M")
if int(Dialogic.get_variable("Is_Blue_F_Dead")) == 0:
aliveNotVisible.push_back("Blue_F")
if int(Dialogic.get_variable("Is_Purple_Dead")) == 0:
aliveNotVisible.push_back("Purple")
if int(Dialogic.get_variable("Is_Green_Dead")) == 0:
aliveNotVisible.push_back("Green")
if int(Dialogic.get_variable("White_on")) == 1:
$chars / White.visible = true
if int(Dialogic.get_variable("Red_on")) == 1:
$chars / Red.visible = true
if int(Dialogic.get_variable("Blue_F_on")) == 1:
$chars / Blue_F.visible = true
if int(Dialogic.get_variable("Pink_on")) == 1:
$chars / Pink.visible = true
if int(Dialogic.get_variable("Black_on")) == 1:
$chars / Black.visible = true
if int(Dialogic.get_variable("Purple_on")) == 1:
$chars / Purple.visible = true
if int(Dialogic.get_variable("Green_on")) == 1:
$chars / Green.visible = true
else :
GallerySingleton.AddBackground("Stol_food")
$WithFood.visible = true
if int(Dialogic.get_variable("Is_White_Dead")) == 0:
$chars / White.visible = true
if int(Dialogic.get_variable("Is_Gray_Dead")) == 0:
$chars / Gray.visible = true
if int(Dialogic.get_variable("Is_Pink_Dead")) == 0:
$chars / Pink.visible = true
if int(Dialogic.get_variable("Is_Yellow_Dead")) == 0:
$chars / Yellow.visible = true
if int(Dialogic.get_variable("Is_Orange_Dead")) == 0:
if int(Dialogic.get_variable("Orange_on")) == 1:
$chars / Orange.visible = true
if int(Dialogic.get_variable("Is_Black_Dead")) == 0:
$chars / Black.visible = true
if int(Dialogic.get_variable("Is_Red_Dead")) == 0:
$chars / Red.visible = true
if int(Dialogic.get_variable("Is_Blue_M_Dead")) == 0:
$chars / Blue_M.visible = true
if int(Dialogic.get_variable("Is_Blue_F_Dead")) == 0:
$chars / Blue_F.visible = true
if int(Dialogic.get_variable("Is_Purple_Dead")) == 0:
$chars / Purple.visible = true
if int(Dialogic.get_variable("Is_Green_Dead")) == 0:
$chars / Green.visible = true
match Dialogic.get_variable("WhoSpeaksStol"):
"White":
EndSpeech()
$chars / White.modulate = Color(1, 1, 1, 1)
"Gray":
EndSpeech()
$chars / Gray.modulate = Color(1, 1, 1, 1)
"Pink":
EndSpeech()
$chars / Pink.modulate = Color(1, 1, 1, 1)
"Yellow":
EndSpeech()
$chars / Yellow.modulate = Color(1, 1, 1, 1)
"Orange":
EndSpeech()
$chars / Orange.modulate = Color(1, 1, 1, 1)
"Black":
EndSpeech()
$chars / Black.modulate = Color(1, 1, 1, 1)
"Red":
EndSpeech()
$chars / Red.modulate = Color(1, 1, 1, 1)
"Blue_M":
EndSpeech()
$chars / Blue_M.modulate = Color(1, 1, 1, 1)
"Blue_F":
EndSpeech()
$chars / Blue_F.modulate = Color(1, 1, 1, 1)
"Purple":
EndSpeech()
$chars / Purple.modulate = Color(1, 1, 1, 1)
"Green":
EndSpeech()
$chars / Green.modulate = Color(1, 1, 1, 1)
"None":
EndSpeech()
var dialogicNode = get_parent().get_parent().get_node("Game").get_child(0).get_child(0)
dialogicNode.connect("dialogic_signal", self, "_food_listener")
var sfxPath = "res://resources/audio/sfx/zvuk-kamina_zastolom.ogg"
get_tree().root.get_node("Root").SetSFXforBGM(sfxPath)
func _food_listener(string):
match string:
"food_on":
Dialogic.set_variable("Orange_on", 1)
$WithFood.self_modulate.a = 0.0
$WithFood.visible = true
var tween = $"Tween"
for i in aliveNotVisible:
$chars.get_node(i).modulate = nonVisibleColor
$chars.get_node(i).visible = true
tween.interpolate_property($chars.get_node(i), "modulate", nonVisibleColor, Color(1, 1, 1, 1), 1.0, Tween.TRANS_LINEAR, 0)
tween.interpolate_method(self, "SpriteInterpolate", 0, 1, 1.0, Tween.TRANS_LINEAR, 0)
tween.start()
"White":
EndSpeech()
$chars / White.modulate = Color(1, 1, 1, 1)
Dialogic.set_variable("WhoSpeaksStol", "White")
"Gray":
EndSpeech()
$chars / Gray.modulate = Color(1, 1, 1, 1)
Dialogic.set_variable("WhoSpeaksStol", "Gray")
"Pink":
EndSpeech()
$chars / Pink.modulate = Color(1, 1, 1, 1)
Dialogic.set_variable("WhoSpeaksStol", "Pink")
"Yellow":
EndSpeech()
$chars / Yellow.modulate = Color(1, 1, 1, 1)
Dialogic.set_variable("WhoSpeaksStol", "Yellow")
"Orange":
EndSpeech()
$chars / Orange.modulate = Color(1, 1, 1, 1)
Dialogic.set_variable("WhoSpeaksStol", "Orange")
"Black":
EndSpeech()
$chars / Black.modulate = Color(1, 1, 1, 1)
Dialogic.set_variable("WhoSpeaksStol", "Black")
"Red":
EndSpeech()
$chars / Red.modulate = Color(1, 1, 1, 1)
Dialogic.set_variable("WhoSpeaksStol", "Red")
"Blue_M":
EndSpeech()
$chars / Blue_M.modulate = Color(1, 1, 1, 1)
Dialogic.set_variable("WhoSpeaksStol", "Blue_M")
"Blue_F":
EndSpeech()
$chars / Blue_F.modulate = Color(1, 1, 1, 1)
Dialogic.set_variable("WhoSpeaksStol", "Blue_F")
"Purple":
EndSpeech()
$chars / Purple.modulate = Color(1, 1, 1, 1)
Dialogic.set_variable("WhoSpeaksStol", "Purple")
"Green":
EndSpeech()
$chars / Green.modulate = Color(1, 1, 1, 1)
Dialogic.set_variable("WhoSpeaksStol", "Green")
"None":
EndSpeech()
Dialogic.set_variable("WhoSpeaksStol", "None")
"Orange_off":
$CharTween.interpolate_property($chars / Orange, "modulate", Color(1, 1, 1, 1), Color(1, 1, 1, 0), 0.6, Tween.TRANS_LINEAR, 0)
$CharTween.start()
Dialogic.set_variable("Orange_on", 0)
$Timer.set_wait_time(0.6)
$Timer.set_one_shot(true)
$Timer.start()
yield ($Timer, "timeout")
$chars / Orange.visible = false
"Orange_on":
$chars / Orange.modulate = nonVisibleColor
$chars / Orange.visible = true
$CharTween.interpolate_property($chars / Orange, "modulate", nonVisibleColor, Color(0.5, 0.5, 0.5, 1), 0.6, Tween.TRANS_LINEAR, 0)
$CharTween.start()
Dialogic.set_variable("Orange_on", 1)
"White_on":
$chars / White.modulate = nonVisibleColor
$chars / White.visible = true
$CharTween.interpolate_property($chars / White, "modulate", nonVisibleColor, Color(0.5, 0.5, 0.5, 1), 0.6, Tween.TRANS_LINEAR, 0)
$CharTween.start()
aliveNotVisible.erase("White")
Dialogic.set_variable("White_on", 1)
"Blue_F_on":
$chars / Blue_F.modulate = nonVisibleColor
$chars / Blue_F.visible = true
$CharTween.interpolate_property($chars / Blue_F, "modulate", nonVisibleColor, Color(0.5, 0.5, 0.5, 1), 0.6, Tween.TRANS_LINEAR, 0)
$CharTween.start()
aliveNotVisible.erase("Blue_F")
Dialogic.set_variable("Blue_F_on", 1)
"Green_on":
$chars / Green.modulate = nonVisibleColor
$chars / Green.visible = true
$CharTween.interpolate_property($chars / Green, "modulate", nonVisibleColor, Color(0.5, 0.5, 0.5, 1), 0.6, Tween.TRANS_LINEAR, 0)
$CharTween.start()
aliveNotVisible.erase("Green")
Dialogic.set_variable("Green_on", 1)
"Black_on":
$chars / Black.modulate = nonVisibleColor
$chars / Black.visible = true
$CharTween.interpolate_property($chars / Black, "modulate", nonVisibleColor, Color(0.5, 0.5, 0.5, 1), 0.6, Tween.TRANS_LINEAR, 0)
$CharTween.start()
aliveNotVisible.erase("Black")
Dialogic.set_variable("Black_on", 1)
"Purple_on":
$chars / Purple.modulate = nonVisibleColor
$chars / Purple.visible = true
$CharTween.interpolate_property($chars / Purple, "modulate", nonVisibleColor, Color(0.5, 0.5, 0.5, 1), 0.6, Tween.TRANS_LINEAR, 0)
$CharTween.start()
aliveNotVisible.erase("Purple")
Dialogic.set_variable("Purple_on", 1)
"Pink_on":
$chars / Pink.modulate = nonVisibleColor
$chars / Pink.visible = true
$CharTween.interpolate_property($chars / Pink, "modulate", nonVisibleColor, Color(0.5, 0.5, 0.5, 1), 0.6, Tween.TRANS_LINEAR, 0)
$CharTween.start()
aliveNotVisible.erase("Pink")
Dialogic.set_variable("Pink_on", 1)
"Red_on":
$chars / Red.modulate = nonVisibleColor
$chars / Red.visible = true
$CharTween.interpolate_property($chars / Red, "modulate", nonVisibleColor, Color(0.5, 0.5, 0.5, 1), 0.6, Tween.TRANS_LINEAR, 0)
$CharTween.start()
aliveNotVisible.erase("Red")
Dialogic.set_variable("Red_on", 1)
"wake_up":
$chars / Blue_F.texture = load("res://resources/graphics/backgrounds/stol/1 11 (13) синяя 1.webp")
func SpriteInterpolate(value):
$WithFood.self_modulate.a = value
func _on_Tween_tween_all_completed():
$NoFood.visible = false
func EndSpeech():
for i in $chars.get_children():
i.modulate = nonSpeakColor
func InitForGallery()->Array:
scale = Vector2(0.5, 0.5)
call_deferred("FUCKVisibile");
if not GallerySingleton.HaveBackground("Stol_food"):
return [];
return ["ui_gallery_stol_food", "ui_gallery_stol", "ui_gallery_people"];
func SetSettings(setting):
if setting == tr("ui_gallery_stol_food"):
$WithFood.visible = true;
$NoFood.visible = false;
elif setting == tr("ui_gallery_stol"):
$WithFood.visible = false;
$NoFood.visible = true;
elif setting == tr("ui_gallery_people"):
$chars.visible = not $chars.visible;
func FUCKVisibile():
yield (get_tree().create_timer(0.2), "timeout");
$WithFood.visible = true;
$chars.visible = false;
for i in $chars.get_children():
i.visible = true;