-
Notifications
You must be signed in to change notification settings - Fork 0
/
DateManager.cs
112 lines (97 loc) · 2.73 KB
/
DateManager.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
using DG.Tweening;
using System;
using System.IO;
using UnityEngine;
using UnityEngine.UI;
using Utage;
public class DateManager : MonoBehaviour, IAdvSaveData, IBinaryIO
{
private bool active;
public CanvasGroup dateCanvas;
public Text Day;
public Text DayOfWeek;
public Text Month;
private void FormatDate(DateTime date)
{
string str = string.Empty;
switch (date.DayOfWeek)
{
case System.DayOfWeek.Sunday:
str = "周日";
break;
case System.DayOfWeek.Monday:
str = "周一";
break;
case System.DayOfWeek.Tuesday:
str = "周二";
break;
case System.DayOfWeek.Wednesday:
str = "周三";
break;
case System.DayOfWeek.Thursday:
str = "周四";
break;
case System.DayOfWeek.Friday:
str = "周五";
break;
case System.DayOfWeek.Saturday:
str = "周六";
break;
}
this.DayOfWeek.set_text(str);
this.Month.set_text(date.Month.ToString());
this.Day.set_text("/" + date.Day);
}
public void HideDate()
{
ShortcutExtensions46.DOFade(this.dateCanvas, 0f, 0.5f);
this.active = false;
}
public void OnClear()
{
this.dateCanvas.set_alpha(0f);
this.active = false;
}
public void OnRead(BinaryReader reader)
{
this.active = reader.ReadBoolean();
if (this.active)
{
AdvEngine component = GameObject.Find("AdvEngine").GetComponent<AdvEngine>();
this.ShowDate(component);
}
else
{
this.dateCanvas.set_alpha(0f);
}
}
public void OnWrite(BinaryWriter writer)
{
writer.Write(this.active);
}
public void ShowDate(AdvEngine engine)
{
DateTime time;
ShortcutExtensions46.DOFade(this.dateCanvas, 1f, 0.5f);
this.active = true;
int parameterInt = engine.Param.GetParameterInt("day");
if (parameterInt <= 11)
{
time = new DateTime(0x7dd, 5, 0x13).AddDays((double) parameterInt);
}
else
{
time = new DateTime(0x7dc, 5, 20).AddDays((double) parameterInt);
}
engine.Param.SetParameterBoolean("weekday", (time.DayOfWeek != System.DayOfWeek.Sunday) && (time.DayOfWeek != System.DayOfWeek.Saturday));
engine.Param.SetParameterInt("dayOfWeek", (int) time.DayOfWeek);
this.FormatDate(time);
}
public string SaveKey
{
get
{
return "DateManager";
}
}
}