79 lines
2.4 KiB
GDScript
79 lines
2.4 KiB
GDScript
extends Node2D
|
|
|
|
const fadeTime = 4.0
|
|
const creditsTime = 155
|
|
onready var creditsProcessing = false
|
|
onready var canExit = false
|
|
onready var timerC = 0.0
|
|
onready var thresHold:int = - 4870
|
|
|
|
func _ready():
|
|
$authors / AuthorText.bbcode_text = tr("ui_authors")
|
|
|
|
Dialogic.set_variable("DoNotSave", 1)
|
|
var endLabel = $ForScale / EndText
|
|
|
|
var localizedTextArray = LanguageLocalization.GetGameEndings()
|
|
var timeline = Dialogic.get_variable("TimelineSave")
|
|
var neededText = tr(localizedTextArray[timeline])
|
|
if timeline == "Timeline_peremoga":
|
|
neededText = tr("ui_game_end_survived")
|
|
endLabel.text = neededText
|
|
|
|
$Tween.interpolate_property(endLabel, "modulate", Color(1, 1, 1, 0), Color(1, 1, 1, 1), fadeTime, Tween.TRANS_LINEAR, 0)
|
|
$Tween.start()
|
|
|
|
if (Dialogic.get_variable("TimelineSave") != "Timeline_Alt_1" and Dialogic.get_variable("TimelineSave") != "Timeline_EasterZakviel"):
|
|
var killer = Dialogic.get_variable("Killer");
|
|
ProgressAchievementsSingleton.AddKillersAchievement(killer);
|
|
canExit = true
|
|
get_tree().root.get_node("Root").allowToDisplayMenu = false
|
|
get_tree().root.get_node("Root").get_node("Game").get_child(0).queue_free()
|
|
$Timer.set_wait_time(fadeTime * 2.0)
|
|
$Timer.set_one_shot(true)
|
|
$Timer.start()
|
|
yield ($Timer, "timeout")
|
|
ShowCredits()
|
|
|
|
|
|
func ShowCredits():
|
|
$Tween.interpolate_property($ForScale / EndText, "modulate", Color(1, 1, 1, 1), Color(1, 1, 1, 0), fadeTime, Tween.TRANS_LINEAR, 0)
|
|
$Tween.start()
|
|
$Timer.set_wait_time(fadeTime)
|
|
$Timer.set_one_shot(true)
|
|
$Timer.start()
|
|
yield ($Timer, "timeout")
|
|
$authors.visible = true
|
|
creditsProcessing = true
|
|
|
|
|
|
func _process(delta):
|
|
if creditsProcessing:
|
|
$authors.position.y -= 30 * delta
|
|
timerC += delta
|
|
if timerC >= creditsTime:
|
|
creditsProcessing = false
|
|
ExitToMenu()
|
|
if $authors.position.y < thresHold:
|
|
creditsProcessing = false
|
|
ExitToMenu()
|
|
|
|
func ExitToMenu():
|
|
# Steam.set_achievement("Credits");
|
|
get_tree().root.get_node("Root").BackToMenu()
|
|
|
|
func _input(ev):
|
|
if ev is InputEventKey and ev.scancode == KEY_ESCAPE and canExit:
|
|
ExitToMenu()
|
|
elif Input.is_mouse_button_pressed(5):
|
|
if ($authors.position.y >= thresHold):
|
|
var newPos = $authors.position.y - 100
|
|
if newPos < thresHold:
|
|
$authors.position.y = thresHold
|
|
else :$authors.position.y -= 100
|
|
elif Input.is_mouse_button_pressed(4):
|
|
if ($authors.position.y <= 0):
|
|
var newPos = $authors.position.y + 100
|
|
if newPos > 0:
|
|
$authors.position.y = 0
|
|
else :$authors.position.y += 100
|