Dayz Explorer 1.28.160049
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 UIScriptedMenu CreateScriptedMenu(int id, UIMenuPanel parent);
6
7 proto native void EnterServerBrowser(UIMenuPanel parentMenu);
8
9 proto native UIScriptedMenu ShowScriptedMenu(UIScriptedMenu menu, UIMenuPanel parent);
10 proto native void HideScriptedMenu(UIScriptedMenu menu);
11
12 proto native Widget GetWidgetUnderCursor();
13 proto native bool IsDialogVisible();
15 proto native bool IsDialogHiding();
16 proto native bool IsModalVisible();
17 proto native void CloseSpecificDialog(int id);
18 proto native void CloseDialog();
19 proto native void HideDialog();
20
45 proto native void ShowDialog(string caption, string text, int id, int butts /*DBT_*/, int def/*DBB_*/, int type /*DMT_*/, UIScriptedMenu handler);
47 proto native bool ShowCursor(bool visible);
48 proto native bool IsCursorVisible();
49 proto native bool IsDialogQueued();
50 proto native bool ShowQueuedDialog();
51 proto native int GetLoginQueuePosition();
52 proto native bool ScreenFadeVisible();
53 proto native void ScreenFadeIn(float duration, string text, int backgroundColor, int textColor);
54 proto native void ScreenFadeOut(float duration);
55 proto native bool IsScaledMode();
56 proto native void SetScaledMode(bool enabled);
57
59 proto native UIScriptedMenu GetMenu();
60
62 bool Back()
63 {
64 if (IsDialogVisible() == false)
65 {
66 UIMenuPanel menu = GetMenu();
67 if (menu)
68 {
69 menu.Close();
70 return true;
71 }
72 }
73
74 return false;
75 }
76
78 bool CloseAll()
79 {
80 UIMenuPanel menu = GetMenu();
81 while (menu)
82 {
83 if (menu.GetParentMenu())
84 {
85 menu = menu.GetParentMenu();
86 }
87 else
88 {
89 menu.Close();
90 return true;
91 }
92 }
93
94 return false;
95 }
96
98 bool CloseAllSubmenus()
99 {
100 UIMenuPanel menu = GetMenu();
101
102 while (menu && menu.GetParentMenu() && menu.GetParentMenu().GetParentMenu())
103 {
104 menu = menu.GetParentMenu();
105 }
106
107 if (menu && menu.GetParentMenu())
108 {
109 menu.Close();
110 return true;
111 }
112
113 return false;
114 }
115
117 bool CloseMenu(int id)
118 {
119 UIMenuPanel menu = GetMenu();
120
121 while (menu)
122 {
123 if (menu.GetID() == id)
124 {
125 menu.Close();
126 return true;
127 }
128
129 menu = menu.GetParentMenu();
130 }
131
132 return false;
133 }
134
135 bool HideMenu(int id)
136 {
137 UIScriptedMenu menu = GetMenu();
138
139 while (menu)
140 {
141 if (menu.GetID() == id)
142 {
143 HideScriptedMenu( menu );
144 return true;
145 }
146
147 menu = UIScriptedMenu.Cast( menu.GetParentMenu() );
148 }
149
150 return false;
151 }
152
154 bool IsMenuOpen(int id)
155 {
156 return FindMenu(id) != null;
157 }
158
160 UIScriptedMenu FindMenu(int id)
161 {
162 UIScriptedMenu menu = GetMenu();
163
164 while (menu)
165 {
166 if (menu.GetID() == id)
167 {
168 return menu;
169 }
170
171 menu = UIScriptedMenu.Cast( menu.GetParentMenu() );
172 }
173
174 return NULL;
175 }
176
177 //Window management
178 void OpenWindow( int id )
179 {
180 UIScriptedWindow window = UIScriptedWindow.GetWindow( id );
181
182 //if window is already opened, close it
183 if ( window )
184 {
185 CloseWindow( id );
186
187 return;
188 }
189
190 //create new window
191 switch( id )
192 {
194 window = GetGame().GetMission().CreateScriptedWindow( id );
195 break;
196
197 default: {};
198 }
199
200 if ( window )
201 {
202 window.Init();
203
204 //add to active windows
205 UIScriptedWindow.AddToActiveWindows( id, window );
206 }
207 }
208
209 void CloseWindow( int id )
210 {
211 UIScriptedWindow window = UIScriptedWindow.GetWindow( id );
212
213 if ( window )
214 {
215 UIScriptedWindow.RemoveFromActiveWindows( id );
216 window.HideWindow();
217
218 //delete window;
219 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Call(this.DeleteWindow, window );
220 /*
221 wtf? leak
222 Timer delete_timer = new Timer ( CALL_CATEGORY_SYSTEM );
223 Param1<UIScriptedWindow> params = new Param1<UIScriptedWindow>( window );
224 delete_timer.Run( 0.5, this, "DeleteWindow", params, false );*/
225
226 }
227 }
228
229 void DeleteWindow( UIScriptedWindow window )
230 {
231 delete window;
232 }
233
234 bool IsWindowOpened( int id )
235 {
236 if ( UIScriptedWindow.GetWindow( id ) )
237 {
238 return true;
239 }
240
241 return false;
242 }
243
244 void ShowUICursor( bool visible )
245 {
246 g_Game.SetMouseCursorDesiredVisibility(visible);
247 }
248};
249
252{
253 const string images[] = {"{655A1BF79F5B291}Gui/textures/loading_screens/loading_screen_1_co.edds", "{84BE5F7442BD4B}Gui/textures/loading_screens/loading_screen_2_co.edds"};
254 Math.Randomize(-1);
255 int index = Math.RandomInt(0, 100) % 2;
256 return images[index];
257}
Definition enmath.c:7
Part of main menu hierarchy to create custom menus from script.
DayZGame g_Game
Definition dayzgame.c:3868
proto native CGame GetGame()
const int GUI_WINDOW_MISSION_LOADER
Definition constants.c:218
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8
string GetRandomLoadingBackground()
Returns random loading background texture path.
Definition uimanager.c:251