Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
ButtonElement Class Reference
Inheritance diagram for ButtonElement:
UIButton IUISkin

Public Types

enum  Mode {
  Skill , Attribute , Tech , Feat ,
  Enchant , Policy , OnlyValue , FeatPurchase ,
  LandFeat , FeatMini
}
 

Public Member Functions

void SetElement (Element _e, ElementContainer _owner, Mode _mode=Mode.Skill)
 
void Refresh ()
 
void SetGrid (Element e, Chara c)
 
- Public Member Functions inherited from UIButton
virtual bool CanMiddleClick ()
 
virtual void OnMiddleClick (bool forceClick)
 
void SetItem (Item i)
 
virtual void RefreshItem ()
 
virtual void OnHover ()
 
void Toggle ()
 
void ToggleCheck ()
 
void SetCheck (bool check)
 
void SetToggle (bool isOn, Action< bool > onToggle=null)
 
void SetToggleWithScore (bool isOn, Action< bool > onToggle, int? score)
 
void SetTooltip (Action< UITooltip > onShowTooltip=null, bool enable=true)
 
void SetTooltip (string id, Action< UITooltip > onShowTooltip=null, bool enable=true)
 
void SetTooltipLang (string lang=null)
 
virtual void ShowTooltip ()
 
void ShowTooltipForced (bool ignoreWhenRightClick=true)
 
override void OnPointerDown (PointerEventData eventData)
 
override void OnPointerClick (PointerEventData eventData)
 
override void OnPointerUp (PointerEventData eventData)
 
void OnPointerUpOnDrag (PointerEventData eventData)
 
void _OnPress ()
 
void OnPress ()
 
void AddHighlight (Func< bool > killCondition)
 
void DoHighlightTransition (bool instant=false)
 
void DoNormalTransition (bool instant=true)
 
override Selectable FindSelectableOnDown ()
 
override Selectable FindSelectableOnUp ()
 
override Selectable FindSelectableOnLeft ()
 
override Selectable FindSelectableOnRight ()
 
void SetNavigation (UIButton up, UIButton down=null, UIButton left=null, UIButton right=null)
 
override bool IsActive ()
 
void SetInteractableWithAlpha (bool enable)
 
virtual void ApplySkin ()
 
void ApplySkin ()
 

Public Attributes

Image imagePotential
 
GameObject goExp
 
Element e
 
ElementContainer owner
 
UIButton buttonUpgrade
 
UIItem moldItemResist
 
LayoutGroup layout
 
Mode mode
 
- Public Attributes inherited from UIButton
UIText mainText
 
UIText subText
 
UIText subText2
 
UIText keyText
 
Image icon
 
Image imageCheck
 
Graphic[] targetGraphics
 
float scaleIcon = 1f
 
float slideX
 
float navigationFix
 
bool isChecked
 
bool instantClick = true
 
UISelectableGroup group
 
TooltipData tooltip
 
SoundData soundClick
 
SoundData soundHighlight
 
Transform animeTarget
 
Anime animeClick
 
Anime animeHold
 
ButtonType buttonType
 
BaseSkinRoot skinRoot
 
Action onDoubleClick
 
Action onRightClick
 
Action< int > onInputWheel
 
object refObj
 
int refInt
 
string refStr
 
bool animating
 
bool selected
 
Vector3 originalIconScale = Vector3.one
 
UIButton highlightTarget
 
Item item
 

Additional Inherited Members

- Static Public Member Functions inherited from UIButton
static void UpdateButtons ()
 
static void TryHihlight ()
 
static void TryShowTip (Transform root=null, bool highlight=true, bool ignoreWhenRightClick=true)
 
static void TryShowTip< T > (Transform root=null, bool highlight=true, bool ignoreWhenRightClick=true)
 
- Static Public Attributes inherited from UIButton
static bool DoSlide
 
static bool locked
 
static UIButton lastButton
 
static UIButton lastHovered
 
static UIButton currentHighlight
 
static UIButton currentPressedButton
 
static float lastClicked
 
static float doubleClickTime = 0.4f
 
static Vector2 buttonPos
 
static Action onPressed
 
static List< UIButtonbuttons = new List<UIButton>()
 
static Action actionTooltip
 
- Protected Member Functions inherited from UIButton
override void Awake ()
 
override void OnEnable ()
 
override void DoStateTransition (SelectionState state, bool instant)
 
- Properties inherited from UIButton
List< Graphic > Graphics [get]
 
virtual bool CanDragLeftButton [get]
 

Detailed Description

Definition at line 5 of file ButtonElement.cs.

Member Enumeration Documentation

◆ Mode

Enumerator
Skill 
Attribute 
Tech 
Feat 
Enchant 
Policy 
OnlyValue 
FeatPurchase 
LandFeat 
FeatMini 

Definition at line 7 of file ButtonElement.cs.

Member Function Documentation

◆ Refresh()

void ButtonElement.Refresh ( )
inline

Definition at line 45 of file ButtonElement.cs.

46 {
47 string text = "";
49 {
50 text = "*";
51 }
52 switch (mode)
53 {
54 case Mode.Tech:
55 {
56 mainText.SetText(text + e.Name + " " + e.DisplayValue, FontColor.Default);
57 int techUpgradeCost = EClass.Branch.GetTechUpgradeCost(e);
58 int currency = EClass.pc.GetCurrency("money2");
59 if (EClass.Branch.elements.ValueWithoutLink(e.id) == 0 || e.source.cost[0] == 0 || techUpgradeCost == 0)
60 {
61 subText.SetText("-");
62 }
63 else
64 {
65 subText.SetText(techUpgradeCost.ToString() ?? "", (currency >= techUpgradeCost) ? FontColor.Good : FontColor.Bad);
66 }
67 break;
68 }
69 case Mode.Policy:
70 mainText.SetText(text + e.Name, FontColor.Default);
72 Mathf.Clamp((float)e.Potential / 300f, 0.1f, 1f);
73 if ((bool)imagePotential)
74 {
75 imagePotential.SetActive(enable: false);
76 }
77 break;
78 case Mode.LandFeat:
79 {
80 string text3 = text + e.Name;
81 if (e.HasTag("network") && EClass.Branch != null && EClass.Branch.HasNetwork)
82 {
83 text3 = "feat_network".lang(text3);
84 }
85 mainText.SetText(text3 + " " + e.Value, FontColor.Default);
86 subText.horizontalOverflow = HorizontalWrapMode.Overflow;
87 subText.text = e.GetDetail().SplitNewline()[0].StripLastPun();
88 if ((bool)imagePotential)
89 {
90 imagePotential.SetActive(enable: false);
91 }
92 break;
93 }
94 case Mode.Feat:
95 case Mode.FeatPurchase:
96 case Mode.FeatMini:
97 if (mode == Mode.FeatPurchase)
98 {
101 subText.text = e.GetDetail().SplitNewline()[0].StripLastPun();
102 subText2.text = "".TagColor((EClass.pc.feat >= e.CostLearn) ? EClass.Colors.Skin.textGood : EClass.Colors.Skin.textBad, e.CostLearn.ToString() ?? "");
103 }
104 else
105 {
106 string text2 = ((mode == Mode.FeatMini) ? e.FullName : e.source.GetText("textPhase").SplitNewline().TryGet(e.Value - 1)
107 .StripLastPun());
108 FontColor c = (e.HasTag("neg") ? FontColor.Bad : FontColor.ButtonSelectable);
109 if (e.source.category == "ether")
110 {
111 c = FontColor.Ether;
112 }
113 mainText.SetText(text + text2, c);
114 subText.text = ((mode == Mode.FeatMini) ? "" : (e as Feat).GetHint(owner));
115 }
116 if ((bool)imagePotential)
117 {
118 imagePotential.SetActive(enable: false);
119 }
120 break;
121 case Mode.Attribute:
122 mainText.SetText(text + e.Name, FontColor.Default);
124 break;
125 case Mode.OnlyValue:
127 imagePotential.SetActive(enable: false);
128 break;
129 default:
130 {
131 mainText.SetText(text + e.Name, (e.owner == null || !e.IsFactionElement(e.owner.Card as Chara)) ? FontColor.Default : FontColor.Myth);
133 bool flag = e.source.category == "skill";
134 if ((bool)imagePotential)
135 {
136 imagePotential.SetActive(flag && imagePotential.enabled);
137 }
138 break;
139 }
140 }
141 if ((bool)imagePotential)
142 {
143 int num = (e.Potential - 80) / 20;
144 imagePotential.enabled = e.Potential != 80;
145 imagePotential.sprite = EClass.core.refs.spritesPotential[Mathf.Clamp(Mathf.Abs(num), 0, EClass.core.refs.spritesPotential.Count - 1)];
146 imagePotential.color = ((num >= 0) ? Color.white : new Color(1f, 0.7f, 0.7f));
147 }
148 e.SetImage(icon);
149 if (mode == Mode.FeatPurchase)
150 {
151 Element refEle = Element.Create(e.id, e.Value - 1);
152 SetTooltip("note", delegate(UITooltip tt)
153 {
154 e.WriteNoteWithRef(tt.note, owner, null, refEle);
155 });
156 }
157 else
158 {
159 SetTooltip("note", delegate(UITooltip tt)
160 {
161 e.WriteNote(tt.note, owner);
162 });
163 }
164 }
@ currency
FontColor
Definition: FontColor.cs:2
Image imagePotential
ElementContainer owner
ElementContainerCard elements
Definition: Card.cs:37
int GetCurrency(string id="money")
Definition: Card.cs:3652
int feat
Definition: Card.cs:358
Definition: Chara.cs:10
SkinColorProfile Skin
List< Sprite > spritesPotential
Definition: CoreRef.cs:359
CoreRef refs
Definition: Core.cs:51
Definition: EClass.cs:5
static ColorProfile Colors
Definition: EClass.cs:38
static Core core
Definition: EClass.cs:6
static FactionBranch Branch
Definition: EClass.cs:22
static Player player
Definition: EClass.cs:12
static Chara pc
Definition: EClass.cs:14
virtual Card Card
int ValueWithoutLink(int ele)
bool IsFactionElement(Chara c)
Definition: ELEMENT.cs:483
virtual int DisplayValue
Definition: ELEMENT.cs:278
int Potential
Definition: ELEMENT.cs:288
int id
Definition: ELEMENT.cs:240
SourceElement.Row source
Definition: ELEMENT.cs:263
virtual bool IsPurchaseFeatReqMet(ElementContainer owner, int lv=-1)
Definition: ELEMENT.cs:904
ElementContainer owner
Definition: ELEMENT.cs:256
bool HasTag(string tag)
Definition: ELEMENT.cs:463
virtual string FullName
Definition: ELEMENT.cs:296
void SetImage(Image i)
Definition: ELEMENT.cs:468
int Value
Definition: ELEMENT.cs:282
void WriteNoteWithRef(UINote n, ElementContainer owner, Action< UINote > onWriteNote, Element refEle)
Definition: ELEMENT.cs:581
virtual void SetTextValue(UIText text)
Definition: ELEMENT.cs:889
virtual string Name
Definition: ELEMENT.cs:294
static Element Create(int id, int v=0)
Definition: ELEMENT.cs:913
void WriteNote(UINote n, ElementContainer owner=null, Action< UINote > onWriteNote=null)
Definition: ELEMENT.cs:574
virtual string GetDetail()
Definition: ELEMENT.cs:478
virtual int CostLearn
Definition: ELEMENT.cs:304
int GetTechUpgradeCost(Element e)
ElementContainerZone elements
Definition: FEAT.cs:249
HashSet< int > trackedElements
Definition: Player.cs:862
UIText subText
Definition: UIButton.cs:104
Image icon
Definition: UIButton.cs:110
UIText mainText
Definition: UIButton.cs:102
void SetTooltip(Action< UITooltip > onShowTooltip=null, bool enable=true)
Definition: UIButton.cs:361
void SetText(string s)
Definition: UIText.cs:159
UINote note
Definition: UITooltip.cs:21
Chara chara
Definition: WindowChara.cs:11
static WindowChara Instance
Definition: WindowChara.cs:9

References EClass.Branch, ElementContainer.Card, WindowChara.chara, Color, EClass.Colors, EClass.core, Element.CostLearn, Element.Create(), currency, Element.DisplayValue, e, Card.elements, FactionBranch.elements, Card.feat, Element.FullName, Card.GetCurrency(), Element.GetDetail(), FactionBranch.GetTechUpgradeCost(), FactionBranch.HasNetwork, Element.HasTag(), UIButton.icon, Element.id, imagePotential, WindowChara.Instance, Element.IsFactionElement(), Element.IsPurchaseFeatReqMet(), UIButton.mainText, mode, Element.Name, UITooltip.note, owner, Element.owner, EClass.pc, EClass.player, Element.Potential, Core.refs, Element.SetImage(), UIText.SetText(), Element.SetTextValue(), UIButton.SetTooltip(), ColorProfile.Skin, Element.source, CoreRef.spritesPotential, UIButton.subText, SkinColorProfile.textBad, SkinColorProfile.textGood, Player.trackedElements, Element.Value, ElementContainer.ValueWithoutLink(), Element.WriteNote(), and Element.WriteNoteWithRef().

Referenced by SetElement().

◆ SetElement()

void ButtonElement.SetElement ( Element  _e,
ElementContainer  _owner,
Mode  _mode = Mode::Skill 
)
inline

Definition at line 37 of file ButtonElement.cs.

38 {
39 e = _e;
40 owner = _owner;
41 mode = _mode;
42 Refresh();
43 }

References e, mode, owner, and Refresh().

Referenced by WindowCharaMini.Refresh(), LayerHome.RefreshFeat(), WindowChara.RefreshProfile(), WindowChara.RefreshSkill(), and WindowChara.RefreshStatic().

◆ SetGrid()

void ButtonElement.SetGrid ( Element  e,
Chara  c 
)
inline

Definition at line 166 of file ButtonElement.cs.

167 {
168 string text = "";
169 bool flag = false;
170 IList<BodySlot> list = c.body.slots.Copy();
171 list.Sort((BodySlot a, BodySlot b) => c.body.GetSortVal(b) - c.body.GetSortVal(a));
172 foreach (BodySlot item in list)
173 {
174 if (item.elementId == 44)
175 {
176 continue;
177 }
179 Thing thing = item.thing;
180 if (thing == null)
181 {
182 uIItem.text1.SetActive(enable: false);
183 uIItem.image1.color = Color.white.SetAlpha(0.5f);
184 continue;
185 }
186 if (!thing.IsIdentified)
187 {
188 flag = true;
189 uIItem.text1.SetText("?", FontColor.Passive);
190 uIItem.image1.color = Color.white.SetAlpha(0.5f);
191 continue;
192 }
193 Element element = item.thing.elements.GetElement(e.id);
194 int num = 0;
195 if (element != null)
196 {
197 num = element.Value;
198 if (element.IsGlobalElement && thing.c_idDeity != EClass.pc.faith.id)
199 {
200 uIItem.text1.SetActive(enable: false);
201 uIItem.image1.color = Color.white.SetAlpha(0.5f);
202 continue;
203 }
204 }
205 if (num == 0)
206 {
207 uIItem.text1.SetActive(enable: false);
208 uIItem.image1.color = Color.white.SetAlpha(0.5f);
209 }
210 text = (e.IsFlag ? "✓" : (Mathf.Abs(num).ToString() ?? ""));
211 FontColor c2 = ((num >= 0) ? FontColor.Good : FontColor.Bad);
212 if (element != null)
213 {
214 if (!element.CanLink(thing.elements))
215 {
216 c2 = FontColor.Gray;
217 }
218 if (element.IsGlobalElement)
219 {
220 c2 = FontColor.Myth;
221 }
222 }
223 uIItem.text1.SetText(text, c2);
224 }
225 text = "";
226 int value = e.Value;
227 int num2 = value;
228 if (e is Resistance)
229 {
230 num2 = Element.GetResistLv(value);
231 text = ((num2 <= 0) ? Lang.GetList("resistNeg")[-num2] : Lang.GetList("resist")[Mathf.Min(num2, 5)]);
232 }
233 text = text + " (" + (flag ? "?" : (e.IsFlag ? "✓" : (value.ToString() ?? ""))) + ")";
234 Sprite sprite = e.GetIcon();
235 if (sprite != null && (bool)icon)
236 {
237 icon.sprite = sprite;
238 }
240 subText.SetText(text, (num2 == 0) ? FontColor.Default : ((num2 > 0) ? FontColor.Good : FontColor.Bad));
241 SetTooltip("note", delegate(UITooltip tt)
242 {
243 e.WriteNote(tt.note, c.elements);
244 });
245 }
UIItem moldItemResist
LayoutGroup layout
string c_idDeity
Definition: Card.cs:1481
bool IsIdentified
Definition: Card.cs:2237
List< BodySlot > slots
Definition: CharaBody.cs:8
int GetSortVal(BodySlot slot)
Definition: CharaBody.cs:470
CharaBody body
Definition: Chara.cs:91
Religion faith
Definition: Chara.cs:424
virtual Sprite GetIcon(string suffix="")
Definition: ELEMENT.cs:438
static int GetResistLv(int v)
Definition: ELEMENT.cs:937
virtual bool CanLink(ElementContainer owner)
Definition: ELEMENT.cs:458
bool IsGlobalElement
Definition: ELEMENT.cs:335
virtual string ShortName
Definition: ELEMENT.cs:332
Definition: Lang.cs:6
static string[] GetList(string id)
Definition: Lang.cs:114
virtual string id
Definition: Religion.cs:26
Definition: Thing.cs:8
Item item
Definition: UIButton.cs:172
Definition: UIItem.cs:5
UIText text1
Definition: UIItem.cs:6
Definition: Util.cs:10
static Transform Instantiate(string path, Component parent=null)
Definition: Util.cs:67

References Chara.body, Card.c_idDeity, Element.CanLink(), Color, e, Card.elements, Chara.faith, Element.GetIcon(), Lang.GetList(), Element.GetResistLv(), CharaBody.GetSortVal(), UIButton.icon, Element.id, Religion.id, Element.IsFactionElement(), Element.IsGlobalElement, Card.IsIdentified, UIButton.item, layout, UIButton.mainText, moldItemResist, UITooltip.note, EClass.pc, UIText.SetText(), UIButton.SetTooltip(), Element.ShortName, CharaBody.slots, UIButton.subText, UIItem.text1, Util, Element.Value, and Element.WriteNote().

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

Member Data Documentation

◆ buttonUpgrade

UIButton ButtonElement.buttonUpgrade

Definition at line 29 of file ButtonElement.cs.

◆ e

Element ButtonElement.e

Definition at line 25 of file ButtonElement.cs.

Referenced by Refresh(), SetElement(), and SetGrid().

◆ goExp

GameObject ButtonElement.goExp

Definition at line 23 of file ButtonElement.cs.

◆ imagePotential

Image ButtonElement.imagePotential

Definition at line 21 of file ButtonElement.cs.

Referenced by Refresh().

◆ layout

LayoutGroup ButtonElement.layout

Definition at line 33 of file ButtonElement.cs.

Referenced by SetGrid().

◆ mode

Mode ButtonElement.mode

Definition at line 35 of file ButtonElement.cs.

Referenced by Refresh(), and SetElement().

◆ moldItemResist

UIItem ButtonElement.moldItemResist

Definition at line 31 of file ButtonElement.cs.

Referenced by SetGrid().

◆ owner

ElementContainer ButtonElement.owner

Definition at line 27 of file ButtonElement.cs.

Referenced by Refresh(), and SetElement().


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