Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
UICurrency Class Reference
Inheritance diagram for UICurrency:
EMono

Classes

class  Item
 
class  Options
 

Public Member Functions

void Build (Options _options)
 
void Build ()
 
void Add (Sprite icon, string lang, Func< string > func)
 
void Refresh ()
 

Public Attributes

List< Itemitems = new List<Item>()
 
bool autoBuild
 
bool disable
 
Options options
 
Sprite[] icons
 
LayoutGroup layout
 
Card target
 

Private Member Functions

void Awake ()
 
void OnEnable ()
 

Private Attributes

UIButton mold
 

Additional Inherited Members

- Static Public Member Functions inherited from EMono
static int rnd (int a)
 
- Static Public Attributes inherited from EMono
static Core core
 
- Properties inherited from EMono
static Game game [get]
 
static bool AdvMode [get]
 
static Player player [get]
 
static Chara pc [get]
 
static UI ui [get]
 
static Map _map [get]
 
static Zone _zone [get]
 
static FactionBranch Branch [get]
 
static FactionBranch BranchOrHomeBranch [get]
 
static Faction Home [get]
 
static Scene scene [get]
 
static BaseGameScreen screen [get]
 
static GameSetting setting [get]
 
static GameData gamedata [get]
 
static ColorProfile Colors [get]
 
static World world [get]
 
static SoundManager Sound [get]
 
static SourceManager sources [get]
 
static SourceManager editorSources [get]
 
static CoreDebug debug [get]
 

Detailed Description

Definition at line 6 of file UICurrency.cs.

Member Function Documentation

◆ Add()

void UICurrency.Add ( Sprite  icon,
string  lang,
Func< string >  func 
)
inline

Definition at line 154 of file UICurrency.cs.

155 {
156 UIButton uIButton = Util.Instantiate(mold, layout);
157 uIButton.icon.sprite = icon;
158 uIButton.icon.SetNativeSize();
159 uIButton.tooltip.lang = lang.lang().ToTitleCase(wholeText: true);
160 items.Add(new Item
161 {
162 func = func,
163 text = uIButton.mainText
164 });
165 uIButton.mainText.SetText(func());
166 uIButton.mainText.RebuildLayout();
167 uIButton.RebuildLayout();
168 }
Image icon
Definition: UIButton.cs:110
UIText mainText
Definition: UIButton.cs:102
List< Item > items
Definition: UICurrency.cs:49
LayoutGroup layout
Definition: UICurrency.cs:59
UIButton mold
Definition: UICurrency.cs:63
void SetText(string s)
Definition: UIText.cs:159
Definition: Util.cs:10
static Transform Instantiate(string path, Component parent=null)
Definition: Util.cs:67

References UIButton.icon, items, layout, UIButton.mainText, mold, UIText.SetText(), and Util.

Referenced by Build().

◆ Awake()

void UICurrency.Awake ( )
inlineprivate

Definition at line 65 of file UICurrency.cs.

66 {
67 if (autoBuild)
68 {
69 Build();
70 }
71 InvokeRepeating("Refresh", 0.1f, 0.1f);
72 }
void Build()
Definition: UICurrency.cs:85
bool autoBuild
Definition: UICurrency.cs:51

References autoBuild, and Build().

◆ Build() [1/2]

void UICurrency.Build ( )
inline

Definition at line 85 of file UICurrency.cs.

86 {
87 items.Clear();
88 mold = layout.CreateMold<UIButton>();
89 if (options.plat)
90 {
91 Add(icons[1], "plat", () => EMono.pc.GetCurrency("plat").ToString("#,0") ?? "");
92 }
93 if (options.money)
94 {
95 Add(icons[0], "money", () => EMono.pc.GetCurrency().ToString("#,0") ?? "");
96 }
97 if (options.money2)
98 {
99 Add(icons[5], "money2", () => EMono.pc.GetCurrency("money2").ToString("#,0") ?? "");
100 }
101 if (options.medal)
102 {
103 Add(icons[4], "medal", () => EMono.pc.GetCurrency("medal").ToString("#,0") ?? "");
104 }
105 if (options.ecopo)
106 {
107 Add(EMono.sources.cards.map["ecopo"].GetSprite(), "ecopo", () => EMono.pc.GetCurrency("ecopo").ToString("#,0") ?? "");
108 }
109 if (options.influence)
110 {
111 Add(icons[3], "influence", () => EMono._zone.influence.ToString() ?? "");
112 }
113 if (options.casino)
114 {
115 Add(icons[10], "casino_coin", () => EMono.pc.GetCurrency("casino_coin").ToString("#,0") ?? "");
116 }
117 if (options.weight)
118 {
119 Add(icons[11], "weightInv", () => Lang._weight(target.ChildrenWeight, showUnit: false) + " / " + Lang._weight(target.WeightLimit));
120 }
121 if (EMono.BranchOrHomeBranch != null)
122 {
125 {
126 Add(icons[5], resources.money.Name, () => resources.money.value.ToString("#,0") ?? "");
127 }
129 {
130 Add(icons[6], resources.food.Name, () => resources.food.value.ToString("#,0") ?? "");
131 }
133 {
134 Add(icons[7], resources.knowledge.Name, () => resources.knowledge.value.ToString("#,0") ?? "");
135 }
136 if (options.admin)
137 {
138 Add(icons[9], "ap", () => EMono.Branch.policies.CurrentAP() + "/" + EMono.Branch.MaxAP);
139 }
140 if (options.resources)
141 {
143 {
144 if (r.IsAvailable)
145 {
146 Add(r.Sprite, r.Name, () => r.value.ToString("#,0") ?? "");
147 }
148 }
149 }
150 }
151 layout.RebuildLayout();
152 }
virtual bool IsAvailable
int ChildrenWeight
Definition: Card.cs:1889
virtual int WeightLimit
Definition: Card.cs:1923
int GetCurrency(string id="money")
Definition: Card.cs:3652
Definition: EMono.cs:4
static Chara pc
Definition: EMono.cs:13
static Zone _zone
Definition: EMono.cs:19
static FactionBranch BranchOrHomeBranch
Definition: EMono.cs:23
static FactionBranch Branch
Definition: EMono.cs:21
static SourceManager sources
Definition: EMono.cs:41
PolicyManager policies
HomeResourceManager resources
List< BaseHomeResource > list
Definition: Lang.cs:6
static string _weight(int a, int b, bool showUnit=true, int unitSize=0)
Definition: Lang.cs:172
Dictionary< string, CardRow > map
Definition: SourceCard.cs:8
SourceCard cards
int influence
Definition: Spatial.cs:214
Options options
Definition: UICurrency.cs:55
Sprite[] icons
Definition: UICurrency.cs:57
Card target
Definition: UICurrency.cs:61
void Add(Sprite icon, string lang, Func< string > func)
Definition: UICurrency.cs:154

References Lang._weight(), EMono._zone, Add(), UICurrency.Options.admin, EMono.Branch, UICurrency.Options.branchFood, UICurrency.Options.branchKnowledge, UICurrency.Options.branchMoney, EMono.BranchOrHomeBranch, SourceManager.cards, UICurrency.Options.casino, Card.ChildrenWeight, PolicyManager.CurrentAP(), UICurrency.Options.ecopo, HomeResourceManager.food, Card.GetCurrency(), icons, Spatial.influence, UICurrency.Options.influence, BaseHomeResource.IsAvailable, items, HomeResourceManager.knowledge, layout, HomeResourceManager.list, SourceCard.map, FactionBranch.MaxAP, UICurrency.Options.medal, mold, HomeResourceManager.money, UICurrency.Options.money, UICurrency.Options.money2, BaseHomeResource.Name, options, EMono.pc, UICurrency.Options.plat, FactionBranch.policies, FactionBranch.resources, UICurrency.Options.resources, EMono.sources, BaseHomeResource.Sprite, target, BaseHomeResource.value, UICurrency.Options.weight, and Card.WeightLimit.

Referenced by Awake(), and Build().

◆ Build() [2/2]

void UICurrency.Build ( Options  _options)
inline

Definition at line 79 of file UICurrency.cs.

80 {
81 options = _options;
82 Build();
83 }

References Build(), and options.

Referenced by InvOwner.BuildUICurrency(), and InvOwnerRecycle.BuildUICurrency().

◆ OnEnable()

void UICurrency.OnEnable ( )
inlineprivate

Definition at line 74 of file UICurrency.cs.

75 {
76 Refresh();
77 }
void Refresh()
Definition: UICurrency.cs:170

References Refresh().

◆ Refresh()

void UICurrency.Refresh ( )
inline

Definition at line 170 of file UICurrency.cs.

171 {
172 foreach (Item item in items)
173 {
174 string text = item.func();
175 if (item.text.text != (text ?? ""))
176 {
177 item.text.SetText(text);
178 item.text.RebuildLayout();
179 item.text.transform.parent.RebuildLayout();
180 }
181 }
182 }

References item, and items.

Referenced by OnEnable().

Member Data Documentation

◆ autoBuild

bool UICurrency.autoBuild

Definition at line 51 of file UICurrency.cs.

Referenced by Awake().

◆ disable

bool UICurrency.disable

Definition at line 53 of file UICurrency.cs.

◆ icons

Sprite [] UICurrency.icons

Definition at line 57 of file UICurrency.cs.

Referenced by Build().

◆ items

List<Item> UICurrency.items = new List<Item>()

Definition at line 49 of file UICurrency.cs.

Referenced by Add(), Build(), and Refresh().

◆ layout

LayoutGroup UICurrency.layout

Definition at line 59 of file UICurrency.cs.

Referenced by Add(), and Build().

◆ mold

UIButton UICurrency.mold
private

Definition at line 63 of file UICurrency.cs.

Referenced by Add(), and Build().

◆ options

Options UICurrency.options

Definition at line 55 of file UICurrency.cs.

Referenced by Build().

◆ target

Card UICurrency.target

Definition at line 61 of file UICurrency.cs.

Referenced by Build().


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