DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
UIPopupScriptSceneManager.c
См. документацию.
1class UIPopupScriptSceneManager extends UIPopupScript
2{
3 private ButtonWidget m_BtnCancel;
4 private ButtonWidget m_BtnSceneNew;
5 private ButtonWidget m_BtnSceneLoad;
6 private ButtonWidget m_BtnSceneRename;
7 private ButtonWidget m_BtnSceneDuplicate;
8 private ButtonWidget m_BtnSceneDelete;
9 private TextListboxWidget m_LstListScenes;
10
11 private static const int m_DaysInMonth[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
12
13 private ButtonWidget m_BtnSave;
14
16
17 private SliderWidget m_SldStartTime;
19 private SliderWidget m_SldStartDay;
21 private SliderWidget m_SldOvercast;
23 private SliderWidget m_SldRain;
25 private SliderWidget m_SldFog;
27 private SliderWidget m_SldWindForce;
29
30 private int m_OrigYear;
31 private int m_OrigMonth;
32 private int m_OrigDay;
33 private int m_OrigHour;
34 private int m_OrigMinute;
35 private float m_OrigOvercast;
36 private float m_OrigRain;
37 private float m_OrigFog;
38 private float m_OrigWindForce;
39
40 private int m_CurrYear;
41 private int m_CurrMonth;
42 private int m_CurrDay;
43 private int m_CurrHour;
44 private int m_CurrMinute;
45 private float m_CurrOvercast;
46 private float m_CurrRain;
47 private float m_CurrFog;
48 private float m_CurrWindForce;
49
50 //================================================
51 // UIPopupScriptSceneManager
52 //================================================
54 {
55 m_BtnCancel = ButtonWidget.Cast( wgt.FindAnyWidget("btn_ppp_sm_cancel") );
56 m_BtnSceneNew = ButtonWidget.Cast( wgt.FindAnyWidget("btn_ppp_sm_mission_new") );
57 m_BtnSceneLoad = ButtonWidget.Cast( wgt.FindAnyWidget("btn_ppp_sm_mission_load") );
58 m_BtnSceneRename = ButtonWidget.Cast( wgt.FindAnyWidget("btn_ppp_sm_mission_rename") );
59 m_BtnSceneDelete = ButtonWidget.Cast( wgt.FindAnyWidget("btn_ppp_sm_mission_delete") );
60 m_BtnSceneDuplicate = ButtonWidget.Cast( wgt.FindAnyWidget("btn_ppp_sm_mission_duplicate") );
61
62 m_LstListScenes = TextListboxWidget.Cast( wgt.FindAnyWidget("tls_ppp_sm_scene_list") );
63
64 m_BtnSave = ButtonWidget.Cast( wgt.FindAnyWidget("btn_ppp_st_save") );
65
66 m_TxtWeatherTime = TextWidget.Cast( wgt.FindAnyWidget("txt_ppp_st_w_time_value") );
67
68 m_SldStartTime = SliderWidget.Cast( wgt.FindAnyWidget("sld_ppp_st_start_time") );
69 m_TxtStartTimeValue = TextWidget.Cast( wgt.FindAnyWidget("txt_ppp_st_start_time_value") );
70
71 m_SldStartDay = SliderWidget.Cast( wgt.FindAnyWidget("sld_ppp_st_start_day") );
72 m_TxtStartDayValue = TextWidget.Cast( wgt.FindAnyWidget("txt_ppp_st_start_day_value") );
73
74 m_SldOvercast = SliderWidget.Cast( wgt.FindAnyWidget("sld_ppp_st_overcast") );
75 m_TxtOvercastValue = TextWidget.Cast( wgt.FindAnyWidget("txt_ppp_st_overcast_value") );
76
77 m_SldRain = SliderWidget.Cast( wgt.FindAnyWidget("sld_ppp_st_rain") );
78 m_TxtRainValue = TextWidget.Cast( wgt.FindAnyWidget("txt_ppp_st_rain_value") );
79
80 m_SldFog = SliderWidget.Cast( wgt.FindAnyWidget("sld_ppp_st_fog") );
81 m_TxtFogValue = TextWidget.Cast( wgt.FindAnyWidget("txt_ppp_st_fog_value") );
82
83 m_SldWindForce = SliderWidget.Cast( wgt.FindAnyWidget("sld_ppp_st_wind_force") );
84 m_TxtWindForceValue = TextWidget.Cast( wgt.FindAnyWidget("txt_ppp_st_wind_force_value") );
85 }
86
91
92 //================================================
93 // OnClick
94 //================================================
95 override bool OnClick(Widget w, int x, int y, int button)
96 {
97 super.OnClick(w, x, y, button);
98
99 string scene_name;
100 PluginSceneManager editor;
101
102 if ( w == m_BtnCancel )
103 {
105
106 Weather weather = GetGame().GetWeather();
107 weather.GetOvercast().Set( m_OrigOvercast, 0, 1000 );
108 weather.GetRain().Set( m_OrigRain, 0, 1000 );
109 weather.GetFog().Set( m_OrigFog, 0, 1000 );
110 weather.SetWindSpeed( m_OrigWindForce );
111
112 PopupBack();
113 return true;
114 }
115 else if ( w == m_BtnSceneNew )
116 {
117 PopupOpen(SceneEditorMenu.POPUP_ID_SCENE_NEW, NULL);
118
119 return true;
120 }
121 else if ( w == m_BtnSceneLoad )
122 {
123 if ( m_LstListScenes.GetSelectedRow() != -1 )
124 {
125 m_LstListScenes.GetItemText( m_LstListScenes.GetSelectedRow(), 0, scene_name );
126 editor = PluginSceneManager.Cast( GetPlugin(PluginSceneManager) );
127
128 editor.SceneLoad(scene_name);
129 PopupBack();
130
131 return true;
132 }
133 }
134 else if ( w == m_BtnSceneRename )
135 {
136 m_LstListScenes.GetItemText( m_LstListScenes.GetSelectedRow(), 0, scene_name );
137
138 UIPopupScriptSceneRename popup_rename = UIPopupScriptSceneRename.Cast( PopupOpen(SceneEditorMenu.POPUP_ID_SCENE_RENAME, NULL) );
139 popup_rename.SetRenameName(scene_name);
140
141 return true;
142 }
143 else if ( w == m_BtnSceneDuplicate )
144 {
145 if ( m_LstListScenes.GetSelectedRow() != -1 )
146 {
147 m_LstListScenes.GetItemText( m_LstListScenes.GetSelectedRow(), 0, scene_name );
148 editor = PluginSceneManager.Cast( GetPlugin(PluginSceneManager) );
149
150 editor.SceneDuplicate(scene_name);
152
153 return true;
154 }
155 }
156 else if ( w == m_BtnSceneDelete )
157 {
158 if ( m_LstListScenes.GetSelectedRow() != -1 )
159 {
160 m_LstListScenes.GetItemText( m_LstListScenes.GetSelectedRow(), 0, scene_name );
161 editor = PluginSceneManager.Cast( GetPlugin(PluginSceneManager) );
162
163 editor.SceneDelete(scene_name);
164
165 if ( editor.SceneCanDelete(scene_name) )
166 {
167 UIPopupScriptSceneDelete popup_delete = UIPopupScriptSceneDelete.Cast( PopupOpen(SceneEditorMenu.POPUP_ID_SCENE_DELETE, NULL) );
168 popup_delete.SetDeleteName(scene_name);
169 }
170 else
171 {
172 UIPopupScriptNotify popup_notify = UIPopupScriptNotify.Cast( PopupOpen(SceneEditorMenu.POPUP_ID_NOTIFY, NULL) );
173 popup_notify.SetLabelText("You cant delete current loaded scene!");
174 }
175
177 return true;
178 }
179 }
180 else if ( w == m_BtnSave )
181 {
191
192 editor = PluginSceneManager.Cast( GetPlugin(PluginSceneManager) );
195 editor.SceneSave();
196
197 PopupBack();
198
199 return true;
200 }
201
202 return false;
203 }
204
205 override bool OnChange(Widget w, int x, int y, bool finished)
206 {
207 if ( w == m_SldStartTime )
208 {
209 float slider_value_start_time = m_SldStartTime.GetCurrent() * 0.01;
210 float start_time_f = slider_value_start_time * 1439;
211 int start_time = start_time_f;
212 m_CurrHour = start_time / 60;
213 m_CurrMinute = start_time % 60;
214
216
218
219 return true;
220 }
221 else if ( w == m_SldStartDay )
222 {
223 float slider_value_start_day = m_SldStartDay.GetCurrent();
224 float start_day_f = slider_value_start_day * 3.64 + 1;
225 int start_day = start_day_f;
226
227 for ( int i = 0; i < 12; i++ )
228 {
229 int days = m_DaysInMonth[i];
230 if ( start_day <= days )
231 {
232 m_CurrMonth = i+1;
233 m_CurrDay = start_day;
234 break;
235 }
236 else
237 {
238 start_day -= days;
239 }
240 }
241
243
245
246 return true;
247 }
248 else if ( w == m_SldOvercast )
249 {
250 m_CurrOvercast = m_SldOvercast.GetCurrent() * 0.01;
252
254
255 return true;
256 }
257 else if ( w == m_SldRain )
258 {
259 m_CurrRain = m_SldRain.GetCurrent() * 0.01;
260 GetGame().GetWeather().GetRain().Set( m_CurrRain, 0, 1000 );
261
263
264 return true;
265 }
266 else if ( w == m_SldFog )
267 {
268 m_CurrFog = m_SldFog.GetCurrent() * 0.01;
269 GetGame().GetWeather().GetFog().Set( m_CurrFog, 0, 1000 );
270
272
273 return true;
274 }
275 else if ( w == m_SldWindForce )
276 {
277 float wind_slider = m_SldWindForce.GetCurrent() * 0.01;
280
282
283 return true;
284 }
285
286 return false;
287 }
288
289 //================================================
290 // UpdateSceneList
291 //================================================
293 {
294 m_LstListScenes.ClearItems();
295
296 PluginSceneManager editor = PluginSceneManager.Cast( GetPlugin(PluginSceneManager) );
297
298 TStringArray scene_list = editor.GetSceneList();
299 string loaded_scene_name = editor.SceneGetName();
300
301 for ( int i = 0; i < scene_list.Count(); ++i )
302 {
303 string scene_name = scene_list.Get(i);
304
305 m_LstListScenes.AddItem(scene_name, NULL, 0);
306
307 if ( scene_name == loaded_scene_name )
308 {
309 m_LstListScenes.SelectRow(i);
310 }
311 }
312 }
313
314 //================================================
315 // UpdateSceneList
316 //================================================
317 override void OnOpen(Param param)
318 {
319 //Log("Poup Scene Manager OnOpen");
320
323
324 Weather weather = GetGame().GetWeather();
326 m_OrigRain = weather.GetRain().GetActual();
327 m_OrigFog = weather.GetFog().GetActual();
328 m_OrigWindForce = weather.GetWindSpeed();
329
339
340 Print( "Year" );
341 Print( m_CurrYear );
342
344
345 ResetSliders();
346 }
347
348 //================================================
349 // OnClose
350 //================================================
351 override void OnClose()
352 {
354 }
355
356 //================================================
357 // OnUpdate
358 //================================================
359 void OnUpdate()
360 {
361 m_TxtWeatherTime.SetText(GetGame().GetWeather().GetTime().ToString());
362 }
363
364 //================================================
365 // ResetSliders
366 //================================================
368 {
369 int year, month, day, hour, minute;
370 GetGame().GetWorld().GetDate( year, month, day, hour, minute );
371 m_SldStartTime.SetCurrent( ((hour * 60) + minute) / 14.39 );
372 UpdateSliderStartTime( hour, minute );
373
374 float start_day = day;
375 int month_tmp = month;
376 while ( month_tmp > 1 )
377 {
378 month_tmp--;
379 start_day += m_DaysInMonth[month];
380 }
381 m_SldStartDay.SetCurrent( start_day / 3.64 );
382 UpdateSliderStartDay( month, day );
383
384 Weather weather = GetGame().GetWeather();
385
386 m_SldOvercast.SetCurrent(weather.GetOvercast().GetActual() * 100);
388
389 m_SldRain.SetCurrent(weather.GetRain().GetActual() * 100);
391
392 m_SldFog.SetCurrent(weather.GetFog().GetActual() * 100);
394
395 float wind_slider = m_SldWindForce.GetCurrent() * 0.01;
396 m_CurrWindForce = weather.GetWindMaximumSpeed() * wind_slider;
397 weather.SetWindSpeed( m_CurrWindForce );
399 }
400
401 void UpdateSliderStartTime( int hour, int minute )
402 {
403 string label_text = hour.ToStringLen(2) + ":" + minute.ToStringLen(2);
404 m_TxtStartTimeValue.SetText( label_text );
405 }
406
407 void UpdateSliderStartDay( int month, int day )
408 {
409 string label_text = day.ToString() + "." + month.ToString() + ". " + m_CurrYear.ToString();
410 m_TxtStartDayValue.SetText( label_text );
411 }
412
414 {
415 string label_text = m_SldOvercast.GetCurrent().ToString()+"%";
416 m_TxtOvercastValue.SetText( label_text );
417 }
418
420 {
421 string label_text = m_SldRain.GetCurrent().ToString()+"%";
422 m_TxtRainValue.SetText( label_text );
423 }
424
426 {
427 string label_text = m_SldFog.GetCurrent().ToString()+"%";
428 m_TxtFogValue.SetText( label_text );
429 }
430
432 {
433 string label_text = m_CurrWindForce.ToString()+"ms";
434 m_TxtWindForceValue.SetText( label_text );
435 }
436}
proto string ToString()
Icon x
Icon y
float GetTime()
Определения NotificationSystem.c:35
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:316
proto native World GetWorld()
override ScriptInvoker GetUpdateQueue(int call_category)
Определения DayZGame.c:1192
proto native Weather GetWeather()
Returns weather controller object.
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Определения param.c:12
proto bool Remove(func fn, int flags=EScriptInvokerRemoveFlags.ALL)
remove specific call from list
proto bool Insert(func fn, int flags=EScriptInvokerInsertFlags.IMMEDIATE)
insert method to list
Определения EnWidgets.c:220
void UIPopupScriptSceneManager(Widget wgt)
Определения UIPopupScriptSceneManager.c:53
int m_OrigYear
Определения UIPopupScriptSceneManager.c:30
int m_OrigMonth
Определения UIPopupScriptSceneManager.c:31
int m_CurrYear
Определения UIPopupScriptSceneManager.c:40
ButtonWidget m_BtnSceneDelete
Определения UIPopupScriptSceneManager.c:8
override bool OnClick(Widget w, int x, int y, int button)
Определения UIPopupScriptSceneManager.c:95
void OnUpdate()
Определения UIPopupScriptSceneManager.c:359
float m_CurrWindForce
Определения UIPopupScriptSceneManager.c:48
float m_CurrOvercast
Определения UIPopupScriptSceneManager.c:45
void UpdateSliderOvercast()
Определения UIPopupScriptSceneManager.c:413
int m_CurrDay
Определения UIPopupScriptSceneManager.c:42
TextListboxWidget m_LstListScenes
Определения UIPopupScriptSceneManager.c:9
TextWidget m_TxtFogValue
Определения UIPopupScriptSceneManager.c:26
void UpdateSliderStartTime(int hour, int minute)
Определения UIPopupScriptSceneManager.c:401
SliderWidget m_SldStartTime
Определения UIPopupScriptSceneManager.c:17
ButtonWidget m_BtnSceneDuplicate
Определения UIPopupScriptSceneManager.c:7
UIPopupScript PopupBack()
Определения UIPopupScript.c:37
static const int m_DaysInMonth[12]
Определения UIPopupScriptSceneManager.c:11
int m_CurrHour
Определения UIPopupScriptSceneManager.c:43
void UIPopupScriptSceneDelete(Widget wgt)
Определения UIPopupScriptSceneDelete.c:10
TextWidget m_TxtStartTimeValue
Определения UIPopupScriptSceneManager.c:18
int m_OrigDay
Определения UIPopupScriptSceneManager.c:32
void ResetSliders()
Определения UIPopupScriptSceneManager.c:367
void UpdateSliderWindForce()
Определения UIPopupScriptSceneManager.c:431
ButtonWidget m_BtnCancel
Определения UIPopupScriptConfigs.c:4
override void OnOpen(Param param)
Определения UIPopupScriptSceneManager.c:317
int m_CurrMonth
Определения UIPopupScriptSceneManager.c:41
int m_OrigHour
Определения UIPopupScriptSceneManager.c:33
float m_OrigOvercast
Определения UIPopupScriptSceneManager.c:35
void ~UIPopupScriptSceneManager()
Определения UIPopupScriptSceneManager.c:87
SliderWidget m_SldOvercast
Определения UIPopupScriptSceneManager.c:21
float m_OrigFog
Определения UIPopupScriptSceneManager.c:37
UIPopupScript PopupOpen(int popup_id, Param param)
Определения UIPopupScript.c:46
void UpdateSliderStartDay(int month, int day)
Определения UIPopupScriptSceneManager.c:407
float m_OrigRain
Определения UIPopupScriptSceneManager.c:36
int m_OrigMinute
Определения UIPopupScriptSceneManager.c:34
void UIPopupScriptSceneRename(Widget wgt)
Определения UIPopupScriptSceneRename.c:10
SliderWidget m_SldWindForce
Определения UIPopupScriptSceneManager.c:27
override void OnClose()
Определения UIPopupScriptSceneManager.c:351
ButtonWidget m_BtnSceneNew
Определения UIPopupScriptSceneManager.c:4
void UIPopupScriptNotify(Widget wgt)
Определения UIPopupScriptNotify.c:9
TextWidget m_TxtWeatherTime
Определения UIPopupScriptSceneManager.c:15
SliderWidget m_SldRain
Определения UIPopupScriptSceneManager.c:23
TextWidget m_TxtRainValue
Определения UIPopupScriptSceneManager.c:24
SliderWidget m_SldFog
Определения UIPopupScriptSceneManager.c:25
void UpdateSliderFog()
Определения UIPopupScriptSceneManager.c:425
void UpdateSliderRain()
Определения UIPopupScriptSceneManager.c:419
TextWidget m_TxtStartDayValue
Определения UIPopupScriptSceneManager.c:20
ButtonWidget m_BtnSave
Определения UIPopupScriptInitScript.c:6
int m_CurrMinute
Определения UIPopupScriptSceneManager.c:44
TextWidget m_TxtOvercastValue
Определения UIPopupScriptSceneManager.c:22
ButtonWidget m_BtnSceneRename
Определения UIPopupScriptSceneManager.c:6
ButtonWidget m_BtnSceneLoad
Определения UIPopupScriptSceneManager.c:5
TextWidget m_TxtWindForceValue
Определения UIPopupScriptSceneManager.c:28
float m_CurrRain
Определения UIPopupScriptSceneManager.c:46
void UpdateSceneList()
Определения UIPopupScriptSceneManager.c:292
float m_CurrFog
Определения UIPopupScriptSceneManager.c:47
float m_OrigWindForce
Определения UIPopupScriptSceneManager.c:38
override bool OnChange(Widget w, int x, int y, bool finished)
Определения UIPopupScriptSceneManager.c:205
SliderWidget m_SldStartDay
Определения UIPopupScriptSceneManager.c:19
Определения UIPopupScript.c:2
proto native Fog GetFog()
Returns a fog phenomenon object.
proto native void SetWindSpeed(float speed)
Sets the actual wind speed in metre per second.
proto native float GetWindSpeed()
Returns actual wind speed in metre per second.
proto native float GetWindMaximumSpeed()
Returns maximal wind speed in metre per second.
proto native Rain GetRain()
Returns a rain phenomenon object.
proto native Overcast GetOvercast()
Returns an overcast phenomenon object.
Определения Weather.c:165
proto native void Set(float forecast, float time=0, float minDuration=0)
Sets the forecast.
proto native float GetActual()
Определения EnWidgets.c:190
proto native void SetDate(int year, int month, int day, int hour, int minute)
Sets actual ingame world time.
proto void GetDate(out int year, out int month, out int day, out int hour, out int minute)
Get actual ingame world time.
proto native CGame GetGame()
proto void Print(void var)
Prints content of variable to console/log.
array< string > TStringArray
Определения EnScript.c:685
const int CALL_CATEGORY_SYSTEM
Определения tools.c:8