16 base.InvokeRepeating(
"Refresh", 0.1f, 0.1f);
20 private void OnEnable()
28 this.options = _options;
36 this.mold = this.layout.CreateMold(
null);
37 if (this.options.plat)
39 this.Add(this.icons[1],
"plat", () =>
EMono.pc.GetCurrency(
"plat").ToString(
"#,0") ??
"");
41 if (this.options.money)
43 this.Add(this.icons[0],
"money", () =>
EMono.pc.GetCurrency(
"money").ToString(
"#,0") ??
"");
45 if (this.options.money2)
47 this.Add(this.icons[5],
"money2", () =>
EMono.pc.GetCurrency(
"money2").ToString(
"#,0") ??
"");
49 if (this.options.medal)
51 this.Add(this.icons[4],
"medal", () =>
EMono.pc.GetCurrency(
"medal").ToString(
"#,0") ??
"");
53 if (this.options.ecopo)
55 this.Add(
EMono.sources.cards.map[
"ecopo"].GetSprite(0, 0,
false),
"ecopo", () =>
EMono.pc.GetCurrency(
"ecopo").ToString(
"#,0") ??
"");
57 if (this.options.influence)
59 this.Add(this.icons[3],
"influence", () =>
EMono._zone.influence.ToString() ??
"");
61 if (this.options.casino)
63 this.Add(this.icons[10],
"casino_coin", () =>
EMono.pc.GetCurrency(
"casino_coin").ToString(
"#,0") ??
"");
65 if (this.options.weight)
67 this.Add(this.icons[11],
"weightInv", () => Lang._weight(
this.target.ChildrenWeight,
false, 0) +
" / " + Lang._weight(
this.target.WeightLimit,
true, 0));
69 if (
EMono.BranchOrHomeBranch !=
null)
72 if (this.options.branchMoney)
74 this.Add(this.icons[5], resources.money.Name, () => resources.money.value.ToString(
"#,0") ??
"");
76 if (this.options.branchFood)
78 this.Add(this.icons[6], resources.food.Name, () => resources.food.value.ToString(
"#,0") ??
"");
80 if (this.options.branchKnowledge)
82 this.Add(this.icons[7], resources.knowledge.Name, () => resources.knowledge.value.ToString(
"#,0") ??
"");
84 if (this.options.admin)
86 this.Add(this.icons[9],
"ap", () =>
EMono.Branch.policies.CurrentAP().ToString() +
"/" +
EMono.Branch.MaxAP.ToString());
88 if (this.options.resources)
90 using (List<BaseHomeResource>.Enumerator enumerator =
EMono.BranchOrHomeBranch.resources.list.GetEnumerator())
92 while (enumerator.MoveNext())
97 this.Add(r.Sprite, r.Name, () => r.value.ToString(
"#,0") ??
"");
103 this.layout.RebuildLayout(
false);
107 public void Add(Sprite icon,
string lang, Func<string> func)
109 UIButton uibutton = Util.Instantiate<UIButton>(this.mold, this.layout);
110 uibutton.icon.sprite = icon;
111 uibutton.icon.SetNativeSize();
112 uibutton.tooltip.lang = lang.lang().ToTitleCase(
true);
116 text = uibutton.mainText
118 uibutton.mainText.SetText(func());
119 uibutton.mainText.RebuildLayout(
false);
120 uibutton.RebuildLayout(
false);
124 public void Refresh()
128 string text = item.func();
129 if (item.text.text != (text ??
""))
131 item.text.SetText(text);
132 item.text.RebuildLayout(
false);
133 item.text.transform.parent.RebuildLayout(
false);
142 public bool autoBuild;
151 public Sprite[] icons;
154 public LayoutGroup layout;
160 private UIButton mold;
176 public bool knowledge;
179 public bool influence;
188 public bool resources;
191 public bool branchMoney;
194 public bool branchFood;
197 public bool branchMaterial;
200 public bool branchKnowledge;
216 public Func<string> func;