Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
ContentHomeReport.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2
4{
6
8
10
12
14
16
18
20
22
24
26
28
30
32
34
36
37 public Zone zone;
38
39 public int tabResearch => 1;
40
41 public override void OnSwitchContent(int idTab)
42 {
44 branch = EClass.Branch ?? EClass.pc.homeZone.branch;
46 }
47
48 public void RefreshInfo()
49 {
50 textName.SetText(faction.name + " <size=13>" + "_branch".lang(zone.Name) + "</size>");
53 textKarma.SetText("20");
54 textPopu.SetText((branch.rank != 0) ? branch.faith.Name : "none".lang());
55 textHeaderReport.text = "headerHomeReport".lang(EClass.world.date.year.ToString() ?? "", EClass.world.date.month + "/" + EClass.world.date.day);
56 buttonHappinessResident.mainText.text = branch.happiness.residents.GetText();
57 buttonHappinessLivestock.mainText.text = branch.happiness.livestocks.GetText();
58 buttonHappinessResident.subText.text = branch.CountMembers(FactionMemberType.Default).ToString() ?? "";
59 buttonHappinessLivestock.subText.text = branch.CountMembers(FactionMemberType.Livestock).ToString() ?? "";
61 {
63 });
65 {
67 });
68 }
69
70 public string GetTextHappiness(List<Chara> list)
71 {
72 int num = 0;
73 int num2 = 0;
74 int num3 = 0;
75 int num4 = 0;
76 foreach (Chara item in list)
77 {
78 int happiness = item.GetHappiness();
79 if (happiness >= 80)
80 {
81 num2++;
82 }
83 else if (happiness >= 30)
84 {
85 num3++;
86 }
87 else
88 {
89 num4++;
90 }
91 num += happiness;
92 }
93 int avg = ((list.Count != 0) ? (num / list.Count) : 0);
94 string s = "(" + num2.ToString().TagColor(FontColor.Good) + "/" + num3.ToString().TagColor(FontColor.Default) + "/" + num4.ToString().TagColor(FontColor.Bad) + ")";
95 return (((list.Count == 0) ? " - " : avg.ToString()) + "%").TagColorGoodBad(() => list.Count == 0 || avg >= 50) + " " + s.TagSize(14);
96 }
97
98 public void RefreshResources()
99 {
101 listCurrencies.callbacks = new UIList.Callback<BaseHomeResource, ItemHomeResource>
102 {
103 onInstantiate = delegate(BaseHomeResource a, ItemHomeResource b)
104 {
105 b.SetResource(a);
106 },
107 onList = delegate
108 {
110 {
111 if (item.IsCurrency)
112 {
114 }
115 }
116 }
117 };
120 listResources.callbacks = new UIList.Callback<BaseHomeResource, ItemHomeResource>
121 {
122 onInstantiate = delegate(BaseHomeResource a, ItemHomeResource b)
123 {
124 b.SetResource(a);
125 },
126 onList = delegate
127 {
128 foreach (BaseHomeResource item2 in branch.resources.list)
129 {
130 if (item2.IsRate)
131 {
132 listResources.Add(item2);
133 }
134 }
135 }
136 };
138 }
139}
FactionMemberType
FontColor
Definition: FontColor.cs:2
Definition: Chara.cs:10
Faction faction
Definition: Chara.cs:412
Zone homeZone
Definition: Chara.cs:252
override void OnSwitchContent(int idTab)
FactionBranch branch
UIButton buttonHappinessLivestock
UIButton buttonHappinessResident
string GetTextHappiness(List< Chara > list)
int month
Definition: Date.cs:50
int day
Definition: Date.cs:62
int year
Definition: Date.cs:38
Definition: EClass.cs:5
static World world
Definition: EClass.cs:40
static FactionBranch Branch
Definition: EClass.cs:22
static Chara pc
Definition: EClass.cs:14
HappinessManager happiness
int CountMembers(FactionMemberType type, bool onlyAlive=false)
Religion faith
HomeResourceManager resources
string name
Definition: FACTION.cs:133
void WriteNote(UINote n)
Definition: Happiness.cs:108
string GetText()
Definition: Happiness.cs:63
List< BaseHomeResource > list
void SetResource(BaseHomeResource _r)
string Name
Definition: Religion.cs:30
virtual string Name
Definition: Spatial.cs:495
void SetTooltip(Action< UITooltip > onShowTooltip=null, bool enable=true)
Definition: UIButton.cs:361
Definition: UIList.cs:9
override void Clear()
Definition: UIList.cs:349
override void Add(object item)
Definition: UIList.cs:302
override void List()
Definition: UIList.cs:717
Definition: UIText.cs:6
void SetText(string s)
Definition: UIText.cs:159
UINote note
Definition: UITooltip.cs:21
GameDate date
Definition: World.cs:6
Definition: Zone.cs:12
FactionBranch branch
Definition: Zone.cs:34