Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
LayerCollectible Class Reference
Inheritance diagram for LayerCollectible:
ELayer Layer IUISkin

Public Member Functions

override void OnAfterInit ()
 
void Refresh ()
 
void SetButton (Hoard.Item a, UIButton b)
 
void RefreshInfo (UIButton button, bool force=false)
 
- Public Member Functions inherited from ELayer
override void OnBeforeAddLayer ()
 
void InitInspector ()
 
sealed override void Init ()
 
override void OnAfterAddLayer ()
 
void TryShowHelp ()
 
void AddLayerToUI (string id)
 
void TryShowHint (string _langHint=null)
 
void TalkHomeMemeber (string id)
 
void TalkMaid (string id)
 
override void OnRightClick ()
 
- Public Member Functions inherited from Layer
virtual string GetTextHeader (Window window)
 
virtual bool HeaderIsListOf (int id)
 
virtual void Init ()
 
virtual void OnInit ()
 
virtual void OnAfterInit ()
 
virtual void ApplySkin ()
 
void ShowScreenLock (string id)
 
void UpdateInput ()
 
virtual void OnUpdateInput ()
 
virtual void OnRightClick ()
 
virtual bool OnBack ()
 
virtual void OnChangeLayer ()
 
virtual void OnCreate ()
 
void _AddLayer (string id)
 
Layer AddLayer (string id)
 
AddLayer< T > ()
 
AddLayer< T > (string id)
 
AddLayerDontCloseOthers< T > ()
 
Layer AddLayerDontCloseOthers (Layer l)
 
GetOrAddLayer< T > ()
 
virtual void OnBeforeAddLayer ()
 
virtual void OnAfterAddLayer ()
 
Layer AddLayer (Layer l)
 
void ToggleLayer (string id)
 
ToggleLayer< T > (string id=null)
 
void WaitAndClose ()
 
void OnClickClose ()
 
virtual void Close ()
 
void CloseLayers ()
 
void RemoveLayers (bool removeImportant=false)
 
bool RemoveLayer< T > ()
 
void RemoveLayer (Layer l)
 
virtual void OnKill ()
 
Layer SetOnKill (Action action)
 
void DisableClose ()
 
void Delay (float duration=0.05f)
 
Layer SetDelay (float d)
 
Layer GetLayer (string id)
 
GetLayer< T > (bool fromTop=false)
 
Layer GetTopLayer ()
 
void SwitchContent (int idWindow, int i)
 
virtual void OnSwitchContent (Window window)
 
Layer SetTitles (string langList, string idHeaderRow=null)
 
bool IsBlockWidgetClick ()
 
bool IsHideHud ()
 
bool IsAllowGeneralInput ()
 
bool IsUseBlur ()
 
bool IsPointerOnLayer ()
 
void ApplySkin ()
 

Public Attributes

UIList list
 
UIText textName
 
UIText textDetail
 
UIButton selected
 
UIButton lastShown
 
Image imageItem
 
Vector3 contextFix
 
Func< Hoard.Item, bool > onClick
 
- Public Attributes inherited from Layer
Option option
 
UnityEvent onKill
 
Anime animeIn
 
Anime animeOut
 
bool closeOthers
 
bool defaultActionMode = true
 
Button screenLock
 
Layer parent
 
string idLayer
 
List< Layerlayers = new List<Layer>()
 
Vector2 lastParentPos
 
List< Windowwindows = new List<Window>()
 
string langHint
 

Properties

Hoard hoard [get]
 
- Properties inherited from ELayer
static Core core [get]
 
static Game game [get]
 
static bool AdvMode [get]
 
static Player player [get]
 
static Chara pc [get]
 
static FactionBranch Branch [get]
 
static Faction Home [get]
 
static UI ui [get]
 
static Map _map [get]
 
static Zone _zone [get]
 
static Scene scene [get]
 
static BaseGameScreen screen [get]
 
static CoreConfig config [get]
 
static GameSetting setting [get]
 
static ColorProfile Colors [get]
 
static SourceManager sources [get]
 
static World world [get]
 
static SoundManager Sound [get]
 
static CoreDebug debug [get]
 
bool IsFloat [get]
 
virtual string IdHelp [get]
 
- Properties inherited from Layer
Layer TopLayer [get]
 
string uid [get]
 
virtual RectTransform rectLayers [get]
 
virtual bool blockWidgetClick [get]
 

Private Member Functions

void Update ()
 

Additional Inherited Members

- Static Public Member Functions inherited from ELayer
static int rnd (int a)
 
- Static Public Member Functions inherited from Layer
static T Create< T > ()
 
static T Create< T > (string path)
 
static Layer Create (string path)
 
- Static Public Attributes inherited from Layer
static int skipInput
 
static bool closeOnRightClick
 
static bool rightClicked
 
static bool cancelKeyDown
 
static bool ignoreSounds
 
static Transform blurStopInstance
 
static string[] searchPath = new string[3] { "Layer", "Layer/Dialog", "Layer/LayerHome" }
 
- Protected Member Functions inherited from ELayer
sealed override void _Close ()
 
sealed override void Kill ()
 
- Protected Member Functions inherited from Layer
virtual void Awake ()
 
virtual void _Close ()
 
virtual void Kill ()
 
- Protected Attributes inherited from Layer
RectTransform _rect
 
bool isDestroyed
 

Detailed Description

Definition at line 5 of file LayerCollectible.cs.

Member Function Documentation

◆ OnAfterInit()

override void LayerCollectible.OnAfterInit ( )
inlinevirtual

Reimplemented from Layer.

Definition at line 25 of file LayerCollectible.cs.

26 {
27 if (hoard.items.Count == 0)
28 {
29 hoard.Add("gold", 1);
30 }
31 Refresh();
32 }
Item Add(string id)
Definition: Hoard.cs:161
Dictionary< string, Item > items
Definition: Hoard.cs:106

References Hoard.Add(), hoard, Hoard.items, and Refresh().

◆ Refresh()

void LayerCollectible.Refresh ( )
inline

Definition at line 34 of file LayerCollectible.cs.

35 {
36 ELayer.ui.GetLayer<LayerHoard>();
37 list.callbacks = new UIList.Callback<Hoard.Item, UIButton>
38 {
39 onClick = delegate(Hoard.Item a, UIButton b)
40 {
41 selected = b;
42 if (onClick != null)
43 {
44 if (onClick(a))
45 {
46 Close();
47 }
48 }
49 else
50 {
51 UIContextMenu uIContextMenu = ELayer.ui.contextMenu.Create("ContextHoard");
52 int max = a.num;
53 if (max > 1 && a.IsUnique)
54 {
55 max = 1;
56 }
57 uIContextMenu.AddSlider("display", (float n) => n + " / " + max, a.show, delegate(float v)
58 {
59 a.show = (int)v;
60 SetButton(a, b);
61 RefreshInfo(b, force: true);
62 }, 0f, max, isInt: true, hideOther: false);
63 uIContextMenu.AddToggle("displayRandom", a.random, delegate(bool on)
64 {
65 a.random = on;
66 });
67 uIContextMenu.Show(EInput.uiMousePosition + contextFix);
68 }
69 },
70 onInstantiate = delegate(Hoard.Item a, UIButton b)
71 {
72 SetButton(a, b);
73 }
74 };
75 foreach (SourceCollectible.Row row in ELayer.sources.collectibles.rows)
76 {
77 if (hoard.items.ContainsKey(row.id))
78 {
79 list.Add(hoard.items[row.id]);
80 }
81 }
82 list.Refresh();
83 selected = list.buttons[0].component as UIButton;
85 }
Definition: EInput.cs:8
static Vector3 uiMousePosition
Definition: EInput.cs:369
Definition: ELayer.cs:4
static SourceManager sources
Definition: ELayer.cs:37
static UI ui
Definition: ELayer.cs:21
Definition: Hoard.cs:8
void RefreshInfo(UIButton button, bool force=false)
Func< Hoard.Item, bool > onClick
void SetButton(Hoard.Item a, UIButton b)
virtual void Close()
Definition: Layer.cs:463
SourceCollectible collectibles
UIContextMenuItem AddToggle(string idLang="", bool isOn=false, UnityAction< bool > action=null)
void Show(UIItem i)
UIContextMenuItem AddSlider(string text, Func< float, string > textFunc, float value, Action< float > action, float min=0f, float max=1f, bool isInt=false, bool hideOther=true, bool useInput=false)
Definition: UIList.cs:9
List< ButtonPair > buttons
Definition: UIList.cs:244
override void Add(object item)
Definition: UIList.cs:302
virtual void Refresh(bool highlightLast=false)
Definition: UIList.cs:424

References UIList.Add(), UIContextMenu.AddSlider(), UIContextMenu.AddToggle(), UIList.buttons, Layer.Close(), SourceManager.collectibles, contextFix, hoard, Hoard.items, list, onClick, UIList.Refresh(), RefreshInfo(), selected, SetButton(), UIContextMenu.Show(), ELayer.sources, ELayer.ui, and EInput.uiMousePosition.

Referenced by OnAfterInit().

◆ RefreshInfo()

void LayerCollectible.RefreshInfo ( UIButton  button,
bool  force = false 
)
inline

Definition at line 113 of file LayerCollectible.cs.

114 {
115 if (force || (!(lastShown == button) && (bool)button))
116 {
117 Hoard.Item item = button.refObj as Hoard.Item;
118 string text = "collectibleTitle".lang(item.Source.GetName(), item.num.ToString() ?? "", item.show.ToString() ?? "");
119 if (item.IsUnique)
120 {
121 text += " UNIQUE";
122 }
123 textName.text = text;
124 textDetail.text = item.Source.GetText("detail", returnNull: true).IsEmpty("none".lang());
125 imageItem.sprite = hoard.GetSprite(item.id);
126 imageItem.SetNativeSize();
127 lastShown = button;
128 }
129 }
Sprite GetSprite(string id)
Definition: Hoard.cs:211

References Hoard.GetSprite(), hoard, imageItem, item, and lastShown.

Referenced by Refresh(), and Update().

◆ SetButton()

void LayerCollectible.SetButton ( Hoard::Item  a,
UIButton  b 
)
inline

Definition at line 100 of file LayerCollectible.cs.

101 {
102 string text = a.num.ToString() ?? "";
103 if (a.num != a.show)
104 {
105 text = text + " (" + a.show + ")";
106 }
107 b.mainText.text = text;
108 b.icon.sprite = hoard.GetSprite(a.id);
109 b.icon.SetNativeSize();
110 b.refObj = a;
111 }
int num
Definition: Hoard.cs:27
string id
Definition: Hoard.cs:19
int show
Definition: Hoard.cs:39
Image icon
Definition: UIButton.cs:110

References Hoard.GetSprite(), hoard, and UIButton.icon.

Referenced by Refresh().

◆ Update()

void LayerCollectible.Update ( )
inlineprivate

Definition at line 87 of file LayerCollectible.cs.

88 {
89 UIButton componentOf = InputModuleEX.GetComponentOf<UIButton>();
90 if ((bool)componentOf && componentOf.refObj is Hoard.Item)
91 {
92 RefreshInfo(componentOf);
93 }
94 else
95 {
97 }
98 }

References RefreshInfo(), and selected.

Member Data Documentation

◆ contextFix

Vector3 LayerCollectible.contextFix

Definition at line 19 of file LayerCollectible.cs.

Referenced by Refresh().

◆ imageItem

Image LayerCollectible.imageItem

Definition at line 17 of file LayerCollectible.cs.

Referenced by RefreshInfo().

◆ lastShown

UIButton LayerCollectible.lastShown

Definition at line 15 of file LayerCollectible.cs.

Referenced by RefreshInfo().

◆ list

UIList LayerCollectible.list

Definition at line 7 of file LayerCollectible.cs.

Referenced by Refresh().

◆ onClick

Func<Hoard.Item, bool> LayerCollectible.onClick

Definition at line 21 of file LayerCollectible.cs.

Referenced by Refresh().

◆ selected

UIButton LayerCollectible.selected

Definition at line 13 of file LayerCollectible.cs.

Referenced by Refresh(), and Update().

◆ textDetail

UIText LayerCollectible.textDetail

Definition at line 11 of file LayerCollectible.cs.

◆ textName

UIText LayerCollectible.textName

Definition at line 9 of file LayerCollectible.cs.

Property Documentation

◆ hoard

Hoard LayerCollectible.hoard
get

Definition at line 23 of file LayerCollectible.cs.

Referenced by OnAfterInit(), Refresh(), RefreshInfo(), and SetButton().


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