update
This commit is contained in:
149
scripts/ui.gd
149
scripts/ui.gd
@@ -16,6 +16,8 @@ var _ablauf: HBoxContainer
|
||||
var _ablauf_titel: Label
|
||||
var _ablauf_jetzt: Label
|
||||
var _ablauf_grund: ColorRect
|
||||
var _probleme: RichTextLabel
|
||||
var _probleme_grund: ColorRect
|
||||
var _zellen: Array = []
|
||||
var _ticks: Array = []
|
||||
var _dim: ColorRect
|
||||
@@ -27,7 +29,6 @@ var _apply_human: Node3D
|
||||
var _journal_seite := "techniken"
|
||||
var _scroll_wunsch := 0
|
||||
var _scroll_frames := 0
|
||||
var _on_travel: Callable
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
@@ -54,6 +55,7 @@ func _baue_hud() -> void:
|
||||
add_child(_hud)
|
||||
|
||||
_baue_ablauf()
|
||||
_baue_probleme()
|
||||
|
||||
var steuerung := Label.new()
|
||||
steuerung.text = "WASD Bewegen · Maus Umsehen · E Interagieren · F Folgen · " + \
|
||||
@@ -151,16 +153,17 @@ func _baue_ablauf() -> void:
|
||||
|
||||
## Farbe je Stunde: unbekannt, gesehen, ungeklärt, benannt, gebaut.
|
||||
func _ablauf_farbe(human_id: String, nr: int) -> Color:
|
||||
if not Game.gesehen_slot(human_id, nr):
|
||||
return Color(0.22, 0.23, 0.30)
|
||||
if not Game.system_in(human_id, nr).is_empty():
|
||||
return Color(0.44, 0.78, 0.50)
|
||||
var grund := Game.slot_grund(human_id, nr)
|
||||
if Ursachen.ist_blocker(grund):
|
||||
return Color(0.85, 0.66, 0.32) if not Game.erkannt(human_id, nr) \
|
||||
else Color(0.84, 0.42, 0.35)
|
||||
if grund == "schlaeft":
|
||||
return Color(0.30, 0.33, 0.44)
|
||||
match Game.slot_zustand(human_id, nr):
|
||||
Game.Stunde.UNBEKANNT:
|
||||
return Color(0.22, 0.23, 0.30)
|
||||
Game.Stunde.GEBAUT:
|
||||
return Color(0.44, 0.78, 0.50)
|
||||
Game.Stunde.UNGEKLAERT:
|
||||
return Color(0.85, 0.66, 0.32)
|
||||
Game.Stunde.BENANNT:
|
||||
return Color(0.84, 0.42, 0.35)
|
||||
Game.Stunde.SCHLAF:
|
||||
return Color(0.30, 0.33, 0.44)
|
||||
return Color(0.46, 0.50, 0.62)
|
||||
|
||||
|
||||
@@ -193,6 +196,60 @@ func _ablauf_aktualisieren() -> void:
|
||||
_ablauf_jetzt.text = "%02d Uhr %s" % [jetzt, _stunden_text(id, nr_jetzt)]
|
||||
|
||||
|
||||
## Die zweite Ebene im HUD: bekannte Probleme und der offene Moment.
|
||||
## Bewusst anders gezeichnet als der Tagesstreifen -- sie hängt nicht an Stunden.
|
||||
func _baue_probleme() -> void:
|
||||
_probleme_grund = ColorRect.new()
|
||||
_probleme_grund.color = Color(0, 0, 0, 0.42)
|
||||
_probleme_grund.set_anchors_preset(Control.PRESET_TOP_LEFT)
|
||||
_probleme_grund.position = Vector2(ABLAUF_X - 8.0, ABLAUF_Y + 88.0)
|
||||
_probleme_grund.custom_minimum_size = Vector2(414.0, 74.0)
|
||||
_probleme_grund.size = _probleme_grund.custom_minimum_size
|
||||
_probleme_grund.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
add_child(_probleme_grund)
|
||||
|
||||
_probleme = RichTextLabel.new()
|
||||
_probleme.bbcode_enabled = true
|
||||
_probleme.fit_content = true
|
||||
_probleme.scroll_active = false
|
||||
_probleme.set_anchors_preset(Control.PRESET_TOP_LEFT)
|
||||
_probleme.position = Vector2(ABLAUF_X, ABLAUF_Y + 94.0)
|
||||
_probleme.custom_minimum_size = Vector2(400, 64)
|
||||
_probleme.size = Vector2(400, 64)
|
||||
_probleme.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
_probleme.add_theme_font_size_override("normal_font_size", 14)
|
||||
_probleme.add_theme_font_size_override("bold_font_size", 14)
|
||||
add_child(_probleme)
|
||||
|
||||
|
||||
func _probleme_aktualisieren() -> void:
|
||||
var id := Game.active_mission
|
||||
var an := id != ""
|
||||
_probleme.visible = an
|
||||
_probleme_grund.visible = an
|
||||
if not an:
|
||||
return
|
||||
var zeilen: Array = []
|
||||
if Game.situation_laeuft() and Game.situation_bei(id):
|
||||
var s: Dictionary = Probleme.SITUATIONEN[Game.situation["key"]]
|
||||
zeilen.append("[color=#ffcc66][b]Jetzt: %s[/b][/color] %s [b]%.0f s[/b]" %
|
||||
[s["name"], s["was"], float(Game.situation["rest"])])
|
||||
else:
|
||||
zeilen.append("[color=#8e93a8]Ihre Momente[/color]")
|
||||
var bekannt: Array = []
|
||||
for p in Game.probleme_von(id):
|
||||
var key := str(p)
|
||||
if not Game.problem_bekannt(id, key):
|
||||
bekannt.append("[color=#55596b]?[/color]")
|
||||
elif Game.problem_ueberwunden(id, key):
|
||||
bekannt.append("[color=#88ff99]%s ✓[/color]" % Probleme.name_von(key))
|
||||
else:
|
||||
bekannt.append("[color=#ffb0a0]%s %d/%d[/color]" % [Probleme.name_von(key),
|
||||
Game.problem_fortschritt(id, key), Game.PROBLEM_UEBERWINDEN])
|
||||
zeilen.append(" · ".join(bekannt))
|
||||
_probleme.text = "\n".join(zeilen)
|
||||
|
||||
|
||||
func _baue_panel() -> void:
|
||||
_dim = ColorRect.new()
|
||||
_dim.color = Color(0, 0, 0, 0.62)
|
||||
@@ -278,6 +335,7 @@ func _hud_aktualisieren() -> void:
|
||||
zeilen.append("[color=#aaaaaa]Keine Mission. Schwarzes Brett am Dorfplatz.[/color]")
|
||||
_hud.text = "\n".join(zeilen)
|
||||
_ablauf_aktualisieren()
|
||||
_probleme_aktualisieren()
|
||||
|
||||
|
||||
func setze_hinweis(text: String) -> void:
|
||||
@@ -531,18 +589,19 @@ func _tagesablauf(human_id: String) -> void:
|
||||
|
||||
|
||||
func _stunden_text(human_id: String, nr: int) -> String:
|
||||
if not Game.gesehen_slot(human_id, nr):
|
||||
return "—"
|
||||
var sys := Game.system_in(human_id, nr)
|
||||
if not sys.is_empty():
|
||||
return "%s ← %s" % [Game.slot_aktivitaet(human_id, nr),
|
||||
TechDB.by_id(str(sys["tech"]))["name"]]
|
||||
var grund := Game.slot_grund(human_id, nr)
|
||||
if not Game.erkannt(human_id, nr):
|
||||
return "?"
|
||||
if Ursachen.ist_blocker(grund):
|
||||
return "%s (%s)" % [Ursachen.BLOCKER[grund]["name"],
|
||||
Ursachen.LISTE[Ursachen.BLOCKER[grund]["ursache"]]["name"]]
|
||||
match Game.slot_zustand(human_id, nr):
|
||||
Game.Stunde.UNBEKANNT:
|
||||
return "—"
|
||||
Game.Stunde.GEBAUT:
|
||||
var sys := Game.system_in(human_id, nr)
|
||||
return "%s ← %s" % [Game.slot_aktivitaet(human_id, nr),
|
||||
TechDB.by_id(str(sys["tech"]))["name"]]
|
||||
Game.Stunde.UNGEKLAERT:
|
||||
return "?"
|
||||
Game.Stunde.BENANNT:
|
||||
return "%s (%s)" % [Ursachen.BLOCKER[grund]["name"],
|
||||
Ursachen.LISTE[Ursachen.BLOCKER[grund]["ursache"]]["name"]]
|
||||
return Orte.text(grund)
|
||||
|
||||
|
||||
@@ -554,6 +613,49 @@ func _stunden_zeile(human_id: String, nr: int, von: int, bis: int, text: String)
|
||||
func() -> void: slot_panel(human_id, nr), offen)
|
||||
|
||||
|
||||
## Der offene Moment: hier zählt, welche Technik zu diesem Problem passt.
|
||||
func situation_panel(mensch: Node3D) -> void:
|
||||
_apply_human = mensch
|
||||
var id: String = str(mensch.data["id"])
|
||||
if not Game.situation_bei(id):
|
||||
anwenden_panel(mensch)
|
||||
return
|
||||
var s: Dictionary = Probleme.SITUATIONEN[Game.situation["key"]]
|
||||
var problem := Game.situation_problem()
|
||||
_leeren("%s — %s" % [mensch.data["name"], s["name"]])
|
||||
_text("[i]%s[/i]" % s["was"], 16)
|
||||
if Game.problem_bekannt(id, problem):
|
||||
_text("Dahinter steckt [b]%s[/b] — %s." %
|
||||
[Probleme.name_von(problem), Probleme.LISTE[problem]["kurz"]], 15)
|
||||
_text("[color=#aaaaaa]Überwunden nach %d von %d Malen.[/color]" %
|
||||
[Game.problem_fortschritt(id, problem), Game.PROBLEM_UEBERWINDEN], 14)
|
||||
else:
|
||||
_text("[color=#ffcc66]Was dahintersteckt, weißt du noch nicht.[/color]", 15)
|
||||
_text("[color=#aaaaaa]Noch %.0f Sekunden. Solange kommt ihr Traum nicht voran.[/color]" %
|
||||
float(Game.situation["rest"]), 14)
|
||||
_trenner()
|
||||
if Game.known.is_empty():
|
||||
_text("[color=#ffcc66]Du kennst keine Technik.[/color]", 16)
|
||||
_zeigen("situation")
|
||||
return
|
||||
for tech_id in TechDB.ids():
|
||||
if not Game.knows(tech_id):
|
||||
continue
|
||||
var t := TechDB.by_id(tech_id)
|
||||
var wofuer: Array = []
|
||||
for tag in t["tags"]:
|
||||
wofuer.append(Probleme.name_von(str(tag)))
|
||||
_text("[b]%s[/b] · Stufe %d\n[color=#cccccc]%s[/color]\n[color=#9fb6ff]Hilft bei:[/color] %s" %
|
||||
[t["name"], Game.skill_of(tech_id), t["wann"], ", ".join(wofuer)], 15)
|
||||
var frei := Game.bereit(tech_id)
|
||||
var text := "Jetzt anwenden" if frei else "Noch %.0f s" % Game.cooldown_rest(tech_id)
|
||||
_knopf(text, func() -> void:
|
||||
Game.situation_anwenden(tech_id)
|
||||
schliessen(), frei)
|
||||
_trenner()
|
||||
_zeigen("situation")
|
||||
|
||||
|
||||
## Was soll in diesem Slot stehen?
|
||||
func slot_panel(human_id: String, nr: int) -> void:
|
||||
var h := HumanDB.by_id(human_id)
|
||||
@@ -664,13 +766,14 @@ func brett_panel() -> void:
|
||||
_text("Ausgehängt wird nur, wem du mit dem, was du kannst, auch helfen kannst. " +
|
||||
"Das Tor zur Erde öffnet sich nur mit einer Mission.", 15)
|
||||
_trenner()
|
||||
var offen := Game.offene_missionen()
|
||||
var gezeigt := 0
|
||||
var verdeckt := 0
|
||||
for h in HumanDB.LIST:
|
||||
var id: String = h["id"]
|
||||
if Game.completed.has(id):
|
||||
continue
|
||||
if Game.active_mission != id and not Game.machbar(id):
|
||||
if not offen.has(id):
|
||||
verdeckt += 1
|
||||
continue
|
||||
gezeigt += 1
|
||||
|
||||
Reference in New Issue
Block a user