Elin Decompiled Documentation EA 23.335 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 160 of file UICurrency.cs.

161 {
162 UIButton uIButton = Util.Instantiate(mold, layout);
163 uIButton.icon.sprite = icon;
164 uIButton.icon.SetNativeSize();
165 uIButton.tooltip.lang = lang.lang().ToTitleCase(wholeText: true);
166 items.Add(new Item
167 {
168 func = func,
169 text = uIButton.mainText
170 });
171 uIButton.mainText.SetText(func());
172 uIButton.mainText.RebuildLayout();
173 uIButton.RebuildLayout();
174 }
Image icon
Definition: UIButton.cs:110
UIText mainText
Definition: UIButton.cs:102
List< Item > items
Definition: UICurrency.cs:51
LayoutGroup layout
Definition: UICurrency.cs:61
UIButton mold
Definition: UICurrency.cs:65
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 67 of file UICurrency.cs.

68 {
69 if (autoBuild)
70 {
71 Build();
72 }
73 InvokeRepeating("Refresh", 0.1f, 0.1f);
74 }
void Build()
Definition: UICurrency.cs:87
bool autoBuild
Definition: UICurrency.cs:53

References autoBuild, and Build().

◆ Build() [1/2]

void UICurrency.Build ( )
inline

Definition at line 87 of file UICurrency.cs.

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

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, 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 81 of file UICurrency.cs.

82 {
83 options = _options;
84 Build();
85 }

References Build(), and options.

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

◆ OnEnable()

void UICurrency.OnEnable ( )
inlineprivate

Definition at line 76 of file UICurrency.cs.

77 {
78 Refresh();
79 }
void Refresh()
Definition: UICurrency.cs:176

References Refresh().

◆ Refresh()

void UICurrency.Refresh ( )
inline

Definition at line 176 of file UICurrency.cs.

177 {
178 foreach (Item item in items)
179 {
180 string text = item.func();
181 if (item.text.text != (text ?? ""))
182 {
183 item.text.SetText(text);
184 item.text.RebuildLayout();
185 item.text.transform.parent.RebuildLayout();
186 }
187 }
188 }

References item, and items.

Referenced by OnEnable().

Member Data Documentation

◆ autoBuild

bool UICurrency.autoBuild

Definition at line 53 of file UICurrency.cs.

Referenced by Awake().

◆ disable

bool UICurrency.disable

Definition at line 55 of file UICurrency.cs.

◆ icons

Sprite [] UICurrency.icons

Definition at line 59 of file UICurrency.cs.

Referenced by Build().

◆ items

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

Definition at line 51 of file UICurrency.cs.

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

◆ layout

LayoutGroup UICurrency.layout

Definition at line 61 of file UICurrency.cs.

Referenced by Add(), and Build().

◆ mold

UIButton UICurrency.mold
private

Definition at line 65 of file UICurrency.cs.

Referenced by Add(), and Build().

◆ options

Options UICurrency.options

Definition at line 57 of file UICurrency.cs.

Referenced by Build().

◆ target

Card UICurrency.target

Definition at line 63 of file UICurrency.cs.

Referenced by Build().


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