Elin Decompiled Documentation EA 23.341 Nightly
Loading...
Searching...
No Matches
UIList Class Reference
Inheritance diagram for UIList:
BaseList UIListEx< T >

Classes

struct  ButtonPair
 
class  Callback
 
interface  ICallback
 
class  RefObject
 

Public Types

enum  BGType {
  none , stripe , line , dot ,
  dot_long , grid , thin
}
 
enum  SortMode {
  ByNone , ByNumber , ByValue , ByCategory ,
  ByEquip , ByJob , ByRace , ByLevel ,
  ByWeight , ByPrice , ByElementParent , ByName ,
  ByID , ByWeightSingle , ByWorkk , ByFeat ,
  ByPartyOrder
}
 
enum  ItemHeight { DontChange , Default }
 

Public Member Functions

void AddCollection (ICollection collection)
 
override void Add (object item)
 
int GetIndexOf (object item)
 
ButtonPair GetPair (object item)
 
GetPair< T > (object item)
 
override void AddDynamic (object item)
 
override void RemoveDynamic (object item)
 
override void Clear ()
 
bool OnClickFolder (UIButton b, Action< UIList > onFold, bool refresh=true)
 
void RebuildLayoutInParent ()
 
virtual void Refresh (bool highlightLast=false)
 
void NextPage ()
 
void PrevPage ()
 
void SetPage (int i)
 
override void OnMove (object o, object select=null)
 
void Select (int index=0, bool invoke=false)
 
void Select (object obj, bool invoke=false)
 
void Select< T > (Func< T, bool > func, bool invoke=false)
 
void Sort ()
 
void ChangeSort (SortMode m)
 
override void NextSort ()
 
override void List ()
 
override void List (SortMode sort)
 
void List (bool refreshHighlight=false)
 
void List (SortMode m, bool refreshHighlight=false)
 
override void Redraw ()
 
void BuildLayout ()
 
override bool Contains (object item)
 
GetMold< T > ()
 
void OnDestroy ()
 
void ClearChildren ()
 
void BeginItemDrag (UIListDragItem drag)
 
void EndItemDrag (UIListDragItem drag)
 
void UpdateItemDragHover (UIListDragItem drag)
 
- Public Member Functions inherited from BaseList
virtual void NextSort ()
 
virtual void List ()
 
virtual void List (UIList.SortMode sort)
 
virtual void Redraw ()
 
virtual void Clear ()
 
virtual void Add (object o)
 
virtual void AddDynamic (object item)
 
virtual void RemoveDynamic (object item)
 
virtual bool Contains (object item)
 
virtual void OnMove (object o, object select=null)
 
void RefreshNoItem ()
 
void RefreshBGGrid ()
 

Public Attributes

string langNoItem
 
int rows
 
UISelectableGroup menu
 
UIListTopbar bar
 
bool fillEmpty
 
bool buildLayout
 
UIItem paginationTop
 
UIItem paginationBottom
 
UISelectableGroup group
 
LayoutGroup _layoutItems
 
Transform moldItem
 
bool selectFirst
 
bool invokeSelected
 
bool enableGroup = true
 
bool onlyDirectChildrenButtonForGroup
 
bool usePage
 
bool usePool
 
bool disableInstaClick = true
 
bool ignoreNullObj = true
 
ItemHeight itemHeight
 
int heightFix
 
int page
 
int maxPage
 
int itemsPerPage
 
List< object > items = new List<object>()
 
List< ButtonPairbuttons = new List<ButtonPair>()
 
string idMold
 
Action SETab
 
UIList moldList
 
UIList parent
 
Dictionary< UIButton, UIListchildren = new Dictionary<UIButton, UIList>()
 
UIScrollView dragScrollView
 
RectTransform dragViewport
 
float dragEdgeSize
 
float dragScrollSpeed = 2.5f
 
- Public Attributes inherited from BaseList
UIList.BGType bgType
 
Vector2 bgFix
 
Vector2 bgUvFix = Vector2.one
 
UIList.ICallback callbacks
 
UIList.SortMode[] sorts
 
Action onBeforeRedraw
 
Action onAfterRedraw
 
bool useDefaultNoItem = true
 
bool numbering
 
SkinType skinType
 
RawImage bgGrid
 
UIList.SortMode sortMode
 
bool isBuilt
 

Static Public Attributes

const int HeightDefault = 34
 
static string[] strNumber
 

Protected Member Functions

virtual void OnRefresh ()
 

Properties

LayoutGroup layoutItems [get]
 
GridLayoutGroup gridLayout [get]
 
override int ItemCount [get]
 
override int RowCount [get]
 
UIList Root [get]
 
bool IsDragging [get]
 
- Properties inherited from BaseList
virtual int ItemCount [get]
 
virtual int RowCount [get]
 
SkinRootStatic Skin [get]
 

Private Member Functions

UIList CreateChild (UIButton button)
 
void RemoveChild (UIButton button)
 
void KillChildren ()
 
void OnSelect (UIList activeList)
 
void AfterRefresh ()
 
void Update ()
 
void AutoScrollWhileDragging ()
 

Private Attributes

bool initialized
 
bool reset
 
int highlightIndex
 
object dragTarget
 
int dragBeginIndex
 
int dragHoverIndex
 

Additional Inherited Members

- Protected Attributes inherited from BaseList
Transform transNoItem
 

Detailed Description

Definition at line 8 of file UIList.cs.

Member Enumeration Documentation

◆ BGType

Enumerator
none 
stripe 
line 
dot 
dot_long 
grid 
thin 

Definition at line 15 of file UIList.cs.

◆ ItemHeight

Enumerator
DontChange 
Default 

Definition at line 47 of file UIList.cs.

◆ SortMode

Enumerator
ByNone 
ByNumber 
ByValue 
ByCategory 
ByEquip 
ByJob 
ByRace 
ByLevel 
ByWeight 
ByPrice 
ByElementParent 
ByName 
ByID 
ByWeightSingle 
ByWorkk 
ByFeat 
ByPartyOrder 

Definition at line 26 of file UIList.cs.

Member Function Documentation

◆ Add()

override void UIList.Add ( object  item)
inlinevirtual

Reimplemented from BaseList.

Definition at line 354 of file UIList.cs.

355 {
356 if (item != null || !ignoreNullObj)
357 {
358 items.Add(item);
359 }
360 }
bool ignoreNullObj
Definition: UIList.cs:257
List< object > items
Definition: UIList.cs:273

References ignoreNullObj, item, and items.

Referenced by DropdownGrid.Activate(), ContentPopulation.Add(), AddCollection(), LayerShippingResult.Awake(), DropdownGrid.Build(), DropdownGrid.BuildIngredients(), DramaCustomSequence.GetListGuide(), LayerInspect.GetMenuItems(), UIDragGridInfo.Init(), UIDragGridInfo.InitFuel(), Dialog.OnAfterInit(), LayerMod.OnInit(), ContentConfigInput.OnInstantiate(), ContentChronicle.OnSwitchContent(), ContentKeyItem.OnSwitchContent(), ContentQuest.OnSwitchContent(), ContentStatistics.OnSwitchContent(), ContentTop.OnSwitchContent(), LayerDebug.OnSwitchContent(), TraitSkyHelm.OnUse(), WidgetCurrentTool.RebuildSlots(), LayerCollectible.Refresh(), LayerHire.Refresh(), LayerTravel.Refresh(), UIDistribution.Refresh(), UIDragGridIngredients.Refresh(), UIRecipeInfo.Refresh(), WindowCharaMini.Refresh(), LayerHome.RefreshAreas(), PartialMapMenu.RefreshCategory(), LayerNewspaper.RefreshChat(), LayerEquip.RefreshEquipment(), WidgetEquip.RefreshEquipment(), LayerFactions.RefreshFactions(), ContentFaction.RefreshFactions(), LayerHome.RefreshFeat(), LayerQuestBoard.RefreshHire(), LayerMapList.RefreshList(), UIRecipeInfo.RefreshList(), LayerLoadGame.RefreshList(), ContentHomeLog.RefreshLog(), LayerEmbark.RefreshMembers(), LayerNewspaper.RefreshNews(), ContentPolicy.RefreshPolicyList(), LayerPolicy.RefreshPolicyList(), LayerQuestBoard.RefreshQuest(), LayerQuestBoard.RefreshRanking(), UIHomeInfo.RefreshReport(), ContentHomeReport.RefreshResources(), UIHomeInfo.RefreshResources(), WindowChara.RefreshSkill(), LayerHome.RefreshSpots(), WindowChara.RefreshStatic(), LayerTech.RefreshTech(), LayerHome.RefreshTech(), LayerNewspaper.RefreshVote(), LayerNewspaper.RefreshWeather(), WidgetSearch.RefreshWords(), LayerDistribution.SetContainer(), LayerDragGrid.SetInv(), LayerList.SetList2< TValue >(), LayerList.SetListCheck< TValue >(), LayerList.SetStringList(), LayerList.Show(), LayerShippingResult.Show(), and ContentRanking.SwitchRanking().

◆ AddCollection()

void UIList.AddCollection ( ICollection  collection)
inline

Definition at line 346 of file UIList.cs.

347 {
348 foreach (object item in collection)
349 {
350 Add(item);
351 }
352 }
override void Add(object item)
Definition: UIList.cs:354

References Add(), and item.

Referenced by LayerInspect.Refresh().

◆ AddDynamic()

override void UIList.AddDynamic ( object  item)
inlinevirtual

Reimplemented from BaseList.

Definition at line 384 of file UIList.cs.

385 {
386 }

◆ AfterRefresh()

void UIList.AfterRefresh ( )
inlineprivate

Definition at line 645 of file UIList.cs.

646 {
648 if ((bool)paginationTop)
649 {
650 paginationTop.text1.text = page + 1 + " / " + maxPage;
651 }
652 if ((bool)paginationBottom)
653 {
654 paginationBottom.text1.text = page + 1 + " / " + maxPage;
655 }
657 OnRefresh();
658 layoutItems.RebuildLayout();
660 }
void RefreshNoItem()
Definition: BaseList.cs:86
UIList.ICallback callbacks
Definition: BaseList.cs:13
void RefreshBGGrid()
Definition: BaseList.cs:106
int maxPage
Definition: UIList.cs:267
LayoutGroup layoutItems
Definition: UIList.cs:324
virtual void OnRefresh()
Definition: UIList.cs:662
UIItem paginationTop
Definition: UIList.cs:233
UIItem paginationBottom
Definition: UIList.cs:235
int page
Definition: UIList.cs:264

References BaseList.callbacks, layoutItems, maxPage, OnRefresh(), page, paginationBottom, paginationTop, BaseList.RefreshBGGrid(), and BaseList.RefreshNoItem().

Referenced by Refresh(), and RemoveDynamic().

◆ AutoScrollWhileDragging()

void UIList.AutoScrollWhileDragging ( )
inlineprivate

Definition at line 904 of file UIList.cs.

905 {
906 if ((bool)dragViewport && (bool)dragScrollView)
907 {
908 RectTransformUtility.ScreenPointToLocalPointInRectangle(dragViewport, Input.mousePosition, null, out var localPoint);
909 float y = localPoint.y;
910 float num = dragViewport.rect.height * 0.5f;
911 float num2 = 0f;
912 if (y < 0f - num + dragEdgeSize)
913 {
914 float num3 = Mathf.InverseLerp(0f - num + dragEdgeSize, 0f - num, y);
915 num2 = (0f - dragScrollSpeed) * num3;
916 }
917 else if (y > num - dragEdgeSize)
918 {
919 float num4 = Mathf.InverseLerp(num - dragEdgeSize, num, y);
920 num2 = dragScrollSpeed * num4;
921 }
922 if (num2 != 0f)
923 {
924 float verticalNormalizedPosition = dragScrollView.verticalNormalizedPosition;
925 dragScrollView.verticalNormalizedPosition = Mathf.Clamp01(verticalNormalizedPosition + num2 * Time.unscaledDeltaTime);
926 }
927 }
928 }
float dragScrollSpeed
Definition: UIList.cs:322
UIScrollView dragScrollView
Definition: UIList.cs:313
float dragEdgeSize
Definition: UIList.cs:319
RectTransform dragViewport
Definition: UIList.cs:316

References dragEdgeSize, dragScrollSpeed, dragScrollView, and dragViewport.

Referenced by Update().

◆ BeginItemDrag()

void UIList.BeginItemDrag ( UIListDragItem  drag)
inline

Definition at line 865 of file UIList.cs.

866 {
867 if (callbacks.CanDragReorder(drag.item))
868 {
869 dragTarget = drag.item;
870 dragBeginIndex = drag.transform.GetSiblingIndex();
871 }
872 }
int dragBeginIndex
Definition: UIList.cs:308
object dragTarget
Definition: UIList.cs:306

References BaseList.callbacks, dragBeginIndex, dragTarget, and UIListDragItem.item.

Referenced by UIListDragItem.OnBeginDrag().

◆ BuildLayout()

void UIList.BuildLayout ( )
inline

Definition at line 811 of file UIList.cs.

812 {
813 GridLayoutGroup gridLayoutGroup = layoutItems as GridLayoutGroup;
814 if ((bool)gridLayoutGroup && buildLayout)
815 {
816 RectTransform rectTransform = layoutItems.Rect();
817 RectTransform rectTransform2 = layoutItems.Rect();
818 Vector2 vector = (layoutItems.Rect().anchorMax = new Vector2(0f, 1f));
819 Vector2 pivot = (rectTransform2.anchorMin = vector);
820 rectTransform.pivot = pivot;
821 rectTransform.sizeDelta = new Vector2(rectTransform.sizeDelta.x, (float)rows * gridLayoutGroup.cellSize.y);
822 }
823 }
int rows
Definition: UIList.cs:223
bool buildLayout
Definition: UIList.cs:231

References buildLayout, layoutItems, and rows.

Referenced by Refresh().

◆ ChangeSort()

void UIList.ChangeSort ( SortMode  m)
inline

Definition at line 758 of file UIList.cs.

759 {
760 sortMode = m;
761 Sort();
762 Refresh();
763 }
UIList.SortMode sortMode
Definition: BaseList.cs:33
virtual void Refresh(bool highlightLast=false)
Definition: UIList.cs:476
void Sort()
Definition: UIList.cs:750

References Refresh(), Sort(), and BaseList.sortMode.

Referenced by NextSort(), WindowCharaMini.Refresh(), and WindowChara.RefreshSkill().

◆ Clear()

◆ ClearChildren()

void UIList.ClearChildren ( )
inline

Definition at line 853 of file UIList.cs.

854 {
855 if (usePool)
856 {
857 foreach (ButtonPair button in buttons)
858 {
859 PoolManager.TryDespawn(button.component);
860 }
861 }
862 layoutItems.DestroyChildren();
863 }
static bool TryDespawn(Component c)
Definition: PoolManager.cs:143
List< ButtonPair > buttons
Definition: UIList.cs:276
bool usePool
Definition: UIList.cs:253

References buttons, UIList.ButtonPair.component, layoutItems, PoolManager.TryDespawn(), and usePool.

Referenced by OnDestroy(), and Refresh().

◆ Contains()

override bool UIList.Contains ( object  item)
inlinevirtual

Reimplemented from BaseList.

Definition at line 825 of file UIList.cs.

826 {
827 return items.Contains(item);
828 }

References item, and items.

◆ CreateChild()

UIList UIList.CreateChild ( UIButton  button)
inlineprivate

Definition at line 407 of file UIList.cs.

408 {
410 uIList.transform.SetSiblingIndex(button.transform.GetSiblingIndex() + 1);
411 uIList.callbacks = callbacks;
412 uIList.parent = this;
413 children.Add(button, uIList);
414 return uIList;
415 }
Definition: UIList.cs:9
Dictionary< UIButton, UIList > children
Definition: UIList.cs:295
UIList moldList
Definition: UIList.cs:291
Definition: Util.cs:10
static Transform Instantiate(string path, Component parent=null)
Definition: Util.cs:67

References BaseList.callbacks, children, layoutItems, moldList, and Util.

Referenced by OnClickFolder().

◆ EndItemDrag()

void UIList.EndItemDrag ( UIListDragItem  drag)
inline

Definition at line 874 of file UIList.cs.

875 {
876 if (dragTarget != null)
877 {
878 int num = dragHoverIndex - dragBeginIndex;
879 dragTarget = null;
880 if (num != 0)
881 {
882 callbacks.OnDragReorder(drag.item, num);
883 }
884 }
885 }
int dragHoverIndex
Definition: UIList.cs:310

References BaseList.callbacks, dragBeginIndex, dragHoverIndex, dragTarget, and UIListDragItem.item.

Referenced by UIListDragItem.OnEndDrag().

◆ GetIndexOf()

int UIList.GetIndexOf ( object  item)
inline

Definition at line 362 of file UIList.cs.

363 {
364 return items.IndexOf(item);
365 }

References item, and items.

◆ GetMold< T >()

T UIList.GetMold< T > ( )
inline
Type Constraints
T :Component 

Definition at line 830 of file UIList.cs.

830 : Component
831 {
832 if ((bool)moldItem)
833 {
834 T component = moldItem.GetComponent<T>();
835 if ((bool)component)
836 {
837 layoutItems.DestroyChildren();
838 return component;
839 }
840 }
841 return layoutItems.CreateMold<T>(idMold);
842 }
string idMold
Definition: UIList.cs:279
Transform moldItem
Definition: UIList.cs:241

References idMold, layoutItems, and moldItem.

◆ GetPair()

ButtonPair UIList.GetPair ( object  item)
inline

Definition at line 367 of file UIList.cs.

368 {
369 foreach (ButtonPair button in buttons)
370 {
371 if (button.obj == item)
372 {
373 return button;
374 }
375 }
376 return buttons[0];
377 }

References buttons, item, and UIList.ButtonPair.obj.

Referenced by GetPair< T >(), RemoveDynamic(), and UpdateItemDragHover().

◆ GetPair< T >()

T UIList.GetPair< T > ( object  item)
inline
Type Constraints
T :Component 

Definition at line 379 of file UIList.cs.

379 : Component
380 {
381 return GetPair(item).component as T;
382 }
ButtonPair GetPair(object item)
Definition: UIList.cs:367
Component component
Definition: UIList.cs:216

References UIList.ButtonPair.component, GetPair(), and item.

◆ KillChildren()

void UIList.KillChildren ( )
inlineprivate

Definition at line 442 of file UIList.cs.

443 {
444 foreach (UIList value in children.Values)
445 {
446 value.KillChildren();
447 }
448 UnityEngine.Object.DestroyImmediate(base.gameObject);
449 }
void KillChildren()
Definition: UIList.cs:442

References children, and KillChildren().

Referenced by KillChildren().

◆ List() [1/4]

◆ List() [2/4]

void UIList.List ( bool  refreshHighlight = false)
inline

Definition at line 780 of file UIList.cs.

781 {
782 List(sortMode, refreshHighlight);
783 }

References List(), and BaseList.sortMode.

◆ List() [3/4]

void UIList.List ( SortMode  m,
bool  refreshHighlight = false 
)
inline

Definition at line 785 of file UIList.cs.

786 {
787 sortMode = m;
788 Clear();
789 callbacks.OnList(sortMode);
790 Refresh(refreshHighlight);
791 }
override void Clear()
Definition: UIList.cs:401

References BaseList.callbacks, Clear(), Refresh(), and BaseList.sortMode.

◆ List() [4/4]

override void UIList.List ( SortMode  sort)
inlinevirtual

Reimplemented from BaseList.

Definition at line 775 of file UIList.cs.

776 {
777 List(sort);
778 }

References List().

◆ NextPage()

void UIList.NextPage ( )
inline

Definition at line 666 of file UIList.cs.

667 {
668 SetPage(page + 1);
669 }
void SetPage(int i)
Definition: UIList.cs:676

References page, and SetPage().

Referenced by Refresh().

◆ NextSort()

override void UIList.NextSort ( )
inlinevirtual

Reimplemented from BaseList.

Definition at line 765 of file UIList.cs.

766 {
767 ChangeSort(sorts.NextItem(sortMode));
768 }
UIList.SortMode[] sorts
Definition: BaseList.cs:15
void ChangeSort(SortMode m)
Definition: UIList.cs:758

References ChangeSort(), BaseList.sortMode, and BaseList.sorts.

◆ OnClickFolder()

bool UIList.OnClickFolder ( UIButton  b,
Action< UIList onFold,
bool  refresh = true 
)
inline

Definition at line 417 of file UIList.cs.

418 {
419 if (children.ContainsKey(b))
420 {
421 RemoveChild(b);
422 return true;
423 }
424 UIList uIList = CreateChild(b);
425 onFold(uIList);
426 uIList.Refresh();
427 if (refresh)
428 {
429 GetComponentInParent<ScrollRect>().RebuildLayout(recursive: true);
430 }
431 return false;
432 }
UIList CreateChild(UIButton button)
Definition: UIList.cs:407
void RemoveChild(UIButton button)
Definition: UIList.cs:434

References children, CreateChild(), Refresh(), and RemoveChild().

◆ OnDestroy()

void UIList.OnDestroy ( )
inline

Definition at line 844 of file UIList.cs.

845 {
847 if ((bool)transNoItem)
848 {
849 UnityEngine.Object.DestroyImmediate(transNoItem.gameObject);
850 }
851 }
Transform transNoItem
Definition: BaseList.cs:25
void ClearChildren()
Definition: UIList.cs:853

References ClearChildren(), and BaseList.transNoItem.

◆ OnMove()

override void UIList.OnMove ( object  o,
object  select = null 
)
inlinevirtual

Reimplemented from BaseList.

Definition at line 690 of file UIList.cs.

691 {
692 List();
693 Select(select ?? o);
694 SE.Click();
695 }
void Select(int index=0, bool invoke=false)
Definition: UIList.cs:697

References List(), and Select().

◆ OnRefresh()

virtual void UIList.OnRefresh ( )
inlineprotectedvirtual

Definition at line 662 of file UIList.cs.

663 {
664 }

Referenced by AfterRefresh().

◆ OnSelect()

void UIList.OnSelect ( UIList  activeList)
inlineprivate

Definition at line 464 of file UIList.cs.

465 {
466 foreach (UIList value in children.Values)
467 {
468 value.OnSelect(activeList);
469 }
470 if (this != activeList && (bool)group)
471 {
472 group.Select(-1);
473 }
474 }
void OnSelect(UIList activeList)
Definition: UIList.cs:464
UISelectableGroup group
Definition: UIList.cs:237
void Select(UIButton button, bool check=true)

References children, group, OnSelect(), and UISelectableGroup.Select().

Referenced by OnSelect(), and Refresh().

◆ PrevPage()

void UIList.PrevPage ( )
inline

Definition at line 671 of file UIList.cs.

672 {
673 SetPage(page - 1);
674 }

References page, and SetPage().

Referenced by Refresh().

◆ RebuildLayoutInParent()

void UIList.RebuildLayoutInParent ( )
inline

Definition at line 451 of file UIList.cs.

452 {
453 this.RebuildLayout();
454 if ((bool)parent)
455 {
456 parent.RebuildLayout();
457 }
458 else
459 {
460 base.transform.parent.RebuildLayout();
461 }
462 }
UIList parent
Definition: UIList.cs:293

References parent.

Referenced by RemoveChild().

◆ Redraw()

override void UIList.Redraw ( )
inlinevirtual

Reimplemented from BaseList.

Definition at line 793 of file UIList.cs.

794 {
795 if (onBeforeRedraw != null)
796 {
798 }
799 int num = 0;
800 foreach (ButtonPair button in buttons)
801 {
802 callbacks.OnRedraw(button.obj, button.component, num);
803 num++;
804 }
805 if (onAfterRedraw != null)
806 {
808 }
809 }
Action onAfterRedraw
Definition: BaseList.cs:19
Action onBeforeRedraw
Definition: BaseList.cs:17

References buttons, BaseList.callbacks, UIList.ButtonPair.component, UIList.ButtonPair.obj, BaseList.onAfterRedraw, and BaseList.onBeforeRedraw.

Referenced by WidgetEquip._Redraw(), WidgetCurrentTool.CheckDirty(), DropdownGrid.OnChangeIngredient(), WidgetCurrentTool.RebuildSlots(), DropdownGrid.Redraw(), LayerEquip.Redraw(), UIMagicChest.Redraw(), UIInventory.RefreshAllList(), and UIRecipeInfo.RefreshImages().

◆ Refresh()

virtual void UIList.Refresh ( bool  highlightLast = false)
inlinevirtual

Reimplemented in UIListEx< T >.

Definition at line 476 of file UIList.cs.

477 {
478 if (!layoutItems)
479 {
480 return;
481 }
483 if (skinType != SkinType.Default)
484 {
485 SkinManager.tempSkin = SkinManager.CurrentSkin.GetSkin(skinType);
486 }
487 highlightIndex = -1;
488 if (highlightLast)
489 {
490 UIButton componentOf = InputModuleEX.GetComponentOf<UIButton>();
491 if ((bool)componentOf)
492 {
493 Component component = componentOf.transform.parent.GetComponent<UIItem>();
494 if (component == null)
495 {
496 component = componentOf;
497 }
498 for (int i = 0; i < buttons.Count; i++)
499 {
500 if (buttons[i].component == component)
501 {
502 highlightIndex = i;
503 break;
504 }
505 }
506 }
507 }
508 callbacks.SetList(this);
509 if (!enableGroup && (bool)group)
510 {
511 UnityEngine.Object.DestroyImmediate(group);
512 }
513 if (!usePage)
514 {
515 maxPage = 9999999;
516 }
517 callbacks.CreateMold();
518 if (itemHeight == ItemHeight.Default)
519 {
520 RectTransform rectTransform = callbacks.GetMold().Rect();
521 rectTransform.sizeDelta = new Vector2(rectTransform.sizeDelta.x, 34 + heightFix);
522 }
523 if (!initialized || reset)
524 {
525 if (sortMode != SortMode.ByNone)
526 {
527 Sort();
528 }
529 if (!initialized)
530 {
531 if ((bool)paginationTop && (bool)paginationTop.button1)
532 {
533 paginationTop.button1.onClick.AddListener(PrevPage);
534 paginationTop.button2.onClick.AddListener(NextPage);
535 }
536 if ((bool)paginationBottom && (bool)paginationBottom.button1)
537 {
538 paginationBottom.button1.onClick.AddListener(PrevPage);
539 paginationBottom.button2.onClick.AddListener(NextPage);
540 }
541 _ = (bool)bar;
542 }
543 initialized = true;
544 reset = false;
545 }
546 children.Clear();
547 buttons.Clear();
548 GridLayoutGroup gridLayoutGroup = layoutItems as GridLayoutGroup;
549 BuildLayout();
550 if (usePage)
551 {
552 if ((bool)gridLayoutGroup)
553 {
554 itemsPerPage = gridLayoutGroup.constraintCount;
555 }
556 else
557 {
559 }
560 this.Rect().RebuildLayout();
561 this.Rect().ForceUpdateRectTransforms();
562 Canvas.ForceUpdateCanvases();
563 float y = RectTransformUtility.PixelAdjustRect(this.Rect(), GetComponentInParent<Canvas>()).size.y;
564 float y2 = callbacks.GetMold().Rect().sizeDelta.y;
565 Debug.Log(y2);
566 Debug.Log(y);
567 itemsPerPage = (int)(y / y2);
568 }
569 else
570 {
571 itemsPerPage = 99999;
572 }
574 maxPage = (items.Count - 1) / itemsPerPage + 1;
575 if (usePage)
576 {
577 while (page > 0 && page * itemsPerPage >= items.Count)
578 {
579 page--;
580 }
581 }
582 for (int j = 0; j < itemsPerPage; j++)
583 {
584 int num = page * itemsPerPage + j;
585 if (num >= items.Count)
586 {
587 if (fillEmpty)
588 {
589 new GameObject().AddComponent<RectTransform>().SetParent(layoutItems.transform, worldPositionStays: false);
590 }
591 continue;
592 }
593 object item = items[num];
594 Component comp = callbacks.Instantiate(item, layoutItems.transform);
595 callbacks.OnRedraw(item, comp, j);
596 ButtonPair item2 = new ButtonPair
597 {
598 obj = item,
599 component = comp
600 };
601 UIButton uIButton = comp as UIButton;
602 if (!uIButton)
603 {
604 UIItem uIItem = comp as UIItem;
605 if ((bool)uIItem)
606 {
607 uIButton = uIItem.button1;
608 }
609 }
610 if ((bool)uIButton)
611 {
612 if (numbering && (bool)uIButton.keyText)
613 {
614 uIButton.keyText.text = strNumber[j % strNumber.Length];
615 }
616 uIButton.onClick.AddListener(delegate
617 {
618 Root.OnSelect(this);
619 callbacks.OnClick(item, comp);
620 });
621 if (highlightIndex == j)
622 {
623 uIButton.DoHighlightTransition();
624 }
625 }
626 buttons.Add(item2);
627 }
628 AfterRefresh();
629 if ((bool)group)
630 {
632 }
634 {
635 UIButton componentInChildren = layoutItems.GetComponentInChildren<UIButton>();
636 if ((bool)componentInChildren)
637 {
638 componentInChildren.onClick.Invoke();
639 }
640 }
641 isBuilt = true;
642 SkinManager.tempSkin = tempSkin;
643 }
SkinType
Definition: SkinType.cs:2
bool isBuilt
Definition: BaseList.cs:36
bool numbering
Definition: BaseList.cs:23
SkinType skinType
Definition: BaseList.cs:27
static SkinRootStatic CurrentSkin
Definition: SkinManager.cs:82
static SkinRootStatic tempSkin
Definition: SkinManager.cs:63
SkinRootStatic GetSkin(SkinType type)
Definition: UIItem.cs:5
UIButton button1
Definition: UIItem.cs:18
UIButton button2
Definition: UIItem.cs:20
void BuildLayout()
Definition: UIList.cs:811
ItemHeight itemHeight
Definition: UIList.cs:259
void NextPage()
Definition: UIList.cs:666
bool invokeSelected
Definition: UIList.cs:245
UIListTopbar bar
Definition: UIList.cs:227
ItemHeight
Definition: UIList.cs:48
int itemsPerPage
Definition: UIList.cs:270
bool selectFirst
Definition: UIList.cs:243
bool fillEmpty
Definition: UIList.cs:229
bool usePage
Definition: UIList.cs:251
int highlightIndex
Definition: UIList.cs:304
bool onlyDirectChildrenButtonForGroup
Definition: UIList.cs:249
SortMode
Definition: UIList.cs:27
bool initialized
Definition: UIList.cs:287
static string[] strNumber
Definition: UIList.cs:297
bool enableGroup
Definition: UIList.cs:247
void PrevPage()
Definition: UIList.cs:671
void AfterRefresh()
Definition: UIList.cs:645
int heightFix
Definition: UIList.cs:261
UIList Root
Definition: UIList.cs:333
virtual void Init(int index=0, UnityAction< int > action=null, bool directChildren=false)

References AfterRefresh(), bar, BuildLayout(), UIItem.button1, UIItem.button2, buttons, BaseList.callbacks, children, ClearChildren(), SkinManager.CurrentSkin, Debug, UIButton.DoHighlightTransition(), enableGroup, fillEmpty, SkinRootStatic.GetSkin(), group, heightFix, highlightIndex, UISelectableGroup.Init(), initialized, invokeSelected, BaseList.isBuilt, item, itemHeight, items, itemsPerPage, UIButton.keyText, layoutItems, maxPage, NextPage(), BaseList.numbering, onlyDirectChildrenButtonForGroup, OnSelect(), page, paginationBottom, paginationTop, PrevPage(), reset, Root, rows, selectFirst, BaseList.skinType, Sort(), BaseList.sortMode, strNumber, SkinManager.tempSkin, and usePage.

Referenced by DropdownGrid.Activate(), DropdownGrid.Build(), DropdownGrid.BuildIngredients(), ChangeSort(), List(), Dialog.OnAfterInit(), OnClickFolder(), ContentChronicle.OnSwitchContent(), ContentStatistics.OnSwitchContent(), ContentTop.OnSwitchContent(), LayerDebug.OnSwitchContent(), WidgetCurrentTool.RebuildSlots(), LayerCollectible.Refresh(), LayerHire.Refresh(), LayerInspect.Refresh(), UIDistribution.Refresh(), UIRecipeInfo.Refresh(), LayerGacha.RefreshCoin(), LayerFactions.RefreshFactions(), ContentFaction.RefreshFactions(), LayerQuestBoard.RefreshHire(), UIRecipeInfo.RefreshList(), LayerLoadGame.RefreshList(), ContentHomeLog.RefreshLog(), LayerEmbark.RefreshMembers(), LayerQuestBoard.RefreshQuest(), LayerQuestBoard.RefreshRanking(), WindowChara.RefreshStatic(), LayerDistribution.SetContainer(), SetPage(), LayerShippingResult.Show(), and ContentRanking.SwitchRanking().

◆ RemoveChild()

void UIList.RemoveChild ( UIButton  button)
inlineprivate

Definition at line 434 of file UIList.cs.

435 {
436 children[button].KillChildren();
437 children.Remove(button);
439 GetComponentInParent<ScrollRect>().RebuildLayout(recursive: true);
440 }
void RebuildLayoutInParent()
Definition: UIList.cs:451

References children, and RebuildLayoutInParent().

Referenced by OnClickFolder().

◆ RemoveDynamic()

override void UIList.RemoveDynamic ( object  item)
inlinevirtual

Reimplemented from BaseList.

Definition at line 388 of file UIList.cs.

389 {
390 BaseCore.Instance.StopEventSystem(GetPair(item).component, delegate
391 {
392 items.Remove(item);
393 ButtonPair item2 = buttons.First((ButtonPair a) => a.obj == item);
394 buttons.IndexOf(item2);
395 buttons.Remove(item2);
396 UnityEngine.Object.DestroyImmediate(item2.component.gameObject);
397 AfterRefresh();
398 });
399 }
static BaseCore Instance
Definition: BaseCore.cs:11
virtual void StopEventSystem(float duration=0.2f)
Definition: BaseCore.cs:72

References AfterRefresh(), buttons, UIList.ButtonPair.component, GetPair(), BaseCore.Instance, item, items, UIList.ButtonPair.obj, and BaseCore.StopEventSystem().

◆ Select() [1/2]

void UIList.Select ( int  index = 0,
bool  invoke = false 
)
inline

Definition at line 697 of file UIList.cs.

698 {
699 if (buttons.Count < 0)
700 {
701 return;
702 }
703 ButtonPair buttonPair = buttons[Mathf.Clamp(index, 0, buttons.Count - 1)];
704 UIButton uIButton = buttonPair.component as UIButton;
705 if (!uIButton)
706 {
707 uIButton = (buttonPair.component as UIItem)?.button1;
708 }
709 if ((bool)uIButton)
710 {
711 if (invoke)
712 {
713 uIButton.onClick.Invoke();
714 }
715 if ((bool)uIButton.group)
716 {
717 uIButton.group.Select(uIButton);
718 }
719 else
720 {
721 uIButton.DoHighlightTransition();
722 }
723 }
724 }
void DoHighlightTransition(bool instant=false)
Definition: UIButton.cs:526
UISelectableGroup group
Definition: UIButton.cs:126

References buttons, UIButton.DoHighlightTransition(), UIButton.group, and UISelectableGroup.Select().

Referenced by PartialMapMenu.Init(), LayerResource.OnInit(), OnMove(), ContentQuest.OnSwitchContent(), PartialMapMenu.RefreshCategory(), LayerLoadGame.RefreshList(), Select(), and Select< T >().

◆ Select() [2/2]

void UIList.Select ( object  obj,
bool  invoke = false 
)
inline

Definition at line 726 of file UIList.cs.

727 {
728 for (int i = 0; i < items.Count; i++)
729 {
730 if (obj == items[i])
731 {
732 Select(i, invoke);
733 break;
734 }
735 }
736 }

References items, and Select().

◆ Select< T >()

void UIList.Select< T > ( Func< T, bool >  func,
bool  invoke = false 
)
inline

Definition at line 738 of file UIList.cs.

739 {
740 for (int i = 0; i < items.Count; i++)
741 {
742 if (func((T)items[i]))
743 {
744 Select(i, invoke);
745 break;
746 }
747 }
748 }

References items, and Select().

◆ SetPage()

void UIList.SetPage ( int  i)
inline

Definition at line 676 of file UIList.cs.

677 {
678 if (i < 0)
679 {
680 i = maxPage - 1;
681 }
682 else if (i >= maxPage)
683 {
684 i = 0;
685 }
686 page = i;
687 Refresh();
688 }

References maxPage, page, and Refresh().

Referenced by NextPage(), and PrevPage().

◆ Sort()

void UIList.Sort ( )
inline

Definition at line 750 of file UIList.cs.

751 {
752 if (callbacks.useSort)
753 {
754 items.Sort((object a, object b) => callbacks.OnSort(b, sortMode) - callbacks.OnSort(a, sortMode));
755 }
756 }

References BaseList.callbacks, items, and BaseList.sortMode.

Referenced by ChangeSort(), DramaCustomSequence.GetListGuide(), UIDragGridIngredients.Refresh(), Refresh(), and LayerQuestBoard.RefreshRanking().

◆ Update()

void UIList.Update ( )
inlineprivate

Definition at line 896 of file UIList.cs.

897 {
898 if (IsDragging)
899 {
901 }
902 }
void AutoScrollWhileDragging()
Definition: UIList.cs:904
bool IsDragging
Definition: UIList.cs:344

References AutoScrollWhileDragging(), and IsDragging.

◆ UpdateItemDragHover()

void UIList.UpdateItemDragHover ( UIListDragItem  drag)
inline

Definition at line 887 of file UIList.cs.

888 {
889 if (callbacks.CanDragReorder(drag.item) && dragTarget != null && dragTarget != drag.item)
890 {
891 dragHoverIndex = drag.transform.GetSiblingIndex();
892 GetPair(dragTarget).component?.transform.SetSiblingIndex(dragHoverIndex);
893 }
894 }

References BaseList.callbacks, UIList.ButtonPair.component, dragHoverIndex, dragTarget, GetPair(), and UIListDragItem.item.

Referenced by UIListDragItem.OnPointerEnter().

Member Data Documentation

◆ _layoutItems

LayoutGroup UIList._layoutItems

Definition at line 239 of file UIList.cs.

◆ bar

UIListTopbar UIList.bar

Definition at line 227 of file UIList.cs.

Referenced by Refresh().

◆ buildLayout

bool UIList.buildLayout

Definition at line 231 of file UIList.cs.

Referenced by BuildLayout().

◆ buttons

◆ children

Dictionary<UIButton, UIList> UIList.children = new Dictionary<UIButton, UIList>()

Definition at line 295 of file UIList.cs.

Referenced by CreateChild(), KillChildren(), OnClickFolder(), OnSelect(), Refresh(), and RemoveChild().

◆ disableInstaClick

bool UIList.disableInstaClick = true

Definition at line 255 of file UIList.cs.

Referenced by UIList.Callback< T1, T2 >.Instantiate().

◆ dragBeginIndex

int UIList.dragBeginIndex
private

Definition at line 308 of file UIList.cs.

Referenced by BeginItemDrag(), and EndItemDrag().

◆ dragEdgeSize

float UIList.dragEdgeSize

Definition at line 319 of file UIList.cs.

Referenced by AutoScrollWhileDragging().

◆ dragHoverIndex

int UIList.dragHoverIndex
private

Definition at line 310 of file UIList.cs.

Referenced by EndItemDrag(), and UpdateItemDragHover().

◆ dragScrollSpeed

float UIList.dragScrollSpeed = 2.5f

Definition at line 322 of file UIList.cs.

Referenced by AutoScrollWhileDragging().

◆ dragScrollView

UIScrollView UIList.dragScrollView

Definition at line 313 of file UIList.cs.

Referenced by AutoScrollWhileDragging().

◆ dragTarget

object UIList.dragTarget
private

Definition at line 306 of file UIList.cs.

Referenced by BeginItemDrag(), EndItemDrag(), and UpdateItemDragHover().

◆ dragViewport

RectTransform UIList.dragViewport

Definition at line 316 of file UIList.cs.

Referenced by AutoScrollWhileDragging().

◆ enableGroup

bool UIList.enableGroup = true

Definition at line 247 of file UIList.cs.

Referenced by Refresh().

◆ fillEmpty

bool UIList.fillEmpty

Definition at line 229 of file UIList.cs.

Referenced by Refresh().

◆ group

UISelectableGroup UIList.group

Definition at line 237 of file UIList.cs.

Referenced by UIRecipeInfo.OnRotate(), OnSelect(), UIRecipeInfo.Refresh(), and Refresh().

◆ HeightDefault

const int UIList.HeightDefault = 34
static

Definition at line 285 of file UIList.cs.

◆ heightFix

int UIList.heightFix

Definition at line 261 of file UIList.cs.

Referenced by Refresh().

◆ highlightIndex

int UIList.highlightIndex
private

Definition at line 304 of file UIList.cs.

Referenced by Refresh().

◆ idMold

string UIList.idMold

Definition at line 279 of file UIList.cs.

Referenced by GetMold< T >().

◆ ignoreNullObj

bool UIList.ignoreNullObj = true

Definition at line 257 of file UIList.cs.

Referenced by Add().

◆ initialized

bool UIList.initialized
private

Definition at line 287 of file UIList.cs.

Referenced by Refresh().

◆ invokeSelected

bool UIList.invokeSelected

Definition at line 245 of file UIList.cs.

Referenced by Refresh().

◆ itemHeight

ItemHeight UIList.itemHeight

Definition at line 259 of file UIList.cs.

Referenced by Refresh().

◆ items

◆ itemsPerPage

int UIList.itemsPerPage

Definition at line 270 of file UIList.cs.

Referenced by Refresh().

◆ langNoItem

string UIList.langNoItem

Definition at line 221 of file UIList.cs.

◆ maxPage

int UIList.maxPage

Definition at line 267 of file UIList.cs.

Referenced by AfterRefresh(), Refresh(), and SetPage().

◆ menu

UISelectableGroup UIList.menu

Definition at line 225 of file UIList.cs.

◆ moldItem

Transform UIList.moldItem

Definition at line 241 of file UIList.cs.

Referenced by GetMold< T >().

◆ moldList

UIList UIList.moldList

Definition at line 291 of file UIList.cs.

Referenced by CreateChild().

◆ onlyDirectChildrenButtonForGroup

bool UIList.onlyDirectChildrenButtonForGroup

Definition at line 249 of file UIList.cs.

Referenced by Refresh().

◆ page

int UIList.page

Definition at line 264 of file UIList.cs.

Referenced by AfterRefresh(), NextPage(), PrevPage(), Refresh(), and SetPage().

◆ paginationBottom

UIItem UIList.paginationBottom

Definition at line 235 of file UIList.cs.

Referenced by AfterRefresh(), and Refresh().

◆ paginationTop

UIItem UIList.paginationTop

Definition at line 233 of file UIList.cs.

Referenced by AfterRefresh(), and Refresh().

◆ parent

◆ reset

bool UIList.reset
private

Definition at line 289 of file UIList.cs.

Referenced by Clear(), and Refresh().

◆ rows

int UIList.rows

Definition at line 223 of file UIList.cs.

Referenced by BuildLayout(), and Refresh().

◆ selectFirst

bool UIList.selectFirst

Definition at line 243 of file UIList.cs.

Referenced by Refresh().

◆ SETab

Action UIList.SETab
Initial value:
= delegate
{
}

Definition at line 281 of file UIList.cs.

◆ strNumber

string [] UIList.strNumber
static
Initial value:
= new string[26]
{
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j",
"k", "l", "m", "n", "o", "p", "q", "r", "s", "t",
"u", "v", "w", "x", "y", "z"
}

Definition at line 297 of file UIList.cs.

Referenced by Refresh().

◆ usePage

bool UIList.usePage

Definition at line 251 of file UIList.cs.

Referenced by Refresh().

◆ usePool

bool UIList.usePool

Definition at line 253 of file UIList.cs.

Referenced by ClearChildren().

Property Documentation

◆ gridLayout

GridLayoutGroup UIList.gridLayout
get

Definition at line 326 of file UIList.cs.

◆ IsDragging

bool UIList.IsDragging
get

Definition at line 344 of file UIList.cs.

Referenced by Update().

◆ ItemCount

override int UIList.ItemCount
get

Definition at line 328 of file UIList.cs.

◆ layoutItems

LayoutGroup UIList.layoutItems
get

Definition at line 324 of file UIList.cs.

Referenced by AfterRefresh(), BuildLayout(), ClearChildren(), CreateChild(), GetMold< T >(), and Refresh().

◆ Root

UIList UIList.Root
get

Definition at line 332 of file UIList.cs.

333 {
334 get
335 {
336 if (!parent)
337 {
338 return this;
339 }
340 return parent.Root;
341 }
342 }

Referenced by Refresh().

◆ RowCount

override int UIList.RowCount
get

Definition at line 330 of file UIList.cs.


The documentation for this class was generated from the following file: