Elin Decompiled Documentation EA 23.262 Nightly Patch 1
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
}
 
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)
 
void AddDynamic (object item)
 
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)
 
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 ()
 
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)
 
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 46 of file UIList.cs.

◆ SortMode

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

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

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

References ignoreNullObj, item, and items.

Referenced by DropdownGrid.Activate(), ContentPopulation.Add(), AddCollection(), DropdownGrid.Build(), DropdownGrid.BuildIngredients(), DramaCustomSequence.GetListGuide(), LayerInspect.GetMenuItems(), UIDragGridInfo.Init(), UIDragGridInfo.InitFuel(), LayerEditPlaylist.ListBGM.List(), Dialog.OnAfterInit(), LayerMod.OnInit(), ContentConfigInput.OnInstantiate(), ListPeopleBed.OnList(), ListPeopleBuySlave.OnList(), ListPeopleEmbark.OnList(), ListPeopleExpedition.OnList(), ListPeopleRevive.OnList(), 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 345 of file UIList.cs.

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

References Add(), and item.

Referenced by LayerInspect.Refresh().

◆ AddDynamic()

void UIList.AddDynamic ( object  item)
inline

Definition at line 383 of file UIList.cs.

384 {
385 }

◆ AfterRefresh()

void UIList.AfterRefresh ( )
inlineprivate

Definition at line 643 of file UIList.cs.

644 {
646 if ((bool)paginationTop)
647 {
648 paginationTop.text1.text = page + 1 + " / " + maxPage;
649 }
650 if ((bool)paginationBottom)
651 {
652 paginationBottom.text1.text = page + 1 + " / " + maxPage;
653 }
655 OnRefresh();
656 layoutItems.RebuildLayout();
658 }
void RefreshNoItem()
Definition: BaseList.cs:69
UIList.ICallback callbacks
Definition: BaseList.cs:13
void RefreshBGGrid()
Definition: BaseList.cs:89
int maxPage
Definition: UIList.cs:266
LayoutGroup layoutItems
Definition: UIList.cs:323
virtual void OnRefresh()
Definition: UIList.cs:660
UIItem paginationTop
Definition: UIList.cs:232
UIItem paginationBottom
Definition: UIList.cs:234
int page
Definition: UIList.cs:263

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

898 {
899 if ((bool)dragViewport && (bool)dragScrollView)
900 {
901 RectTransformUtility.ScreenPointToLocalPointInRectangle(dragViewport, Input.mousePosition, null, out var localPoint);
902 float y = localPoint.y;
903 float num = dragViewport.rect.height * 0.5f;
904 float num2 = 0f;
905 if (y < 0f - num + dragEdgeSize)
906 {
907 float num3 = Mathf.InverseLerp(0f - num + dragEdgeSize, 0f - num, y);
908 num2 = (0f - dragScrollSpeed) * num3;
909 }
910 else if (y > num - dragEdgeSize)
911 {
912 float num4 = Mathf.InverseLerp(num - dragEdgeSize, num, y);
913 num2 = dragScrollSpeed * num4;
914 }
915 if (num2 != 0f)
916 {
917 float verticalNormalizedPosition = dragScrollView.verticalNormalizedPosition;
918 dragScrollView.verticalNormalizedPosition = Mathf.Clamp01(verticalNormalizedPosition + num2 * Time.unscaledDeltaTime);
919 }
920 }
921 }
float dragScrollSpeed
Definition: UIList.cs:321
UIScrollView dragScrollView
Definition: UIList.cs:312
float dragEdgeSize
Definition: UIList.cs:318
RectTransform dragViewport
Definition: UIList.cs:315

References dragEdgeSize, dragScrollSpeed, dragScrollView, and dragViewport.

Referenced by Update().

◆ BeginItemDrag()

void UIList.BeginItemDrag ( UIListDragItem  drag)
inline

Definition at line 858 of file UIList.cs.

859 {
860 if (callbacks.CanDragReorder(drag.item))
861 {
862 dragTarget = drag.item;
863 dragBeginIndex = drag.transform.GetSiblingIndex();
864 }
865 }
int dragBeginIndex
Definition: UIList.cs:307
object dragTarget
Definition: UIList.cs:305

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

Referenced by UIListDragItem.OnBeginDrag().

◆ BuildLayout()

void UIList.BuildLayout ( )
inline

Definition at line 809 of file UIList.cs.

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

References buildLayout, layoutItems, and rows.

Referenced by Refresh().

◆ ChangeSort()

void UIList.ChangeSort ( SortMode  m)
inline

Definition at line 756 of file UIList.cs.

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

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

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

◆ Clear()

◆ ClearChildren()

void UIList.ClearChildren ( )
inline

Definition at line 846 of file UIList.cs.

847 {
848 if (usePool)
849 {
850 foreach (ButtonPair button in buttons)
851 {
852 PoolManager.TryDespawn(button.component);
853 }
854 }
855 layoutItems.DestroyChildren();
856 }
static bool TryDespawn(Component c)
Definition: PoolManager.cs:143
List< ButtonPair > buttons
Definition: UIList.cs:275
bool usePool
Definition: UIList.cs:252

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

Referenced by OnDestroy(), and Refresh().

◆ CreateChild()

UIList UIList.CreateChild ( UIButton  button)
inlineprivate

Definition at line 406 of file UIList.cs.

407 {
409 uIList.transform.SetSiblingIndex(button.transform.GetSiblingIndex() + 1);
410 uIList.callbacks = callbacks;
411 uIList.parent = this;
412 children.Add(button, uIList);
413 return uIList;
414 }
Definition: UIList.cs:9
Dictionary< UIButton, UIList > children
Definition: UIList.cs:294
UIList moldList
Definition: UIList.cs:290
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 867 of file UIList.cs.

868 {
869 if (dragTarget != null)
870 {
871 int num = dragHoverIndex - dragBeginIndex;
872 dragTarget = null;
873 if (num != 0)
874 {
875 callbacks.OnDragReorder(drag.item, num);
876 }
877 }
878 }
int dragHoverIndex
Definition: UIList.cs:309

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

Referenced by UIListDragItem.OnEndDrag().

◆ GetIndexOf()

int UIList.GetIndexOf ( object  item)
inline

Definition at line 361 of file UIList.cs.

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

References item, and items.

◆ GetMold< T >()

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

Definition at line 823 of file UIList.cs.

823 : Component
824 {
825 if ((bool)moldItem)
826 {
827 T component = moldItem.GetComponent<T>();
828 if ((bool)component)
829 {
830 layoutItems.DestroyChildren();
831 return component;
832 }
833 }
834 return layoutItems.CreateMold<T>(idMold);
835 }
string idMold
Definition: UIList.cs:278
Transform moldItem
Definition: UIList.cs:240

References idMold, layoutItems, and moldItem.

◆ GetPair()

ButtonPair UIList.GetPair ( object  item)
inline

Definition at line 366 of file UIList.cs.

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

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

378 : Component
379 {
380 return GetPair(item).component as T;
381 }
ButtonPair GetPair(object item)
Definition: UIList.cs:366
Component component
Definition: UIList.cs:215

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

◆ KillChildren()

void UIList.KillChildren ( )
inlineprivate

Definition at line 441 of file UIList.cs.

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

References children, and KillChildren().

Referenced by KillChildren().

◆ List() [1/4]

◆ List() [2/4]

void UIList.List ( bool  refreshHighlight = false)
inline

Definition at line 778 of file UIList.cs.

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

References List(), and BaseList.sortMode.

◆ List() [3/4]

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

Definition at line 783 of file UIList.cs.

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

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

◆ List() [4/4]

override void UIList.List ( SortMode  sort)
inlinevirtual

Reimplemented from BaseList.

Definition at line 773 of file UIList.cs.

774 {
775 List(sort);
776 }

References List().

◆ NextPage()

void UIList.NextPage ( )
inline

Definition at line 664 of file UIList.cs.

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

References page, and SetPage().

Referenced by Refresh().

◆ NextSort()

override void UIList.NextSort ( )
inlinevirtual

Reimplemented from BaseList.

Definition at line 763 of file UIList.cs.

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

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

◆ OnClickFolder()

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

Definition at line 416 of file UIList.cs.

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

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

◆ OnDestroy()

void UIList.OnDestroy ( )
inline

Definition at line 837 of file UIList.cs.

838 {
840 if ((bool)transNoItem)
841 {
842 UnityEngine.Object.DestroyImmediate(transNoItem.gameObject);
843 }
844 }
Transform transNoItem
Definition: BaseList.cs:25
void ClearChildren()
Definition: UIList.cs:846

References ClearChildren(), and BaseList.transNoItem.

◆ OnMove()

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

Definition at line 688 of file UIList.cs.

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

References List(), and Select().

◆ OnRefresh()

virtual void UIList.OnRefresh ( )
inlineprotectedvirtual

Definition at line 660 of file UIList.cs.

661 {
662 }

Referenced by AfterRefresh().

◆ OnSelect()

void UIList.OnSelect ( UIList  activeList)
inlineprivate

Definition at line 463 of file UIList.cs.

464 {
465 foreach (UIList value in children.Values)
466 {
467 value.OnSelect(activeList);
468 }
469 if (this != activeList && (bool)group)
470 {
471 group.Select(-1);
472 }
473 }
void OnSelect(UIList activeList)
Definition: UIList.cs:463
UISelectableGroup group
Definition: UIList.cs:236
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 669 of file UIList.cs.

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

References page, and SetPage().

Referenced by Refresh().

◆ RebuildLayoutInParent()

void UIList.RebuildLayoutInParent ( )
inline

Definition at line 450 of file UIList.cs.

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

References parent.

Referenced by RemoveChild().

◆ Redraw()

override void UIList.Redraw ( )
inlinevirtual

Reimplemented from BaseList.

Definition at line 791 of file UIList.cs.

792 {
793 if (onBeforeRedraw != null)
794 {
796 }
797 int num = 0;
798 foreach (ButtonPair button in buttons)
799 {
800 callbacks.OnRedraw(button.obj, button.component, num);
801 num++;
802 }
803 if (onAfterRedraw != null)
804 {
806 }
807 }
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 475 of file UIList.cs.

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

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

References children, and RebuildLayoutInParent().

Referenced by OnClickFolder().

◆ RemoveDynamic()

void UIList.RemoveDynamic ( object  item)
inline

Definition at line 387 of file UIList.cs.

388 {
389 BaseCore.Instance.StopEventSystem(GetPair(item).component, delegate
390 {
391 items.Remove(item);
392 ButtonPair item2 = buttons.First((ButtonPair a) => a.obj == item);
393 buttons.IndexOf(item2);
394 buttons.Remove(item2);
395 UnityEngine.Object.DestroyImmediate(item2.component.gameObject);
396 AfterRefresh();
397 });
398 }
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().

Referenced by ListOwner< T1, T2 >.MoveToOther().

◆ Select() [1/2]

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

Definition at line 695 of file UIList.cs.

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

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

References items, and Select().

◆ Select< T >()

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

Definition at line 736 of file UIList.cs.

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

References items, and Select().

◆ SetPage()

void UIList.SetPage ( int  i)
inline

Definition at line 674 of file UIList.cs.

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

References maxPage, page, and Refresh().

Referenced by NextPage(), and PrevPage().

◆ Sort()

void UIList.Sort ( )
inline

Definition at line 748 of file UIList.cs.

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

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

890 {
891 if (IsDragging)
892 {
894 }
895 }
void AutoScrollWhileDragging()
Definition: UIList.cs:897
bool IsDragging
Definition: UIList.cs:343

References AutoScrollWhileDragging(), and IsDragging.

◆ UpdateItemDragHover()

void UIList.UpdateItemDragHover ( UIListDragItem  drag)
inline

Definition at line 880 of file UIList.cs.

881 {
882 if (callbacks.CanDragReorder(drag.item) && dragTarget != null && dragTarget != drag.item)
883 {
884 dragHoverIndex = drag.transform.GetSiblingIndex();
885 GetPair(dragTarget).component?.transform.SetSiblingIndex(dragHoverIndex);
886 }
887 }

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

◆ bar

UIListTopbar UIList.bar

Definition at line 226 of file UIList.cs.

Referenced by Refresh().

◆ buildLayout

bool UIList.buildLayout

Definition at line 230 of file UIList.cs.

Referenced by BuildLayout().

◆ buttons

◆ children

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

Definition at line 294 of file UIList.cs.

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

◆ disableInstaClick

bool UIList.disableInstaClick = true

Definition at line 254 of file UIList.cs.

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

◆ dragBeginIndex

int UIList.dragBeginIndex
private

Definition at line 307 of file UIList.cs.

Referenced by BeginItemDrag(), and EndItemDrag().

◆ dragEdgeSize

float UIList.dragEdgeSize

Definition at line 318 of file UIList.cs.

Referenced by AutoScrollWhileDragging().

◆ dragHoverIndex

int UIList.dragHoverIndex
private

Definition at line 309 of file UIList.cs.

Referenced by EndItemDrag(), and UpdateItemDragHover().

◆ dragScrollSpeed

float UIList.dragScrollSpeed = 2.5f

Definition at line 321 of file UIList.cs.

Referenced by AutoScrollWhileDragging().

◆ dragScrollView

UIScrollView UIList.dragScrollView

Definition at line 312 of file UIList.cs.

Referenced by AutoScrollWhileDragging().

◆ dragTarget

object UIList.dragTarget
private

Definition at line 305 of file UIList.cs.

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

◆ dragViewport

RectTransform UIList.dragViewport

Definition at line 315 of file UIList.cs.

Referenced by AutoScrollWhileDragging().

◆ enableGroup

bool UIList.enableGroup = true

Definition at line 246 of file UIList.cs.

Referenced by Refresh().

◆ fillEmpty

bool UIList.fillEmpty

Definition at line 228 of file UIList.cs.

Referenced by Refresh().

◆ group

UISelectableGroup UIList.group

Definition at line 236 of file UIList.cs.

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

◆ HeightDefault

const int UIList.HeightDefault = 34
static

Definition at line 284 of file UIList.cs.

◆ heightFix

int UIList.heightFix

Definition at line 260 of file UIList.cs.

Referenced by Refresh().

◆ highlightIndex

int UIList.highlightIndex
private

Definition at line 303 of file UIList.cs.

Referenced by Refresh().

◆ idMold

string UIList.idMold

Definition at line 278 of file UIList.cs.

Referenced by GetMold< T >().

◆ ignoreNullObj

bool UIList.ignoreNullObj = true

Definition at line 256 of file UIList.cs.

Referenced by Add().

◆ initialized

bool UIList.initialized
private

Definition at line 286 of file UIList.cs.

Referenced by Refresh().

◆ invokeSelected

bool UIList.invokeSelected

Definition at line 244 of file UIList.cs.

Referenced by Refresh().

◆ itemHeight

ItemHeight UIList.itemHeight

Definition at line 258 of file UIList.cs.

Referenced by Refresh().

◆ items

◆ itemsPerPage

int UIList.itemsPerPage

Definition at line 269 of file UIList.cs.

Referenced by Refresh().

◆ langNoItem

string UIList.langNoItem

Definition at line 220 of file UIList.cs.

◆ maxPage

int UIList.maxPage

Definition at line 266 of file UIList.cs.

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

◆ menu

UISelectableGroup UIList.menu

Definition at line 224 of file UIList.cs.

◆ moldItem

Transform UIList.moldItem

Definition at line 240 of file UIList.cs.

Referenced by GetMold< T >().

◆ moldList

UIList UIList.moldList

Definition at line 290 of file UIList.cs.

Referenced by CreateChild().

◆ onlyDirectChildrenButtonForGroup

bool UIList.onlyDirectChildrenButtonForGroup

Definition at line 248 of file UIList.cs.

Referenced by Refresh().

◆ page

int UIList.page

Definition at line 263 of file UIList.cs.

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

◆ paginationBottom

UIItem UIList.paginationBottom

Definition at line 234 of file UIList.cs.

Referenced by AfterRefresh(), and Refresh().

◆ paginationTop

UIItem UIList.paginationTop

Definition at line 232 of file UIList.cs.

Referenced by AfterRefresh(), and Refresh().

◆ parent

◆ reset

bool UIList.reset
private

Definition at line 288 of file UIList.cs.

Referenced by Clear(), and Refresh().

◆ rows

int UIList.rows

Definition at line 222 of file UIList.cs.

Referenced by BuildLayout(), and Refresh().

◆ selectFirst

bool UIList.selectFirst

Definition at line 242 of file UIList.cs.

Referenced by Refresh().

◆ SETab

Action UIList.SETab
Initial value:
= delegate
{
}

Definition at line 280 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 296 of file UIList.cs.

Referenced by Refresh().

◆ usePage

bool UIList.usePage

Definition at line 250 of file UIList.cs.

Referenced by Refresh().

◆ usePool

bool UIList.usePool

Definition at line 252 of file UIList.cs.

Referenced by ClearChildren().

Property Documentation

◆ gridLayout

GridLayoutGroup UIList.gridLayout
get

Definition at line 325 of file UIList.cs.

◆ IsDragging

bool UIList.IsDragging
get

Definition at line 343 of file UIList.cs.

Referenced by Update().

◆ ItemCount

override int UIList.ItemCount
get

Definition at line 327 of file UIList.cs.

◆ layoutItems

LayoutGroup UIList.layoutItems
get

Definition at line 323 of file UIList.cs.

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

◆ Root

UIList UIList.Root
get

Definition at line 331 of file UIList.cs.

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

Referenced by Refresh().

◆ RowCount

override int UIList.RowCount
get

Definition at line 329 of file UIList.cs.


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