Elin Decompiled Documentation EA 23.350.1 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< Item > items = 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 166 of file UICurrency.cs.

167 {
168 UIButton uIButton = Util.Instantiate(mold, layout);
169 uIButton.icon.sprite = icon;
170 uIButton.icon.SetNativeSize();
171 uIButton.tooltip.lang = lang.lang().ToTitleCase(wholeText: true);
172 items.Add(new Item
173 {
174 func = func,
175 text = uIButton.mainText
176 });
177 uIButton.mainText.SetText(func());
178 uIButton.mainText.RebuildLayout();
179 uIButton.RebuildLayout();
180 }
Image icon
Definition: UIButton.cs:110
UIText mainText
Definition: UIButton.cs:102
List< Item > items
Definition: UICurrency.cs:53
LayoutGroup layout
Definition: UICurrency.cs:63
UIButton mold
Definition: UICurrency.cs:67
void SetText(string s)
Definition: UIText.cs:163
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 69 of file UICurrency.cs.

70 {
71 if (autoBuild)
72 {
73 Build();
74 }
75 InvokeRepeating("Refresh", 0.1f, 0.1f);
76 }
void Build()
Definition: UICurrency.cs:89
bool autoBuild
Definition: UICurrency.cs:55

References autoBuild, and Build().

◆ Build() [1/2]

void UICurrency.Build ( )
inline

Definition at line 89 of file UICurrency.cs.

90 {
91 items.Clear();
92 mold = layout.CreateMold<UIButton>();
93 if (options.plat)
94 {
95 Add(icons[1], "plat", () => EMono.pc.GetCurrency("plat").ToString("#,0") ?? "");
96 }
97 if (options.money)
98 {
99 Add(icons[0], "money", () => EMono.pc.GetCurrency().ToString("#,0") ?? "");
100 }
101 if (options.money2)
102 {
103 Add(icons[5], "money2", () => EMono.pc.GetCurrency("money2").ToString("#,0") ?? "");
104 }
105 if (options.medal)
106 {
107 Add(icons[4], "medal", () => EMono.pc.GetCurrency("medal").ToString("#,0") ?? "");
108 }
109 if (options.ecopo)
110 {
111 Add(EMono.sources.cards.map["ecopo"].GetSprite(), "ecopo", () => EMono.pc.GetCurrency("ecopo").ToString("#,0") ?? "");
112 }
113 if (options.mandrake)
114 {
115 Add(EMono.sources.cards.map["money3"].GetSprite(), "money3", () => EMono.pc.GetCurrency("money3").ToString("#,0") ?? "");
116 }
117 if (options.ticketSky)
118 {
119 Add(EMono.sources.cards.map["ticket_sky"].GetSprite(), "ticket_sky", () => EMono.pc.GetCurrency("ticket_sky").ToString("#,0") ?? "");
120 }
121 if (options.influence)
122 {
123 Add(icons[3], "influence", () => EMono._zone.influence.ToString() ?? "");
124 }
125 if (options.casino)
126 {
127 Add(icons[10], "casino_coin", () => EMono.pc.GetCurrency("casino_coin").ToString("#,0") ?? "");
128 }
129 if (options.weight)
130 {
131 Add(icons[11], "weightInv", () => Lang._weight(target.ChildrenWeight, showUnit: false) + " / " + Lang._weight(target.WeightLimit));
132 }
133 if (EMono.BranchOrHomeBranch != null)
134 {
137 {
138 Add(icons[5], resources.money.Name, () => resources.money.value.ToString("#,0") ?? "");
139 }
141 {
142 Add(icons[6], resources.food.Name, () => resources.food.value.ToString("#,0") ?? "");
143 }
145 {
146 Add(icons[7], resources.knowledge.Name, () => resources.knowledge.value.ToString("#,0") ?? "");
147 }
148 if (options.admin)
149 {
150 Add(icons[9], "ap", () => EMono.Branch.policies.CurrentAP() + "/" + EMono.Branch.MaxAP);
151 }
152 if (options.resources)
153 {
155 {
156 if (r.IsAvailable)
157 {
158 Add(r.Sprite, r.Name, () => r.value.ToString("#,0") ?? "");
159 }
160 }
161 }
162 }
163 layout.RebuildLayout();
164 }
virtual bool IsAvailable
int ChildrenWeight
Definition: Card.cs:2065
virtual int WeightLimit
Definition: Card.cs:2099
int GetCurrency(string id="money")
Definition: Card.cs:4156
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:7
static string _weight(int a, int b, bool showUnit=true, int unitSize=0)
Definition: Lang.cs:171
Dictionary< string, CardRow > map
Definition: SourceCard.cs:9
SourceCard cards
int influence
Definition: Spatial.cs:214
Options options
Definition: UICurrency.cs:59
Sprite[] icons
Definition: UICurrency.cs:61
Card target
Definition: UICurrency.cs:65
void Add(Sprite icon, string lang, Func< string > func)
Definition: UICurrency.cs:166

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, UICurrency.Options.mandrake, 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, UICurrency.Options.ticketSky, 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 83 of file UICurrency.cs.

84 {
85 options = _options;
86 Build();
87 }

References Build(), and options.

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

◆ OnEnable()

void UICurrency.OnEnable ( )
inlineprivate

Definition at line 78 of file UICurrency.cs.

79 {
80 Refresh();
81 }
void Refresh()
Definition: UICurrency.cs:182

References Refresh().

◆ Refresh()

void UICurrency.Refresh ( )
inline

Definition at line 182 of file UICurrency.cs.

183 {
184 foreach (Item item in items)
185 {
186 string text = item.func();
187 if (item.text.text != (text ?? ""))
188 {
189 item.text.SetText(text);
190 item.text.RebuildLayout();
191 item.text.transform.parent.RebuildLayout();
192 }
193 }
194 }

References item, and items.

Referenced by OnEnable().

Member Data Documentation

◆ autoBuild

bool UICurrency.autoBuild

Definition at line 55 of file UICurrency.cs.

Referenced by Awake().

◆ disable

bool UICurrency.disable

Definition at line 57 of file UICurrency.cs.

◆ icons

Sprite [] UICurrency.icons

Definition at line 61 of file UICurrency.cs.

Referenced by Build().

◆ items

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

Definition at line 53 of file UICurrency.cs.

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

◆ layout

LayoutGroup UICurrency.layout

Definition at line 63 of file UICurrency.cs.

Referenced by Add(), and Build().

◆ mold

UIButton UICurrency.mold
private

Definition at line 67 of file UICurrency.cs.

Referenced by Add(), and Build().

◆ options

Options UICurrency.options

Definition at line 59 of file UICurrency.cs.

Referenced by Build().

◆ target

Card UICurrency.target

Definition at line 65 of file UICurrency.cs.

Referenced by Build().


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