Elin Modding Docs Doc
Loading...
Searching...
No Matches
LayerGachaResult.cs
1using System;
2using System.Collections.Generic;
3using UnityEngine.UI;
4
5// Token: 0x02000549 RID: 1353
6public class LayerGachaResult : ELayer
7{
8 // Token: 0x060024CC RID: 9420 RVA: 0x000CFBF0 File Offset: 0x000CDDF0
9 public void PlayGacha(int n, string id)
10 {
11 this.layout.DestroyChildren(false, true);
12 this.items.Clear();
13 int i;
14 for (i = 0; i < n; i++)
15 {
16 Chara c = LayerGachaResult.Draw(id.Split('_', StringSplitOptions.None).LastItem<string>());
17 ItemGachaResult itemGachaResult = Util.Instantiate<ItemGachaResult>(this.moldItem, this.layout);
18 itemGachaResult.SetChara(c, this);
19 this.items.Add(itemGachaResult);
20 }
21 ELayer.pc.things.AddCurrency(ELayer.pc, id, -n, null);
22 Msg.Say("playedGacha", n.ToString() ?? "", null, null, null);
23 this.buttonGetAll.onClick.AddListener(delegate()
24 {
25 ELayer.Sound.Play("good");
26 this.items.ForeachReverse(delegate(ItemGachaResult i)
27 {
28 i.Confirm(true);
29 });
30 });
31 this.buttonDumpAll.onClick.AddListener(delegate()
32 {
33 ELayer.Sound.Play("pay");
34 this.items.ForeachReverse(delegate(ItemGachaResult i)
35 {
36 i.Confirm(false);
37 });
38 });
39 this.Refresh();
40 }
41
42 // Token: 0x060024CD RID: 9421 RVA: 0x000CFCD0 File Offset: 0x000CDED0
43 public static Chara Draw(string id = "citizen")
44 {
45 List<LayerGachaResult.Data> list = new List<LayerGachaResult.Data>();
46 int num = 0;
47 foreach (SourceChara.Row row in ELayer.sources.charas.rows)
48 {
49 if (id == "citizen")
50 {
51 if (!row.gachaFilter.Contains("resident"))
52 {
53 continue;
54 }
55 }
56 else if (id == "livestock")
57 {
58 if (!row.gachaFilter.Contains("livestock"))
59 {
60 continue;
61 }
62 }
63 else if (id == "unique")
64 {
65 if (!row.gachaFilter.Contains("resident"))
66 {
67 continue;
68 }
69 if (row.quality != 4)
70 {
71 continue;
72 }
73 }
74 else if (!row.gachaFilter.Contains("resident") && !row.gachaFilter.Contains("livestock"))
75 {
76 continue;
77 }
78 int num2 = (row.chance > 0) ? row.chance : 1;
79 if (row.LV < 10)
80 {
81 num2 = num2 * 300 / 100;
82 }
83 else if (row.LV < 20)
84 {
85 num2 = num2 * 250 / 100;
86 }
87 else if (row.LV < 30)
88 {
89 num2 = num2 * 200 / 100;
90 }
91 else if (row.LV < 50)
92 {
93 num2 = num2 * 150 / 100;
94 }
95 list.Add(new LayerGachaResult.Data
96 {
97 row = row,
98 weight = num2
99 });
100 num += num2;
101 }
102 int num3 = ELayer.rnd(num);
103 int num4 = 0;
104 LayerGachaResult.Data data = list[0];
105 foreach (LayerGachaResult.Data data2 in list)
106 {
107 num4 += data2.weight;
108 if (num3 < num4)
109 {
110 data = data2;
111 break;
112 }
113 }
114 return CharaGen.Create(data.row.id, -1);
115 }
116
117 // Token: 0x060024CE RID: 9422 RVA: 0x000CFF04 File Offset: 0x000CE104
118 public void Refresh()
119 {
120 int num = 0;
121 foreach (ItemGachaResult itemGachaResult in this.items)
122 {
123 num += itemGachaResult.GetMedal();
124 }
125 this.buttonDumpAll.mainText.text = "dumpAll".lang(num.ToString() ?? "", null, null, null, null);
126 }
127
128 // Token: 0x04001451 RID: 5201
129 public ItemGachaResult moldItem;
130
131 // Token: 0x04001452 RID: 5202
132 public LayoutGroup layout;
133
134 // Token: 0x04001453 RID: 5203
135 public UIButton buttonGetAll;
136
137 // Token: 0x04001454 RID: 5204
138 public UIButton buttonDumpAll;
139
140 // Token: 0x04001455 RID: 5205
141 public LayerGachaResult.Mode mode;
142
143 // Token: 0x04001456 RID: 5206
144 public List<ItemGachaResult> items = new List<ItemGachaResult>();
145
146 // Token: 0x02000A6A RID: 2666
147 public enum Mode
148 {
149 // Token: 0x04002AA5 RID: 10917
150 Chara
151 }
152
153 // Token: 0x02000A6B RID: 2667
154 public class Data
155 {
156 // Token: 0x04002AA6 RID: 10918
157 public SourceChara.Row row;
158
159 // Token: 0x04002AA7 RID: 10919
160 public int weight;
161 }
162}
Definition Chara.cs:12
Definition Msg.cs:7