tengri/Content/Debug/UI/WBP_DebugHUD.ts

159 lines
6.3 KiB
TypeScript

// Debug/UI/WBP_DebugHUD.ts
import type { AC_Movement } from '#root/Movement/Components/AC_Movement.js';
import { SystemLibrary } from '#root/UE/SystemLibrary.ts';
import type { Text } from '#root/UE/Text.ts';
import { TextBlock } from '#root/UE/TextBlock.ts';
import { UserWidget } from '#root/UE/UserWidget.ts';
/**
* Debug HUD Widget for displaying system information
* Provides real-time debug information display with multiple pages
* Part of the deterministic movement system debug infrastructure
*/
export class WBP_DebugHUD extends UserWidget {
// ════════════════════════════════════════════════════════════════════════════════════════
// GRAPHS
// ════════════════════════════════════════════════════════════════════════════════════════
// ────────────────────────────────────────────────────────────────────────────────────────
// EventGraph
// ────────────────────────────────────────────────────────────────────────────────────────
/**
* Widget construction event - initializes all text displays
* Called automatically when widget is created
*/
EventConstruct(): void {
this.UpdateHeaderDisplay();
this.UpdateContentDisplay();
this.UpdateNavigationDisplay();
}
// ════════════════════════════════════════════════════════════════════════════════════════
// FUNCTIONS
// ════════════════════════════════════════════════════════════════════════════════════════
/**
* Update header text box with current header text
* @category Display Updates
*/
private UpdateHeaderDisplay(): void {
if (SystemLibrary.IsValid(this.HeaderTextBox)) {
this.HeaderTextBox.SetText(this.HeaderText);
}
}
/**
* Update content text box with current content text
* @category Display Updates
*/
private UpdateContentDisplay(): void {
if (SystemLibrary.IsValid(this.ContentTextBox)) {
this.ContentTextBox.SetText(this.ContentText);
}
}
/**
* Update navigation text box with current navigation text
* @category Display Updates
*/
private UpdateNavigationDisplay(): void {
if (SystemLibrary.IsValid(this.NavigationTextBox)) {
this.NavigationTextBox.SetText(this.NavigationText);
}
}
/**
* Set new header text and update display
* @param NewHeaderText - New title text for current debug page
* @example
* // Set movement page header
* SetHeaderText("Movement Constants")
* @category Public Interface
*/
public SetHeaderText(NewHeaderText: Text): void {
this.HeaderText = NewHeaderText;
this.UpdateHeaderDisplay();
}
/**
* Set new content text and update display
* @param NewContentText - New debug content (supports multi-line text)
* @example
* // Set movement constants content
* SetContentText("Max Speed: 600\nAcceleration: 2000\nFriction: 8.0")
* @category Public Interface
*/
public SetContentText(NewContentText: Text): void {
this.ContentText = NewContentText;
this.UpdateContentDisplay();
}
/**
* Set new navigation text and update display
* @param NewNavigationText - Navigation instructions and page info
* @example
* // Set navigation with page counter
* SetNavigationText("Page 1/3 | PageUp/PageDown - Navigate")
* @category Public Interface
*/
public SetNavigationText(NewNavigationText: Text): void {
this.NavigationText = NewNavigationText;
this.UpdateNavigationDisplay();
}
// ════════════════════════════════════════════════════════════════════════════════════════
// VARIABLES
// ════════════════════════════════════════════════════════════════════════════════════════
/**
* Reference to movement component for accessing debug data
* Set by AC_DebugHUD during initialization
* @category Components
*/
public MovementComponent: AC_Movement | null = null;
/**
* Current page title text
* Updated by AC_DebugHUD when switching pages
* @category PageData
*/
private HeaderText: Text = 'Debug HUD';
/**
* Current page content text
* Contains the main debug information for current page
* @category PageData
*/
private ContentText: Text = 'Text';
/**
* Navigation instructions text
* Shows current page index and navigation controls
* @category PageData
*/
private NavigationText: Text = 'Navigation';
/**
* Text box widget for displaying page header/title
* Positioned at top of debug HUD
* @category UI Components
*/
private HeaderTextBox = new TextBlock();
/**
* Text box widget for displaying main debug content
* Contains multi-line debug information for current page
* @category UI Components
*/
private ContentTextBox = new TextBlock();
/**
* Text box widget for displaying navigation help
* Shows page counter and keyboard shortcuts
* @category UI Components
*/
private NavigationTextBox = new TextBlock();
}