133 lines
3.8 KiB
TypeScript
133 lines
3.8 KiB
TypeScript
// Content/Debug/UI/WBP_DebugHUD.ts
|
|
|
|
import type {AC_Movement} from "../../Movement/Components/AC_Movement.js";
|
|
import {TextBox, Widget} from "../../classes.js";
|
|
import type {Text} from "../../types.js";
|
|
import {IsValid} from "../../functions.js";
|
|
|
|
/**
|
|
* 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 Widget{
|
|
// Category: "Components"
|
|
/**
|
|
* Reference to movement component for accessing debug data
|
|
* Set by AC_DebugHUD during initialization
|
|
*/
|
|
public MovementComponent: AC_Movement | null = null;
|
|
|
|
// Category: "PageData"
|
|
/**
|
|
* Current page title text
|
|
* Updated by AC_DebugHUD when switching pages
|
|
*/
|
|
private HeaderText: Text = "Debug HUD";
|
|
|
|
// Category: "PageData"
|
|
/**
|
|
* Current page content text
|
|
* Contains the main debug information for current page
|
|
*/
|
|
private ContentText: Text = "Text";
|
|
|
|
// Category: "PageData"
|
|
/**
|
|
* Navigation instructions text
|
|
* Shows current page index and navigation controls
|
|
*/
|
|
private NavigationText: Text = "Navigation";
|
|
|
|
// Category: "UI Components"
|
|
/**
|
|
* Text box widget for displaying page header/title
|
|
* Positioned at top of debug HUD
|
|
*/
|
|
private HeaderTextBox = new TextBox();
|
|
|
|
// Category: "UI Components"
|
|
/**
|
|
* Text box widget for displaying main debug content
|
|
* Contains multi-line debug information for current page
|
|
*/
|
|
private ContentTextBox = new TextBox();
|
|
|
|
// Category: "UI Components"
|
|
/**
|
|
* Text box widget for displaying navigation help
|
|
* Shows page counter and keyboard shortcuts
|
|
*/
|
|
private NavigationTextBox = new TextBox();
|
|
|
|
// Category: "Display Updates"
|
|
private UpdateHeaderDisplay() {
|
|
if (IsValid(this.HeaderTextBox)) {
|
|
this.HeaderTextBox.SetText(this.HeaderText);
|
|
}
|
|
}
|
|
|
|
// Category: "Display Updates"
|
|
/**
|
|
* Update header text box with current header text
|
|
* Called automatically when header text changes
|
|
* @private Internal display update method
|
|
*/
|
|
private UpdateContentDisplay() {
|
|
if (IsValid(this.ContentTextBox)) {
|
|
this.ContentTextBox.SetText(this.ContentText);
|
|
}
|
|
}
|
|
|
|
// Category: "Display Updates"
|
|
/**
|
|
* Update navigation text box with current navigation text
|
|
* Called automatically when navigation text changes
|
|
* @private Internal display update method
|
|
*/
|
|
private UpdateNavigationDisplay() {
|
|
if (IsValid(this.NavigationTextBox)) {
|
|
this.NavigationTextBox.SetText(this.NavigationText);
|
|
}
|
|
}
|
|
|
|
// Category: "Public Interface"
|
|
/**
|
|
* Set new header text and update display
|
|
* @param NewHeaderText - New title text for current debug page
|
|
* @example
|
|
* // Set movement page header
|
|
* SetHeaderText("Movement Constants")
|
|
*/
|
|
public SetHeaderText(NewHeaderText: string): void {
|
|
this.HeaderText = NewHeaderText;
|
|
this.UpdateHeaderDisplay();
|
|
}
|
|
|
|
// Category: "Public Interface"
|
|
/**
|
|
* 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")
|
|
*/
|
|
public SetContentText(NewContentText: string): void {
|
|
this.ContentText = NewContentText;
|
|
this.UpdateContentDisplay();
|
|
}
|
|
|
|
// Category: "Public Interface"
|
|
/**
|
|
* 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")
|
|
*/
|
|
public SetNavigationText(NewNavigationText: string): void {
|
|
this.NavigationText = NewNavigationText;
|
|
this.UpdateNavigationDisplay();
|
|
}
|
|
}
|