11 public override void OnSwitchContent(
int idTab)
13 EClass.Branch.policies.Validate();
18 public void RefreshPolicy()
20 this.RefreshPolicyList(this.listPolicyLaw,
"law",
"department_law");
21 this.RefreshPolicyList(this.listPolicyEconomy,
"economy",
"department_economy");
22 this.RefreshPolicyList(this.listPolicyLife,
"life",
"department_life");
23 this.RefreshPolicyList(this.listUtility,
"utility",
"department_utility");
24 this.listUtility.SetActive(
EClass.Branch.lv >= 2);
25 this.RefreshPolicyIcons();
26 base.GetComponentInParent<Layer>().RebuildLayout(
true);
27 this.RebuildLayout(
true);
31 public void RefreshPolicyList(UIList list,
string cat,
string plan)
33 BaseList list2 = list;
34 UIList.Callback<
Policy, UIButton> callback =
new UIList.Callback<
Policy, UIButton>();
35 callback.onClick = delegate(
Policy a, UIButton b)
38 callback.onInstantiate = delegate(
Policy a, UIButton b)
40 b.mainText.SetText(a.Name);
41 b.onClick.AddListener(delegate()
45 if ((a.Cost > 0 &&
EClass.Branch.policies.CurrentAP() + a.Cost >
EClass.Branch.MaxAP) || !
ContentPolicy.<RefreshPolicyList>g__CanActivate|7_0(a))
50 if (a.id == 2514 &&
EClass.pc.faction.CountTaxFreeLand() >= 3)
60 EClass.pc.faction.SetGlobalPolicyActive(2705, a.active);
64 EClass.pc.faction.SetGlobalPolicyActive(2708, a.active);
68 EClass.pc.faction.SetGlobalPolicyActive(2710, a.active);
70 EClass.Branch.policies.RefreshEffects();
71 this.RefreshPolicyIcons();
74 b.tooltip.onShowTooltip = delegate(UITooltip tp)
79 Func<Policy, bool> <>9__7;
80 callback.onList = delegate(UIList.SortMode m)
82 IEnumerable<Policy> list3 =
EClass.Branch.policies.list;
83 Func<Policy, bool> predicate;
84 if ((predicate = <>9__7) ==
null)
86 predicate = (<>9__7 = ((
Policy p) => p.source.categorySub == cat));
88 foreach (
Policy o
in list3.Where(predicate))
93 callback.onSort = ((
Policy a, UIList.SortMode m) => a.GetSortVal(m));
94 callback.onRefresh =
null;
95 list2.callbacks = callback;
97 list.GetComponentInChildren<CanvasGroup>().alpha = ((list.items.Count > 0) ? 0.9f : 0.4f);
101 public void RefreshPolicyIcons()
103 int num =
EClass.Branch.policies.CurrentAP();
104 UIList[] array =
new UIList[]
108 this.listPolicyEconomy,
111 for (
int i = 0; i < array.Length; i++)
113 foreach (UIButton uibutton
in array[i].GetComponentsInChildren<UIButton>())
116 uibutton.icon.material = (policy.active ? null : this.matGrayscale);
117 uibutton.imageCheck.SetActive(policy.active);
118 uibutton.subText.SetText(policy.Cost.ToString() ??
"", (num + policy.Cost <=
EClass.Branch.MaxAP || policy.active) ? FontColor.Good : FontColor.Bad);
125 internal static bool <RefreshPolicyList>g__CanActivate|7_0(
Policy p)
127 return (p.id != 2515 || !
EClass.Branch.policies.IsActive(2516, -1)) && (p.id != 2516 || !
EClass.Branch.policies.IsActive(2515, -1)) && (p.id != 2814 || !
EClass.Branch.policies.IsActive(2823, -1)) && (p.id != 2823 || !
EClass.Branch.policies.IsActive(2814, -1));
131 public UIList listPolicyLaw;
134 public UIList listPolicyEconomy;
137 public UIList listPolicyLife;
140 public UIList listUtility;
143 public Material matGrayscale;