Elin Decompiled Documentation EA 23.287 Stable
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(), 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(), 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 644 of file UIList.cs.

645 {
647 if ((bool)paginationTop)
648 {
649 paginationTop.text1.text = page + 1 + " / " + maxPage;
650 }
651 if ((bool)paginationBottom)
652 {
653 paginationBottom.text1.text = page + 1 + " / " + maxPage;
654 }
656 OnRefresh();
657 layoutItems.RebuildLayout();
659 }
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:661
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 903 of file UIList.cs.

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

865 {
866 if (callbacks.CanDragReorder(drag.item))
867 {
868 dragTarget = drag.item;
869 dragBeginIndex = drag.transform.GetSiblingIndex();
870 }
871 }
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 810 of file UIList.cs.

811 {
812 GridLayoutGroup gridLayoutGroup = layoutItems as GridLayoutGroup;
813 if ((bool)gridLayoutGroup && buildLayout)
814 {
815 RectTransform rectTransform = layoutItems.Rect();
816 RectTransform rectTransform2 = layoutItems.Rect();
817 Vector2 vector2 = (layoutItems.Rect().anchorMax = new Vector2(0f, 1f));
818 Vector2 pivot = (rectTransform2.anchorMin = vector2);
819 rectTransform.pivot = pivot;
820 rectTransform.sizeDelta = new Vector2(rectTransform.sizeDelta.x, (float)rows * gridLayoutGroup.cellSize.y);
821 }
822 }
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 757 of file UIList.cs.

758 {
759 sortMode = m;
760 Sort();
761 Refresh();
762 }
list. Refresh()
UIList.SortMode sortMode
Definition: BaseList.cs:33
void Sort()
Definition: UIList.cs:749

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

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

◆ Clear()

◆ ClearChildren()

void UIList.ClearChildren ( )
inline

Definition at line 852 of file UIList.cs.

853 {
854 if (usePool)
855 {
856 foreach (ButtonPair button in buttons)
857 {
858 PoolManager.TryDespawn(button.component);
859 }
860 }
861 layoutItems.DestroyChildren();
862 }
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 824 of file UIList.cs.

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

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 873 of file UIList.cs.

874 {
875 if (dragTarget != null)
876 {
877 int num = dragHoverIndex - dragBeginIndex;
878 dragTarget = null;
879 if (num != 0)
880 {
881 callbacks.OnDragReorder(drag.item, num);
882 }
883 }
884 }
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 829 of file UIList.cs.

829 : Component
830 {
831 if ((bool)moldItem)
832 {
833 T component = moldItem.GetComponent<T>();
834 if ((bool)component)
835 {
836 layoutItems.DestroyChildren();
837 return component;
838 }
839 }
840 return layoutItems.CreateMold<T>(idMold);
841 }
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 779 of file UIList.cs.

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

References List(), and BaseList.sortMode.

◆ List() [3/4]

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

Definition at line 784 of file UIList.cs.

785 {
786 sortMode = m;
787 Clear();
788 callbacks.OnList(sortMode);
789 Refresh(refreshHighlight);
790 }
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 774 of file UIList.cs.

775 {
776 List(sort);
777 }

References List().

◆ NextPage()

void UIList.NextPage ( )
inline

Definition at line 665 of file UIList.cs.

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

References page, and SetPage().

Referenced by Refresh().

◆ NextSort()

override void UIList.NextSort ( )
inlinevirtual

Reimplemented from BaseList.

Definition at line 764 of file UIList.cs.

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

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
virtual void Refresh(bool highlightLast=false)
Definition: UIList.cs:476

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

◆ OnDestroy()

void UIList.OnDestroy ( )
inline

Definition at line 843 of file UIList.cs.

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

References ClearChildren(), and BaseList.transNoItem.

◆ OnMove()

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

Reimplemented from BaseList.

Definition at line 689 of file UIList.cs.

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

References List(), and Select().

◆ OnRefresh()

virtual void UIList.OnRefresh ( )
inlineprotectedvirtual

Definition at line 661 of file UIList.cs.

662 {
663 }

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 670 of file UIList.cs.

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

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 792 of file UIList.cs.

793 {
794 if (onBeforeRedraw != null)
795 {
797 }
798 int num = 0;
799 foreach (ButtonPair button in buttons)
800 {
801 callbacks.OnRedraw(button.obj, button.component, num);
802 num++;
803 }
804 if (onAfterRedraw != null)
805 {
807 }
808 }
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 != 0)
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 != 0)
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 buttonPair = default(ButtonPair);
597 buttonPair.obj = item;
598 buttonPair.component = comp;
599 ButtonPair item2 = buttonPair;
600 UIButton uIButton = comp as UIButton;
601 if (!uIButton)
602 {
603 UIItem uIItem = comp as UIItem;
604 if ((bool)uIItem)
605 {
606 uIButton = uIItem.button1;
607 }
608 }
609 if ((bool)uIButton)
610 {
611 if (numbering && (bool)uIButton.keyText)
612 {
613 uIButton.keyText.text = strNumber[j % strNumber.Length];
614 }
615 uIButton.onClick.AddListener(delegate
616 {
617 Root.OnSelect(this);
618 callbacks.OnClick(item, comp);
619 });
620 if (highlightIndex == j)
621 {
622 uIButton.DoHighlightTransition();
623 }
624 }
625 buttons.Add(item2);
626 }
627 AfterRefresh();
628 if ((bool)group)
629 {
631 }
633 {
634 UIButton componentInChildren = layoutItems.GetComponentInChildren<UIButton>();
635 if ((bool)componentInChildren)
636 {
637 componentInChildren.onClick.Invoke();
638 }
639 }
640 isBuilt = true;
641 SkinManager.tempSkin = tempSkin;
642 }
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:810
ItemHeight itemHeight
Definition: UIList.cs:259
void NextPage()
Definition: UIList.cs:665
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
bool initialized
Definition: UIList.cs:287
static string[] strNumber
Definition: UIList.cs:297
bool enableGroup
Definition: UIList.cs:247
void PrevPage()
Definition: UIList.cs:670
void AfterRefresh()
Definition: UIList.cs:644
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(), 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(), 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 696 of file UIList.cs.

697 {
698 if (buttons.Count < 0)
699 {
700 return;
701 }
702 ButtonPair buttonPair = buttons[Mathf.Clamp(index, 0, buttons.Count - 1)];
703 UIButton uIButton = buttonPair.component as UIButton;
704 if (!uIButton)
705 {
706 uIButton = (buttonPair.component as UIItem)?.button1;
707 }
708 if ((bool)uIButton)
709 {
710 if (invoke)
711 {
712 uIButton.onClick.Invoke();
713 }
714 if ((bool)uIButton.group)
715 {
716 uIButton.group.Select(uIButton);
717 }
718 else
719 {
720 uIButton.DoHighlightTransition();
721 }
722 }
723 }
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 725 of file UIList.cs.

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

References items, and Select().

◆ Select< T >()

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

Definition at line 737 of file UIList.cs.

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

References items, and Select().

◆ SetPage()

void UIList.SetPage ( int  i)
inline

Definition at line 675 of file UIList.cs.

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

References maxPage, page, and Refresh().

Referenced by NextPage(), and PrevPage().

◆ Sort()

void UIList.Sort ( )
inline

Definition at line 749 of file UIList.cs.

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

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 895 of file UIList.cs.

896 {
897 if (IsDragging)
898 {
900 }
901 }
void AutoScrollWhileDragging()
Definition: UIList.cs:903
bool IsDragging
Definition: UIList.cs:344

References AutoScrollWhileDragging(), and IsDragging.

◆ UpdateItemDragHover()

void UIList.UpdateItemDragHover ( UIListDragItem  drag)
inline

Definition at line 886 of file UIList.cs.

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

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: