Elin Modding Docs Doc
Loading...
Searching...
No Matches
LayerGacha.cs
1using System;
2using DG.Tweening;
3using UnityEngine;
4
5// Token: 0x02000547 RID: 1351
6public class LayerGacha : ELayer
7{
8 // Token: 0x060024BD RID: 9405 RVA: 0x000CF49B File Offset: 0x000CD69B
9 public override void OnAfterInit()
10 {
11 Msg.TalkHomeMemeber("layerGacha");
12 if (this.alt)
13 {
14 ActionMode.NoMap.Activate(true, false);
15 }
16 this.RefreshCoin();
17 base.InvokeRepeating("RandomAnime", 2f, 2f);
18 }
19
20 // Token: 0x060024BE RID: 9406 RVA: 0x000CF4D7 File Offset: 0x000CD6D7
21 private void RandomAnime()
22 {
23 this.randomAnimes.RandomItem<DOTweenAnimation>().DORestart();
24 }
25
26 // Token: 0x060024BF RID: 9407 RVA: 0x000CF4E9 File Offset: 0x000CD6E9
27 public void OnClickGoldGacha(int num)
28 {
29 this.PlayGacha(true, num);
30 }
31
32 // Token: 0x060024C0 RID: 9408 RVA: 0x000CF4F3 File Offset: 0x000CD6F3
33 public void OnClickSilverGacha(int num)
34 {
35 this.PlayGacha(false, num);
36 }
37
38 // Token: 0x060024C1 RID: 9409 RVA: 0x000CF500 File Offset: 0x000CD700
39 public void PlayGacha(bool gold, int num)
40 {
41 Thing thing = null;
42 if (ELayer.player.dailyGacha && !gold && num == 1)
43 {
44 ELayer.player.dailyGacha = false;
45 }
46 else
47 {
48 thing = ELayer.pc.things.Find("gacha_coin", gold ? "gold" : "silver");
49 if (thing == null || thing.Num < num)
50 {
51 SE.Beep();
52 return;
53 }
54 thing.ModNum(-num, true);
55 }
56 this.RefreshCoin();
57 Dialog d = Layer.Create("DialogGacha") as Dialog;
58 d.windows[0].setting.textCaption = "confirm".lang();
59 d.note.AddPrefab("Media/Graphics/Image/IllustGacha");
60 d.note.Space(0, 1);
61 bool lose = true;
62 for (int i = 0; i < num; i++)
63 {
64 int num2 = 1;
65 if (ELayer.rnd(6) == 0)
66 {
67 num2 = 2;
68 }
69 if (ELayer.rnd(30) == 0)
70 {
71 num2 = 3;
72 }
73 if (ELayer.rnd(100) == 0)
74 {
75 num2 = 4;
76 }
77 if (ELayer.rnd(1000) == 0)
78 {
79 num2 = 5;
80 }
81 if (gold)
82 {
83 num2++;
84 }
85 if (i == 9)
86 {
87 if (gold)
88 {
89 if (num2 < 4)
90 {
91 num2 = 4;
92 }
93 }
94 else if (num2 < 3)
95 {
96 num2 = 3;
97 }
98 }
99 if (num2 > 5)
100 {
101 num2 = 5;
102 }
103 Hoard.Item item = ELayer.player.hoard.AddRandom(num2, true);
104 int rarity = item.Source.rarity;
105 if (rarity == 4 || rarity == 5)
106 {
107 lose = false;
108 }
109 d.note.AddText(null, item.Name(1), ELayer.Colors.GetRarityColor(rarity, false));
110 }
111 d.note.Space(0, 1);
112 if (thing == null)
113 {
114 d.note.AddText("dailyGacha".lang() + " 1 > 0", FontColor.DontChange);
115 }
116 else
117 {
118 d.note.AddText(string.Concat(new string[]
119 {
120 thing.NameSimple,
121 " ",
122 (thing.Num + num).ToString(),
123 " > ",
124 thing.Num.ToString()
125 }), FontColor.DontChange);
126 }
127 d.note.Build();
128 d.windows[0].Find("GachaAnime", false).SetActive(true);
129 d.list.AddButton(null, Lang.Get("ok"), delegate
130 {
131 d.Close();
132 }, null);
133 ELayer.ui.AddLayer(d);
134 ELayer.Sound.Play("gacha");
135 TweenUtil.Delay(0.5f, delegate
136 {
137 ELayer.Sound.Play(lose ? "gacha_lose" : "gacha_win");
138 });
139 d.SetOnKill(delegate
140 {
141 if (!lose)
142 {
143 Msg.TalkHomeMemeber("ding_other");
144 }
145 });
146 }
147
148 // Token: 0x060024C2 RID: 9410 RVA: 0x000CF7E4 File Offset: 0x000CD9E4
149 public void RefreshCoin()
150 {
151 this.goFree.SetActive(ELayer.player.dailyGacha);
152 this.listCoin.Clear();
153 BaseList baseList = this.listCoin;
154 UIList.Callback<Thing, ButtonGrid> callback = new UIList.Callback<Thing, ButtonGrid>();
155 callback.onInstantiate = delegate(Thing a, ButtonGrid b)
156 {
157 b.SetCard(a, ButtonGrid.Mode.Default, null);
158 };
159 callback.onClick = delegate(Thing a, ButtonGrid b)
160 {
161 ELayer.ui.AddLayer<LayerInfo>().Set(a, false);
162 };
163 baseList.callbacks = callback;
164 this.listCoin.Refresh(false);
165 }
166
167 // Token: 0x060024C3 RID: 9411 RVA: 0x000CF877 File Offset: 0x000CDA77
168 public void OnClickBuyCoin()
169 {
170 SE.Beep();
171 }
172
173 // Token: 0x060024C4 RID: 9412 RVA: 0x000CF87E File Offset: 0x000CDA7E
174 public override void OnKill()
175 {
176 if (this.alt)
177 {
178 ActionMode.DefaultMode.Activate(true, false);
179 }
180 }
181
182 // Token: 0x04001439 RID: 5177
183 public static GameObject slot;
184
185 // Token: 0x0400143A RID: 5178
186 public GameObject goFree;
187
188 // Token: 0x0400143B RID: 5179
189 public Color colorC;
190
191 // Token: 0x0400143C RID: 5180
192 public Color colorR;
193
194 // Token: 0x0400143D RID: 5181
195 public Color colorSR;
196
197 // Token: 0x0400143E RID: 5182
198 public Color colorSSR;
199
200 // Token: 0x0400143F RID: 5183
201 public Color colorLE;
202
203 // Token: 0x04001440 RID: 5184
204 public DOTweenAnimation[] randomAnimes;
205
206 // Token: 0x04001441 RID: 5185
207 public bool alt;
208
209 // Token: 0x04001442 RID: 5186
210 public UIList listCoin;
211}
Definition Msg.cs:7
Definition Thing.cs:10