14 return ELayer.player.layerAbilityConfig;
19 public override void OnInit()
22 foreach (
string str
in this.idGroup)
24 this.windows[0].AddTab(
"cat_" + str, this.windows[0].CurrentContent,
null,
null,
null);
26 LayerAbility.Instance =
this;
27 this.list.sortMode =
ELayer.player.pref.sortAbility;
28 if (
ELayer.game.altAbility)
30 UIButton buttonSort = this.windows[0].buttonSort;
31 buttonSort.onClick.RemoveAllListeners();
32 buttonSort.onClick.AddListener(delegate()
34 UIContextMenu uicontextMenu =
ELayer.ui.CreateContextMenuInteraction();
35 uicontextMenu.layoutGroup.childAlignment = TextAnchor.UpperLeft;
36 uicontextMenu.alwaysPopLeft =
true;
37 UIContextMenu uicontextMenu2 = uicontextMenu.AddChild(
"sort", TextAnchor.UpperRight);
38 UIList.SortMode[] sorts = this.list.sorts;
39 for (
int j = 0; j < sorts.Length; j++)
41 UIList.SortMode sortMode = sorts[j];
42 string str2 = (this.list.sortMode == sortMode) ?
"context_checker".lang() :
"";
43 UIList.SortMode _sort = sortMode;
44 uicontextMenu2.AddButton(str2 + sortMode.ToString().lang(), delegate()
46 this.list.List(_sort);
50 UIContextMenu uicontextMenu3 = uicontextMenu.AddChild(
"config", TextAnchor.UpperRight);
51 uicontextMenu3.AddSlider(
"alpha", (
float a) => a.ToString() ??
"", (
float)
this.config.bgAlpha, delegate(
float b)
53 this.config.bgAlpha = (int)b;
55 }, 0f, 100f,
true,
false,
false);
56 uicontextMenu3.AddToggle(
"autoHideBG", this.config.autoHideBG, delegate(
bool a)
58 this.config.autoHideBG = a;
61 uicontextMenu3.AddToggle(
"hideDepletedSpell", this.config.hideDepletedSpell, delegate(
bool a)
63 this.config.hideDepletedSpell = a;
69 this.windows[0].idTab =
ELayer.player.pref.lastIdTabAbility;
74 public void RefreshConfig()
76 Window window = this.windows[0];
77 window.imageBG.color = Color.white.SetAlpha(0.01f * (
float)this.config.bgAlpha);
78 window.listCgFloat.Clear();
79 if (this.config.autoHideBG)
81 window.listCgFloat.Add(window.cgBG);
83 window.cgBG.enabled = this.config.autoHideBG;
87 public static void SetDirty(
Element a)
95 foreach (UIList.ButtonPair buttonPair in layerInventory.invs[0].list.buttons)
98 if (buttonGrid.card !=
null && buttonGrid.card.trait is
TraitAbility)
100 layerInventory.invs[0].list.callbacks.OnRedraw(buttonGrid.card, buttonGrid, buttonGrid.index);
106 foreach (UIList.ButtonPair buttonPair2 in
WidgetCurrentTool.Instance.list.buttons)
109 if (buttonGrid2.card !=
null && buttonGrid2.card.trait is
TraitAbility)
111 WidgetCurrentTool.Instance.list.callbacks.OnRedraw(buttonGrid2.card, buttonGrid2, buttonGrid2.index);
119 public override void OnSwitchContent(Window window)
121 ELayer.player.pref.lastIdTabAbility = window.idTab;
122 this.SelectGroup(this.windows[0].setting.tabs[window.idTab].idLang.Replace(
"cat_",
""));
126 public override void OnUpdateInput()
128 if (EInput.middleMouse.down)
138 base.OnUpdateInput();
142 public static void ClearHotElement()
145 LayerAbility.hotElement =
null;
147 if (buttonAbility && buttonAbility.attach !=
null)
149 UnityEngine.Object.Destroy(buttonAbility.attach.gameObject);
151 EInput.Consume(
false, 1);
152 ELayer.ui.hud.SetDragImage(
null,
null,
null);
156 public void SelectGroup(
string id)
159 BaseList baseList = this.list;
169 LayerAbility.hotElement = b;
170 b.attach = Util.Instantiate(
"UI/Element/Grid/Attach/guide_ability", b.transform);
172 ELayer.ui.hud.SetDragImage(b.icon,
null,
null);
177 b.SetAct(this.chara, a);
179 callback.onList = delegate(UIList.SortMode m)
181 List<Element> list =
new List<Element>();
184 string categorySub = element.source.categorySub;
185 if (element.Value != 0 && (!
this.config.hideDepletedSpell || !element.PotentialAsStock || element.vPotential > 0))
187 if (
id ==
"favAbility" &&
ELayer.player.favAbility.Contains(element.id))
191 else if (
id == categorySub || (
id ==
"all" && this.idGroup.Contains(categorySub)))
197 list.Sort((
Element a,
Element b) => a.GetSortVal(m) - b.GetSortVal(m));
203 baseList.callbacks = callback;
208 public static void Redraw()
217 public void _Redraw()
223 public void OnStartDrag(UIButton b)
225 ELayer.ui.hud.SetDragImage(b.icon,
null,
null);
229 public void OnDrag(UIButton b)
234 if (((layer !=
null) ? layer.GetButton() :
null) ??
null)
236 text =
"hotitemRegister";
242 ELayer.ui.hud.SetDragText(text,
null);
246 public void OnEndDrag(UIButton b,
bool cancel =
false)
248 ELayer.ui.hud.imageDrag.SetActive(
false);
260 public void OnDisable()
262 ELayer.player.pref.sortAbility = this.list.sortMode;
263 ELayer.ui.hud.imageDrag.SetActive(
false);
274 public UIDynamicList list;
280 public Transform headerRow;
284 public string[] idGroup =
new string[]
299 public bool autoHideBG;
302 public bool hideDepletedSpell;