Elin Modding Docs Doc
Loading...
Searching...
No Matches
Happiness.cs
1using System;
2using System.Collections.Generic;
3using Newtonsoft.Json;
4using UnityEngine;
5
6// Token: 0x02000075 RID: 117
7public class Happiness : EClass
8{
9 // Token: 0x170000A0 RID: 160
10 // (get) Token: 0x06000356 RID: 854 RVA: 0x0001900B File Offset: 0x0001720B
11 public string Name
12 {
13 get
14 {
15 return ("member" + this.type.ToString()).lang();
16 }
17 }
18
19 // Token: 0x06000357 RID: 855 RVA: 0x0001902D File Offset: 0x0001722D
20 public void SetOwner(FactionBranch _branch, FactionMemberType _type)
21 {
22 this.branch = _branch;
23 this.type = _type;
24 }
25
26 // Token: 0x06000358 RID: 856 RVA: 0x0001903D File Offset: 0x0001723D
27 public void OnAdvanceDay()
28 {
29 this.lastValue = this.value;
30 this.value = (int)Mathf.Lerp((float)this.value, (float)this.GetTargetValue(), 0.1f);
31 }
32
33 // Token: 0x06000359 RID: 857 RVA: 0x0001906A File Offset: 0x0001726A
34 public void OnRefreshEffect()
35 {
36 this.modPolicy = 0;
37 }
38
39 // Token: 0x0600035A RID: 858 RVA: 0x00019074 File Offset: 0x00017274
40 public int GetTargetValue()
41 {
42 int num = 50;
43 if (this.branch.resources.food.value < 0)
44 {
45 num -= 100;
46 }
47 num += (this.branch.resources.fun.value - 50) / 4;
48 num += (this.branch.resources.culture.value - 50) / 4;
49 num += (this.branch.resources.medicine.value - 50) / 4;
50 num += (this.branch.resources.safety.value - 50) / 4;
51 foreach (Chara chara in this.branch.members)
52 {
53 }
54 foreach (BaseHomeResource baseHomeResource in this.branch.resources.list)
55 {
56 }
57 foreach (Policy policy in this.branch.policies.list)
58 {
59 }
60 num += this.modPolicy;
61 return num;
62 }
63
64 // Token: 0x0600035B RID: 859 RVA: 0x000191F0 File Offset: 0x000173F0
65 public string GetText()
66 {
67 if (this.CountMembers() == 0)
68 {
69 return " - %".TagColor(FontColor.Passive, null);
70 }
71 string text = this.value.ToString() + "%";
72 int num = this.value - this.lastValue;
73 if (num != 0)
74 {
75 }
76 if (this.value <= 30)
77 {
78 text = text.TagColor(FontColor.Bad, null);
79 }
80 else if (this.value >= 70)
81 {
82 text = text.TagColor(FontColor.Good, null);
83 }
84 string str = "";
85 if (num > 0)
86 {
87 str = "↑".TagColor(FontColor.Good, null);
88 }
89 else if (num < 0)
90 {
91 str = "↓".TagColor(FontColor.Bad, null);
92 }
93 return text + " " + str;
94 }
95
96 // Token: 0x0600035C RID: 860 RVA: 0x000192A0 File Offset: 0x000174A0
97 public int CountMembers()
98 {
99 int num = 0;
100 using (List<Chara>.Enumerator enumerator = this.branch.members.GetEnumerator())
101 {
102 while (enumerator.MoveNext())
103 {
104 if (enumerator.Current.memberType == this.type)
105 {
106 num++;
107 }
108 }
109 }
110 return num;
111 }
112
113 // Token: 0x0600035D RID: 861 RVA: 0x00019304 File Offset: 0x00017504
114 public void WriteNote(UINote n)
115 {
116 n.Clear();
117 n.AddHeader(this.Name, null);
118 n.Space(0, 1);
119 n.AddText("vTarget".lang() + this.GetTargetValue().ToString(), FontColor.DontChange);
120 n.AddText("vCurrent".lang() + this.value.ToString(), FontColor.DontChange);
121 n.AddText("vLast".lang() + this.lastValue.ToString(), FontColor.DontChange);
122 n.Space(0, 1);
123 n.AddText("policyHappiness".lang(this.modPolicy.ToString() ?? "", null, null, null, null), FontColor.DontChange);
124 n.Build();
125 }
126
127 // Token: 0x04000570 RID: 1392
128 [JsonProperty]
129 public int value;
130
131 // Token: 0x04000571 RID: 1393
132 [JsonProperty]
133 public int lastValue;
134
135 // Token: 0x04000572 RID: 1394
136 public int modPolicy;
137
138 // Token: 0x04000573 RID: 1395
139 public FactionBranch branch;
140
141 // Token: 0x04000574 RID: 1396
142 public FactionMemberType type;
143}
Definition Chara.cs:12