2using System.Collections;
3using System.Collections.Generic;
62 public Func<T1, SortMode, int>
onSort;
95 val.SetActive(enable:
true);
96 val.transform.SetParent(
parent, worldPositionStays:
false);
102 uIButton.instantClick =
false;
112 public void OnClick(
object obj, Component button)
128 public void OnRedraw(
object obj, Component c,
int index)
138 return onSort((T1)obj, mode);
151 return t.GetComponent<T2>();
173 void OnRedraw(
object obj, Component button,
int index);
241 public List<object>
items =
new List<object>();
244 public List<ButtonPair>
buttons =
new List<ButtonPair>();
263 public Dictionary<UIButton, UIList>
children =
new Dictionary<UIButton, UIList>();
267 "a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
268 "k",
"l",
"m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
269 "u",
"v",
"w",
"x",
"y",
"z"
296 foreach (
object item in collection)
344 UnityEngine.Object.DestroyImmediate(item2.
component.gameObject);
358 uIList.transform.SetSiblingIndex(button.transform.GetSiblingIndex() + 1);
360 uIList.parent =
this;
377 GetComponentInParent<ScrollRect>().RebuildLayout(recursive:
true);
387 GetComponentInParent<ScrollRect>().RebuildLayout(recursive:
true);
396 UnityEngine.Object.DestroyImmediate(base.gameObject);
401 this.RebuildLayout();
408 base.transform.
parent.RebuildLayout();
418 if (
this != activeList)
424 public virtual void Refresh(
bool highlightLast =
false)
439 if ((
bool)componentOf)
441 Component component = componentOf.transform.parent.GetComponent<
UIItem>();
442 if (component ==
null)
444 component = componentOf;
446 for (
int i = 0; i <
buttons.Count; i++)
448 if (
buttons[i].component == component)
459 UnityEngine.Object.DestroyImmediate(
group);
468 RectTransform rectTransform =
callbacks.GetMold().Rect();
469 rectTransform.sizeDelta =
new Vector2(rectTransform.sizeDelta.x, 34 +
heightFix);
496 GridLayoutGroup gridLayoutGroup =
layoutItems as GridLayoutGroup;
500 if ((
bool)gridLayoutGroup)
508 this.Rect().RebuildLayout();
509 this.Rect().ForceUpdateRectTransforms();
510 Canvas.ForceUpdateCanvases();
511 float y = RectTransformUtility.PixelAdjustRect(this.Rect(), GetComponentInParent<Canvas>()).size.y;
512 float y2 =
callbacks.GetMold().Rect().sizeDelta.y;
533 if (num >=
items.Count)
537 new GameObject().AddComponent<RectTransform>().SetParent(
layoutItems.transform, worldPositionStays:
false);
545 buttonPair.obj =
item;
546 buttonPair.component = comp;
563 uIButton.onClick.AddListener(delegate
583 if ((
bool)componentInChildren)
585 componentInChildren.onClick.Invoke();
589 SkinManager.tempSkin = tempSkin;
597 paginationTop.text1.text =
page + 1 +
" / " +
maxPage;
601 paginationBottom.text1.text =
page + 1 +
" / " +
maxPage;
637 public void OnMove(
object o,
object select =
null)
644 public void Select(
int index = 0,
bool invoke =
false)
654 uIButton = (buttonPair.component as
UIItem)?.button1;
660 uIButton.onClick.Invoke();
662 if ((
bool)uIButton.
group)
673 public void Select(
object obj,
bool invoke =
false)
675 for (
int i = 0; i <
items.Count; i++)
685 public void Select<T>(Func<T, bool> func,
bool invoke =
false)
687 for (
int i = 0; i <
items.Count; i++)
689 if (func((T)
items[i]))
727 public void List(
bool refreshHighlight =
false)
760 GridLayoutGroup gridLayoutGroup =
layoutItems as GridLayoutGroup;
765 Vector2 vector2 = (
layoutItems.Rect().anchorMax =
new Vector2(0f, 1f));
766 Vector2 pivot = (rectTransform2.anchorMin = vector2);
767 rectTransform.pivot = pivot;
768 rectTransform.sizeDelta =
new Vector2(rectTransform.sizeDelta.x, (
float)
rows * gridLayoutGroup.cellSize.y);
776 T component =
moldItem.GetComponent<T>();
791 UnityEngine.Object.DestroyImmediate(
transNoItem.gameObject);
virtual void StopEventSystem(float duration=0.2f)
UIList.ICallback callbacks
static bool TryDespawn(Component c)
static Transform Spawn(string id, string path, Transform parent)
static SkinRootStatic CurrentSkin
static SkinRootStatic tempSkin
SkinRootStatic GetSkin(SkinType type)
Action< T1, T2, int > onRedraw
Action< T1, T2 > onInstantiate
int OnSort(object obj, SortMode mode)
void OnList(SortMode mode)
Component GetComponent(Transform t)
Func< T1, SortMode, int > onSort
void OnClick(object obj, Component button)
Component Instantiate(object obj, Transform parent)
void SetList(UIList _list)
void OnRedraw(object obj, Component c, int index)
Action< SortMode > onList
void Select< T >(Func< T, bool > func, bool invoke=false)
UIList CreateChild(UIButton button)
List< ButtonPair > buttons
override void List(SortMode sort)
void OnSelect(UIList activeList)
void List(bool refreshHighlight=false)
int GetIndexOf(object item)
bool OnClickFolder(UIButton b, Action< UIList > onFold, bool refresh=true)
GridLayoutGroup gridLayout
void Select(object obj, bool invoke=false)
Dictionary< UIButton, UIList > children
void RemoveDynamic(object item)
void Select(int index=0, bool invoke=false)
void OnMove(object o, object select=null)
void RebuildLayoutInParent()
bool onlyDirectChildrenButtonForGroup
void RemoveChild(UIButton button)
override void Add(object item)
static string[] strNumber
T GetPair< T >(object item)
void List(SortMode m, bool refreshHighlight=false)
ButtonPair GetPair(object item)
void AddCollection(ICollection collection)
virtual void Refresh(bool highlightLast=false)
void AddDynamic(object item)
void ChangeSort(SortMode m)
void Select(UIButton button, bool check=true)
virtual void Init(int index=0, UnityAction< int > action=null, bool directChildren=false)
void OnList(SortMode mode)
int OnSort(object obj, SortMode mode)
void SetList(UIList list)
void OnRedraw(object obj, Component button, int index)
Component GetComponent(Transform t)
void OnClick(object obj, Component button)
Component Instantiate(object obj, Transform parent)