Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
LayerHoard.cs
Go to the documentation of this file.
1using System.Linq;
2using UnityEngine;
3using UnityEngine.UI;
4
5public class LayerHoard : ELayer
6{
8
9 public bool autoList;
10
11 public int autoNum;
12
13 public float idleTimer;
14
15 public float fadeSpeed;
16
17 public CanvasGroup cg;
18
20
22
24
26
27 public LayoutGroup layoutMenu;
28
29 private int lastScore;
30
31 public int v;
32
33 private Vector3 lastMousePos;
34
35 private bool hasMouseMoved;
36
38
39 public override void OnAfterInit()
40 {
42 Msg.TalkHomeMemeber("layerHoard");
44 actor = Util.Instantiate(actor);
45 if (hoard.items.Count == 0)
46 {
48 }
49 else
50 {
51 Reset();
52 }
53 InvokeRepeating("UpdateMousePos", 0f, 0.1f);
55 {
56 UIButton[] array = debugButtons;
57 for (int i = 0; i < array.Length; i++)
58 {
59 array[i].SetActive(enable: false);
60 }
61 }
62 layoutMenu.RebuildLayout(recursive: true);
63 SoundManager.disableSpread = true;
64 ELayer.Sound.zone.enabled = false;
65 ELayer.scene.cam.enabled = false;
66 }
67
68 public void Reset()
69 {
71 textMode.text = "[" + ("h_" + hoard.mode).lang() + "]";
72 }
73
74 public override void OnKill()
75 {
76 actor.Clear();
77 Object.DestroyImmediate(actor.gameObject);
79 ELayer.ui.cg.alpha = 1f;
80 ELayer.Sound.maxSounds = ELayer.Sound._maxSounds;
81 SoundManager.disableSpread = false;
82 ELayer.Sound.zone.enabled = true;
83 ELayer.scene.cam.enabled = true;
84 }
85
86 private void Update()
87 {
88 if (textScore.gameObject.activeSelf && hoard.score != lastScore)
89 {
90 textScore.text = hoard.score + " / " + hoard.hiScore;
92 }
93 if (Input.GetMouseButtonDown(2))
94 {
95 Reset();
96 }
98 {
99 if (Input.GetKeyDown(KeyCode.H))
100 {
101 hoard.hentai = true;
102 hoard.Add("lulu", 2);
103 hoard.Add("tentacle", 1);
104 hoard.Add("tentacle2", 1);
105 hoard.Add("tentacle3", 1);
106 hoard.Add("tentacle4", 2);
107 Msg.SayPic("UN_farris", "変態だー!");
108 Reset();
109 }
110 if (Input.GetKeyDown(KeyCode.M))
111 {
112 try
113 {
114 CollectibleActor collectibleActor = actor.actors.FirstOrDefault((CollectibleActor a) => a.item.id == "mani");
115 if ((bool)collectibleActor && collectibleActor.gameObject.activeInHierarchy)
116 {
117 Msg.Nerun("あ・・・");
118 RigidExplode rigidExplode = collectibleActor.gameObject.AddComponent<RigidExplode>();
119 rigidExplode.particle = actor.psExplode;
120 rigidExplode.radius *= 10f;
121 rigidExplode.force *= 10f;
122 rigidExplode.chance = 1f;
123 rigidExplode.intervalMin = (rigidExplode.intervalMax = 2f);
124 rigidExplode.rb = collectibleActor.GetComponent<Rigidbody2D>();
125 actor.updates.Add(rigidExplode);
126 }
127 }
128 catch
129 {
130 }
131 }
132 }
133 UIButton componentOf = InputModuleEX.GetComponentOf<UIButton>();
134 if (ELayer.ui.GetTopLayer() != this || ((bool)componentOf && componentOf.transform.IsChildOf(base.transform)) || hasMouseMoved)
135 {
136 idleTimer = 0f;
137 v = 1;
138 }
139 else
140 {
141 idleTimer += Time.deltaTime;
142 if (idleTimer > 1f)
143 {
144 v = -1;
145 }
146 }
147 (cg ?? ELayer.ui.cg).alpha += (float)v * Time.deltaTime * fadeSpeed;
148 ELayer.Sound.maxSounds = hoard.maxSounds;
149 }
150
151 private void UpdateMousePos()
152 {
153 hasMouseMoved = (Input.mousePosition - lastMousePos).magnitude > 15f;
154 lastMousePos = Input.mousePosition;
155 }
156
157 public void AddRandom()
158 {
159 foreach (SourceCollectible.Row row in ELayer.sources.collectibles.rows)
160 {
161 if (!row.tag.Contains("noSpawn"))
162 {
163 int num = ((row.num == 0) ? 10 : row.num);
164 hoard.Add(row.id, ELayer.rnd(ELayer.rnd(ELayer.rnd(ELayer.rnd(num + 1) + 1) + 1) + 1));
165 }
166 }
167 Reset();
168 }
169
170 public void Generate()
171 {
172 hoard.Clear();
173 foreach (SourceCollectible.Row row in ELayer.sources.collectibles.rows)
174 {
175 if (!row.tag.Contains("noSpawn"))
176 {
177 hoard.Add(row.id);
178 }
179 }
180 hoard.mode = Hoard.Mode.lux;
181 Reset();
182 }
183
184 public void OnClickClear()
185 {
186 hoard.Clear();
187 hoard.Add("gold", 1);
188 Reset();
189 }
190
191 public void OnClickNextMode()
192 {
193 hoard.mode = hoard.mode.NextEnum();
194 Msg.Nerun("h_filter".lang(("h_" + hoard.mode).lang()));
195 Reset();
196 }
197
198 public void OnClickConfig()
199 {
200 UIContextMenu uIContextMenu = ELayer.ui.contextMenu.Create("ContextHoard");
201 int max = actor.bgs.Length - 1;
202 uIContextMenu.AddSlider("room", (float n) => n + " / " + max, hoard.bg, delegate(float v)
203 {
204 hoard.bg = (int)v;
206 }, 0f, max, isInt: true, hideOther: false);
207 uIContextMenu.AddSlider("reflection", (float n) => n + " %", hoard.reflection, delegate(float v)
208 {
209 hoard.reflection = (int)v;
211 }, 0f, 300f, isInt: true, hideOther: false);
212 uIContextMenu.AddSlider("maxSounds", (float n) => n.ToString() ?? "", hoard.maxSounds, delegate(float v)
213 {
214 hoard.maxSounds = (int)v;
215 }, 0f, 64f, isInt: true, hideOther: false);
216 uIContextMenu.AddSlider("volume", (float n) => n.ToString() ?? "", hoard.volume, delegate(float v)
217 {
218 hoard.volume = (int)v;
219 }, 0f, 200f, isInt: true, hideOther: false);
220 uIContextMenu.AddToggle("voice", hoard.voice, delegate(bool on)
221 {
222 hoard.voice = on;
223 });
224 uIContextMenu.AddToggle("shadow", hoard.shadow, delegate(bool on)
225 {
226 hoard.shadow = on;
227 });
228 uIContextMenu.AddToggle("pixelPerfect", hoard.pixelPerfect, delegate(bool on)
229 {
230 hoard.pixelPerfect = on;
232 });
233 uIContextMenu.Show();
234 }
235}
static ActionMode DefaultMode
Definition: ActionMode.cs:7
void Activate(bool toggle=true, bool forceActivate=false)
Definition: ActionMode.cs:339
static AM_NoMap NoMap
Definition: ActionMode.cs:25
bool enable
Definition: CoreDebug.cs:285
bool debugHoard
Definition: CoreDebug.cs:155
Definition: ELayer.cs:4
static Player player
Definition: ELayer.cs:13
static SourceManager sources
Definition: ELayer.cs:37
static int rnd(int a)
Definition: ELayer.cs:49
static CoreDebug debug
Definition: ELayer.cs:43
static UI ui
Definition: ELayer.cs:21
static SoundManager Sound
Definition: ELayer.cs:41
List< CollectibleActor > actors
Definition: HoardActor.cs:34
List< RigidUpdate > updates
Definition: HoardActor.cs:36
void RefreshBG()
Definition: HoardActor.cs:442
void Clear()
Definition: HoardActor.cs:451
void Activate()
Definition: HoardActor.cs:82
void RefreshZoom()
Definition: HoardActor.cs:405
ParticleSystem psExplode
Definition: HoardActor.cs:50
Definition: Hoard.cs:8
int reflection
Definition: Hoard.cs:118
bool shadow
Definition: Hoard.cs:132
Mode mode
Definition: Hoard.cs:112
Item Add(string id)
Definition: Hoard.cs:161
int score
Definition: Hoard.cs:130
bool voice
Definition: Hoard.cs:134
int maxSounds
Definition: Hoard.cs:121
void Clear()
Definition: Hoard.cs:226
int bg
Definition: Hoard.cs:115
Dictionary< string, Item > items
Definition: Hoard.cs:106
bool pixelPerfect
Definition: Hoard.cs:136
int hiScore
Definition: Hoard.cs:127
int volume
Definition: Hoard.cs:124
Mode
Definition: Hoard.cs:10
void Reset()
Definition: LayerHoard.cs:68
float fadeSpeed
Definition: LayerHoard.cs:15
bool autoList
Definition: LayerHoard.cs:9
int lastScore
Definition: LayerHoard.cs:29
void AddRandom()
Definition: LayerHoard.cs:157
CanvasGroup cg
Definition: LayerHoard.cs:17
UIText textTime
Definition: LayerHoard.cs:23
Hoard hoard
Definition: LayerHoard.cs:37
Vector3 lastMousePos
Definition: LayerHoard.cs:33
UIButton[] debugButtons
Definition: LayerHoard.cs:25
void Update()
Definition: LayerHoard.cs:86
void Generate()
Definition: LayerHoard.cs:170
float idleTimer
Definition: LayerHoard.cs:13
int autoNum
Definition: LayerHoard.cs:11
override void OnAfterInit()
Definition: LayerHoard.cs:39
override void OnKill()
Definition: LayerHoard.cs:74
void OnClickNextMode()
Definition: LayerHoard.cs:191
void OnClickClear()
Definition: LayerHoard.cs:184
UIText textMode
Definition: LayerHoard.cs:19
LayoutGroup layoutMenu
Definition: LayerHoard.cs:27
bool hasMouseMoved
Definition: LayerHoard.cs:35
void OnClickConfig()
Definition: LayerHoard.cs:198
HoardActor actor
Definition: LayerHoard.cs:7
void UpdateMousePos()
Definition: LayerHoard.cs:151
UIText textScore
Definition: LayerHoard.cs:21
Definition: Msg.cs:5
static PopItem TalkHomeMemeber(string id)
Definition: Msg.cs:219
static void SayPic(Card c, string lang)
Definition: Msg.cs:171
static void Nerun(string lang, string idPortrait="UN_nerun")
Definition: Msg.cs:145
Hoard hoard
Definition: Player.cs:892
SourceCollectible collectibles
UIContextMenuItem AddToggle(string idLang="", bool isOn=false, UnityAction< bool > action=null)
void Show(UIItem i)
UIContextMenuItem AddSlider(string text, Func< float, string > textFunc, float value, Action< float > action, float min=0f, float max=1f, bool isInt=false, bool hideOther=true, bool useInput=false)
Definition: UIText.cs:6