Elin Decompiled Documentation EA 23.350.1 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)
 
T 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)
 
T 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< ButtonPair > buttons = new List<ButtonPair>()
 
string idMold
 
Action SETab
 
UIList moldList
 
UIList parent
 
Dictionary< UIButton, UIList > children = new Dictionary<UIButton, UIList>()
 
UIScrollView dragScrollView
 
RectTransform dragViewport
 
float dragEdgeSize
 
float dragScrollSpeed = 2.5f
 
Action< object > onDragBegin
 
- 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 357 of file UIList.cs.

358 {
359 if (item != null || !ignoreNullObj)
360 {
361 items.Add(item);
362 }
363 }
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(), LayerMod.CreateCallbacks(), DramaCustomSequence.GetListGuide(), LayerInspect.GetMenuItems(), UIDragGridInfo.Init(), UIDragGridInfo.InitFuel(), Dialog.OnAfterInit(), 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(), LayerMod.ShowInfo(), and ContentRanking.SwitchRanking().

◆ AddCollection()

void UIList.AddCollection ( ICollection  collection)
inline

Definition at line 349 of file UIList.cs.

350 {
351 foreach (object item in collection)
352 {
353 Add(item);
354 }
355 }
override void Add(object item)
Definition: UIList.cs:357

References Add(), and item.

Referenced by LayerInspect.Refresh().

◆ AddDynamic()

override void UIList.AddDynamic ( object  item)
inlinevirtual

Reimplemented from BaseList.

Definition at line 387 of file UIList.cs.

388 {
389 }

◆ AfterRefresh()

void UIList.AfterRefresh ( )
inlineprivate

Definition at line 648 of file UIList.cs.

649 {
651 if ((bool)paginationTop)
652 {
653 paginationTop.text1.text = page + 1 + " / " + maxPage;
654 }
655 if ((bool)paginationBottom)
656 {
657 paginationBottom.text1.text = page + 1 + " / " + maxPage;
658 }
660 OnRefresh();
661 layoutItems.RebuildLayout();
663 }
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:327
virtual void OnRefresh()
Definition: UIList.cs:665
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 905 of file UIList.cs.

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

869 {
870 if (callbacks.CanDragReorder(drag.item))
871 {
872 dragTarget = drag.item;
873 dragBeginIndex = (dragHoverIndex = drag.transform.GetSiblingIndex());
874 onDragBegin?.Invoke(drag.item);
875 }
876 }
int dragBeginIndex
Definition: UIList.cs:308
int dragHoverIndex
Definition: UIList.cs:310
object dragTarget
Definition: UIList.cs:306
Action< object > onDragBegin
Definition: UIList.cs:325

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

Referenced by UIListDragItem.OnBeginDrag().

◆ BuildLayout()

void UIList.BuildLayout ( )
inline

Definition at line 814 of file UIList.cs.

815 {
816 GridLayoutGroup gridLayoutGroup = layoutItems as GridLayoutGroup;
817 if ((bool)gridLayoutGroup && buildLayout)
818 {
819 RectTransform rectTransform = layoutItems.Rect();
820 RectTransform rectTransform2 = layoutItems.Rect();
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);
825 }
826 }
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 761 of file UIList.cs.

762 {
763 sortMode = m;
764 Sort();
765 Refresh();
766 }
UIList.SortMode sortMode
Definition: BaseList.cs:33
virtual void Refresh(bool highlightLast=false)
Definition: UIList.cs:479
void Sort()
Definition: UIList.cs:753

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

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

◆ Clear()

◆ ClearChildren()

void UIList.ClearChildren ( )
inline

Definition at line 856 of file UIList.cs.

857 {
858 if (usePool)
859 {
860 foreach (ButtonPair button in buttons)
861 {
862 PoolManager.TryDespawn(button.component);
863 }
864 }
865 layoutItems.DestroyChildren();
866 }
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 828 of file UIList.cs.

829 {
830 return items.Contains(item);
831 }

References item, and items.

◆ CreateChild()

UIList UIList.CreateChild ( UIButton  button)
inlineprivate

Definition at line 410 of file UIList.cs.

411 {
413 uIList.transform.SetSiblingIndex(button.transform.GetSiblingIndex() + 1);
414 uIList.callbacks = callbacks;
415 uIList.parent = this;
416 children.Add(button, uIList);
417 return uIList;
418 }
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 878 of file UIList.cs.

879 {
880 if (dragTarget != null)
881 {
883 dragTarget = null;
884 callbacks.OnDragReorder(drag.item, a);
885 }
886 }

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

Referenced by UIListDragItem.OnEndDrag().

◆ GetIndexOf()

int UIList.GetIndexOf ( object  item)
inline

Definition at line 365 of file UIList.cs.

366 {
367 return items.IndexOf(item);
368 }

References item, and items.

◆ GetMold< T >()

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

Definition at line 833 of file UIList.cs.

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

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

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

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

◆ GetPair< T >()

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

Definition at line 382 of file UIList.cs.

382 : Component
383 {
384 return GetPair(item).component as T;
385 }
ButtonPair GetPair(object item)
Definition: UIList.cs:370
Component component
Definition: UIList.cs:216

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

◆ KillChildren()

void UIList.KillChildren ( )
inlineprivate

Definition at line 445 of file UIList.cs.

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

References children, and KillChildren().

Referenced by KillChildren().

◆ List() [1/4]

◆ List() [2/4]

void UIList.List ( bool  refreshHighlight = false)
inline

Definition at line 783 of file UIList.cs.

784 {
785 List(sortMode, refreshHighlight);
786 }

References List(), and BaseList.sortMode.

◆ List() [3/4]

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

Definition at line 788 of file UIList.cs.

789 {
790 sortMode = m;
791 Clear();
792 callbacks.OnList(sortMode);
793 Refresh(refreshHighlight);
794 }
override void Clear()
Definition: UIList.cs:404

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

◆ List() [4/4]

override void UIList.List ( SortMode  sort)
inlinevirtual

Reimplemented from BaseList.

Definition at line 778 of file UIList.cs.

779 {
780 List(sort);
781 }

References List().

◆ NextPage()

void UIList.NextPage ( )
inline

Definition at line 669 of file UIList.cs.

670 {
671 SetPage(page + 1);
672 }
void SetPage(int i)
Definition: UIList.cs:679

References page, and SetPage().

Referenced by Refresh().

◆ NextSort()

override void UIList.NextSort ( )
inlinevirtual

Reimplemented from BaseList.

Definition at line 768 of file UIList.cs.

769 {
770 ChangeSort(sorts.NextItem(sortMode));
771 }
UIList.SortMode[] sorts
Definition: BaseList.cs:15
void ChangeSort(SortMode m)
Definition: UIList.cs:761

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

◆ OnClickFolder()

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

Definition at line 420 of file UIList.cs.

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

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

◆ OnDestroy()

void UIList.OnDestroy ( )
inline

Definition at line 847 of file UIList.cs.

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

References ClearChildren(), and BaseList.transNoItem.

◆ OnMove()

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

Reimplemented from BaseList.

Definition at line 693 of file UIList.cs.

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

References List(), and Select().

◆ OnRefresh()

virtual void UIList.OnRefresh ( )
inlineprotectedvirtual

Definition at line 665 of file UIList.cs.

666 {
667 }

Referenced by AfterRefresh().

◆ OnSelect()

void UIList.OnSelect ( UIList  activeList)
inlineprivate

Definition at line 467 of file UIList.cs.

468 {
469 foreach (UIList value in children.Values)
470 {
471 value.OnSelect(activeList);
472 }
473 if (this != activeList && (bool)group)
474 {
475 group.Select(-1);
476 }
477 }
void OnSelect(UIList activeList)
Definition: UIList.cs:467
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 674 of file UIList.cs.

675 {
676 SetPage(page - 1);
677 }

References page, and SetPage().

Referenced by Refresh().

◆ RebuildLayoutInParent()

void UIList.RebuildLayoutInParent ( )
inline

Definition at line 454 of file UIList.cs.

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

References parent.

Referenced by RemoveChild().

◆ Redraw()

override void UIList.Redraw ( )
inlinevirtual

Reimplemented from BaseList.

Definition at line 796 of file UIList.cs.

797 {
798 if (onBeforeRedraw != null)
799 {
801 }
802 int num = 0;
803 foreach (ButtonPair button in buttons)
804 {
805 callbacks.OnRedraw(button.obj, button.component, num);
806 num++;
807 }
808 if (onAfterRedraw != null)
809 {
811 }
812 }
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 479 of file UIList.cs.

480 {
481 if (!layoutItems)
482 {
483 return;
484 }
486 if (skinType != SkinType.Default)
487 {
488 SkinManager.tempSkin = SkinManager.CurrentSkin.GetSkin(skinType);
489 }
490 highlightIndex = -1;
491 if (highlightLast)
492 {
493 UIButton componentOf = InputModuleEX.GetComponentOf<UIButton>();
494 if ((bool)componentOf)
495 {
496 Component component = componentOf.transform.parent.GetComponent<UIItem>();
497 if (component == null)
498 {
499 component = componentOf;
500 }
501 for (int i = 0; i < buttons.Count; i++)
502 {
503 if (buttons[i].component == component)
504 {
505 highlightIndex = i;
506 break;
507 }
508 }
509 }
510 }
511 callbacks.SetList(this);
512 if (!enableGroup && (bool)group)
513 {
514 UnityEngine.Object.DestroyImmediate(group);
515 }
516 if (!usePage)
517 {
518 maxPage = 9999999;
519 }
520 callbacks.CreateMold();
521 if (itemHeight == ItemHeight.Default)
522 {
523 RectTransform rectTransform = callbacks.GetMold().Rect();
524 rectTransform.sizeDelta = new Vector2(rectTransform.sizeDelta.x, 34 + heightFix);
525 }
526 if (!initialized || reset)
527 {
528 if (sortMode != SortMode.ByNone)
529 {
530 Sort();
531 }
532 if (!initialized)
533 {
534 if ((bool)paginationTop && (bool)paginationTop.button1)
535 {
536 paginationTop.button1.onClick.AddListener(PrevPage);
537 paginationTop.button2.onClick.AddListener(NextPage);
538 }
539 if ((bool)paginationBottom && (bool)paginationBottom.button1)
540 {
541 paginationBottom.button1.onClick.AddListener(PrevPage);
542 paginationBottom.button2.onClick.AddListener(NextPage);
543 }
544 _ = (bool)bar;
545 }
546 initialized = true;
547 reset = false;
548 }
549 children.Clear();
550 buttons.Clear();
551 GridLayoutGroup gridLayoutGroup = layoutItems as GridLayoutGroup;
552 BuildLayout();
553 if (usePage)
554 {
555 if ((bool)gridLayoutGroup)
556 {
557 itemsPerPage = gridLayoutGroup.constraintCount;
558 }
559 else
560 {
562 }
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;
568 Debug.Log(y2);
569 Debug.Log(y);
570 itemsPerPage = (int)(y / y2);
571 }
572 else
573 {
574 itemsPerPage = 99999;
575 }
577 maxPage = (items.Count - 1) / itemsPerPage + 1;
578 if (usePage)
579 {
580 while (page > 0 && page * itemsPerPage >= items.Count)
581 {
582 page--;
583 }
584 }
585 for (int j = 0; j < itemsPerPage; j++)
586 {
587 int num = page * itemsPerPage + j;
588 if (num >= items.Count)
589 {
590 if (fillEmpty)
591 {
592 new GameObject().AddComponent<RectTransform>().SetParent(layoutItems.transform, worldPositionStays: false);
593 }
594 continue;
595 }
596 object item = items[num];
597 Component comp = callbacks.Instantiate(item, layoutItems.transform);
598 callbacks.OnRedraw(item, comp, j);
599 ButtonPair item2 = new ButtonPair
600 {
601 obj = item,
602 component = comp
603 };
604 UIButton uIButton = comp as UIButton;
605 if (!uIButton)
606 {
607 UIItem uIItem = comp as UIItem;
608 if ((bool)uIItem)
609 {
610 uIButton = uIItem.button1;
611 }
612 }
613 if ((bool)uIButton)
614 {
615 if (numbering && (bool)uIButton.keyText)
616 {
617 uIButton.keyText.text = strNumber[j % strNumber.Length];
618 }
619 uIButton.onClick.AddListener(delegate
620 {
621 Root.OnSelect(this);
622 callbacks.OnClick(item, comp);
623 });
624 if (highlightIndex == j)
625 {
626 uIButton.DoHighlightTransition();
627 }
628 }
629 buttons.Add(item2);
630 }
631 AfterRefresh();
632 if ((bool)group)
633 {
635 }
637 {
638 UIButton componentInChildren = layoutItems.GetComponentInChildren<UIButton>();
639 if ((bool)componentInChildren)
640 {
641 componentInChildren.onClick.Invoke();
642 }
643 }
644 isBuilt = true;
645 SkinManager.tempSkin = tempSkin;
646 }
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:814
ItemHeight itemHeight
Definition: UIList.cs:259
void NextPage()
Definition: UIList.cs:669
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:674
void AfterRefresh()
Definition: UIList.cs:648
int heightFix
Definition: UIList.cs:261
UIList Root
Definition: UIList.cs:336
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 437 of file UIList.cs.

438 {
439 children[button].KillChildren();
440 children.Remove(button);
442 GetComponentInParent<ScrollRect>().RebuildLayout(recursive: true);
443 }
void RebuildLayoutInParent()
Definition: UIList.cs:454

References children, and RebuildLayoutInParent().

Referenced by OnClickFolder().

◆ RemoveDynamic()

override void UIList.RemoveDynamic ( object  item)
inlinevirtual

Reimplemented from BaseList.

Definition at line 391 of file UIList.cs.

392 {
393 BaseCore.Instance.StopEventSystem(GetPair(item).component, delegate
394 {
395 items.Remove(item);
396 ButtonPair item2 = buttons.First((ButtonPair a) => a.obj == item);
397 buttons.IndexOf(item2);
398 buttons.Remove(item2);
399 UnityEngine.Object.DestroyImmediate(item2.component.gameObject);
400 AfterRefresh();
401 });
402 }
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 700 of file UIList.cs.

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

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

References items, and Select().

◆ Select< T >()

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

Definition at line 741 of file UIList.cs.

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

References items, and Select().

◆ SetPage()

void UIList.SetPage ( int  i)
inline

Definition at line 679 of file UIList.cs.

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

References maxPage, page, and Refresh().

Referenced by NextPage(), and PrevPage().

◆ Sort()

void UIList.Sort ( )
inline

Definition at line 753 of file UIList.cs.

754 {
755 if (callbacks.useSort)
756 {
757 items.Sort((object a, object b) => callbacks.OnSort(b, sortMode) - callbacks.OnSort(a, sortMode));
758 }
759 }

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

898 {
899 if (IsDragging)
900 {
902 }
903 }
void AutoScrollWhileDragging()
Definition: UIList.cs:905
bool IsDragging
Definition: UIList.cs:347

References AutoScrollWhileDragging(), and IsDragging.

◆ UpdateItemDragHover()

void UIList.UpdateItemDragHover ( UIListDragItem  drag)
inline

Definition at line 888 of file UIList.cs.

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

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 BeginItemDrag(), 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(), and LayerMod.NewGroup().

◆ 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().

◆ onDragBegin

Action<object> UIList.onDragBegin

Definition at line 325 of file UIList.cs.

Referenced by BeginItemDrag().

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

◆ IsDragging

bool UIList.IsDragging
get

Definition at line 347 of file UIList.cs.

Referenced by Update().

◆ ItemCount

override int UIList.ItemCount
get

Definition at line 331 of file UIList.cs.

◆ layoutItems

LayoutGroup UIList.layoutItems
get

Definition at line 327 of file UIList.cs.

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

◆ Root

UIList UIList.Root
get

Definition at line 335 of file UIList.cs.

336 {
337 get
338 {
339 if (!parent)
340 {
341 return this;
342 }
343 return parent.Root;
344 }
345 }

Referenced by Refresh().

◆ RowCount

override int UIList.RowCount
get

Definition at line 333 of file UIList.cs.


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