DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
UIManager.c
Go to the documentation of this file.
2{
4 proto native UIScriptedMenu EnterScriptedMenu(int id, UIMenuPanel parent);
5 proto native void EnterServerBrowser(UIMenuPanel parentMenu);
6
8 proto native void HideScriptedMenu(UIScriptedMenu menu);
9
11 proto native bool IsDialogVisible();
12 proto native bool IsModalVisible();
13 proto native void CloseSpecificDialog(int id);
14 proto native void CloseDialog();
15 proto native void HideDialog();
16
18 {
19 UIScriptedMenu menu = EnterScriptedMenu(id, parent);
20 HideScriptedMenu( menu );
21 return menu;
22 }
23
48 proto native void ShowDialog(string caption, string text, int id, int butts /*DBT_*/, int def/*DBB_*/, int type /*DMT_*/, UIScriptedMenu handler);
49 proto native bool ShowCursor(bool visible);
50 proto native bool IsCursorVisible();
51 proto native bool IsDialogQueued();
52 proto native bool ShowQueuedDialog();
53 proto native int GetLoginQueuePosition();
54 proto native bool ScreenFadeVisible();
55 proto native void ScreenFadeIn(float duration, string text, int backgroundColor, int textColor);
56 proto native void ScreenFadeOut(float duration);
57 proto native bool IsScaledMode();
58 proto native void SetScaledMode(bool enabled);
59
61 proto native UIScriptedMenu GetMenu();
62
64 bool Back()
65 {
66 if (IsDialogVisible() == false)
67 {
68 UIMenuPanel menu = GetMenu();
69 if (menu)
70 {
71 menu.Close();
72 return true;
73 }
74 }
75
76 return false;
77 }
78
80 bool CloseAll()
81 {
82 UIMenuPanel menu = GetMenu();
83 while (menu)
84 {
85 if (menu.GetParentMenu())
86 {
87 menu = menu.GetParentMenu();
88 }
89 else
90 {
91 menu.Close();
92 return true;
93 }
94 }
95
96 return false;
97 }
98
101 {
102 UIMenuPanel menu = GetMenu();
103
104 while (menu && menu.GetParentMenu() && menu.GetParentMenu().GetParentMenu())
105 {
106 menu = menu.GetParentMenu();
107 }
108
109 if (menu && menu.GetParentMenu())
110 {
111 menu.Close();
112 return true;
113 }
114
115 return false;
116 }
117
119 bool CloseMenu(int id)
120 {
121 UIMenuPanel menu = GetMenu();
122
123 while (menu)
124 {if (menu.GetID() == id)
125 {
126 menu.Close();
127 return true;
128 }
129
130 menu = menu.GetParentMenu();
131 }
132
133 return false;
134 }
135
136 bool HideMenu(int id)
137 {
138 UIScriptedMenu menu = GetMenu();
139
140 while (menu)
141 {
142 if (menu.GetID() == id)
143 {
144 HideScriptedMenu( menu );
145 return true;
146 }
147
148 menu = UIScriptedMenu.Cast( menu.GetParentMenu() );
149 }
150
151 return false;
152 }
153
155 bool IsMenuOpen(int id)
156 {
157 return FindMenu(id) != null;
158 }
159
162 {
163 UIScriptedMenu menu = GetMenu();
164
165 while (menu)
166 {
167 if (menu.GetID() == id)
168 {
169 return menu;
170 }
171
172 menu = UIScriptedMenu.Cast( menu.GetParentMenu() );
173 }
174
175 return NULL;
176 }
177
178 //Window management
179 void OpenWindow( int id )
180 {
182
183 //if window is already opened, close it
184 if ( window )
185 {
186 CloseWindow( id );
187
188 return;
189 }
190
191 //create new window
192 switch( id )
193 {
195 window = GetGame().GetMission().CreateScriptedWindow( id );
196 break;
197
198 default: {};
199 }
200
201 if ( window )
202 {
203 window.Init();
204
205 //add to active windows
207 }
208 }
209
210 void CloseWindow( int id )
211 {
213
214 if ( window )
215 {
217 window.HideWindow();
218
219 //delete window;
221 /*
222 wtf? leak
223 Timer delete_timer = new Timer ( CALL_CATEGORY_SYSTEM );
224 Param1<UIScriptedWindow> params = new Param1<UIScriptedWindow>( window );
225 delete_timer.Run( 0.5, this, "DeleteWindow", params, false );*/
226
227 }
228 }
229
231 {
232 delete window;
233 }
234
235 bool IsWindowOpened( int id )
236 {
237 if ( UIScriptedWindow.GetWindow( id ) )
238 {
239 return true;
240 }
241
242 return false;
243 }
244
245 //UI cursor
246 void ShowUICursor( bool visible )
247 {
248 ShowCursor( visible );
249 }
250};
251
254{
255 const string images[] = {"{655A1BF79F5B291}Gui/textures/loading_screens/loading_screen_1_co.edds", "{84BE5F7442BD4B}Gui/textures/loading_screens/loading_screen_2_co.edds"};
256 Math.Randomize(-1);
257 int index = Math.RandomInt(0, 100) % 2;
258 return images[index];
259}
string GetRandomLoadingBackground()
Returns random loading background texture path.
Definition UIManager.c:253
proto native Mission GetMission()
override ScriptCallQueue GetCallQueue(int call_category)
Definition DayZGame.c:1153
Definition EnMath.c:7
UIScriptedWindow CreateScriptedWindow(int id)
Definition gameplay.c:714
proto void Call(func fn, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto native bool ShowQueuedDialog()
bool CloseAllSubmenus()
Close all opened menus except first menu.
Definition UIManager.c:100
void DeleteWindow(UIScriptedWindow window)
Definition UIManager.c:230
UIScriptedMenu CreateScriptedMenu(int id, UIMenuPanel parent)
Definition UIManager.c:17
proto native void CloseDialog()
proto native void ScreenFadeIn(float duration, string text, int backgroundColor, int textColor)
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
Definition UIManager.c:161
bool CloseMenu(int id)
Close menu with specific ID (see MenuID)
Definition UIManager.c:119
proto native bool IsModalVisible()
proto native bool IsCursorVisible()
proto native int GetLoginQueuePosition()
proto native bool ShowCursor(bool visible)
void OpenWindow(int id)
Definition UIManager.c:179
proto native void EnterServerBrowser(UIMenuPanel parentMenu)
proto native bool IsDialogVisible()
void ShowUICursor(bool visible)
Definition UIManager.c:246
proto native UIScriptedMenu GetMenu()
Returns most-top open menu.
proto native UIScriptedMenu EnterScriptedMenu(int id, UIMenuPanel parent)
Create & open menu with specific id (see MenuID) and set its parent.
proto native void HideScriptedMenu(UIScriptedMenu menu)
proto native void ShowDialog(string caption, string text, int id, int butts, int def, int type, UIScriptedMenu handler)
Shows message dialog.
proto native bool IsDialogQueued()
proto native bool ScreenFadeVisible()
bool CloseAll()
Close all opened menus.
Definition UIManager.c:80
bool IsWindowOpened(int id)
Definition UIManager.c:235
proto native void CloseSpecificDialog(int id)
bool Back()
Close top window on windows stack, returns true when any window is closed.
Definition UIManager.c:64
proto native void HideDialog()
void CloseWindow(int id)
Definition UIManager.c:210
proto native Widget GetWidgetUnderCursor()
proto native UIScriptedMenu ShowScriptedMenu(UIScriptedMenu menu, UIMenuPanel parent)
proto native void SetScaledMode(bool enabled)
bool HideMenu(int id)
Definition UIManager.c:136
proto native bool IsScaledMode()
bool IsMenuOpen(int id)
Returns true if menu with specific ID is opened (see MenuID)
Definition UIManager.c:155
proto native void ScreenFadeOut(float duration)
Part of main menu hierarchy to create custom menus from script.
int GetID()
Returns MenuID.
proto native UIMenuPanel GetParentMenu()
proto native void Close()
Safe way to close window, using this function can even window safely close itself.
static UIScriptedWindow GetWindow(int id)
static void RemoveFromActiveWindows(int id)
static void AddToActiveWindows(int id, UIScriptedWindow window)
proto native CGame GetGame()
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].
static proto int Randomize(int seed)
Sets the seed for the random number generator.
const int GUI_WINDOW_MISSION_LOADER
Definition constants.c:193
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8