Elin Modding Docs Doc
Loading...
Searching...
No Matches
HomeResource.cs
1using System;
2using System.Collections.Generic;
3
4// Token: 0x0200007B RID: 123
6{
7 // Token: 0x06000393 RID: 915 RVA: 0x00019F2D File Offset: 0x0001812D
8 public override void OnAdvanceDay()
9 {
10 this.lastValue = this.value;
11 }
12
13 // Token: 0x06000394 RID: 916 RVA: 0x00019F3B File Offset: 0x0001813B
14 public override void Mod(int a, bool popText = true)
15 {
16 if (a == 0)
17 {
18 return;
19 }
20 this.value += a;
21 if (popText)
22 {
23 WidgetPopText.SayValue(base.Name, a, false, base.Sprite);
24 }
25 }
26
27 // Token: 0x06000395 RID: 917 RVA: 0x00019F68 File Offset: 0x00018168
28 public void AddResource(int a, ref string s)
29 {
30 if (a == 0)
31 {
32 return;
33 }
34 this.value += a;
35 s = s + (base.Name + " " + a.ToString()).TagColorGoodBad(() => a > 0, false) + ",";
36 }
37
38 // Token: 0x020007E5 RID: 2021
39 public class CostList : List<HomeResource.Cost>
40 {
41 // Token: 0x06003804 RID: 14340 RVA: 0x0012CAB0 File Offset: 0x0012ACB0
42 public string GetText()
43 {
44 string text = "";
45 using (List<HomeResource.Cost>.Enumerator enumerator = base.GetEnumerator())
46 {
47 while (enumerator.MoveNext())
48 {
49 HomeResource.Cost c = enumerator.Current;
50 text = text + (c.resource.Name + ":" + c.cost.ToString()).TagColorGoodBad(() => c.resource.value >= c.cost, () => c.resource.value < c.cost, false) + " ";
51 }
52 }
53 return text;
54 }
55
56 // Token: 0x06003805 RID: 14341 RVA: 0x0012CB60 File Offset: 0x0012AD60
57 public bool CanPay()
58 {
59 foreach (HomeResource.Cost cost in this)
60 {
61 if (cost.resource.value < cost.cost)
62 {
63 return false;
64 }
65 }
66 return true;
67 }
68
69 // Token: 0x06003806 RID: 14342 RVA: 0x0012CBC4 File Offset: 0x0012ADC4
70 public void Pay()
71 {
72 foreach (HomeResource.Cost cost in this)
73 {
74 cost.resource.Mod(-cost.cost, true);
75 }
76 }
77 }
78
79 // Token: 0x020007E6 RID: 2022
80 public class Cost
81 {
82 // Token: 0x06003808 RID: 14344 RVA: 0x0012CC28 File Offset: 0x0012AE28
83 public Cost(HomeResource _resource, int _cost)
84 {
85 this.resource = _resource;
86 this.cost = _cost;
87 }
88
89 // Token: 0x0400222E RID: 8750
90 public int cost;
91
92 // Token: 0x0400222F RID: 8751
93 public HomeResource resource;
94 }
95}