-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUtageUguiSaveLoadItem.cs
114 lines (105 loc) · 3.19 KB
/
UtageUguiSaveLoadItem.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
112
113
using System;
using System.Runtime.CompilerServices;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
using Utage;
[AddComponentMenu("Utage/TemplateUI/SaveLoadItem"), RequireComponent(typeof(Button))]
public class UtageUguiSaveLoadItem : MonoBehaviour
{
public Texture2D autoSaveIcon;
private Button button;
public RawImage captureImage;
private AdvSaveData data;
public Text date;
private Color defaultColor;
private int index;
public Text no;
public Text text;
public string textEmpty = "Empty";
public void Init(AdvSaveData data, Action<UtageUguiSaveLoadItem> ButtonClickedEvent, int index, bool isSave)
{
<Init>c__AnonStorey0 storey = new <Init>c__AnonStorey0 {
ButtonClickedEvent = ButtonClickedEvent,
$this = this
};
this.data = data;
this.index = index;
this.button = base.GetComponent<Button>();
this.button.get_onClick().AddListener(new UnityAction(storey, (IntPtr) this.<>m__0));
this.Refresh(isSave);
}
private void OnDestroy()
{
if ((this.captureImage != null) && (this.captureImage.get_texture() != null))
{
this.captureImage.set_texture(null);
}
}
public void Refresh(bool isSave)
{
this.no.set_text(string.Format("No.{0,3}", this.index));
if (this.data.IsSaved)
{
if ((this.data.Type == AdvSaveData.SaveDataType.Auto) || (this.data.Texture == null))
{
if ((this.data.Type == AdvSaveData.SaveDataType.Auto) && (this.autoSaveIcon != null))
{
this.captureImage.set_texture(this.autoSaveIcon);
this.captureImage.set_color(Color.get_white());
}
else
{
this.captureImage.set_texture(null);
this.captureImage.set_color(Color.get_black());
}
}
else
{
this.captureImage.set_texture(this.data.Texture);
this.captureImage.set_color(Color.get_white());
}
this.text.set_text(this.data.Title);
this.date.set_text(UtageToolKit.DateToStringJp(this.data.Date));
this.button.set_interactable(true);
}
else
{
this.text.set_text(this.textEmpty);
this.date.set_text(string.Empty);
this.button.set_interactable(isSave);
}
if (this.data.Type == AdvSaveData.SaveDataType.Auto)
{
this.no.set_text("Auto");
if (isSave)
{
this.button.set_interactable(false);
}
}
}
public AdvSaveData Data
{
get
{
return this.data;
}
}
public int Index
{
get
{
return this.index;
}
}
[CompilerGenerated]
private sealed class <Init>c__AnonStorey0
{
internal UtageUguiSaveLoadItem $this;
internal Action<UtageUguiSaveLoadItem> ButtonClickedEvent;
internal void <>m__0()
{
this.ButtonClickedEvent(this.$this);
}
}
}