DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
UIPopupScriptSceneSettings.c
См. документацию.
1class UIPopupScriptSceneSettings extends UIPopupScript
2{
3 private static const int m_DaysInMonth[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
4
5 private ButtonWidget m_BtnSave;
6 private ButtonWidget m_BtnCancel;
7
8 private TextWidget m_TxtWeatherTime;
9
10 private SliderWidget m_SldStartTime;
11 private TextWidget m_TxtStartTimeValue;
12 private SliderWidget m_SldStartDay;
13 private TextWidget m_TxtStartDayValue;
14 private SliderWidget m_SldOvercast;
15 private TextWidget m_TxtOvercastValue;
16 private SliderWidget m_SldRain;
17 private TextWidget m_TxtRainValue;
18 private SliderWidget m_SldFog;
19 private TextWidget m_TxtFogValue;
20 private SliderWidget m_SldWindForce;
21 private TextWidget m_TxtWindForceValue;
22
23 private int m_OrigYear;
24 private int m_OrigMonth;
25 private int m_OrigDay;
26 private int m_OrigHour;
27 private int m_OrigMinute;
28 private float m_OrigOvercast;
29 private float m_OrigRain;
30 private float m_OrigFog;
31 private float m_OrigWindForce;
32
33 private int m_CurrYear;
34 private int m_CurrMonth;
35 private int m_CurrDay;
36 private int m_CurrHour;
37 private int m_CurrMinute;
38 private float m_CurrOvercast;
39 private float m_CurrRain;
40 private float m_CurrFog;
41 private float m_CurrWindForce;
42
43 //================================================
44 // UIPopupScriptSceneSettings
45 //================================================
47 {
48 m_BtnSave = ButtonWidget.Cast( wgt.FindAnyWidget("btn_ppp_st_save") );
49 m_BtnCancel = ButtonWidget.Cast( wgt.FindAnyWidget("btn_ppp_st_cancel") );
50
51 m_TxtWeatherTime = TextWidget.Cast( wgt.FindAnyWidget("txt_ppp_st_w_time_value") );
52
53 m_SldStartTime = SliderWidget.Cast( wgt.FindAnyWidget("sld_ppp_st_start_time") );
54 m_TxtStartTimeValue = TextWidget.Cast( wgt.FindAnyWidget("txt_ppp_st_start_time_value") );
55
56 m_SldStartDay = SliderWidget.Cast( wgt.FindAnyWidget("sld_ppp_st_start_day") );
57 m_TxtStartDayValue = TextWidget.Cast( wgt.FindAnyWidget("txt_ppp_st_start_day_value") );
58
59 m_SldOvercast = SliderWidget.Cast( wgt.FindAnyWidget("sld_ppp_st_overcast") );
60 m_TxtOvercastValue = TextWidget.Cast( wgt.FindAnyWidget("txt_ppp_st_overcast_value") );
61
62 m_SldRain = SliderWidget.Cast( wgt.FindAnyWidget("sld_ppp_st_rain") );
63 m_TxtRainValue = TextWidget.Cast( wgt.FindAnyWidget("txt_ppp_st_rain_value") );
64
65 m_SldFog = SliderWidget.Cast( wgt.FindAnyWidget("sld_ppp_st_fog") );
66 m_TxtFogValue = TextWidget.Cast( wgt.FindAnyWidget("txt_ppp_st_fog_value") );
67
68 m_SldWindForce = SliderWidget.Cast( wgt.FindAnyWidget("sld_ppp_st_wind_force") );
69 m_TxtWindForceValue = TextWidget.Cast( wgt.FindAnyWidget("txt_ppp_st_wind_force_value") );
70 }
71
76 //================================================
77 // OnClick
78 //================================================
79 override bool OnClick(Widget w, int x, int y, int button)
80 {
81 super.OnClick(w, x, y, button);
82
83 if ( w == m_BtnSave )
84 {
94
95 PluginSceneManager editor = PluginSceneManager.Cast( GetPlugin(PluginSceneManager) );
98
99 PopupBack();
100
101 return true;
102 }
103 else if ( w == m_BtnCancel )
104 {
105
106 PopupBack();
107
108 return true;
109 }
110
111 return false;
112 }
113
114
115 override bool OnChange(Widget w, int x, int y, bool finished)
116 {
117 if ( w == m_SldStartTime )
118 {
119 float slider_value_start_time = m_SldStartTime.GetCurrent() * 0.01;
120 float start_time_f = slider_value_start_time * 1439;
121 int start_time = start_time_f;
122 m_CurrHour = start_time / 60;
123 m_CurrMinute = start_time % 60;
124
126
128
129 return true;
130 }
131 else if ( w == m_SldStartDay )
132 {
133 float slider_value_start_day = m_SldStartDay.GetCurrent();
134 float start_day_f = slider_value_start_day * 3.64 + 1;
135 int start_day = start_day_f;
136
137 for ( int i = 0; i < 12; i++ )
138 {
139 int days = m_DaysInMonth[i];
140 if ( start_day <= days )
141 {
142 m_CurrMonth = i+1;
143 m_CurrDay = start_day;
144 break;
145 }
146 else
147 {
148 start_day -= days;
149 }
150 }
151
153
155
156 return true;
157 }
158 else if ( w == m_SldOvercast )
159 {
161
162 m_CurrOvercast = m_SldOvercast.GetCurrent() * 0.01;
164
165 return true;
166 }
167 else if ( w == m_SldRain )
168 {
170
171 m_CurrRain = m_SldRain.GetCurrent() * 0.01;
172 GetGame().GetWeather().GetRain().Set( m_CurrRain, 0, 1000 );
173
174 return true;
175 }
176 else if ( w == m_SldFog )
177 {
179
180 m_CurrFog = m_SldFog.GetCurrent() * 0.01;
181 GetGame().GetWeather().GetFog().Set( m_CurrFog, 0, 1000 );
182
183 return true;
184 }
185 else if ( w == m_SldWindForce )
186 {
188
189 m_CurrWindForce = m_SldWindForce.GetCurrent() * 0.01;
190 //GetGame().GetWeather().SetWindSpeed( m_CurrWindForce );
191
192 return true;
193 }
194
195 return false;
196 }
197
198 //================================================
199 // OnOpen
200 //================================================
229
230 //================================================
231 // OnClose
232 //================================================
233 override void OnClose()
234 {
235 Weather weather = GetGame().GetWeather();
236
238 weather.GetOvercast().Set( m_OrigOvercast, 0, 1000 );
239 weather.GetRain().Set( m_OrigRain, 0, 1000 );
240 weather.GetFog().Set( m_OrigFog, 0, 1000 );
241 //weather.SetWindSpeed( m_OrigWindForce );
242 }
243
244 //================================================
245 // OnUpdate
246 //================================================
247 void OnUpdate()
248 {
249 m_TxtWeatherTime.SetText(GetGame().GetWeather().GetTime().ToString());
250 }
251
252 //================================================
253 // ResetSliders
254 //================================================
256 {
257 int year, month, day, hour, minute;
258 GetGame().GetWorld().GetDate( year, month, day, hour, minute );
259 m_SldStartTime.SetCurrent( ((hour * 60) + minute) / 14.39 );
260 UpdateSliderStartTime( hour, minute );
261
262 float start_day = day;
263 int month_tmp = month;
264 while ( month_tmp > 1 )
265 {
266 month_tmp--;
267 start_day += m_DaysInMonth[month];
268 }
269 m_SldStartDay.SetCurrent( start_day / 3.64 );
270 UpdateSliderStartDay( month, day );
271
272 Weather weather = GetGame().GetWeather();
273
274 m_SldOvercast.SetCurrent(weather.GetOvercast().GetActual() * 100);
276
277 m_SldRain.SetCurrent(weather.GetRain().GetActual() * 100);
279
280 m_SldFog.SetCurrent(weather.GetFog().GetActual() * 100);
282
283 float slider_wind_value = ( weather.GetWindSpeed() / weather.GetWindMaximumSpeed() ) * 100;
284 m_SldWindForce.SetCurrent( slider_wind_value );
286 }
287
288 void UpdateSliderStartTime( int hour, int minute )
289 {
290 string label_text = hour.ToStringLen(2) + ":" + minute.ToStringLen(2);
291 m_TxtStartTimeValue.SetText( label_text );
292 }
293
294 void UpdateSliderStartDay( int month, int day )
295 {
296 string label_text = day.ToString() + "." + month.ToString() + ". " + m_CurrYear.ToString();
297 m_TxtStartDayValue.SetText( label_text );
298 }
299
301 {
302 string label_text = m_SldOvercast.GetCurrent().ToString()+"%";
303 m_TxtOvercastValue.SetText( label_text );
304 }
305
307 {
308 string label_text = m_SldRain.GetCurrent().ToString()+"%";
309 m_TxtRainValue.SetText( label_text );
310 }
311
313 {
314 string label_text = m_SldFog.GetCurrent().ToString()+"%";
315 m_TxtFogValue.SetText( label_text );
316 }
317
319 {
320 string label_text = m_SldWindForce.GetCurrent().ToString()+"%";
321 m_TxtWindForceValue.SetText( label_text );
322 }
323}
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
int m_OrigYear
Определения UIPopupScriptSceneManager.c:30
int m_OrigMonth
Определения UIPopupScriptSceneManager.c:31
int m_CurrYear
Определения UIPopupScriptSceneManager.c:40
override bool OnClick(Widget w, int x, int y, int button)
Определения UIPopupScriptSceneSettings.c:79
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
TextWidget m_TxtFogValue
Определения UIPopupScriptSceneManager.c:26
void UpdateSliderStartTime(int hour, int minute)
Определения UIPopupScriptSceneManager.c:401
SliderWidget m_SldStartTime
Определения UIPopupScriptSceneManager.c:17
UIPopupScript PopupBack()
Определения UIPopupScript.c:37
static const int m_DaysInMonth[12]
Определения UIPopupScriptSceneManager.c:11
int m_CurrHour
Определения UIPopupScriptSceneManager.c:43
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)
Определения UIPopupScriptSceneSettings.c:201
int m_CurrMonth
Определения UIPopupScriptSceneManager.c:41
void ~UIPopupScriptSceneSettings()
Определения UIPopupScriptSceneSettings.c:72
int m_OrigHour
Определения UIPopupScriptSceneManager.c:33
float m_OrigOvercast
Определения UIPopupScriptSceneManager.c:35
SliderWidget m_SldOvercast
Определения UIPopupScriptSceneManager.c:21
float m_OrigFog
Определения UIPopupScriptSceneManager.c:37
void UpdateSliderStartDay(int month, int day)
Определения UIPopupScriptSceneManager.c:407
float m_OrigRain
Определения UIPopupScriptSceneManager.c:36
int m_OrigMinute
Определения UIPopupScriptSceneManager.c:34
SliderWidget m_SldWindForce
Определения UIPopupScriptSceneManager.c:27
override void OnClose()
Определения UIPopupScriptSceneSettings.c:233
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
void UIPopupScriptSceneSettings(Widget wgt)
Определения UIPopupScriptSceneSettings.c:46
TextWidget m_TxtOvercastValue
Определения UIPopupScriptSceneManager.c:22
TextWidget m_TxtWindForceValue
Определения UIPopupScriptSceneManager.c:28
float m_CurrRain
Определения UIPopupScriptSceneManager.c:46
float m_CurrFog
Определения UIPopupScriptSceneManager.c:47
float m_OrigWindForce
Определения UIPopupScriptSceneManager.c:38
override bool OnChange(Widget w, int x, int y, bool finished)
Определения UIPopupScriptSceneSettings.c:115
SliderWidget m_SldStartDay
Определения UIPopupScriptSceneManager.c:19
Определения UIPopupScript.c:2
proto native Fog GetFog()
Returns a fog phenomenon object.
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.
const int CALL_CATEGORY_SYSTEM
Определения tools.c:8