152 lines
5.5 KiB
GDScript
152 lines
5.5 KiB
GDScript
extends Control
|
|
## Schlussbild nach dem Uralten — der einzige Moment, in dem das Spiel den
|
|
## Spieler nicht mehr nach dem nächsten Schritt fragt.
|
|
##
|
|
## Kein neues System: der Screen liest nur, was nach dem Kampf ohnehin in
|
|
## `Game` steht (Tag, Gold, Partei, Stufen). Er wird vom ScreenManager einmalig
|
|
## gezeigt (`main.gd`), danach geht es zurück auf die Karte — die Welt bleibt
|
|
## offen, auch nach dem Ende.
|
|
##
|
|
## Der Hintergrund ist das Bossbild, stark abgedunkelt: es ist derselbe Drache,
|
|
## den die Partei gerade erschlagen hat, und es braucht keine neue Zeichnung.
|
|
|
|
signal weiter
|
|
signal zum_titel
|
|
|
|
const THEME := preload("res://scripts/ui/ui_theme.gd")
|
|
const BILD := "res://assets/pictures/boss_uralter_drache_1920x1080.png"
|
|
|
|
var _knopf_y := 792.0
|
|
|
|
|
|
func _ready() -> void:
|
|
if Game.party.is_empty() and OS.get_cmdline_user_args().has("--schnellstart"):
|
|
Game.party_schnellstart()
|
|
theme = THEME.baue()
|
|
set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
|
_hintergrund()
|
|
_text()
|
|
|
|
var weiter_knopf := _knopf("WEITERSPIELEN", _knopf_y)
|
|
weiter_knopf.pressed.connect(func() -> void: weiter.emit())
|
|
var titel_knopf := _knopf("ZUM TITEL", _knopf_y + 72)
|
|
titel_knopf.pressed.connect(func() -> void: zum_titel.emit())
|
|
|
|
|
|
func _hintergrund() -> void:
|
|
var grund := ColorRect.new()
|
|
grund.color = Color(0.04, 0.03, 0.02)
|
|
grund.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
|
grund.mouse_filter = Control.MOUSE_FILTER_STOP
|
|
add_child(grund)
|
|
|
|
if ResourceLoader.exists(BILD):
|
|
var bild := TextureRect.new()
|
|
bild.texture = load(BILD)
|
|
bild.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
|
bild.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
|
|
bild.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_COVERED
|
|
bild.texture_filter = CanvasItem.TEXTURE_FILTER_LINEAR
|
|
bild.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
add_child(bild)
|
|
|
|
var dimm := ColorRect.new()
|
|
dimm.color = Color(0.035, 0.028, 0.022, 0.78)
|
|
dimm.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
|
dimm.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
add_child(dimm)
|
|
|
|
# Verlauf von unten: die Schrift bekommt Grund, das Bild bleibt oben sichtbar.
|
|
var verlauf := Gradient.new()
|
|
verlauf.set_color(0, Color(0.04, 0.03, 0.02, 0.15))
|
|
verlauf.set_color(1, Color(0.04, 0.03, 0.02, 0.92))
|
|
var tex := GradientTexture2D.new()
|
|
tex.gradient = verlauf
|
|
tex.width = 4
|
|
tex.height = 256
|
|
tex.fill_from = Vector2(0, 0)
|
|
tex.fill_to = Vector2(0, 1)
|
|
var flaeche := TextureRect.new()
|
|
flaeche.texture = tex
|
|
flaeche.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
|
|
flaeche.stretch_mode = TextureRect.STRETCH_SCALE
|
|
flaeche.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
|
flaeche.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
add_child(flaeche)
|
|
|
|
|
|
func _text() -> void:
|
|
var titel := Label.new()
|
|
titel.text = "DER URALTE IST GEFALLEN"
|
|
titel.position = Vector2(120, 132)
|
|
titel.add_theme_color_override("font_color", THEME.GOLD)
|
|
titel.add_theme_color_override("font_outline_color", THEME.INK)
|
|
titel.add_theme_constant_override("outline_size", 10)
|
|
add_child(titel)
|
|
|
|
var unter := Label.new()
|
|
unter.text = "Die Westreiche haben wieder eine Geschichte."
|
|
unter.position = Vector2(120, 190)
|
|
unter.add_theme_color_override("font_color", THEME.CREAM_D)
|
|
unter.add_theme_color_override("font_outline_color", THEME.INK)
|
|
unter.add_theme_constant_override("outline_size", 6)
|
|
add_child(unter)
|
|
|
|
var zeilen := [
|
|
"Über dem Hügel wird es still. Was uralt war, liegt im Staub, und der Weg nach Garana ist frei.",
|
|
"Wirtin Hella zahlt, was sie versprochen hat. Die Wache nickt Euch zu. Torvald schlägt Euch auf die Schulter, dass es staubt.",
|
|
"Was danach kommt, schreibt Ihr selbst.",
|
|
]
|
|
# VBox statt fester y-Werte: ein Absatz, der umbricht, schiebt die
|
|
# folgenden nach unten, statt in sie hineinzulaufen.
|
|
var box := VBoxContainer.new()
|
|
box.position = Vector2(120, 296)
|
|
box.size = Vector2(1120, 300)
|
|
box.add_theme_constant_override("separation", 20)
|
|
add_child(box)
|
|
for zeile in zeilen:
|
|
var lbl := Label.new()
|
|
lbl.text = zeile
|
|
lbl.custom_minimum_size = Vector2(1120, 0)
|
|
lbl.autowrap_mode = TextServer.AUTOWRAP_WORD
|
|
lbl.add_theme_color_override("font_color", THEME.CREAM)
|
|
lbl.add_theme_color_override("font_outline_color", THEME.INK)
|
|
lbl.add_theme_constant_override("outline_size", 6)
|
|
box.add_child(lbl)
|
|
|
|
var namen: Array[String] = []
|
|
for figur in Game.party:
|
|
namen.append(str(figur.get("name", "?")))
|
|
var stufe := 0
|
|
if not Game.party.is_empty():
|
|
stufe = int(Game.party[0].get("level", 1))
|
|
var stand := Label.new()
|
|
stand.text = "Tag %d - %d Gold - %d Figuren - Stufe %d" % [
|
|
int(Game.time.get("day", 1)), Game.gold, Game.party.size(), stufe]
|
|
stand.position = Vector2(120, 588)
|
|
stand.add_theme_color_override("font_color", THEME.OCHRE_D)
|
|
stand.add_theme_color_override("font_outline_color", THEME.INK)
|
|
stand.add_theme_constant_override("outline_size", 6)
|
|
add_child(stand)
|
|
|
|
if not namen.is_empty():
|
|
var dabei := Label.new()
|
|
dabei.text = "Dabei: " + ", ".join(namen)
|
|
dabei.position = Vector2(120, 626)
|
|
dabei.size = Vector2(1120, 60)
|
|
dabei.autowrap_mode = TextServer.AUTOWRAP_WORD
|
|
dabei.add_theme_color_override("font_color", THEME.CREAM_D)
|
|
dabei.add_theme_color_override("font_outline_color", THEME.INK)
|
|
dabei.add_theme_constant_override("outline_size", 6)
|
|
add_child(dabei)
|
|
|
|
|
|
func _knopf(text: String, y: float) -> Button:
|
|
var b := Button.new()
|
|
b.text = text
|
|
b.position = Vector2(120, y)
|
|
b.size = Vector2(420, 60)
|
|
b.focus_mode = Control.FOCUS_NONE
|
|
b.pressed.connect(func() -> void: Audio.sfx("klick", 0.03, 0.8))
|
|
add_child(b)
|
|
return b
|