10 protected override void Awake()
13 if (this.buttonReroll)
15 this.buttonReroll.SetActive(
false);
20 public override void OnInit()
22 if (this.highlightTarget)
24 this.highlightTarget.DoHighlightTransition(
false);
26 EInput.WaitReleaseKey();
30 public override void OnUpdateInput()
32 foreach (UIList.ButtonPair buttonPair in
this.list.buttons)
35 UIButton uibutton = itemGeneral ? itemGeneral.button1 : (buttonPair.component as UIButton);
36 if (uibutton && uibutton.interactable && !EInput.waitReleaseAnyKey && uibutton.keyText && !uibutton.keyText.text.IsEmpty() && uibutton.keyText.text == Input.inputString)
39 uibutton.onClick.Invoke();
53 this.list.moldItem = this.moldItemDetail;
58 this.list.moldItem = this.moldItemGeneral;
64 public LayerList SetSize(
float w = 450f,
float h = -1f)
66 Vector2 sizeDelta = this.windows[0].Rect().sizeDelta;
67 this.windows[0].Rect().sizeDelta =
new Vector2((w == -1f) ? sizeDelta.x : w, (h == -1f) ? sizeDelta.y : h);
80 public LayerList SetPivot(
float x,
float y = -1f)
82 this.windows[0].Rect().pivot =
new Vector2(x, y);
87 public void RefreshSize()
89 RectTransform rectTransform = this.windows[0].Rect();
90 float x = rectTransform.sizeDelta.x;
91 float y = rectTransform.sizeDelta.y;
92 this.RebuildLayout(
true);
93 Vector2 sizeDelta = this.scroll.content.Rect().sizeDelta;
96 x = Mathf.Clamp(sizeDelta.x,
this.sizeMin.x,
this.sizeMax.x) + this.paddings.x;
100 y = Mathf.Clamp(sizeDelta.y,
this.sizeMin.y,
this.sizeMax.y) + this.paddings.y;
102 rectTransform.sizeDelta =
new Vector2(x, y);
106 public LayerList SetList<TValue>(ICollection<TValue> items, Func<TValue, string> getString, Action<int, string> onSelect,
bool autoClose =
true)
108 List<string> strs =
new List<string>();
109 foreach (TValue arg
in items)
111 strs.Add(getString(arg));
113 this.SetStringList(() => strs, onSelect, autoClose);
118 public LayerList SetStringList(Func<ICollection<string>> getList, Action<int, string> onSelect,
bool autoClose =
true)
120 this.list.callbacks =
new UIList.Callback<string,
ItemGeneral>
124 onSelect(this.list.items.IndexOf(a), a);
130 onInstantiate = delegate(
string a,
ItemGeneral item)
132 item.button1.mainText.text = a;
137 item.button1.soundClick =
null;
140 onList = delegate(UIList.SortMode m)
142 foreach (
string o
in getList())
148 this.list.List(
false);
154 public LayerList SetList2<TValue>(ICollection<TValue> _list, Func<TValue, string> getText, Action<TValue, ItemGeneral> onClick, Action<TValue, ItemGeneral> onInstantiate,
bool autoClose =
true)
156 this.list.callbacks =
new UIList.Callback<TValue,
ItemGeneral>
166 onInstantiate = delegate(TValue a,
ItemGeneral item)
168 item.button1.mainText.text = getText(a);
171 onInstantiate(a, item);
173 onList = delegate(UIList.SortMode m)
175 foreach (TValue tvalue
in _list)
177 this.list.Add(tvalue);
181 this.list.List(
false);
183 UIButton.TryShowTip(base.transform,
true,
true);
188 public LayerList SetListCheck<TValue>(ICollection<TValue> _list, Func<TValue, string> getText, Action<TValue, ItemGeneral> onClick, Action<List<UIList.ButtonPair>> onValidate)
190 LayerList.<>c__DisplayClass24_0<TValue> CS$<>8__locals1 =
new LayerList.<>c__DisplayClass24_0<TValue>();
191 CS$<>8__locals1.onValidate = onValidate;
192 CS$<>8__locals1.<>4__this =
this;
193 CS$<>8__locals1.getText = getText;
194 CS$<>8__locals1.onClick = onClick;
195 CS$<>8__locals1._list = _list;
196 this.list.moldItem = this.moldItemCheck.transform;
197 BaseList baseList = this.list;
199 callback.onClick = delegate(TValue a,
ItemGeneral b)
202 callback.onInstantiate = delegate(TValue a,
ItemGeneral item)
204 item.button1.mainText.text = CS$<>8__locals1.getText(a);
207 item.button1.SetOnClick(delegate
209 CS$<>8__locals1.onClick(a, item);
210 CS$<>8__locals1.<SetListCheck>g__Validate|0();
213 callback.onList = delegate(UIList.SortMode m)
215 foreach (TValue tvalue
in CS$<>8__locals1._list)
217 CS$<>8__locals1.<>4__this.list.Add(tvalue);
220 baseList.callbacks = callback;
221 this.list.List(
false);
222 CS$<>8__locals1.<SetListCheck>g__Validate|0();
224 UIButton.TryShowTip(base.transform,
true,
true);
231 this.buttonReroll.SetActive(
true);
232 this.buttonReroll.onClick.RemoveAllListeners();
233 this.buttonReroll.onClick.AddListener(delegate()
235 this.list.List(
false);
237 this.list.RebuildLayout(
true);
243 public LayerList ManualList(Action<UIList, LayerList> onInit)
245 this.buttonReroll.SetActive(
false);
246 this.list.moldItem = this.moldItemGeneral;
247 onInit(this.list,
this);
248 this.list.List(
false);
256 this.windows[0].SetCaption(lang.lang());
268 public void SetHighlightTarget(UIButton _target)
270 this.highlightTarget = _target;
271 this.highlightTarget.DoHighlightTransition(
false);
275 private void Update()
277 if (this.highlightTarget)
279 this.highlightTarget.DoHighlightTransition(
false);
284 private void LateUpdate()
286 if (this.highlightTarget)
288 this.highlightTarget.DoHighlightTransition(
false);
293 public override void OnKill()
295 if (this.highlightTarget)
297 ELayer.core.WaitForEndOfFrame(delegate
299 if (this.highlightTarget)
301 if (!InputModuleEX.IsPointerOver(
this.highlightTarget))
303 this.highlightTarget.DoNormalTransition(
true);
306 this.highlightTarget.DoHighlightTransition(
false);
310 TooltipManager.Instance.HideTooltips(
true);
311 TooltipManager.Instance.disableHide =
null;
312 EInput.WaitReleaseKey();
316 public void Add(
string lang, Action<int> action)
318 if (!this.initialized)
320 this.initialized =
true;
326 id = this.customItems.Count
331 public void Show(
bool autoClose =
true)
333 BaseList baseList = this.list;
345 item.button1.mainText.text = a.lang.lang();
349 callback.onList = delegate(UIList.SortMode m)
356 baseList.callbacks = callback;
357 this.buttonReroll.SetActive(
false);
358 this.list.List(
false);
362 this.windows[0].AddBottomButton(
"back",
new UnityAction(this.Close),
true);
370 public UIButton buttonReroll;
373 public UIButton highlightTarget;
376 public UIItem moldItemCheck;
379 public Transform moldItemGeneral;
382 public Transform moldItemDetail;
397 public UIScrollView scroll;
400 public Vector2 sizeMin;
403 public Vector2 sizeMax;
406 public Vector2 paddings;
409 private bool initialized;
421 public Action<int> action;