Elin Modding Docs Doc
Loading...
Searching...
No Matches
LayerShippingResult.cs
1using System;
2using DG.Tweening;
3using UnityEngine;
4using UnityEngine.UI;
5
6// Token: 0x020005BC RID: 1468
8{
9 // Token: 0x06002836 RID: 10294 RVA: 0x000E3478 File Offset: 0x000E1678
10 private new void Awake()
11 {
12 Rand.SetSeed(ELayer.game.seed + ELayer.player.stats.days);
13 int num = ELayer.rnd(this.spriteBG.Length);
14 if (num == 1 && ELayer.game.cards.globalCharas.Find("corgon") == null)
15 {
16 num = 0;
17 }
18 if (num == 2 && ELayer.game.cards.globalCharas.Find("loytel") == null)
19 {
20 num = 0;
21 }
22 this.imageBG.sprite = this.spriteBG[num];
23 Rand.SetSeed(-1);
24 base.Awake();
25 }
26
27 // Token: 0x06002837 RID: 10295 RVA: 0x000E3514 File Offset: 0x000E1714
28 public void Show()
29 {
30 this.Show(ELayer.player.shippingResults.LastItem<ShippingResult>() ?? new ShippingResult());
31 SE.Play("money_shipping");
32 base.InvokeRepeating("UpdateRepeating", 0f, this.duration / (float)this.maxUpdate);
33 }
34
35 // Token: 0x06002838 RID: 10296 RVA: 0x000E3567 File Offset: 0x000E1767
36 public void UpdateRepeating()
37 {
38 if (!this.showEffect)
39 {
40 return;
41 }
42 this.Refresh();
43 }
44
45 // Token: 0x06002839 RID: 10297 RVA: 0x000E3578 File Offset: 0x000E1778
46 public void Refresh()
47 {
48 if (this.update == 0)
49 {
50 this.lastBonus = 0;
51 }
52 if (!this.showEffect)
53 {
54 if (this.update != this.maxUpdate)
55 {
56 foreach (DOTweenAnimation dotweenAnimation in base.GetComponentsInChildren<DOTweenAnimation>())
57 {
58 if (dotweenAnimation.tween != null)
59 {
60 dotweenAnimation.tween.Kill(true);
61 }
62 }
63 }
64 this.update = this.maxUpdate;
65 }
66 FactionBranch branch = (ELayer.game.spatials.Find(this.result.uidZone) ?? ELayer.pc.homeZone).branch;
67 float num = (float)this.update / (float)this.maxUpdate;
68 int num2 = this.result.GetIncome();
69 num2 = (int)((float)num2 * num);
70 int a = this.result.total + num2;
71 this.textIncome.text = Lang._currency(num2, true, 14);
72 this.textIncomeTotal.text = Lang._currency(a, true, 14);
73 int shippingBonus = ELayer.player.stats.GetShippingBonus(this.result.total);
74 int shippingBonus2 = ELayer.player.stats.GetShippingBonus(a);
75 int lastShippingExp = ELayer.player.stats.lastShippingExp;
76 int lastShippingExpMax = ELayer.player.stats.lastShippingExpMax;
77 int hearthLv = this.result.hearthLv;
78 int num3 = (int)((float)this.result.hearthExpGained * num);
79 int nextExp = branch.GetNextExp(hearthLv);
80 int num4 = this.result.hearthExp + num3;
81 this.gaugeGold.rectTransform.sizeDelta = new Vector2((float)Mathf.Min(300, 300 * lastShippingExp / lastShippingExpMax), 50f);
82 this.gaugeHearth.rectTransform.sizeDelta = new Vector2((float)Mathf.Min(300, 300 * num4 / nextExp), 50f);
83 this.gaugeDebt.rectTransform.sizeDelta = new Vector2(Mathf.Min(300f, 300f * ((float)this.result.debt / 20000000f)), 50f);
84 this.textGold.text = "shipping_nextGold".lang(lastShippingExp.ToFormat(), lastShippingExpMax.ToFormat(), null, null, null);
85 int num5 = shippingBonus2 - shippingBonus;
86 this.textGold2.text = ((num5 == 0) ? "" : ("+" + num5.ToString()));
87 this.textHearth.text = "shipping_hearth".lang(hearthLv.ToString() ?? "", (100f * (float)num4 / (float)nextExp).ToString("F1"), null, null, null);
88 float num6 = 100f * (float)num3 / (float)nextExp;
89 this.textHearth2.text = ((num6 == 0f) ? "" : ("+" + num6.ToString("F1") + "%"));
90 this.textDebt.text = (ELayer.game.quests.IsStarted<QuestDebt>() ? (Lang._currency(this.result.debt, true, 14) ?? "") : "???");
91 this.gaugeDebt.SetActive(ELayer.game.quests.IsStarted<QuestDebt>());
92 if (shippingBonus2 - shippingBonus != this.lastBonus)
93 {
94 this.lastBonus = shippingBonus2 - shippingBonus;
95 if (this.showEffect)
96 {
97 SE.Play("ore_drop");
98 }
99 }
100 this.update++;
101 if (this.showEffect && this.update > this.maxUpdate)
102 {
103 SE.Play("regi");
104 this.showEffect = false;
105 }
106 }
107
108 // Token: 0x0600283A RID: 10298 RVA: 0x000E3928 File Offset: 0x000E1B28
109 public void Show(ShippingResult _result)
110 {
111 this.result = _result;
112 Zone zone = ELayer.game.spatials.Find(this.result.uidZone) ?? ELayer.pc.homeZone;
113 FactionBranch branch = zone.branch;
114 BaseList baseList = this.list;
115 UIList.Callback<ShippingResult.Item, UIItem> callback = new UIList.Callback<ShippingResult.Item, UIItem>();
116 callback.onInstantiate = delegate(ShippingResult.Item a, UIItem b)
117 {
118 b.text1.SetText(a.text);
119 b.text2.SetText(a.income.ToFormat());
120 };
121 baseList.callbacks = callback;
122 this.list.Clear();
123 foreach (ShippingResult.Item o in this.result.items)
124 {
125 this.list.Add(o);
126 }
127 this.list.Refresh(false);
128 Date date = Date.ToDate(this.result.rawDate);
129 this.textTitle.text = string.Concat(new string[]
130 {
131 date.month.ToString(),
132 "/",
133 date.day.ToString(),
134 " ",
135 date.year.ToString()
136 });
137 this.textHome.text = "shipping_home".lang(zone.Name, null, null, null, null);
138 this.Refresh();
139 int count = ELayer.player.shippingResults.Count;
140 int index = ELayer.player.shippingResults.IndexOf(this.result);
141 this.buttonNext.SetActive(index != -1 && count > index + 1);
142 this.buttonPrev.SetActive(index > 0);
143 this.buttonNext.SetOnClick(delegate
144 {
145 this.showEffect = false;
146 this.Show(ELayer.player.shippingResults[index + 1]);
147 });
148 this.buttonPrev.SetOnClick(delegate
149 {
150 this.showEffect = false;
151 this.Show(ELayer.player.shippingResults[index - 1]);
152 });
153 this.RebuildLayout(true);
154 }
155
156 // Token: 0x04001664 RID: 5732
157 public UIList list;
158
159 // Token: 0x04001665 RID: 5733
160 public UIButton buttonNext;
161
162 // Token: 0x04001666 RID: 5734
163 public UIButton buttonPrev;
164
165 // Token: 0x04001667 RID: 5735
166 public Image gaugeGold;
167
168 // Token: 0x04001668 RID: 5736
169 public Image gaugeHearth;
170
171 // Token: 0x04001669 RID: 5737
172 public Image gaugeDebt;
173
174 // Token: 0x0400166A RID: 5738
175 public Image imageBG;
176
177 // Token: 0x0400166B RID: 5739
178 public UIText textGold;
179
180 // Token: 0x0400166C RID: 5740
181 public UIText textGold2;
182
183 // Token: 0x0400166D RID: 5741
184 public UIText textHearth;
185
186 // Token: 0x0400166E RID: 5742
187 public UIText textHearth2;
188
189 // Token: 0x0400166F RID: 5743
190 public UIText textHome;
191
192 // Token: 0x04001670 RID: 5744
193 public UIText textIncome;
194
195 // Token: 0x04001671 RID: 5745
196 public UIText textIncomeTotal;
197
198 // Token: 0x04001672 RID: 5746
199 public UIText textTitle;
200
201 // Token: 0x04001673 RID: 5747
202 public UIText textDebt;
203
204 // Token: 0x04001674 RID: 5748
205 public bool showEffect = true;
206
207 // Token: 0x04001675 RID: 5749
208 public float duration;
209
210 // Token: 0x04001676 RID: 5750
211 public int update;
212
213 // Token: 0x04001677 RID: 5751
214 public int maxUpdate;
215
216 // Token: 0x04001678 RID: 5752
217 public ShippingResult result;
218
219 // Token: 0x04001679 RID: 5753
220 public Sprite[] spriteBG;
221
222 // Token: 0x0400167A RID: 5754
223 private int lastBonus;
224}
Definition Date.cs:6
Definition Zone.cs:14