DayZ 1.24
Loading...
Searching...
No Matches
UIManager.c
Go to the documentation of this file.
2{
6
8
11
18
43 proto native void ShowDialog(string caption, string text, int id, int butts /*DBT_*/, int def/*DBB_*/, int type /*DMT_*/, UIScriptedMenu handler);
55
58
60 bool Back()
61 {
62 if (IsDialogVisible() == false)
63 {
65 if (menu)
66 {
67 menu.Close();
68 return true;
69 }
70 }
71
72 return false;
73 }
74
76 bool CloseAll()
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 }
92
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 }
109
111 bool CloseMenu(int id)
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 }
128
129 bool HideMenu(int id)
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 }
146
148 bool IsMenuOpen(int id)
149 {
150 return FindMenu(id) != null;
151 }
152
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 }
168
169 //Window management
170 void OpenWindow(int id)
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 }
200
201 void CloseWindow(int id)
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 }
220
222 {
223 delete window;
224 }
225
226 bool IsWindowOpened(int id)
227 {
229 return true;
230
231 return false;
232 }
233
235 {
236 g_Game.SetMouseCursorDesiredVisibility(visible);
237 }
238};
239
242{
243 const string images[] = {"{655A1BF79F5B291}Gui/textures/loading_screens/loading_screen_1_co.edds", "{84BE5F7442BD4B}Gui/textures/loading_screens/loading_screen_2_co.edds"};
244 Math.Randomize(-1);
245 int index = Math.RandomInt(0, 100) % 2;
246 return images[index];
247}
DayZGame g_Game
Definition DayZGame.c:3528
string GetRandomLoadingBackground()
Returns random loading background texture path.
Definition UIManager.c:241
Definition EnMath.c:7
void DeleteWindow(UIScriptedWindow window)
Definition UIManager.c:221
void OpenWindow(int id)
Definition UIManager.c:170
proto native bool IsScaledMode()
proto native void ShowDialog(string caption, string text, int id, int butts, int def, int type, UIScriptedMenu handler)
Shows message dialog.
proto native UIScriptedMenu GetMenu()
Returns most-top open menu.
proto native bool IsDialogVisible()
proto native bool IsModalVisible()
proto native void ScreenFadeOut(float duration)
proto native bool ShowCursor(bool visible)
natively checks game focus on cursor hiding
bool IsWindowOpened(int id)
Definition UIManager.c:226
proto native bool IsCursorVisible()
proto native void CloseSpecificDialog(int id)
bool CloseAllSubmenus()
Close all opened menus except first menu.
Definition UIManager.c:94
bool CloseMenu(int id)
Close menu with specific ID (see MenuID)
Definition UIManager.c:111
proto native bool ScreenFadeVisible()
proto native int GetLoginQueuePosition()
proto native UIScriptedMenu EnterScriptedMenu(int id, UIMenuPanel parent)
Create & open menu with specific id (see MenuID) and set its parent.
proto native void EnterServerBrowser(UIMenuPanel parentMenu)
void ShowUICursor(bool visible)
Definition UIManager.c:234
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
Definition UIManager.c:154
proto native bool ShowQueuedDialog()
bool IsMenuOpen(int id)
Returns true if menu with specific ID is opened (see MenuID)
Definition UIManager.c:148
bool HideMenu(int id)
Definition UIManager.c:129
bool Back()
Close top window on windows stack, returns true when any window is closed.
Definition UIManager.c:60
void CloseWindow(int id)
Definition UIManager.c:201
bool CloseAll()
Close all opened menus.
Definition UIManager.c:76
proto native UIScriptedMenu CreateScriptedMenu(int id, UIMenuPanel parent)
proto native bool IsDialogQueued()
proto native Widget GetWidgetUnderCursor()
proto native void HideDialog()
proto native void CloseDialog()
proto native UIScriptedMenu ShowScriptedMenu(UIScriptedMenu menu, UIMenuPanel parent)
proto native void HideScriptedMenu(UIScriptedMenu menu)
proto native void SetScaledMode(bool enabled)
proto native void ScreenFadeIn(float duration, string text, int backgroundColor, int textColor)
Part of main menu hierarchy to create custom menus from script.
static void RemoveFromActiveWindows(int id)
static UIScriptedWindow GetWindow(int id)
static void AddToActiveWindows(int id, UIScriptedWindow window)
proto native CGame GetGame()
static proto int Randomize(int seed)
Sets the seed for the random number generator.
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].
const int GUI_WINDOW_MISSION_LOADER
Definition constants.c:207
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8