DayZ 1.24
Loading...
Searching...
No Matches
UIManager Class Reference

Private Member Functions

proto native UIScriptedMenu EnterScriptedMenu (int id, UIMenuPanel parent)
 Create & open menu with specific id (see MenuID) and set its parent.
 
proto native UIScriptedMenu CreateScriptedMenu (int id, UIMenuPanel parent)
 
proto native void EnterServerBrowser (UIMenuPanel parentMenu)
 
proto native UIScriptedMenu ShowScriptedMenu (UIScriptedMenu menu, UIMenuPanel parent)
 
proto native void HideScriptedMenu (UIScriptedMenu menu)
 
proto native Widget GetWidgetUnderCursor ()
 
proto native bool IsDialogVisible ()
 
proto native bool IsModalVisible ()
 
proto native void CloseSpecificDialog (int id)
 
proto native void CloseDialog ()
 
proto native void HideDialog ()
 
proto native void ShowDialog (string caption, string text, int id, int butts, int def, int type, UIScriptedMenu handler)
 Shows message dialog.
 
proto native bool ShowCursor (bool visible)
 natively checks game focus on cursor hiding
 
proto native bool IsCursorVisible ()
 
proto native bool IsDialogQueued ()
 
proto native bool ShowQueuedDialog ()
 
proto native int GetLoginQueuePosition ()
 
proto native bool ScreenFadeVisible ()
 
proto native void ScreenFadeIn (float duration, string text, int backgroundColor, int textColor)
 
proto native void ScreenFadeOut (float duration)
 
proto native bool IsScaledMode ()
 
proto native void SetScaledMode (bool enabled)
 
proto native UIScriptedMenu GetMenu ()
 Returns most-top open menu.
 
bool Back ()
 Close top window on windows stack, returns true when any window is closed.
 
bool CloseAll ()
 Close all opened menus.
 
bool CloseAllSubmenus ()
 Close all opened menus except first menu.
 
bool CloseMenu (int id)
 Close menu with specific ID (see MenuID)
 
bool HideMenu (int id)
 
bool IsMenuOpen (int id)
 Returns true if menu with specific ID is opened (see MenuID)
 
UIScriptedMenu FindMenu (int id)
 Returns menu with specific ID if it is open (see MenuID)
 
void OpenWindow (int id)
 
void CloseWindow (int id)
 
void DeleteWindow (UIScriptedWindow window)
 
bool IsWindowOpened (int id)
 
void ShowUICursor (bool visible)
 

Detailed Description

Definition at line 1 of file UIManager.c.

Member Function Documentation

◆ Back()

bool UIManager::Back ( )
inlineprivate

Close top window on windows stack, returns true when any window is closed.

Definition at line 60 of file UIManager.c.

61 {
62 if (IsDialogVisible() == false)
63 {
65 if (menu)
66 {
67 menu.Close();
68 return true;
69 }
70 }
71
72 return false;
73 }
proto native UIScriptedMenu GetMenu()
Returns most-top open menu.
proto native bool IsDialogVisible()
Part of main menu hierarchy to create custom menus from script.

References GetMenu(), and IsDialogVisible().

◆ CloseAll()

bool UIManager::CloseAll ( )
inlineprivate

Close all opened menus.

Definition at line 76 of file UIManager.c.

77 {
79 while (menu)
80 {
81 if (menu.GetParentMenu())
82 menu = menu.GetParentMenu();
83 else
84 {
85 menu.Close();
86 return true;
87 }
88 }
89
90 return false;
91 }

References GetMenu().

Referenced by MissionBase::CloseAllMenus(), MissionBase::DestroyAllMenus(), and ActionUnfoldMapCB::PerformMapChange().

◆ CloseAllSubmenus()

bool UIManager::CloseAllSubmenus ( )
inlineprivate

Close all opened menus except first menu.

Definition at line 94 of file UIManager.c.

95 {
97
98 while (menu && menu.GetParentMenu() && menu.GetParentMenu().GetParentMenu())
99 menu = menu.GetParentMenu();
100
101 if (menu && menu.GetParentMenu())
102 {
103 menu.Close();
104 return true;
105 }
106
107 return false;
108 }

References GetMenu().

◆ CloseDialog()

proto native void UIManager::CloseDialog ( )
private

◆ CloseMenu()

bool UIManager::CloseMenu ( int id)
inlineprivate

Close menu with specific ID (see MenuID)

Definition at line 111 of file UIManager.c.

112 {
114
115 while (menu)
116 {
117 if (menu.GetID() == id)
118 {
119 menu.Close();
120 return true;
121 }
122
123 menu = menu.GetParentMenu();
124 }
125
126 return false;
127 }

References GetMenu().

Referenced by MissionBase::Continue().

◆ CloseSpecificDialog()

proto native void UIManager::CloseSpecificDialog ( int id)
private

◆ CloseWindow()

void UIManager::CloseWindow ( int id)
inlineprivate

Definition at line 201 of file UIManager.c.

202 {
204
205 if (window)
206 {
208 window.HideWindow();
209
210 //delete window;
211 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Call(this.DeleteWindow, window);
212 /*
213 wtf? leak
214 Timer delete_timer = new Timer ( CALL_CATEGORY_SYSTEM );
215 Param1<UIScriptedWindow> params = new Param1<UIScriptedWindow>( window );
216 delete_timer.Run( 0.5, this, "DeleteWindow", params, false );*/
217
218 }
219 }
void DeleteWindow(UIScriptedWindow window)
Definition UIManager.c:221
static void RemoveFromActiveWindows(int id)
static UIScriptedWindow GetWindow(int id)
proto native CGame GetGame()
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8

References CALL_CATEGORY_SYSTEM, DeleteWindow(), GetGame(), UIScriptedWindow::GetWindow(), and UIScriptedWindow::RemoveFromActiveWindows().

Referenced by OpenWindow().

◆ CreateScriptedMenu()

proto native UIScriptedMenu UIManager::CreateScriptedMenu ( int id,
UIMenuPanel parent )
private

◆ DeleteWindow()

void UIManager::DeleteWindow ( UIScriptedWindow window)
inlineprivate

Definition at line 221 of file UIManager.c.

222 {
223 delete window;
224 }

Referenced by CloseWindow().

◆ EnterScriptedMenu()

proto native UIScriptedMenu UIManager::EnterScriptedMenu ( int id,
UIMenuPanel parent )
private

Create & open menu with specific id (see MenuID) and set its parent.

Referenced by MissionBase::Pause(), ActionUnfoldMapCB::PerformMapChange(), and MissionBase::ShowChat().

◆ EnterServerBrowser()

proto native void UIManager::EnterServerBrowser ( UIMenuPanel parentMenu)
private

◆ FindMenu()

UIScriptedMenu UIManager::FindMenu ( int id)
inlineprivate

Returns menu with specific ID if it is open (see MenuID)

Definition at line 154 of file UIManager.c.

155 {
157
158 while (menu)
159 {
160 if (menu.GetID() == id)
161 return menu;
162
163 menu = UIScriptedMenu.Cast(menu.GetParentMenu());
164 }
165
166 return NULL;
167 }

References GetMenu().

Referenced by IsMenuOpen(), and MissionBase::OnUpdate().

◆ GetLoginQueuePosition()

proto native int UIManager::GetLoginQueuePosition ( )
private

◆ GetMenu()

proto native UIScriptedMenu UIManager::GetMenu ( )
private

◆ GetWidgetUnderCursor()

proto native Widget UIManager::GetWidgetUnderCursor ( )
private

◆ HideDialog()

proto native void UIManager::HideDialog ( )
private

◆ HideMenu()

bool UIManager::HideMenu ( int id)
inlineprivate

Definition at line 129 of file UIManager.c.

130 {
132
133 while (menu)
134 {
135 if (menu.GetID() == id)
136 {
138 return true;
139 }
140
141 menu = UIScriptedMenu.Cast(menu.GetParentMenu());
142 }
143
144 return false;
145 }
proto native void HideScriptedMenu(UIScriptedMenu menu)

References GetMenu(), and HideScriptedMenu().

◆ HideScriptedMenu()

proto native void UIManager::HideScriptedMenu ( UIScriptedMenu menu)
private

◆ IsCursorVisible()

proto native bool UIManager::IsCursorVisible ( )
private

◆ IsDialogQueued()

proto native bool UIManager::IsDialogQueued ( )
private

◆ IsDialogVisible()

proto native bool UIManager::IsDialogVisible ( )
private

Referenced by Back(), and MissionBase::OnUpdate().

◆ IsMenuOpen()

bool UIManager::IsMenuOpen ( int id)
inlineprivate

Returns true if menu with specific ID is opened (see MenuID)

Definition at line 148 of file UIManager.c.

149 {
150 return FindMenu(id) != null;
151 }
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
Definition UIManager.c:154

References FindMenu().

◆ IsModalVisible()

proto native bool UIManager::IsModalVisible ( )
private

◆ IsScaledMode()

proto native bool UIManager::IsScaledMode ( )
private

◆ IsWindowOpened()

bool UIManager::IsWindowOpened ( int id)
inlineprivate

Definition at line 226 of file UIManager.c.

227 {
229 return true;
230
231 return false;
232 }

References UIScriptedWindow::GetWindow().

◆ OpenWindow()

void UIManager::OpenWindow ( int id)
inlineprivate

Definition at line 170 of file UIManager.c.

171 {
173
174 //if window is already opened, close it
175 if (window)
176 {
177 CloseWindow(id);
178
179 return;
180 }
181
182 //create new window
183 switch (id)
184 {
186 window = GetGame().GetMission().CreateScriptedWindow(id);
187 break;
188
189 default: {};
190 }
191
192 if (window)
193 {
194 window.Init();
195
196 //add to active windows
198 }
199 }
void CloseWindow(int id)
Definition UIManager.c:201
static void AddToActiveWindows(int id, UIScriptedWindow window)
const int GUI_WINDOW_MISSION_LOADER
Definition constants.c:207

References UIScriptedWindow::AddToActiveWindows(), CloseWindow(), GetGame(), UIScriptedWindow::GetWindow(), and GUI_WINDOW_MISSION_LOADER.

◆ ScreenFadeIn()

proto native void UIManager::ScreenFadeIn ( float duration,
string text,
int backgroundColor,
int textColor )
private

◆ ScreenFadeOut()

proto native void UIManager::ScreenFadeOut ( float duration)
private

Referenced by MissionBase::OnUpdate().

◆ ScreenFadeVisible()

proto native bool UIManager::ScreenFadeVisible ( )
private

◆ SetScaledMode()

proto native void UIManager::SetScaledMode ( bool enabled)
private

◆ ShowCursor()

proto native bool UIManager::ShowCursor ( bool visible)
private

natively checks game focus on cursor hiding

◆ ShowDialog()

proto native void UIManager::ShowDialog ( string caption,
string text,
int id,
int butts,
int def,
int type,
UIScriptedMenu handler )
private

Shows message dialog.

Parameters
caption
text
idcustom user id
buttsDialogBoxType
defDialogBoxButton
typeDialogMessageType
handler
usage :
const int QUIT_DIALOG_ID = 76;
GetGame().GetUIManager().ShowDialog("Quit", "Do You really want to quit?", QUIT_DIALOG_ID, DBT_YESNO, DBB_YES, DMT_QUESTION, this);
...
// after user pass dialog, callback on menu/event handler is called
ScriptedWidgetEventHandler::OnModalResult( Widget w, int x, int y, int code, int result )
{
if (code == QUIT_DIALOG_ID && result == DBB_YES) // yes this is callback for dialog we show earlier and user press YES button
{
Quit();
}
}
Icon x
Icon y

◆ ShowQueuedDialog()

proto native bool UIManager::ShowQueuedDialog ( )
private

◆ ShowScriptedMenu()

proto native UIScriptedMenu UIManager::ShowScriptedMenu ( UIScriptedMenu menu,
UIMenuPanel parent )
private

◆ ShowUICursor()

void UIManager::ShowUICursor ( bool visible)
inlineprivate

Definition at line 234 of file UIManager.c.

235 {
236 g_Game.SetMouseCursorDesiredVisibility(visible);
237 }
DayZGame g_Game
Definition DayZGame.c:3528

References g_Game.

Referenced by MissionBase::OnMissionStart(), and MissionBase::OnUpdate().


The documentation for this class was generated from the following file: