Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
ItemGeneral Class Reference
Inheritance diagram for ItemGeneral:
UIItem IPrefImage

Public Member Functions

void SetChara (Chara c)
 
RenderRow GetRenderRow ()
 
void OnRefreshPref ()
 
void Clear ()
 
UIButton AddSubButton (Sprite sprite, Action action, string lang=null, Action< UITooltip > onTooltip=null)
 
void SetMainText (string lang, Sprite sprite=null, bool disableMask=true)
 
UIButton SetSubText (string lang, int x, FontColor c=FontColor.Default, TextAnchor align=TextAnchor.MiddleLeft)
 
UIButton SetSubText2 (string lang, FontColor c=FontColor.Default, TextAnchor align=TextAnchor.MiddleRight)
 
AddPrefab< T > (string id)
 
void SetSound (SoundData data=null)
 
void DisableIcon ()
 
void DisableMask ()
 
void Build ()
 
- Public Member Functions inherited from UIItem
void SetTopic (string lang1, string lang2)
 
void SetWidth (int w)
 
void Hyphenate ()
 
RenderRow GetRenderRow ()
 
void OnRefreshPref ()
 

Public Attributes

LayoutGroup layout
 
int paddingSubText = 50
 
Card card
 
- Public Attributes inherited from UIItem
UIText text1
 
UIText text2
 
UIText text3
 
UIText text4
 
Image image1
 
Image image2
 
UIButton button1
 
UIButton button2
 
UIButton button3
 
UIItem item
 
Toggle toggle
 
UIDropdown dd
 
object refObj
 

Private Attributes

int count
 

Static Private Attributes

const int IconSize = 40
 
const int IconPadding = 10
 
const int ButtonPaddingWhenIcon = 3
 

Detailed Description

Definition at line 5 of file ItemGeneral.cs.

Member Function Documentation

◆ AddPrefab< T >()

T ItemGeneral.AddPrefab< T > ( string  id)
inline
Type Constraints
T :Component 

Definition at line 137 of file ItemGeneral.cs.

137 : Component
138 {
139 return Util.Instantiate<T>("UI/Element/Item/Extra/" + id, base.transform);
140 }
Definition: Util.cs:10
static Transform Instantiate(string path, Component parent=null)
Definition: Util.cs:67

References Util.

◆ AddSubButton()

UIButton ItemGeneral.AddSubButton ( Sprite  sprite,
Action  action,
string  lang = null,
Action< UITooltip onTooltip = null 
)
inline

Definition at line 76 of file ItemGeneral.cs.

77 {
78 UIButton uIButton = Util.Instantiate<UIButton>("UI/Element/Button/SubButton", base.transform);
79 uIButton.Rect().anchoredPosition = new Vector2(count * -40 - 20 - 10, 0f);
80 uIButton.icon.sprite = sprite;
81 uIButton.onClick.AddListener(delegate
82 {
83 action();
84 });
85 if (!lang.IsEmpty())
86 {
87 uIButton.tooltip.enable = true;
88 uIButton.tooltip.lang = lang;
89 }
90 if (onTooltip != null)
91 {
92 uIButton.tooltip.id = "note";
93 uIButton.tooltip.onShowTooltip = onTooltip;
94 uIButton.tooltip.enable = true;
95 }
96 uIButton.highlightTarget = button1;
97 count++;
98 return uIButton;
99 }
UIButton button1
Definition: UIItem.cs:18

References UIItem.button1, count, and Util.

Referenced by TraitMoongateEx._OnUse(), LayerEditPlaylist.ListBGM.List(), BaseListPeople.OnInstantiate(), ListPeopleCallReserve.OnInstantiate(), ListPeopleBed.OnInstantiate(), LayerHome.RefreshAreas(), UIHomeInfo.RefreshReport(), and LayerHome.RefreshSpots().

◆ Build()

void ItemGeneral.Build ( )
inline

◆ Clear()

void ItemGeneral.Clear ( )
inline

Definition at line 60 of file ItemGeneral.cs.

61 {
62 if (count <= 0)
63 {
64 return;
65 }
66 foreach (UIButton componentsInDirectChild in base.transform.GetComponentsInDirectChildren<UIButton>())
67 {
68 if (componentsInDirectChild != button1)
69 {
70 UnityEngine.Object.DestroyImmediate(componentsInDirectChild.gameObject);
71 }
72 }
73 count = 0;
74 }

References UIItem.button1, and count.

◆ DisableIcon()

void ItemGeneral.DisableIcon ( )
inline

Definition at line 147 of file ItemGeneral.cs.

148 {
149 button1.icon.transform.parent.SetActive(enable: false);
150 if (!button1.keyText)
151 {
152 button1.mainText.rectTransform.anchoredPosition = new Vector2(20f, 0f);
153 }
154 }
Image icon
Definition: UIButton.cs:110
UIText keyText
Definition: UIButton.cs:108

References UIItem.button1, UIButton.icon, and UIButton.keyText.

Referenced by SetMainText().

◆ DisableMask()

void ItemGeneral.DisableMask ( )
inline

Definition at line 156 of file ItemGeneral.cs.

157 {
158 image2.enabled = false;
159 }

Referenced by SetMainText().

◆ GetRenderRow()

RenderRow ItemGeneral.GetRenderRow ( )
inline

Implements IPrefImage.

Definition at line 47 of file ItemGeneral.cs.

48 {
49 return card?.sourceRenderCard;
50 }
virtual CardRow sourceRenderCard
Definition: Card.cs:2009

References card, and Card.sourceRenderCard.

◆ OnRefreshPref()

void ItemGeneral.OnRefreshPref ( )
inline

Implements IPrefImage.

Definition at line 52 of file ItemGeneral.cs.

53 {
54 if (card != null && card.isChara)
55 {
57 }
58 }
virtual Chara Chara
Definition: Card.cs:1946
virtual bool isChara
Definition: Card.cs:1959
void SetChara(Chara c)
Definition: ItemGeneral.cs:21

References card, Card.Chara, Card.isChara, and SetChara().

◆ SetChara()

void ItemGeneral.SetChara ( Chara  c)
inline

Definition at line 21 of file ItemGeneral.cs.

22 {
23 card = c;
25 string text = c.Name;
26 if (EClass.Branch?.uidMaid == c.uid)
27 {
28 text += ("(" + "maid".lang() + ")").TagSize(12);
29 }
30 FontColor c2 = FontColor.ButtonGeneral;
31 if (c.isDead)
32 {
33 c2 = FontColor.Bad;
34 }
35 else if (c.IsPCParty)
36 {
37 c2 = FontColor.Good;
38 }
39 else if (c.hp < c.MaxHP / 2 && c.currentZone == EClass._zone)
40 {
41 c2 = FontColor.Warning;
42 }
43 button1.mainText.SetText(text, c2);
44 _ = button1.icon.rectTransform;
45 }
FontColor
Definition: FontColor.cs:2
int hp
Definition: Card.cs:226
string Name
Definition: Card.cs:2013
int uid
Definition: Card.cs:118
void SetImage(Image image, int dir, int idSkin=0)
Definition: Card.cs:5355
override bool IsPCParty
Definition: Chara.cs:600
override int MaxHP
Definition: Chara.cs:693
Zone currentZone
Definition: Chara.cs:240
bool isDead
Definition: Chara.cs:374
Definition: EClass.cs:5
static Zone _zone
Definition: EClass.cs:20
static FactionBranch Branch
Definition: EClass.cs:22
UIText mainText
Definition: UIButton.cs:102
void SetText(string s)
Definition: UIText.cs:159

References EClass._zone, EClass.Branch, UIItem.button1, card, Chara.currentZone, Card.hp, UIButton.icon, Chara.isDead, Chara.IsPCParty, UIButton.mainText, Chara.MaxHP, Card.Name, Card.SetImage(), UIText.SetText(), Card.uid, and FactionBranch.uidMaid.

Referenced by BaseListPeople.List(), and OnRefreshPref().

◆ SetMainText()

void ItemGeneral.SetMainText ( string  lang,
Sprite  sprite = null,
bool  disableMask = true 
)
inline

Definition at line 101 of file ItemGeneral.cs.

102 {
103 button1.mainText.SetText(lang.lang());
104 if ((bool)sprite)
105 {
106 button1.icon.sprite = sprite;
107 button1.icon.SetNativeSize();
108 if (disableMask)
109 {
110 DisableMask();
111 }
112 }
113 else
114 {
115 DisableIcon();
116 }
117 }
void DisableMask()
Definition: ItemGeneral.cs:156
void DisableIcon()
Definition: ItemGeneral.cs:147

References UIItem.button1, DisableIcon(), DisableMask(), UIButton.icon, UIButton.mainText, and UIText.SetText().

Referenced by LayerEditPlaylist.ListBGM.List(), LayerHome.RefreshAreas(), LayerFactions.RefreshFactions(), ContentFaction.RefreshFactions(), LayerMapList.RefreshList(), UIHomeInfo.RefreshReport(), LayerHome.RefreshSpots(), ContentFaction.RefreshZones(), LayerFactions.RefreshZones(), and LayerLocation.RefreshZones().

◆ SetSound()

void ItemGeneral.SetSound ( SoundData  data = null)
inline

◆ SetSubText()

UIButton ItemGeneral.SetSubText ( string  lang,
int  x,
FontColor  c = FontColor::Default,
TextAnchor  align = TextAnchor::MiddleLeft 
)
inline

Definition at line 119 of file ItemGeneral.cs.

120 {
121 button1.subText.SetActive(enable: true);
122 button1.subText.SetText(lang.lang(), c);
123 button1.subText.alignment = align;
124 button1.mainText.rectTransform.sizeDelta = new Vector2(x - paddingSubText, 20f);
125 button1.subText.rectTransform.anchoredPosition = new Vector2(x, 0f);
126 return button1;
127 }
int paddingSubText
Definition: ItemGeneral.cs:15
UIText subText
Definition: UIButton.cs:104

References UIItem.button1, paddingSubText, UIText.SetText(), and UIButton.subText.

Referenced by AM_Adv._OnUpdateInput(), TraitCrafter.Craft(), ListPeopleCallReserve.OnInstantiate(), ListPeopleEmbark.OnInstantiate(), ContentKeyItem.OnSwitchContent(), ContentQuest.OnSwitchContent(), LayerFactions.RefreshFactions(), ContentFaction.RefreshFactions(), BaseListPeople.SetSubText(), and ListPeopleExpedition.SetSubText().

◆ SetSubText2()

UIButton ItemGeneral.SetSubText2 ( string  lang,
FontColor  c = FontColor::Default,
TextAnchor  align = TextAnchor::MiddleRight 
)
inline

Definition at line 129 of file ItemGeneral.cs.

130 {
131 button1.subText2.SetActive(enable: true);
132 button1.subText2.SetText(lang.lang(), c);
133 button1.subText2.alignment = align;
134 return button1;
135 }
UIText subText2
Definition: UIButton.cs:106

References UIItem.button1, UIText.SetText(), and UIButton.subText2.

Referenced by ListPeopleSelect.OnInstantiate().

Member Data Documentation

◆ ButtonPaddingWhenIcon

const int ItemGeneral.ButtonPaddingWhenIcon = 3
staticprivate

Definition at line 11 of file ItemGeneral.cs.

◆ card

Card ItemGeneral.card

Definition at line 17 of file ItemGeneral.cs.

Referenced by GetRenderRow(), OnRefreshPref(), and SetChara().

◆ count

int ItemGeneral.count
private

Definition at line 19 of file ItemGeneral.cs.

Referenced by AddSubButton(), Build(), and Clear().

◆ IconPadding

const int ItemGeneral.IconPadding = 10
staticprivate

Definition at line 9 of file ItemGeneral.cs.

◆ IconSize

const int ItemGeneral.IconSize = 40
staticprivate

Definition at line 7 of file ItemGeneral.cs.

◆ layout

LayoutGroup ItemGeneral.layout

Definition at line 13 of file ItemGeneral.cs.

◆ paddingSubText

int ItemGeneral.paddingSubText = 50

Definition at line 15 of file ItemGeneral.cs.

Referenced by SetSubText().


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