Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
Date Class Reference
Inheritance diagram for Date:
EClass GameDate VirtualDate

Public Types

enum  TextFormat {
  Default , Log , Widget , Schedule ,
  Travel , YearMonthDay , LogPlusYear
}
 

Public Member Functions

Date Copy ()
 
override string ToString ()
 
void AddHour (int a)
 
void AddDay (int a)
 
void AddMonth (int a)
 
string GetText (TextFormat format)
 
int GetRawReal (int offsetHours=0)
 
int GetRaw (int offsetHours=0)
 
int GetRawDay ()
 
bool IsExpired (int time)
 
int GetRemainingHours (int rawDeadLine)
 
int GetRemainingSecs (int rawDeadLine)
 
int GetElapsedMins (int rawDate)
 
int GetElapsedHour (int rawDate)
 

Static Public Member Functions

static string GetText (int raw, TextFormat format)
 
static string GetText (int hour)
 
static string GetText2 (int hour)
 
static string SecToDate (int sec)
 
static string MinToDayAndHour (int min)
 
static int[] GetDateArray (int raw)
 
static Date ToDate (int raw)
 
- Static Public Member Functions inherited from EClass
static int rnd (int a)
 
static int curve (int a, int start, int step, int rate=75)
 
static int rndHalf (int a)
 
static float rndf (float a)
 
static int rndSqrt (int a)
 
static void Wait (float a, Card c)
 
static void Wait (float a, Point p)
 
static int Bigger (int a, int b)
 
static int Smaller (int a, int b)
 

Public Attributes

int[] raw = new int[6]
 

Static Public Attributes

const int ShippingHour = 5
 
const int HourToken = 60
 
const int DayToken = 1440
 
const int MonthToken = 43200
 
const int YearToken = 518400
 
const int HourTokenReal = 60
 
const int DayTokenReal = 1440
 
const int MonthTokenReal = 46080
 
const int YearTokenReal = 552960
 
- Static Public Attributes inherited from EClass
static Core core
 

Properties

int year [get, set]
 
int month [get, set]
 
int day [get, set]
 
int hour [get, set]
 
int min [get, set]
 
int sec [get, set]
 
bool IsDay [get]
 
bool IsNight [get]
 
PeriodOfDay periodOfDay [get]
 
string NameMonth [get]
 
string NameMonthShort [get]
 
string NameTime [get]
 
bool IsSpring [get]
 
bool IsSummer [get]
 
bool IsAutumn [get]
 
bool IsWinter [get]
 
- Properties inherited from EClass
static Game game [get]
 
static bool AdvMode [get]
 
static Player player [get]
 
static Chara pc [get]
 
static UI ui [get]
 
static Map _map [get]
 
static Zone _zone [get]
 
static FactionBranch Branch [get]
 
static FactionBranch BranchOrHomeBranch [get]
 
static Faction Home [get]
 
static Faction Wilds [get]
 
static Scene scene [get]
 
static BaseGameScreen screen [get]
 
static GameSetting setting [get]
 
static GameData gamedata [get]
 
static ColorProfile Colors [get]
 
static World world [get]
 
static SourceManager sources [get]
 
static SourceManager editorSources [get]
 
static SoundManager Sound [get]
 
static CoreDebug debug [get]
 

Detailed Description

Definition at line 3 of file Date.cs.

Member Enumeration Documentation

◆ TextFormat

Enumerator
Default 
Log 
Widget 
Schedule 
Travel 
YearMonthDay 
LogPlusYear 

Definition at line 5 of file Date.cs.

Member Function Documentation

◆ AddDay()

void Date.AddDay ( int  a)
inline

Definition at line 225 of file Date.cs.

226 {
227 day += a;
228 while (day > 30)
229 {
230 day -= 30;
231 AddMonth(1);
232 }
233 }
void AddMonth(int a)
Definition: Date.cs:235
int day
Definition: Date.cs:62

References AddMonth(), and day.

Referenced by AddHour().

◆ AddHour()

void Date.AddHour ( int  a)
inline

Definition at line 215 of file Date.cs.

216 {
217 hour += a;
218 while (hour >= 24)
219 {
220 hour -= 24;
221 AddDay(1);
222 }
223 }
int hour
Definition: Date.cs:74
void AddDay(int a)
Definition: Date.cs:225

References AddDay(), and hour.

Referenced by Weather.GetForecast(), Weather.GetWeatherForecast(), and Weather.RefreshForecasts().

◆ AddMonth()

void Date.AddMonth ( int  a)
inline

Definition at line 235 of file Date.cs.

236 {
237 month += a;
238 while (month > 12)
239 {
240 month -= 12;
241 year++;
242 }
243 }
int month
Definition: Date.cs:50
int year
Definition: Date.cs:38

References month, and year.

Referenced by AddDay(), and FortuneRollData.Refresh().

◆ Copy()

Date Date.Copy ( )
inline

Definition at line 197 of file Date.cs.

198 {
199 return new Date
200 {
201 year = year,
202 month = month,
203 day = day,
204 hour = hour,
205 min = min,
206 sec = sec
207 };
208 }
Definition: Date.cs:4
int min
Definition: Date.cs:86
int sec
Definition: Date.cs:98

References day, hour, min, month, sec, and year.

Referenced by GameIndex.Create(), Weather.GetWeatherForecast(), FortuneRollData.Refresh(), and Weather.RefreshForecasts().

◆ GetDateArray()

static int[] Date.GetDateArray ( int  raw)
inlinestatic

Definition at line 381 of file Date.cs.

382 {
383 return new int[5]
384 {
385 raw % 60,
386 raw / 60 % 24,
387 raw / 60 / 24 % 30,
388 raw / 60 / 24 / 30 % 12,
389 raw / 60 / 24 / 30 / 12
390 };
391 }
int[] raw
Definition: Date.cs:19

References raw.

Referenced by ToDate().

◆ GetElapsedHour()

int Date.GetElapsedHour ( int  rawDate)
inline

Definition at line 352 of file Date.cs.

353 {
354 if (rawDate != 0)
355 {
356 return (GetRaw() - rawDate) / 60;
357 }
358 return 0;
359 }
int GetRaw(int offsetHours=0)
Definition: Date.cs:322

References GetRaw().

Referenced by Player.MoveZone().

◆ GetElapsedMins()

int Date.GetElapsedMins ( int  rawDate)
inline

Definition at line 347 of file Date.cs.

348 {
349 return GetRaw() - rawDate;
350 }

References GetRaw().

Referenced by Weather.GetTimeSinceLastRain().

◆ GetRaw()

◆ GetRawDay()

int Date.GetRawDay ( )
inline

Definition at line 327 of file Date.cs.

328 {
329 return day * 1440 + month * 43200 + year * 518400;
330 }

References day, month, and year.

Referenced by Card.DamageHP().

◆ GetRawReal()

int Date.GetRawReal ( int  offsetHours = 0)
inline

Definition at line 317 of file Date.cs.

318 {
319 return min + (hour + offsetHours) * 60 + day * 1440 + month * 46080 + year * 552960;
320 }

References day, hour, min, month, and year.

Referenced by GameIO.GetGameList().

◆ GetRemainingHours()

int Date.GetRemainingHours ( int  rawDeadLine)
inline

Definition at line 337 of file Date.cs.

338 {
339 return (rawDeadLine - GetRaw()) / 60;
340 }

References GetRaw().

Referenced by TraitGeneMachine.GetProgress(), TraitGeneMachine.GetProgressText(), Trait.GetTextRestock(), BaseListPeople.OnClick(), LayerTravel.Refresh(), and Zone.ToString().

◆ GetRemainingSecs()

int Date.GetRemainingSecs ( int  rawDeadLine)
inline

Definition at line 342 of file Date.cs.

343 {
344 return rawDeadLine - GetRaw();
345 }

References GetRaw().

◆ GetText() [1/3]

static string Date.GetText ( int  hour)
inlinestatic

Definition at line 291 of file Date.cs.

292 {
293 if (hour < 0)
294 {
295 return "dateDayVoid".lang();
296 }
297 if (hour > 24)
298 {
299 return "dateDay".lang((hour / 24).ToString() ?? "");
300 }
301 return "dateHour".lang(hour.ToString() ?? "");
302 }
override string ToString()
Definition: Date.cs:210

References hour, and ToString().

◆ GetText() [2/3]

static string Date.GetText ( int  raw,
TextFormat  format 
)
inlinestatic

Definition at line 286 of file Date.cs.

287 {
288 return ToDate(raw).GetText(format);
289 }
static Date ToDate(int raw)
Definition: Date.cs:393
string GetText(TextFormat format)
Definition: Date.cs:245

References GetText(), raw, and ToDate().

◆ GetText() [3/3]

string Date.GetText ( TextFormat  format)
inline

Definition at line 245 of file Date.cs.

246 {
247 switch (format)
248 {
249 case TextFormat.LogPlusYear:
250 return year + ", " + month + "/" + day + " " + ((hour < 10) ? "0" : "") + hour + ":" + ((min < 10) ? "0" : "") + min;
251 case TextFormat.Log:
252 return month + "/" + day + " " + hour + ":" + min;
253 case TextFormat.Widget:
254 return "dateYearMonthDay".lang(year.ToString() ?? "", month.ToString() ?? "", day.ToString() ?? "");
255 case TextFormat.Schedule:
256 return "dateSchedule".lang(NameMonth, day.ToString() ?? "");
257 case TextFormat.Travel:
258 {
259 string text = "_short";
260 if (format == TextFormat.Travel)
261 {
262 return "travelDate".lang(year.ToString() ?? "", month.ToString() ?? "", day.ToString() ?? "");
263 }
264 string text2 = "";
265 if (day != 0)
266 {
267 text2 = text2 + day + Lang.Get("wDay" + text);
268 }
269 if (hour != 0)
270 {
271 text2 = text2 + hour + Lang.Get("wHour" + text);
272 }
273 if (min != 0)
274 {
275 text2 = text2 + min + Lang.Get("wMin" + text);
276 }
277 return text2 + sec + Lang.Get("wSec" + text);
278 }
279 case TextFormat.YearMonthDay:
280 return "dateYearMonthDay".lang(year.ToString() ?? "", month.ToString() ?? "", day.ToString() ?? "");
281 default:
282 return "Day " + day + " " + hour + ":" + min;
283 }
284 }
string NameMonth
Definition: Date.cs:143
TextFormat
Definition: Date.cs:6
Definition: Lang.cs:6
static string Get(string id)
Definition: Lang.cs:91

References day, Lang.Get(), hour, min, month, NameMonth, sec, and year.

Referenced by WidgetDate._Refresh(), GetText(), Trait.GetTextRestock(), Player.MoveZone(), BaseListPeople.OnClick(), UIHomeInfo.RefreshInfo(), ItemQuest.SetQuest(), and ToString().

◆ GetText2()

static string Date.GetText2 ( int  hour)
inlinestatic

Definition at line 304 of file Date.cs.

305 {
306 if (hour < 0)
307 {
308 return "-";
309 }
310 if (hour > 24)
311 {
312 return hour / 24 + "d";
313 }
314 return hour + "h";
315 }

References hour.

Referenced by LayerTravel.Refresh().

◆ IsExpired()

◆ MinToDayAndHour()

static string Date.MinToDayAndHour ( int  min)
inlinestatic

Definition at line 366 of file Date.cs.

367 {
368 int num = min / 60;
369 int num2 = num / 24;
370 if (num == 0)
371 {
372 return min + "分";
373 }
374 if (num2 != 0)
375 {
376 return num2 + "日と" + num % 24 + "時間";
377 }
378 return num + "時間";
379 }

References min.

◆ SecToDate()

static string Date.SecToDate ( int  sec)
inlinestatic

Definition at line 361 of file Date.cs.

362 {
363 return sec / 60 / 60 + "時間 " + sec / 60 % 60 + "分 " + sec % 60 + "秒";
364 }

References sec.

◆ ToDate()

static Date Date.ToDate ( int  raw)
inlinestatic

Definition at line 393 of file Date.cs.

394 {
395 int[] dateArray = GetDateArray(raw);
396 int num = dateArray[4];
397 int num2 = dateArray[3];
398 int num3 = dateArray[2];
399 if (num2 == 0)
400 {
401 num2 = 12;
402 num--;
403 }
404 if (num3 == 0)
405 {
406 num3 = 30;
407 num2--;
408 }
409 if (num2 == 0)
410 {
411 num2 = 12;
412 num--;
413 }
414 return new Date
415 {
416 min = dateArray[0],
417 hour = dateArray[1],
418 day = num3,
419 month = num2,
420 year = num
421 };
422 }
static int[] GetDateArray(int raw)
Definition: Date.cs:381

References day, GetDateArray(), hour, min, month, raw, and year.

Referenced by GetText(), and LayerShippingResult.Show().

◆ ToString()

override string Date.ToString ( )
inline

Definition at line 210 of file Date.cs.

211 {
212 return GetText(TextFormat.Log);
213 }

References GetText().

Referenced by GetText().

Member Data Documentation

◆ DayToken

const int Date.DayToken = 1440
static

Definition at line 23 of file Date.cs.

◆ DayTokenReal

const int Date.DayTokenReal = 1440
static

Definition at line 31 of file Date.cs.

◆ HourToken

const int Date.HourToken = 60
static

Definition at line 21 of file Date.cs.

◆ HourTokenReal

const int Date.HourTokenReal = 60
static

Definition at line 29 of file Date.cs.

◆ MonthToken

const int Date.MonthToken = 43200
static

Definition at line 25 of file Date.cs.

◆ MonthTokenReal

const int Date.MonthTokenReal = 46080
static

Definition at line 33 of file Date.cs.

◆ raw

int [] Date.raw = new int[6]

Definition at line 19 of file Date.cs.

Referenced by GetDateArray(), GetText(), ToDate(), and VirtualDate.VirtualDate().

◆ ShippingHour

const int Date.ShippingHour = 5
static

Definition at line 16 of file Date.cs.

◆ YearToken

const int Date.YearToken = 518400
static

Definition at line 27 of file Date.cs.

◆ YearTokenReal

const int Date.YearTokenReal = 552960
static

Definition at line 35 of file Date.cs.

Property Documentation

◆ day

int Date.day
getset

◆ hour

int Date.hour
getset

Definition at line 73 of file Date.cs.

74 {
75 get
76 {
77 return raw[3];
78 }
79 set
80 {
81 raw[3] = value;
82 }
83 }

Referenced by AddHour(), Chara.ChooseNewGoal(), Copy(), GetRaw(), GetRawReal(), GetText(), GetText2(), WidgetArtTool.OnActivate(), Region.OnAdvanceHour(), TraitDaggerGrave.OnUse(), Chara.TickWork(), ToDate(), and Trait.TryToggle().

◆ IsAutumn

bool Date.IsAutumn
get

Definition at line 173 of file Date.cs.

174 {
175 get
176 {
177 if (month >= 9)
178 {
179 return month <= 11;
180 }
181 return false;
182 }
183 }

◆ IsDay

bool Date.IsDay
get

Definition at line 109 of file Date.cs.

Referenced by GameUpdater.Update().

◆ IsNight

bool Date.IsNight
get

Definition at line 111 of file Date.cs.

112 {
113 get
114 {
115 if (hour < 19)
116 {
117 return hour <= 5;
118 }
119 return true;
120 }
121 }

Referenced by BaseTileMap.DrawTile(), Card.GetLightRadius(), BaseGameScreen.RefreshSky(), CoreConfig.RefreshUIBrightness(), BaseGameScreen.RefreshWeather(), AI_Idle.Run(), and Zone.Simulate().

◆ IsSpring

bool Date.IsSpring
get

Definition at line 149 of file Date.cs.

150 {
151 get
152 {
153 if (month >= 3)
154 {
155 return month <= 5;
156 }
157 return false;
158 }
159 }

◆ IsSummer

bool Date.IsSummer
get

Definition at line 161 of file Date.cs.

162 {
163 get
164 {
165 if (month >= 6)
166 {
167 return month <= 8;
168 }
169 return false;
170 }
171 }

◆ IsWinter

bool Date.IsWinter
get

Definition at line 185 of file Date.cs.

186 {
187 get
188 {
189 if (month < 12)
190 {
191 return month <= 2;
192 }
193 return true;
194 }
195 }

Referenced by GrowSystem.CanGrow(), and Zone.GrowPlants().

◆ min

int Date.min
getset

Definition at line 85 of file Date.cs.

86 {
87 get
88 {
89 return raw[4];
90 }
91 set
92 {
93 raw[4] = value;
94 }
95 }

Referenced by Copy(), GetRaw(), GetRawReal(), GetText(), MinToDayAndHour(), ToDate(), and Scene.UpdateTimeRatio().

◆ month

int Date.month
getset

Definition at line 49 of file Date.cs.

50 {
51 get
52 {
53 return raw[1];
54 }
55 set
56 {
57 raw[1] = value;
58 }
59 }

Referenced by AddMonth(), Copy(), GetRaw(), GetRawDay(), GetRawReal(), GetText(), ContentHomeReport.RefreshInfo(), UIHomeInfo.RefreshInfo(), and ToDate().

◆ NameMonth

string Date.NameMonth
get

Definition at line 143 of file Date.cs.

Referenced by GetText().

◆ NameMonthShort

string Date.NameMonthShort
get

Definition at line 145 of file Date.cs.

◆ NameTime

string Date.NameTime
get

Definition at line 147 of file Date.cs.

◆ periodOfDay

PeriodOfDay Date.periodOfDay
get

Definition at line 123 of file Date.cs.

124 {
125 get
126 {
127 if (hour >= 5 && hour <= 6)
128 {
129 return PeriodOfDay.Dawn;
130 }
131 if (hour >= 7 && hour <= 17)
132 {
133 return PeriodOfDay.Day;
134 }
135 if (hour >= 18 && hour <= 19)
136 {
137 return PeriodOfDay.Dusk;
138 }
139 return PeriodOfDay.Night;
140 }
141 }
PeriodOfDay
Definition: PeriodOfDay.cs:2

Referenced by WidgetDate._Refresh(), and Card.GetLightRadius().

◆ sec

int Date.sec
getset

Definition at line 97 of file Date.cs.

98 {
99 get
100 {
101 return raw[5];
102 }
103 set
104 {
105 raw[5] = value;
106 }
107 }

Referenced by Copy(), GetText(), and SecToDate().

◆ year

int Date.year
getset

Definition at line 37 of file Date.cs.

38 {
39 get
40 {
41 return raw[0];
42 }
43 set
44 {
45 raw[0] = value;
46 }
47 }

Referenced by AddMonth(), Copy(), GetRaw(), GetRawDay(), GetRawReal(), GetText(), LayerNewspaper.OnInit(), ContentHomeReport.RefreshInfo(), UIHomeInfo.RefreshInfo(), LayerShippingResult.Show(), and ToDate().


The documentation for this class was generated from the following file: