3.6 KiB
UI Manager (CECUIManager) – V1
CECUIManager is a singleton that manages in-game dialogs and UI. Access it via CECUIManager.Instance. Dialogs are resolved by name through GetInGameUIMan().GetDialog(componentName) (e.g. "Win_Quest", "DlgMessageBox").
Stack / Push / Pop
The manager keeps an internal UI stack: an ordered list of dialog names. The top of the stack (index 0) is the dialog currently shown on top; Unity draws it last via SetAsLastSibling() on the canvas. Pushing adds to the top; popping removes from the top.
Behaviour
-
Show UI (stacked)
ShowUI(string componentName)hides the current top dialog (if any) and pushes the named dialog: it is shown, added to the front of the stack, and brought to front in the hierarchy. If the same name is already in the stack, it is moved to the top. -
Max stack size
A_maxStacklimit (Inspector, default 1) caps how many dialogs can be in the stack. When the stack is already at or above this limit and a new dialog is pushed, the top dialog is popped once (hidden and removed from the stack), then the new dialog is pushed. If_maxStack <= 0, the stack is unlimited. -
Hide current / pop
HideCurrentUIInStack()pops the top dialog (hides it and removes it from the stack), then shows the new top (if any) and brings it to front.
Stack-related API
| Method | Description |
|---|---|
ShowUI(string componentName) |
Hides current top dialog and pushes the named dialog (show + add to front of stack + SetAsLastSibling). |
HideCurrentUIInStack() |
Pops the top dialog, then shows and brings to front the new top if the stack is not empty. |
GetCurrentUI() |
Returns the name of the dialog at the top of the stack, or null if the stack is empty. |
GetCurrentDialog() |
Returns the AUIDialog instance at the top of the stack, or null if empty. |
GetStackCount() |
Returns the number of dialogs in the stack (0 when empty). |
IsInStack(string componentName) |
Returns whether the given dialog name is in the stack. |
PeekStack(int index = 0) |
Returns the dialog name at index (0 = top) without removing it; returns null if index is out of range. |
ClearStack(bool hideAll = true) |
Clears the stack. If hideAll is true, calls Show(false) on every dialog in the stack before clearing. |
Internal notes
- Stack is stored as
List<string>; front = index 0 = top. - Push is implemented internally (show, insert at 0, SetAsLastSibling); when at capacity, the top is popped once before pushing.
- Pop is implemented internally (remove top, hide it, SetAsLastSibling on new top if any).
Other APIs
-
Message box
ShowMessageBox(MessageBoxData)/ShowMessageBox(string title, string message, MessageBoxType, ...)– show the DlgMessageBox with the given data or title/message/type. -
Skill tooltip
ShowSkillTooltip(string hintText, RectTransform sourceButton)– show skill tooltip;HideSkillTooltip()– hide it. -
In-game UI / dialogs
GetInGameUIMan()returnsCECGameUIMan; use it to resolve dialogs by name and callShow/other methods as needed. -
Player options
ShowPlayerOptionsDialog(int characterId, Vector2 position)– show the player options menu for the given character at the given position. -
Misc
GetCDlgQuickBar(),GetCurrentTargetNPCID(),FilterBadWords(ref string str), etc. as used elsewhere.
File reference
- Manager:
Assets/Scripts/CECUIManager.cs - Base dialog:
Assets/PerfectWorld/Scripts/UI/Dialogs/AUIDialog.cs - In-game UI manager:
Assets/PerfectWorld/Scripts/UI/GamePlay/EC_GameUIMan.cs