2using System.Collections;
3using System.Collections.Generic;
62 public Func<T1, SortMode, int>
onSort;
99 val.SetActive(enable:
true);
100 val.transform.SetParent(
parent, worldPositionStays:
false);
106 uIButton.instantClick =
false;
116 orCreate.list =
list;
122 public void OnClick(
object obj, Component button)
138 public void OnRedraw(
object obj, Component c,
int index)
148 return onSort((T1)obj, mode);
178 return t.GetComponent<T2>();
200 void OnRedraw(
object obj, Component button,
int index);
272 public List<object>
items =
new List<object>();
275 public List<ButtonPair>
buttons =
new List<ButtonPair>();
294 public Dictionary<UIButton, UIList>
children =
new Dictionary<UIButton, UIList>();
298 "a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
299 "k",
"l",
"m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
300 "u",
"v",
"w",
"x",
"y",
"z"
347 foreach (
object item in collection)
395 UnityEngine.Object.DestroyImmediate(item2.
component.gameObject);
409 uIList.transform.SetSiblingIndex(button.transform.GetSiblingIndex() + 1);
411 uIList.parent =
this;
428 GetComponentInParent<ScrollRect>().RebuildLayout(recursive:
true);
438 GetComponentInParent<ScrollRect>().RebuildLayout(recursive:
true);
447 UnityEngine.Object.DestroyImmediate(base.gameObject);
452 this.RebuildLayout();
459 base.transform.
parent.RebuildLayout();
469 if (
this != activeList && (
bool)
group)
475 public virtual void Refresh(
bool highlightLast =
false)
490 if ((
bool)componentOf)
492 Component component = componentOf.transform.parent.GetComponent<
UIItem>();
493 if (component ==
null)
495 component = componentOf;
497 for (
int i = 0; i <
buttons.Count; i++)
499 if (
buttons[i].component == component)
510 UnityEngine.Object.DestroyImmediate(
group);
519 RectTransform rectTransform =
callbacks.GetMold().Rect();
520 rectTransform.sizeDelta =
new Vector2(rectTransform.sizeDelta.x, 34 +
heightFix);
547 GridLayoutGroup gridLayoutGroup =
layoutItems as GridLayoutGroup;
551 if ((
bool)gridLayoutGroup)
559 this.Rect().RebuildLayout();
560 this.Rect().ForceUpdateRectTransforms();
561 Canvas.ForceUpdateCanvases();
562 float y = RectTransformUtility.PixelAdjustRect(this.Rect(), GetComponentInParent<Canvas>()).size.y;
563 float y2 =
callbacks.GetMold().Rect().sizeDelta.y;
584 if (num >=
items.Count)
588 new GameObject().AddComponent<RectTransform>().SetParent(
layoutItems.transform, worldPositionStays:
false);
596 buttonPair.obj =
item;
597 buttonPair.component = comp;
614 uIButton.onClick.AddListener(delegate
634 if ((
bool)componentInChildren)
636 componentInChildren.onClick.Invoke();
640 SkinManager.tempSkin = tempSkin;
648 paginationTop.text1.text =
page + 1 +
" / " +
maxPage;
652 paginationBottom.text1.text =
page + 1 +
" / " +
maxPage;
688 public void OnMove(
object o,
object select =
null)
695 public void Select(
int index = 0,
bool invoke =
false)
705 uIButton = (buttonPair.component as
UIItem)?.button1;
711 uIButton.onClick.Invoke();
713 if ((
bool)uIButton.
group)
724 public void Select(
object obj,
bool invoke =
false)
726 for (
int i = 0; i <
items.Count; i++)
736 public void Select<T>(Func<T, bool> func,
bool invoke =
false)
738 for (
int i = 0; i <
items.Count; i++)
740 if (func((T)
items[i]))
778 public void List(
bool refreshHighlight =
false)
811 GridLayoutGroup gridLayoutGroup =
layoutItems as GridLayoutGroup;
816 Vector2 vector2 = (
layoutItems.Rect().anchorMax =
new Vector2(0f, 1f));
817 Vector2 pivot = (rectTransform2.anchorMin = vector2);
818 rectTransform.pivot = pivot;
819 rectTransform.sizeDelta =
new Vector2(rectTransform.sizeDelta.x, (
float)
rows * gridLayoutGroup.cellSize.y);
827 T component =
moldItem.GetComponent<T>();
842 UnityEngine.Object.DestroyImmediate(
transNoItem.gameObject);
901 RectTransformUtility.ScreenPointToLocalPointInRectangle(
dragViewport, Input.mousePosition,
null, out var localPoint);
902 float y = localPoint.y;
903 float num = dragViewport.rect.height * 0.5f;
907 float num3 = Mathf.InverseLerp(0f - num +
dragEdgeSize, 0f - num, y);
912 float num4 = Mathf.InverseLerp(num -
dragEdgeSize, num, y);
917 float verticalNormalizedPosition =
dragScrollView.verticalNormalizedPosition;
918 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 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)
RectTransform dragViewport
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)