Set up the complete Godot 4.6 client foundation as a pure renderer (D-020): - project.godot with 2D rendering, autoloads, input actions - Main scene: Game > World (TileMapLayer, Entities, FogOverlay) + Camera2D + UILayer - Autoloads: SimBridge (connection state machine + test mode), GameState, InputMapper - Rendering stubs: WorldRenderer, EntityRenderer, FogRenderer - UI stubs: HUD (health/perception/time), Minimap, MonologueDisplay - Input mapping: WASD/arrows, E (interact), Tab (perception), Esc (menu), Space (pause) - gdUnit4 smoke tests: scene loads, autoloads registered (2/2 passing) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
44 lines
1.1 KiB
GDScript
44 lines
1.1 KiB
GDScript
extends Control
|
|
|
|
# Internal monologue display (per D-015)
|
|
# Shows character's internal thoughts as text overlay
|
|
|
|
@onready var text_panel: PanelContainer = $PanelContainer
|
|
@onready var text_label: RichTextLabel = $PanelContainer/MarginContainer/RichTextLabel
|
|
|
|
var fade_timer: float = 0.0
|
|
var fade_duration: float = 5.0 # Display duration before fade
|
|
var is_visible: bool = false
|
|
|
|
func _ready() -> void:
|
|
print("MonologueDisplay: Initialized")
|
|
text_panel.modulate.a = 0.0
|
|
is_visible = false
|
|
|
|
func _process(delta: float) -> void:
|
|
# Auto-fade after display
|
|
if is_visible:
|
|
fade_timer += delta
|
|
if fade_timer >= fade_duration:
|
|
_fade_out()
|
|
|
|
# Show internal monologue text
|
|
func show_monologue(text: String, duration: float = 5.0) -> void:
|
|
text_label.text = text
|
|
fade_duration = duration
|
|
fade_timer = 0.0
|
|
is_visible = true
|
|
|
|
# Fade in
|
|
var tween = create_tween()
|
|
tween.tween_property(text_panel, "modulate:a", 1.0, 0.3)
|
|
|
|
# Fade out the monologue
|
|
func _fade_out() -> void:
|
|
if not is_visible:
|
|
return
|
|
|
|
is_visible = false
|
|
var tween = create_tween()
|
|
tween.tween_property(text_panel, "modulate:a", 0.0, 0.5)
|