Creating UI

From Ardenfall Wiki
Revision as of 21:35, 29 July 2026 by Joshcamas (talk | contribs) (Created page with "Creating new UI elements is for now, quite simple. More complex UI features will be coming later. == Event Message == Event Message is text that appears on the top left of the screen. Can appear at any time in gameplay and in most menus. Messages will stack, and only a handful will appear at a time. === ShowMessage === Displays the message<syntaxhighlight lang="c#">//Shows a simple text message. Will play a sound, and will stack. EventMessageInfoUI.ShowMessage(string m...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Creating new UI elements is for now, quite simple. More complex UI features will be coming later.

Event Message

Event Message is text that appears on the top left of the screen. Can appear at any time in gameplay and in most menus. Messages will stack, and only a handful will appear at a time.

ShowMessage

Displays the message

//Shows a simple text message. Will play a sound, and will stack.
EventMessageInfoUI.ShowMessage(string message);

//Shows a message with the more complex EventMessageUIMessageItem 
EventMessageInfoUI.ShowMessage(EventMessageUIMessageItem message);

Event Message UI Message Item

EventMessageUIMessageItem:
    string text               // The text message 
    bool allowStacking = true // Whether duplicate messages will stack 
    bool playSound = true     // Whether the message will display a sound when it appears
    bool skipIfVisible        // Whether to not display the message entirely if a duplicate one is visible
    int stackCount = 1        // How many 'stacks' this message counts as (This is uncommonly used)

Alert Message UI

An alert message is a popup that pauses the game, and can appear at any time in gameplay or in any menu.

'Ok' Alert

Displays an alert with a title (optional), text, and an ok button. You can hook into the button event. Supports AlertMessageSettings.

AlertMessageUI.OpenAlertMessage(string title, string message, Action onOk = null, string customOkLabel = null, AlertMessageSettings settings = new AlertMessageSettings())

Cancelable Alert

Displays an alert with a title (optional), text, and a ok + cancel button. You can hook into both button events. Supports AlertMessageSettings.

AlertMessageUI.OpenCancelableAlertMessage(string title, string message, Action onOk, Action onCancel = null, string customOkLabel = null, string customCancelLabel = null, AlertMessageSettings settings = new AlertMessageSettings())

No Buttons Alert

An alert with a title (optional), and text. No buttons. Supports AlertMessageSettings. Meant to be paired with Alert objects.

AlertMessageUI.OpenNoButtonsAlertMessage(string title, string message, AlertMessageSettings settings = new AlertMessageSettings())

Alert Message Settings

A few settings to modify an alert.

onTopOfFader: Makes the alert message appear on top of the fading screen. Useful to display narration popups.

objects: Allows you to register Alert Objects

AlertMessageSettings:
     bool onTopOfFader
     List<AlertMessageObject> objects

Other Methods

//Closes the current alert if there is one
void AlertMessageUI.CloseCurrentAlert();

//Returns whether an alert message is open
bool AlertMessageUI.IsOpen();

Alert Objects

Add additional buttons, toggles, sliders, text input, dropdowns, and more.

AlertMessageSliderObject:
        string title
        float min
        float max
        float value
        bool isInt

AlertMessageToggleObject
        string title
        bool value

AlertMessageTextInputObject
        string title
        string value
        int characterLimit
        Func<string, bool> Validate

AlertMessageDropdownObject
        string title
        int value
        List<TMP_Dropdown.OptionData> options

AlertMessageButtonObject
        string title
        string label
        Action onClick

AlertMessageImageObject
        string title
        Sprite texture