The UIManager is the core of DoozyUI as it alone manages the entire system by binding all the relevant components together.
It has a lot of methods that will help you manage your designed UI structure.
The component (shown above) has the following options available:
Control Panel: opens the Control Panel window
Editor Settings: opens the Control Panel window at the Editor Settings Tab
Help: opens the Control Panel window at the Help Tab
Add Orientation Manager to Scene: ads the Orientation Manager gameObject to the currently opened scene
Debug GameEvents: prints to the console all the GameEvents that are being sent at runtime
Debug UIButtons: prints to the console all the button interactions that are captured by the system at runtime
Debug UIElements: prints to the console all the show and hide commands issued at runtime
Debug UINotifications: prints to the console all the relevant info about shown UINotifications at runtime
Auto disable Button Clicks when an UIElement is in transition: forces the system to ignore any button clicks that are performed then an UIElement is executing an In or an Out animation; this feature prevents the possibility that a click is issued when an UIElement transition is happening
CODE
To be able to access DoozyUI components in code, you need to add the following using on top of your classes.
using DoozyUI;
Fields
Name |
Description |
autoDisableButtonClicks |
Should the system disable button clicks when an UIElement is in transition (an In or Out animation is running). Default is true. |
currentGameTimeScale |
Every time the user pauses the game, this variable stores the current Time.timeScale value. This is needed so that when the game needs to get unpaused, UIManager will know at what timescale should the game return to. |
currentOrientation |
Returns the current orientation of the device. Default is Orientation.Unknown because that triggers an orientation check/update. |
debugGameEvents |
Prints debug messages related to game events at runtime. |
debugUIButtons |
Prints debug messages related to UIButtons at runtime. |
debugUICanvases |
Prints debug messages related to UICanvases at runtime. |
debugUIElements |
Prints debug messages related to UIElements at runtime. |
debugUINotifications |
Prints debug messages related to UINotifications at runtime. |
gamePaused |
Returns true if the game has been paused (by the UIManager) and false otherwise. |
isMusicOn |
Returns true if the music is on and false otherwise. This variable knows only if the music is on for DoozyUI and not for anything else as it checks a PlayerPrefs int value named 'musicState'. |
isSoundOn |
Returns true if the sound is on and false otherwise. This variable knows only if the sound is on for DoozyUI and not for anything else as it checks a PlayerPrefs int value named 'soundState'. |
useOrientationManager |
Determines if the Orientation Manager should be used. This value is automatically set to true when the 'dUI_UseOrientationManager' Scripting Define Symbol has been added to the current active platform. |
useOrientationManager |
Determines if the Orientation Manager should be used. This value is automatically set to false when the 'dUI_UseOrientationManager' Scripting Define Symbol has not been added to the currently active platform. |
useSceneLoader |
Determines if the Scene Loader should be automatically loaded. This value is automatically set to false when the 'dUI_SceneLoaderDisabled' Scripting Define Symbol has been added to the current active platform. |
useSceneLoader |
Determines if the Scene Loader should be automatically loaded. This value is automatically set to true when the 'dUI_SceneLoaderDisabled' Scripting Define Symbol has not been added to the currently active platform. |
usesTMPro |
Global static variable that determines if the UINotification look for TextMeshProUGUI component instead of a Text componenet when looking for text. TextMeshPro support is currently in limbo as we wait to see what Unity does with it. |
Properties
Name |
Description |
BackButtonDisabled |
Returns true if the 'Back' button is disabled and false otherwise. |
ButtonClicksDisabled |
Returns true if button clicks are disabled and false otherwise. This is mosty used when an UIElement is in transition and, in order to prevent accidental clicks, the buttons need to be disabled. |
ButtonClicksTriggerDatabase |
Returns a registry of all the registered UITriggers that listens for button clicks. |
ButtonDoubleClicksTriggerDatabase |
Returns a registry of all the registered UITriggers that listens for button clicks. |
ButtonLongClicksTriggerRegistry |
Returns a registry of all the registered UITriggers that listens for button clicks. |
CanvasDatabase |
Returns a registry of all the registered UICanvases. |
EffectDatabase |
Returns a registry of all the registered UIEffects. |
ElementDatabase |
Returns a registry of all the registered UIElements. |
GameEventsTriggerDatabase |
Returns a registry of all the registered UITriggers that listens for game events. |
Instance |
Gets the instance. |
IsNavigationEnabled |
Returns true if the UI Navigation is enabled and false otherwise. It is set to false if Scripting Define Symbols, for the current active platform, contain the 'dUI_NavigationDisabled' symbol. In you want to handle the UI Navigation yourself just disable the UI Navigation from the Control Panel. |
NotificationManager |
Returns the UINotificationManager component. |
OrientationManager |
Returns the OrientationManager reference. |
PlaymakerEventDispatcherDatabase |
Returns a registry of all the registered PlaymakerEventDispatchers. |
SceneLoader |
Returns the SceneLoader reference. |
Soundy |
Returns the Soundy component. |
TouchManager |
Returns the TouchManager reference. |
Methods
Name |
Description |
ApplicationQuit() |
Exits play mode (if in editor) or quits the application if in build mode |
BackButtonEvent() |
The 'back' button was pressed (or escape key) |
ChangeOrientation(Orientation) |
Updates the current orientation to the new given one. |
CreateCanvas(string) |
Creates an UICanvas with the given canvas name and returns the reference to it. |
DisableBackButton() |
Disables the 'Back' button functionality |
DisableButtonClicks() |
Disables all the button clicks. This is triggered by the system when an UIElement started a transition (IN/OUT animations). |
DispatchEventToPlaymakerEventDispatchers(string, DUI.EventType) |
This method is obsolete, please use SendEventToPlaymaker instead. |
EnableBackButton() |
Enables the 'Back' button functionality |
EnableBackButtonByForce() |
Enables the 'Back' button functionality by resetting the additive bool to zero. backButtonDisableLevel = 0. Use this ONLY for special cases when something wrong happens, and the back button is stuck in disabled mode. |
EnableButtonClicks() |
Enables all the button clicks. This is triggered by the system when an UIElement finished a transition (IN/OUT animations). |
EnableButtonClicksByForce() |
Enables the button clicks by resetting the additive bool to zero. buttonClicksDisableLevel = 0. Use this ONLY for special cases when something unexpected happens and the button clicks are stuck in disabled mode. |
GetCanvas(string, bool, bool) |
Returns a reference to an UICanvas that has the given canvas name. It can also create the canvas you are searching for or just return the 'MasterCanvas' UICanvas. |
GetMasterCanvas(bool) |
Returns a reference to an UICanvas that is considered and used as a 'MasterCanvas'. If no such canvas exists, one will get created automatically by default. |
GetUiEffects(string, string) |
Returns a List of all UIEffects that are linked to an UIElement with a given name and category. If no UIEffect was found, it will return an empty list. |
GetUiElements(string, string) |
Returns a List of all UIElements that have a given name and category. If no UIElement was found, it will return an empty list. |
GetUiTriggers(string, DUI.EventType) |
Returns a list of all the UITriggers that are linked to the given triggerValue and of the given triggerType. |
GetVisibleUIElements() |
Returns a List of all the UIElements that are visible on the screen. An UIElement is considered visible if isVisible = true. If eDatabase is null or empty or if no UIElements are visible, it will return an empty list. |
HideUiElement(string, string) |
Hides all the UIElements that have the given name and category. |
HideUiElement(string, bool) |
Hides all the UIElements that have the given name and the DEFAULT CATEGORY name. |
HideUiElement(string, string, bool) |
Hides all the UIElements that have the given name and category. |
MusicCheck() |
Checks the musicState when the game starts in the PlayerPrefs |
PlaySound(string) |
Plays the given sound name, through Soundy. You can also use Soundy.PlaySound... Note: If support for MasterAudio is enabled it will play the sound name from the MasterAudio sounds database. |
PlaySound(string, float) |
Plays the given sound name, through Soundy. You can also use Soundy.PlaySound... Note: If support for MasterAudio is enabled it will play the sound name from the MasterAudio sounds database. |
PlaySound(string, float, float) |
Plays the given sound name, through Soundy. You can also use Soundy.PlaySound... Note: If support for MasterAudio is enabled it will play the sound name from the MasterAudio sounds database. |
PlaySound(AudioClip) |
Plays the given audio clip, through Soundy. You can also use Soundy.PlaySound... |
PlaySound(AudioClip, float) |
Plays the given audio clip at the given volume level, through Soundy. You can also use Soundy.PlaySound... |
PlaySound(AudioClip, float, float) |
Plays the given audio clip at the given volume and pitch levels, through Soundy. You can also use Soundy.PlaySound... |
PlaySoundFromResources(string, float) |
Plays the given sound name by searching the Resources folder for it, through Soundy. You can also use Soundy.PlaySound... |
PlaySoundFromResources(string, float, float) |
Plays the given sound name by searching the Resources folder for it, through Soundy. You can also use Soundy.PlaySound... |
PlaySoundFromResources(string) |
Plays the given sound name by searching the Resources folder for it, through Soundy. You can also use Soundy.PlaySound... |
RegisterToNotificationQueue(UINotification.NotificationData) |
Every notification that needs to enter the Notification Queue will be added to the notificatioQueue list as the last item. |
SendButtonAction(string, UIButton.ButtonClickType) |
Sends a button action with just a button name and what type of click it is. This method is used to simulate a button action since it does not have an UIButton reference. |
SendButtonAction(UIButton, UIButton.ButtonActionType) |
Sends a button action with a reference to the UIButton that sent it and what type of action it is. |
SendButtonAction(string, UIButton.ButtonActionType) |
Sends a button action with just a button name and what type of action it is. This method is used to simulate a button action since it does not have an UIButton reference. |
SendButtonClick(string, bool, List<string>, List<string>, List<string>) |
Use SendButtonAction instead. |
SendEventToPlaymaker(string, DUI.EventType) |
Sends an event that can be either a Game Event or Button Click to all the registered Playmaker Event Dispatchers. |
SendGameEvent(string) |
Sends the given game event. |
SendGameEvents(List<string>) |
Sends the given list of game events. |
ShowNotification(GameObject, float, bool, string[], string[], UnityAction[], UnityAction) |
Show a premade notification with the given settings, using a prefab GameObject reference. |
ShowNotification(string, float, bool, string[], string[], UnityAction[], UnityAction) |
Show a premade notification with the given settings, using a prefabName. |
ShowNotification(GameObject, float, bool, string[], UnityAction[], UnityAction) |
Show a premade notification with the given settings, using a prefab GameObject reference. |
ShowNotification(string, float, bool, string, string[], UnityAction[], UnityAction) |
Show a premade notification with the given settings, using a prefabName. |
ShowNotification(GameObject, float, bool, string, string[], string[], UnityAction[], UnityAction) |
Show a premade notification with the given settings, using a prefab GameObject reference. |
ShowNotification(string, float, bool, string, string[], string[], UnityAction[], UnityAction) |
Show a premade notification with the given settings, using a prefabName. |
ShowNotification(GameObject, float, bool, string, string[], UnityAction[], UnityAction) |
Show a premade notification with the given settings, using a prefab GameObject reference. |
ShowNotification(GameObject, float, bool, string, UnityAction) |
Show a premade notification with the given settings, using a prefab GameObject reference. |
ShowNotification(string, float, bool, string, UnityAction) |
Show a premade notification with the given settings, using a prefabName. |
ShowNotification(GameObject, float, bool, string, string, UnityAction) |
Show a premade notification with the given settings, using a prefab GameObject reference. |
ShowNotification(string, float, bool, string, string, UnityAction) |
Show a premade notification with the given settings, using a prefabName. |
ShowNotification(GameObject, float, bool, string, string, Sprite, string[], string[], UnityAction[], UnityAction) |
Show a premade notification with the given settings, using a prefab GameObject reference. |
ShowNotification(string, float, bool, string, string, Sprite, string[], string[], UnityAction[], UnityAction) |
Show a premade notification with the given settings, using a prefabName. |
ShowNotification(GameObject, float, bool, UnityAction) |
Show a premade notification with the given settings, using a prefab GameObject reference. |
ShowNotification(string, float, bool, UnityAction[], UnityAction) |
Show a premade notification with the given settings, using a prefabName. |
ShowNotification(string, float, bool, string, string, Sprite, UnityAction) |
Show a premade notification with the given settings, using a prefabName. |
ShowNotification(GameObject, float, bool, Sprite, UnityAction) |
Show a premade notification with the given settings, using a prefab GameObject reference. |
ShowNotification(string, float, bool, Sprite, UnityAction) |
Show a premade notification with the given settings, using a prefabName. |
ShowNotification(string, float, bool, string, Sprite, UnityAction) |
Show a premade notification with the given settings, using a prefabName. |
ShowNotification(string, float, bool, string[], UnityAction[], UnityAction) |
Show a premade notification with the given settings, using a prefabName. |
ShowNotification(GameObject, float, bool, string, Sprite, UnityAction) |
Show a premade notification with the given settings, using a prefab GameObject reference. |
ShowNotification(string, float, bool, string, string, Sprite, string[], UnityAction[], UnityAction) |
Show a premade notification with the given settings, using a prefabName. |
ShowNotification(GameObject, float, bool, string, string, Sprite, UnityAction) |
Show a premade notification with the given settings, using a prefab GameObject reference. |
ShowNotification(GameObject, float, bool, string, string, Sprite, string[], UnityAction[], UnityAction) |
Show a premade notification with the given settings, using a prefab GameObject reference. |
ShowUiElement(string, string, bool) |
Shows all the UIElements that have the given name and category. |
ShowUiElement(string, string) |
Shows all the UIElements that have the given name and category. |
ShowUiElement(string, bool) |
Shows all the UIElements that have the given name and the DEFAULT CATEGORY name. |
SoundCheck() |
Checks the soundState when the game starts in the PlayerPrefs |
ToggleMusic() |
Toggles the musicState and saves it to the PlayerPrefs |
TogglePause() |
Pauses or Unpauses the application |
ToggleSound() |
Toggles the soundState and saves it to the PlayerPrefs |
TriggerTheTriggers(string, DUI.EventType) |
Triggers all the UITriggers that are listening for the given triggerValue and are of the given triggerType. |
UnregisterFromNotificationQueue(UINotification.NotificationData) |
Unregisters a notification, by removing the notification data that started it. |
UpdateCanvasSortingLayerName(GameObject, string) |
Updates the sorting layer for all the canvases on and under the target gameObject |
UpdateRendererSortingLayerName(GameObject, string) |
Updates all the sorting layer for all the renderers on and under the target gameObject |
Comments
0 comments
Please sign in to leave a comment.