update
This commit is contained in:
167
scripts/ui.gd
167
scripts/ui.gd
@@ -18,6 +18,9 @@ var _titel: Label
|
||||
var _content: VBoxContainer
|
||||
var _scroll: ScrollContainer
|
||||
var _apply_human: Node3D
|
||||
var _journal_seite := "techniken"
|
||||
var _scroll_wunsch := 0
|
||||
var _scroll_frames := 0
|
||||
var _on_travel: Callable
|
||||
|
||||
|
||||
@@ -45,7 +48,7 @@ func _baue_hud() -> void:
|
||||
add_child(_hud)
|
||||
|
||||
var steuerung := Label.new()
|
||||
steuerung.text = "WASD Bewegen · Maus Umsehen · E Interagieren · Tab Kodex · Esc Maus frei"
|
||||
steuerung.text = "WASD Bewegen · Maus Umsehen · E Interagieren · J Journal · Esc Maus frei"
|
||||
steuerung.set_anchors_preset(Control.PRESET_TOP_RIGHT)
|
||||
steuerung.position = Vector2(-640, 16)
|
||||
steuerung.size = Vector2(620, 24)
|
||||
@@ -130,6 +133,9 @@ func _process(_delta: float) -> void:
|
||||
var wunsch := _content.get_combined_minimum_size().y
|
||||
var platz := get_viewport().get_visible_rect().size.y - 220.0
|
||||
_scroll.custom_minimum_size.y = clampf(wunsch, 120.0, platz)
|
||||
if _scroll_frames > 0:
|
||||
_scroll.scroll_vertical = _scroll_wunsch
|
||||
_scroll_frames -= 1
|
||||
_panel.position = (get_viewport().get_visible_rect().size - _panel.size) * 0.5
|
||||
|
||||
|
||||
@@ -148,7 +154,7 @@ func _hud_aktualisieren() -> void:
|
||||
elif Game.completed.size() >= HumanDB.LIST.size():
|
||||
zeilen.append("[color=#88ff99]Alle Träume erfüllt.[/color]")
|
||||
else:
|
||||
zeilen.append("[color=#aaaaaa]Keine Mission. Missionshalle in der Traumwelt.[/color]")
|
||||
zeilen.append("[color=#aaaaaa]Keine Mission. Journal öffnen mit J.[/color]")
|
||||
_hud.text = "\n".join(zeilen)
|
||||
|
||||
|
||||
@@ -242,88 +248,96 @@ func _hinweis_block(t: Dictionary) -> String:
|
||||
[t["was"], t["wann"], t["warum"]])
|
||||
|
||||
|
||||
# -------------------------------------------------------- Bibliothek
|
||||
# -------------------------------------------------------- Journal
|
||||
|
||||
func technik_panel(id: String) -> void:
|
||||
var t := TechDB.by_id(id)
|
||||
_leeren(t["name"])
|
||||
_text(_hinweis_block(t))
|
||||
_trenner()
|
||||
_text("[color=#9fb6ff]Hilft bei:[/color] %s\n[color=#9fb6ff]Gute Momente:[/color] %s" %
|
||||
[TechDB.tags_text(t["tags"]), TechDB.momente_text(t["momente"])], 15)
|
||||
if Game.knows(id):
|
||||
_text("[color=#88ff99]Gelernt — Stufe %d (%s)[/color]" %
|
||||
[Game.skill_of(id), Game.xp_to_next(id)])
|
||||
## Das Journal ist immer dabei. Hier werden Techniken gelernt und vertieft
|
||||
## und Missionen angenommen.
|
||||
func journal_panel(seite: String = "") -> void:
|
||||
if seite != "":
|
||||
_journal_seite = seite
|
||||
var scroll_alt := _scroll.scroll_vertical if offen and _kind == "journal" else 0
|
||||
_leeren("Journal")
|
||||
_reiter()
|
||||
if _journal_seite == "missionen":
|
||||
_journal_missionen()
|
||||
else:
|
||||
_text("[color=#ffcc66]Noch nicht gelernt. Kosten: 1 Einsicht (du hast %d).[/color]" %
|
||||
Game.einsicht)
|
||||
_knopf("Technik lernen (1 Einsicht)", func() -> void:
|
||||
if Game.learn(id):
|
||||
technik_panel(id), Game.einsicht >= 1)
|
||||
_zeigen("technik")
|
||||
_journal_techniken()
|
||||
_zeigen("journal")
|
||||
_scroll_wunsch = scroll_alt
|
||||
_scroll_frames = 4
|
||||
|
||||
|
||||
# -------------------------------------------------------- Missionshalle
|
||||
|
||||
func mission_panel(id: String) -> void:
|
||||
var h := HumanDB.by_id(id)
|
||||
_leeren("%s, %d — %s" % [h["name"], h["alter"], h["beruf"]])
|
||||
_text("[b]Traum:[/b] %s" % h["traum"])
|
||||
_text("[b]Was im Weg steht:[/b] %s" % h["problem"])
|
||||
_text("[color=#9fb6ff]Themen:[/color] %s" % TechDB.tags_text(h["tags"]), 15)
|
||||
func _reiter() -> void:
|
||||
var hb := HBoxContainer.new()
|
||||
hb.add_theme_constant_override("separation", 8)
|
||||
_content.add_child(hb)
|
||||
for eintrag in [["techniken", "Techniken"], ["missionen", "Missionen"]]:
|
||||
var b := Button.new()
|
||||
b.text = eintrag[1]
|
||||
b.custom_minimum_size = Vector2(0, 36)
|
||||
b.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
b.add_theme_font_size_override("font_size", 17)
|
||||
b.disabled = _journal_seite == eintrag[0]
|
||||
if b.disabled:
|
||||
b.add_theme_color_override("font_disabled_color", Color(1, 0.88, 0.55))
|
||||
hb.add_child(b)
|
||||
if not b.disabled:
|
||||
b.pressed.connect(func() -> void: journal_panel(eintrag[0]))
|
||||
var mission := "keine"
|
||||
if Game.active_mission != "":
|
||||
mission = "%s (%d %%)" % [HumanDB.by_id(Game.active_mission)["name"],
|
||||
int(Game.mission_progress(Game.active_mission))]
|
||||
_text("[color=#aaaaaa]Einsicht: [b]%d[/b] · Mission: %s[/color]" %
|
||||
[Game.einsicht, mission], 15)
|
||||
_trenner()
|
||||
if Game.completed.has(id):
|
||||
_text("[color=#88ff99]★ Der Traum ist erfüllt.[/color]")
|
||||
elif Game.active_mission == id:
|
||||
_text("[color=#ffdd77]Aktive Mission — %d %%[/color]" % int(Game.mission_progress(id)))
|
||||
else:
|
||||
_text("Fortschritt: %d %%" % int(Game.mission_progress(id)))
|
||||
_knopf("Mission annehmen", func() -> void:
|
||||
Game.accept_mission(id)
|
||||
mission_panel(id))
|
||||
_zeigen("mission")
|
||||
|
||||
|
||||
# -------------------------------------------------------- Meditation
|
||||
|
||||
func vertiefen_panel() -> void:
|
||||
_leeren("Meditationskammer")
|
||||
_text("Übung kostet 1 Einsicht und bringt 3 Erfahrungspunkte. Du hast [b]%d[/b] Einsicht." %
|
||||
Game.einsicht)
|
||||
func _journal_techniken() -> void:
|
||||
_text("Zwölf Wege, die Menschen wirklich weiterbringen. Jede Anwendung " +
|
||||
"draußen macht eine Technik von allein besser. Vertiefen geht auch hier.", 15)
|
||||
_trenner()
|
||||
if Game.known.is_empty():
|
||||
_text("[color=#ffcc66]Du kennst noch keine Technik. Geh in die Bibliothek.[/color]")
|
||||
for id in TechDB.ids():
|
||||
if not Game.knows(id):
|
||||
continue
|
||||
var t := TechDB.by_id(id)
|
||||
_text("[b]%s[/b] — Stufe %d (%s)" % [t["name"], Game.skill_of(id), Game.xp_to_next(id)], 16)
|
||||
_knopf("Vertiefen (1 Einsicht)", func() -> void:
|
||||
if Game.deepen(id):
|
||||
vertiefen_panel(), Game.einsicht >= 1)
|
||||
_zeigen("vertiefen")
|
||||
|
||||
|
||||
# -------------------------------------------------------- Kodex
|
||||
|
||||
func kodex_panel() -> void:
|
||||
_leeren("Kodex der Techniken")
|
||||
if Game.known.is_empty():
|
||||
_text("Du kennst noch keine Technik. In der Bibliothek der Traumwelt liegen zwölf.")
|
||||
for id in TechDB.ids():
|
||||
if not Game.knows(id):
|
||||
continue
|
||||
var t := TechDB.by_id(id)
|
||||
_text("[b][color=#ffe3a0]%s[/color][/b] · Stufe %d (%s)" %
|
||||
[t["name"], Game.skill_of(id), Game.xp_to_next(id)], 18)
|
||||
if Game.knows(id):
|
||||
_text("[b][color=#ffe3a0]%s[/color][/b] · Stufe %d (%s)" %
|
||||
[t["name"], Game.skill_of(id), Game.xp_to_next(id)], 18)
|
||||
else:
|
||||
_text("[b][color=#9aa0b8]%s[/color][/b] · noch nicht gelernt" % t["name"], 18)
|
||||
_text(_hinweis_block(t), 15)
|
||||
_text("[color=#9fb6ff]Hilft bei:[/color] %s [color=#9fb6ff]Momente:[/color] %s" %
|
||||
[TechDB.tags_text(t["tags"]), TechDB.momente_text(t["momente"])], 14)
|
||||
if Game.knows(id):
|
||||
_knopf("Vertiefen (1 Einsicht)", func() -> void:
|
||||
if Game.deepen(id):
|
||||
journal_panel(), Game.einsicht >= 1)
|
||||
else:
|
||||
_knopf("Lernen (1 Einsicht)", func() -> void:
|
||||
if Game.learn(id):
|
||||
journal_panel(), Game.einsicht >= 1)
|
||||
_trenner()
|
||||
|
||||
|
||||
func _journal_missionen() -> void:
|
||||
_text("Menschen, deren Traum feststeckt.", 15)
|
||||
_trenner()
|
||||
for h in HumanDB.LIST:
|
||||
var id: String = h["id"]
|
||||
_text("[b][color=#ffe3a0]%s[/color][/b], %d — %s" %
|
||||
[h["name"], h["alter"], h["beruf"]], 18)
|
||||
_text("[b]Traum:[/b] %s" % h["traum"], 16)
|
||||
_text("[b]Was im Weg steht:[/b] %s" % h["problem"], 15)
|
||||
_text("[color=#9fb6ff]Themen:[/color] %s" % TechDB.tags_text(h["tags"]), 14)
|
||||
if Game.completed.has(id):
|
||||
_text("[color=#88ff99]★ Der Traum ist erfüllt.[/color]", 15)
|
||||
elif Game.active_mission == id:
|
||||
_text("[color=#ffdd77]Aktive Mission — %d %%[/color]" %
|
||||
int(Game.mission_progress(id)), 15)
|
||||
else:
|
||||
_text("Fortschritt: %d %%" % int(Game.mission_progress(id)), 15)
|
||||
_knopf("Mission annehmen", func() -> void:
|
||||
Game.accept_mission(id)
|
||||
journal_panel())
|
||||
_trenner()
|
||||
var fehlend := TechDB.LIST.size() - Game.known.size()
|
||||
if fehlend > 0:
|
||||
_text("[color=#aaaaaa]%d weitere Techniken warten in der Bibliothek.[/color]" % fehlend, 15)
|
||||
_zeigen("kodex")
|
||||
|
||||
|
||||
# -------------------------------------------------------- Anwenden auf der Erde
|
||||
@@ -332,7 +346,7 @@ func anwenden_panel(mensch: Node3D) -> void:
|
||||
_apply_human = mensch
|
||||
var h: Dictionary = mensch.data
|
||||
var aktiv: String = mensch.activity
|
||||
_leeren("%s — %s" % [h["name"], HumanDB.activity_text(aktiv)])
|
||||
_leeren("%s — %s" % [h["name"], Orte.text(aktiv)])
|
||||
_text("[b]Traum:[/b] %s" % h["traum"], 16)
|
||||
if Game.active_mission == h["id"]:
|
||||
_text("Fortschritt: [b]%d %%[/b]" % int(Game.mission_progress(h["id"])), 16)
|
||||
@@ -404,11 +418,14 @@ func intro_panel(on_close: Callable) -> void:
|
||||
_text("Du bist ein Wesen aus der Traumwelt. Menschen tragen Träume mit sich herum, " +
|
||||
"die sie allein nicht bewegt bekommen. Du wirst zu ihnen geschickt.")
|
||||
_trenner()
|
||||
_text("[b]Dein Journal — Taste J[/b]\n" +
|
||||
"· Es ist immer dabei, in beiden Welten.\n" +
|
||||
"· [b]Techniken[/b] — lerne echte Lösungswege. Jede sagt dir, was sie tut, " +
|
||||
"wann sie passt und warum sie hilft. Anwenden macht sie von allein besser.\n" +
|
||||
"· [b]Missionen[/b] — nimm einen Menschen an, dem du helfen willst.")
|
||||
_text("[b]In der Traumwelt[/b]\n" +
|
||||
"· [b]Bibliothek der Techniken[/b] — lerne echte Lösungswege. Jede Technik sagt dir, " +
|
||||
"was sie tut, wann sie passt und warum sie hilft.\n" +
|
||||
"· [b]Missionshalle[/b] — nimm einen Menschen an, dem du helfen willst.\n" +
|
||||
"· [b]Meditationskammer[/b] — vertiefe, was du schon kannst.\n" +
|
||||
"· Ein Dorf auf einer schwebenden Insel. Vier Wesen wohnen hier, jedes in " +
|
||||
"seinem Haus, jedes mit eigenem Tagesablauf. Die Häuser stehen offen.\n" +
|
||||
"· [b]Tor zur Erde[/b] — reise hinab, sobald du eine Mission hast.")
|
||||
_text("[b]Auf der Erde[/b]\n" +
|
||||
"· Du bist ein unsichtbarer Geist und schwebst durch Wände. Leertaste hoch, Umschalt runter.\n" +
|
||||
|
||||
Reference in New Issue
Block a user