10 public override void OnInit()
16 public void RefreshPolicy()
18 this.RefreshPolicyList(this.listPolicyLaw,
"law",
"department_law");
19 this.RefreshPolicyList(this.listPolicyEconomy,
"economy",
"department_economy");
20 this.RefreshPolicyList(this.listPolicyLife,
"life",
"department_life");
21 this.RefreshPolicyIcons();
25 public void RefreshPolicyList(UIList list,
string cat,
string plan)
27 BaseList list2 = list;
28 UIList.Callback<
Policy, UIButton> callback =
new UIList.Callback<
Policy, UIButton>();
29 callback.onClick = delegate(
Policy a, UIButton b)
32 callback.onInstantiate = delegate(
Policy a, UIButton b)
34 b.mainText.SetText(a.Name);
35 b.onClick.AddListener(delegate()
37 if (!a.active &&
ELayer.Branch.policies.CurrentAP() + a.Cost >
ELayer.Branch.MaxAP)
44 ELayer.Branch.policies.RefreshEffects();
45 this.RefreshPolicyIcons();
48 b.tooltip.onShowTooltip = delegate(UITooltip tp)
53 Func<Policy, bool> <>9__6;
54 callback.onList = delegate(UIList.SortMode m)
56 IEnumerable<Policy> list3 =
ELayer.Branch.policies.list;
57 Func<Policy, bool> predicate;
58 if ((predicate = <>9__6) ==
null)
60 predicate = (<>9__6 = ((
Policy p) => p.source.categorySub == cat));
62 foreach (
Policy o
in list3.Where(predicate))
67 callback.onSort = ((
Policy a, UIList.SortMode m) => a.GetSortVal(m));
68 callback.onRefresh =
null;
69 list2.callbacks = callback;
71 list.GetComponentInChildren<CanvasGroup>().alpha = ((list.items.Count > 0) ? 0.9f : 0.4f);
75 public void RefreshPolicyIcons()
77 int num =
ELayer.Branch.policies.CurrentAP();
78 UIList[] array =
new UIList[]
82 this.listPolicyEconomy
84 for (
int i = 0; i < array.Length; i++)
86 foreach (UIButton uibutton
in array[i].GetComponentsInChildren<UIButton>())
89 uibutton.icon.material = (policy.active ? null : this.matGrayscale);
90 uibutton.imageCheck.SetActive(policy.active);
91 uibutton.subText.SetText(policy.Cost.ToString() ??
"", (num + policy.Cost <=
ELayer.Branch.MaxAP || policy.active) ? FontColor.Good : FontColor.Bad);
97 public UIList listPolicyLaw;
100 public UIList listPolicyEconomy;
103 public UIList listPolicyLife;
106 public Material matGrayscale;