ULimenNumberPad
Overview
ULimenNumberPad is a custom UMG widget designed to allow users to input numeric codes. It consists of a grid of number buttons (0-9), a submit button, and a clear button. The widget maintains the current code being entered and provides an event for when the submitted code is checked against a predefined solution.
Properties
Type | Name | Access | Description |
|---|---|---|---|
| SubmitButtonText | EditAnywhere | Text displayed on the submit button. |
| ClearButtonText | EditAnywhere | Text displayed on the clear button. |
| Solution | EditAnywhere | The correct code to be submitted. |
| MaxDigits | EditAnywhere | Maximum number of digits allowed in the code. |
| ScreenBrush | EditAnywhere | Brush used for the background of the screen. |
| ButtonStyle | EditAnywhere | Style applied to all buttons. |
| ButtonFont | EditAnywhere | Font used for button text. |
| ScreenFont | EditAnywhere | Font used for the code display on the screen. |
| ButtonPadding | EditAnywhere | Padding applied to each button. |
Functions
Return Type | Signature | Description |
|---|---|---|
| ClearScreen() | Clears the current code displayed on the screen. |
| RebuildWidget() | Constructs and returns the widget's visual representation. |
| NumberPressed(ULimenStandardButton* Button) | Handles the event when a number button is pressed, updating the displayed code. |
| ClearPressed(ULimenStandardButton* Button) | Handles the event when the clear button is pressed, resetting the screen. |
| SubmitPressed(ULimenStandardButton* Button) | Handles the event when the submit button is pressed, checking if the entered code matches the solution and broadcasting the result via |
Usage & Implementation Notes
Threading Constraints: This widget does not perform any operations that require threading constraints.
Replication Requirements: No replication is required for this widget as it operates purely on client-side data.
Memory Lifetime Management: The widget manages memory for the buttons and screen using smart pointers (
TSharedPtrandTStrongObjectPtr). Ensure proper management of these objects to avoid memory leaks.Initialization Dependencies: This widget depends on
ULimenStandardButtonfor its functionality. Ensure that this class is properly defined and available in your project.
Events
Type | Name | Description |
|---|---|---|
FLimenNumberPadCodeSubmited | OnCodeSubmitted | Event triggered when the submitted code is checked against the solution. |