2using System.Collections;
3using System.Collections.Generic;
63 public Func<T1, SortMode, int>
onSort;
100 val.SetActive(enable:
true);
101 val.transform.SetParent(
parent, worldPositionStays:
false);
107 uIButton.instantClick =
false;
117 orCreate.list =
list;
123 public void OnClick(
object obj, Component button)
139 public void OnRedraw(
object obj, Component c,
int index)
149 return onSort((T1)obj, mode);
179 return t.GetComponent<T2>();
201 void OnRedraw(
object obj, Component button,
int index);
273 public List<object>
items =
new List<object>();
276 public List<ButtonPair>
buttons =
new List<ButtonPair>();
295 public Dictionary<UIButton, UIList>
children =
new Dictionary<UIButton, UIList>();
299 "a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
300 "k",
"l",
"m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
301 "u",
"v",
"w",
"x",
"y",
"z"
351 foreach (
object item in collection)
399 UnityEngine.Object.DestroyImmediate(item2.
component.gameObject);
413 uIList.transform.SetSiblingIndex(button.transform.GetSiblingIndex() + 1);
415 uIList.parent =
this;
432 GetComponentInParent<ScrollRect>().RebuildLayout(recursive:
true);
442 GetComponentInParent<ScrollRect>().RebuildLayout(recursive:
true);
451 UnityEngine.Object.DestroyImmediate(base.gameObject);
456 this.RebuildLayout();
463 base.transform.
parent.RebuildLayout();
473 if (
this != activeList && (
bool)
group)
479 public virtual void Refresh(
bool highlightLast =
false)
494 if ((
bool)componentOf)
496 Component component = componentOf.transform.parent.GetComponent<
UIItem>();
497 if (component ==
null)
499 component = componentOf;
501 for (
int i = 0; i <
buttons.Count; i++)
503 if (
buttons[i].component == component)
514 UnityEngine.Object.DestroyImmediate(
group);
523 RectTransform rectTransform =
callbacks.GetMold().Rect();
524 rectTransform.sizeDelta =
new Vector2(rectTransform.sizeDelta.x, 34 +
heightFix);
551 GridLayoutGroup gridLayoutGroup =
layoutItems as GridLayoutGroup;
555 if ((
bool)gridLayoutGroup)
563 this.Rect().RebuildLayout();
564 this.Rect().ForceUpdateRectTransforms();
565 Canvas.ForceUpdateCanvases();
566 float y = RectTransformUtility.PixelAdjustRect(this.Rect(), GetComponentInParent<Canvas>()).size.y;
567 float y2 =
callbacks.GetMold().Rect().sizeDelta.y;
588 if (num >=
items.Count)
592 new GameObject().AddComponent<RectTransform>().SetParent(
layoutItems.transform, worldPositionStays:
false);
619 uIButton.onClick.AddListener(delegate
639 if ((
bool)componentInChildren)
641 componentInChildren.onClick.Invoke();
645 SkinManager.tempSkin = tempSkin;
653 paginationTop.text1.text =
page + 1 +
" / " +
maxPage;
657 paginationBottom.text1.text =
page + 1 +
" / " +
maxPage;
693 public override void OnMove(
object o,
object select =
null)
700 public void Select(
int index = 0,
bool invoke =
false)
710 uIButton = (buttonPair.component as
UIItem)?.button1;
716 uIButton.onClick.Invoke();
718 if ((
bool)uIButton.
group)
729 public void Select(
object obj,
bool invoke =
false)
731 for (
int i = 0; i <
items.Count; i++)
741 public void Select<T>(Func<T, bool> func,
bool invoke =
false)
743 for (
int i = 0; i <
items.Count; i++)
745 if (func((T)
items[i]))
783 public void List(
bool refreshHighlight =
false)
816 GridLayoutGroup gridLayoutGroup =
layoutItems as GridLayoutGroup;
821 Vector2 vector = (
layoutItems.Rect().anchorMax =
new Vector2(0f, 1f));
822 Vector2 pivot = (rectTransform2.anchorMin = vector);
823 rectTransform.pivot = pivot;
824 rectTransform.sizeDelta =
new Vector2(rectTransform.sizeDelta.x, (
float)
rows * gridLayoutGroup.cellSize.y);
837 T component =
moldItem.GetComponent<T>();
852 UnityEngine.Object.DestroyImmediate(
transNoItem.gameObject);
909 RectTransformUtility.ScreenPointToLocalPointInRectangle(
dragViewport, Input.mousePosition,
null, out var localPoint);
910 float y = localPoint.y;
911 float num = dragViewport.rect.height * 0.5f;
915 float num3 = Mathf.InverseLerp(0f - num +
dragEdgeSize, 0f - num, y);
920 float num4 = Mathf.InverseLerp(num -
dragEdgeSize, num, y);
925 float verticalNormalizedPosition =
dragScrollView.verticalNormalizedPosition;
926 dragScrollView.verticalNormalizedPosition = Mathf.Clamp01(verticalNormalizedPosition + num2 * Time.unscaledDeltaTime);
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)
void OnDragReorder(object obj, int a)
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
bool CanDragReorder(object obj)
Func< T1, bool > canDragReorder
Action< T1, int > onDragReorder
void Select< T >(Func< T, bool > func, bool invoke=false)
UIList CreateChild(UIButton button)
List< ButtonPair > buttons
override void List(SortMode sort)
void AutoScrollWhileDragging()
void OnSelect(UIList activeList)
void List(bool refreshHighlight=false)
void UpdateItemDragHover(UIListDragItem drag)
int GetIndexOf(object item)
bool OnClickFolder(UIButton b, Action< UIList > onFold, bool refresh=true)
void BeginItemDrag(UIListDragItem drag)
GridLayoutGroup gridLayout
UIScrollView dragScrollView
void Select(object obj, bool invoke=false)
Dictionary< UIButton, UIList > children
void EndItemDrag(UIListDragItem drag)
void Select(int index=0, bool invoke=false)
void RebuildLayoutInParent()
bool onlyDirectChildrenButtonForGroup
override void OnMove(object o, object select=null)
void RemoveChild(UIButton button)
Action< object > onDragBegin
override void Add(object item)
static string[] strNumber
T GetPair< T >(object item)
void List(SortMode m, bool refreshHighlight=false)
ButtonPair GetPair(object item)
override void AddDynamic(object item)
void AddCollection(ICollection collection)
virtual void Refresh(bool highlightLast=false)
void ChangeSort(SortMode m)
RectTransform dragViewport
override void RemoveDynamic(object item)
override bool Contains(object item)
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)
void OnDragReorder(object obj, int a)
bool CanDragReorder(object obj)