Elin Decompiled Documentation EA 23.289 Nightly
Loading...
Searching...
No Matches
UIText Class Reference
Inheritance diagram for UIText:
IUISkin

Public Member Functions

void ApplySkin ()
 
void SetText (string s)
 
void SetText (string s, Color c)
 
void SetText (string s, FontColor c)
 
UIText SetSize (int a)
 
void SetColor (FontColor c)
 
void SetLang (string idLang)
 
void OnChangeLanguage ()
 
void ApplySkin ()
 

Public Attributes

string lang
 
BaseSkinRoot skinRoot
 
FontType fontType
 
FontColor fontColor
 
SkinType skinType
 
int size
 
HyphenationJpn hyphenation
 
UIButton button
 
Typewriter typewriter
 
float orgSpacing
 
int orgSize
 
Color orgColor = Color.white
 

Static Public Attributes

static int globalSizeMod
 

Protected Member Functions

override void Awake ()
 
override void OnEnable ()
 

Private Member Functions

void OnSetText ()
 

Detailed Description

Definition at line 5 of file UIText.cs.

Member Function Documentation

◆ ApplySkin()

void UIText.ApplySkin ( )
inline

Implements IUISkin.

Definition at line 42 of file UIText.cs.

43 {
44 if (!Application.isPlaying)
45 {
46 return;
47 }
49 int num = size + 19 + globalSizeMod;
50 SkinManager.FontSet fontSet = instance.fontSet;
51 FontSource fontSource = instance.FontList[0];
52 if (fontType != FontType.DontChange)
53 {
54 int num2 = 0;
55 switch (fontType)
56 {
57 case FontType.UI:
58 fontSource = fontSet.ui.source;
59 num2 = Mathf.Min(fontSet.ui.sizeMod, SkinManager.LimitFontSizeMod_UI);
60 break;
61 case FontType.Widget:
62 fontSource = fontSet.widget.source;
63 num2 = fontSet.widget.sizeMod;
64 break;
65 case FontType.Chatbox:
66 fontSource = fontSet.chatbox.source;
67 num2 = fontSet.chatbox.sizeMod;
68 break;
69 case FontType.Balloon:
70 fontSource = fontSet.balloon.source;
71 num2 = fontSet.balloon.sizeMod;
72 break;
73 case FontType.Dialog:
74 fontSource = fontSet.dialog.source;
75 num2 = fontSet.dialog.sizeMod;
76 break;
77 case FontType.News:
78 fontSource = fontSet.news.source;
79 num2 = fontSet.news.sizeMod;
80 break;
81 }
82 if (fontSource == null)
83 {
84 fontSource = instance.FontList[0];
85 }
86 base.font = fontSource.font;
87 num += fontSource.sizeFix + num2;
88 }
89 if (base.fontSize != num)
90 {
91 base.fontSize = num;
92 }
93 if (base.resizeTextForBestFit)
94 {
95 base.resizeTextMaxSize = base.fontSize;
96 }
97 if ((bool)button && (bool)button.skinRoot)
98 {
99 SkinAsset_Button skinAsset_Button = button.skinRoot.GetButton();
100 if (fontColor != 0)
101 {
102 this.color = skinAsset_Button.textColor;
103 }
104 Shadow component = GetComponent<Shadow>();
105 if (skinAsset_Button.textShadow)
106 {
107 if ((bool)component)
108 {
109 component.enabled = true;
110 component.effectColor = skinAsset_Button.textShadowColor;
111 }
112 }
113 else if ((bool)component)
114 {
115 component.enabled = false;
116 }
117 return;
118 }
119 if (orgSpacing == 0f)
120 {
121 orgSpacing = base.lineSpacing;
122 }
123 if (fontColor == FontColor.DontChange && orgColor == Color.white)
124 {
125 orgColor = this.color;
126 }
128 SkinColorProfile colors = obj.GetColors(skinType);
129 float num3 = 0.5f;
130 bool flag = fontColor == FontColor.DontChange;
131 float num4 = 1f + (flag ? 0f : colors.contrast) + fontSource.contrast;
132 obj.ApplySkin(this, fontSource);
133 Color color = (flag ? orgColor : colors.GetTextColor(fontColor));
134 if (base.fontStyle == FontStyle.Bold)
135 {
136 if (fontSource.alwaysBold)
137 {
138 base.fontStyle = FontStyle.Normal;
139 }
140 else
141 {
142 color.a *= fontSource.boldAlpha;
143 }
144 }
145 num3 = ((!(color.r + color.g + color.b > 1.5f)) ? (0.5f - (flag ? 0f : colors.strength) - (Lang.isJP ? (fontSource.strength + fontSource.strengthFixJP) : fontSource.strength)) : (0.5f + (flag ? 0f : colors.strength) + (Lang.isJP ? (fontSource.strength + fontSource.strengthFixJP) : fontSource.strength)));
146 color.r = (color.r - 0.5f) * num4 + num3;
147 color.g = (color.g - 0.5f) * num4 + num3;
148 color.b = (color.b - 0.5f) * num4 + num3;
149 this.color = color;
150 base.lineSpacing = orgSpacing * fontSource.lineSpacing;
151 _ = (bool)hyphenation;
152 }
FontColor
Definition: FontColor.cs:2
FontType
Definition: FontType.cs:2
virtual void ApplySkin(UIImage t)
Definition: BaseSkinRoot.cs:16
virtual SkinColorProfile GetColors(SkinType type)
Definition: BaseSkinRoot.cs:11
virtual SkinAsset_Button GetButton()
Definition: BaseSkinRoot.cs:28
float strength
Definition: FontSource.cs:21
bool alwaysBold
Definition: FontSource.cs:15
float contrast
Definition: FontSource.cs:19
float strengthFixJP
Definition: FontSource.cs:23
float lineSpacing
Definition: FontSource.cs:25
float boldAlpha
Definition: FontSource.cs:17
Font font
Definition: FontSource.cs:9
Definition: Lang.cs:7
static bool isJP
Definition: Lang.cs:39
Color GetTextColor(FontColor fontColor)
FontSet fontSet
Definition: SkinManager.cs:74
static SkinRootStatic CurrentSkin
Definition: SkinManager.cs:82
static SkinManager Instance
Definition: SkinManager.cs:78
List< FontSource > FontList
Definition: SkinManager.cs:80
static int LimitFontSizeMod_UI
Definition: SkinManager.cs:43
BaseSkinRoot skinRoot
Definition: UIButton.cs:142
int size
Definition: UIText.cs:19
Color orgColor
Definition: UIText.cs:33
UIButton button
Definition: UIText.cs:23
FontType fontType
Definition: UIText.cs:13
SkinType skinType
Definition: UIText.cs:17
HyphenationJpn hyphenation
Definition: UIText.cs:21
static int globalSizeMod
Definition: UIText.cs:7
float orgSpacing
Definition: UIText.cs:27
BaseSkinRoot skinRoot
Definition: UIText.cs:11
FontColor fontColor
Definition: UIText.cs:15

References FontSource.alwaysBold, BaseSkinRoot.ApplySkin(), SkinManager.FontSet.balloon, FontSource.boldAlpha, button, SkinManager.FontSet.chatbox, Color, FontSource.contrast, SkinColorProfile.contrast, SkinManager.CurrentSkin, SkinManager.FontSet.dialog, FontSource.font, fontColor, SkinManager.FontList, SkinManager.fontSet, fontType, BaseSkinRoot.GetButton(), BaseSkinRoot.GetColors(), SkinColorProfile.GetTextColor(), globalSizeMod, hyphenation, SkinManager.Instance, Lang.isJP, SkinManager.LimitFontSizeMod_UI, FontSource.lineSpacing, SkinManager.FontSet.news, orgColor, orgSpacing, size, SkinManager.FontData.sizeMod, UIButton.skinRoot, skinRoot, skinType, SkinManager.FontData.source, FontSource.strength, SkinColorProfile.strength, FontSource.strengthFixJP, SkinAsset_Button.textColor, SkinAsset_Button.textShadow, SkinAsset_Button.textShadowColor, SkinManager.FontSet.ui, and SkinManager.FontSet.widget.

Referenced by Awake(), SetColor(), SkinManager.SetFonts(), SetSize(), DialogDrama.SetText(), and SetText().

◆ Awake()

override void UIText.Awake ( )
inlineprotected

Definition at line 35 of file UIText.cs.

36 {
37 orgSize = size;
38 ApplySkin();
39 base.Awake();
40 }
void ApplySkin()
Definition: UIText.cs:42
int orgSize
Definition: UIText.cs:30

References ApplySkin(), orgSize, and size.

◆ OnChangeLanguage()

void UIText.OnChangeLanguage ( )
inline

Definition at line 250 of file UIText.cs.

251 {
252 if (!string.IsNullOrEmpty(lang))
253 {
254 text = Lang.Get(lang);
255 }
256 }
static string Get(string id)
Definition: Lang.cs:94
string lang
Definition: UIText.cs:9

References Lang.Get(), and lang.

◆ OnEnable()

override void UIText.OnEnable ( )
inlineprotected

Definition at line 154 of file UIText.cs.

155 {
156 base.OnEnable();
157 if (!string.IsNullOrEmpty(lang))
158 {
159 m_Text = Lang.Get(lang);
160 }
161 }

References Lang.Get(), and lang.

◆ OnSetText()

void UIText.OnSetText ( )
inlineprivate

Definition at line 223 of file UIText.cs.

224 {
225 if ((bool)typewriter)
226 {
228 }
229 }
void OnSetText()
Definition: Typewriter.cs:38
Typewriter typewriter
Definition: UIText.cs:25

References Typewriter.OnSetText(), and typewriter.

Referenced by SetText().

◆ SetColor()

void UIText.SetColor ( FontColor  c)
inline

Definition at line 238 of file UIText.cs.

239 {
240 fontColor = c;
241 ApplySkin();
242 }

References ApplySkin(), and fontColor.

Referenced by ContentChronicle.OnSwitchContent(), ContentHomeLog.RefreshLog(), and UIHomeInfo.RefreshReport().

◆ SetLang()

void UIText.SetLang ( string  idLang)
inline

Definition at line 244 of file UIText.cs.

245 {
246 lang = idLang;
247 text = Lang.Get(lang);
248 }

References Lang.Get(), and lang.

Referenced by Window.AddBottomButton(), Window.BuildTabs(), UIButtonLR.SelectOption(), UIButtonLR.SetOptions(), UIButtonLR.SetOptions< T >(), and UIHeader.Start().

◆ SetSize()

UIText UIText.SetSize ( int  a)
inline

Definition at line 231 of file UIText.cs.

232 {
233 size = a;
234 ApplySkin();
235 return this;
236 }

References ApplySkin(), and size.

Referenced by WidgetHP.Refresh(), ButtonGrid.WriteReqMat(), and Recipe.WriteReqSkill().

◆ SetText() [1/3]

void UIText.SetText ( string  s)
inline

Definition at line 163 of file UIText.cs.

164 {
165 if (s == null)
166 {
167 s = "";
168 }
169 if ((bool)hyphenation)
170 {
172 {
174 {
176 {
177 if (this != null)
178 {
180 hyphenation.RebuildLayoutTo<Canvas>();
181 }
182 });
183 }
184 else
185 {
187 }
188 }
189 else
190 {
191 base.horizontalOverflow = HorizontalWrapMode.Wrap;
192 text = s;
193 }
194 }
195 else
196 {
197 text = s;
198 }
199 lang = null;
200 OnSetText();
201 }
static BaseCore Instance
Definition: BaseCore.cs:11
List< Action > actionsLateUpdate
Definition: BaseCore.cs:29
void _SetText(string str, bool useHypenation)
bool hyphenation
Definition: LangSetting.cs:38
static LangSetting setting
Definition: Lang.cs:55
void OnSetText()
Definition: UIText.cs:223

References HyphenationJpn._SetText(), BaseCore.actionsLateUpdate, HyphenationJpn.evaluateLate, LangSetting.hyphenation, hyphenation, BaseCore.Instance, lang, OnSetText(), and Lang.setting.

Referenced by Dialog._Confetti(), UIAutoTurn._Update(), Element._WriteNote(), UICurrency.Add(), WidgetInspector.AddButton(), WidgetInspector.AddLog(), WindowChara.AddNeeds(), LayerFaith.AddReligion(), WindowChara.AddStatus(), UINote.AddText(), ActionHint.AddToggle(), UINote.AddTopic(), MsgBlock.Append(), MsgLine.Append(), Dialog.Choice(), ItemGachaResult.Confirm(), Dialog.CreateNarration(), UIItem.Hyphenate(), BuildMenu.Init(), DramaEventEndRoll.Init(), Dialog.Keymap(), Dialog.List< TValue >(), UICharaMaker.ListModes(), Dialog.Ok(), UIQueue.OnAdd(), LayerNewspaper.OnClickPage(), LayerMod.OnInit(), LayerWorldSetting.OnInit(), NotificationBuff.OnRefresh(), ContentFaction.OnSwitchContent(), ContentKeyItem.OnSwitchContent(), ContentQuest.OnSwitchContent(), LayerConfig.OnSwitchContent(), LayerQuestBoard.OnSwitchContent(), InvOwner.OnWriteNote(), WidgetCurrentTool.RebuildSlots(), ButtonElement.Refresh(), ButtonResourceTrack.Refresh(), ButtonRoster.Refresh(), ContentGallery.Refresh(), ItemCulture.Refresh(), ItemQuestTracker.Refresh(), LayerTravel.Refresh(), LayerWorldSetting.Refresh(), PartialMapMenu.Refresh(), UICharaMaker.Refresh(), UIInspector.Refresh(), UIRecipeInfo.Refresh(), WindowCharaMini.Refresh(), UIRecipeInfo.RefreshBalance(), UIMagicChest.RefreshBottom(), LayerEditPortrait.RefreshButtons(), LayerNewspaper.RefreshChat(), LayerDragGrid.RefreshCost(), WindowChara.RefreshEquipment(), ContentCodex.RefreshInfo(), ContentHomeReport.RefreshInfo(), UIHomeInfo.RefreshInfo(), LayerLoadGame.RefreshInfo(), DropdownRecipe.RefreshLabel(), ContentCodex.RefreshList(), LayerEditPortrait.RefreshList(), LayerEditSkin.RefreshList(), UIInventory.RefreshList(), UIRecipeInfo.RefreshList(), LayerLoadGame.RefreshList(), LayerNewspaper.RefreshNews(), WindowChara.RefreshNote(), ContentPolicy.RefreshPolicyIcons(), LayerPolicy.RefreshPolicyIcons(), ContentPolicy.RefreshPolicyList(), LayerPolicy.RefreshPolicyList(), LayerQuestBoard.RefreshQuest(), LayerQuestBoard.RefreshRanking(), ContentConfigOther.RefreshRewardCode(), WindowChara.RefreshSkill(), LayerGlobalMap.RefreshSummary(), LayerWorldSetting.RefreshTemplate(), UIBook.RefreshTopics(), LayerNewspaper.RefreshVote(), WidgetSearch.RefreshWords(), ContentKeyItem.SelectItem(), ContentQuest.SelectQuest(), ButtonAbility.SetAct(), UIRecipeInfo.SetArea(), CharaBody.SetBodyIndexText(), Window.SetCaption(), ButtonGeneral.SetCard(), UICharaMaker.SetChara(), ItemGeneral.SetChara(), ItemGachaResult.SetChara(), ButtonChara.SetChara(), ButtonElement.SetGrid(), ItemGeneral.SetMainText(), Trait.SetMainText(), TraitAbility.SetMainText(), TraitToolRange.SetMainText(), ItemQuest.SetQuest(), ItemGeneral.SetSubText(), ItemGeneral.SetSubText2(), BaseSticky.SetText(), DialogDrama.SetText(), PopfabText.SetText(), UIHeader.SetText(), ActionHint.SetText(), SetText(), PopItemText.SetText(), BaseStats.SetText(), Recipe.SetTextDifficulty(), FactionRelation.SetTextHostility(), Religion.SetTextRelation(), UIItem.SetTopic(), TerrainMenu.Show(), WidgetPopup.Show(), LayerShippingResult.Show(), UIBook.Show(), LayerInteraction.ShowPage(), Thing.ShowSplitMenu2(), WidgetInspector.SwitchPage(), Dialog.TryWarn(), Chara.WriteNote(), Thing.WriteNote(), and Dialog.YesNo().

◆ SetText() [2/3]

void UIText.SetText ( string  s,
Color  c 
)
inline

Definition at line 203 of file UIText.cs.

204 {
205 SetText(s);
206 fontColor = FontColor.DontChange;
207 orgColor = c;
208 color = c;
209 OnSetText();
210 }
void SetText(string s)
Definition: UIText.cs:163

References fontColor, OnSetText(), orgColor, and SetText().

◆ SetText() [3/3]

void UIText.SetText ( string  s,
FontColor  c 
)
inline

Definition at line 212 of file UIText.cs.

213 {
214 SetText(s);
215 if (c != FontColor.Ignore)
216 {
217 fontColor = c;
218 ApplySkin();
219 }
220 OnSetText();
221 }

References ApplySkin(), fontColor, OnSetText(), and SetText().

Member Data Documentation

◆ button

UIButton UIText.button

Definition at line 23 of file UIText.cs.

Referenced by ApplySkin().

◆ fontColor

FontColor UIText.fontColor

Definition at line 15 of file UIText.cs.

Referenced by ApplySkin(), SetColor(), and SetText().

◆ fontType

FontType UIText.fontType

Definition at line 13 of file UIText.cs.

Referenced by ApplySkin().

◆ globalSizeMod

int UIText.globalSizeMod
static

Definition at line 7 of file UIText.cs.

Referenced by ApplySkin().

◆ hyphenation

HyphenationJpn UIText.hyphenation

Definition at line 21 of file UIText.cs.

Referenced by ApplySkin(), and SetText().

◆ lang

◆ orgColor

Color UIText.orgColor = Color.white

Definition at line 33 of file UIText.cs.

Referenced by ApplySkin(), and SetText().

◆ orgSize

int UIText.orgSize

Definition at line 30 of file UIText.cs.

Referenced by Awake(), and WidgetHP.Refresh().

◆ orgSpacing

float UIText.orgSpacing

Definition at line 27 of file UIText.cs.

Referenced by ApplySkin().

◆ size

int UIText.size

Definition at line 19 of file UIText.cs.

Referenced by ApplySkin(), Awake(), HUD.SetDragImage(), and SetSize().

◆ skinRoot

BaseSkinRoot UIText.skinRoot

Definition at line 11 of file UIText.cs.

Referenced by ApplySkin().

◆ skinType

SkinType UIText.skinType

Definition at line 17 of file UIText.cs.

Referenced by ApplySkin().

◆ typewriter

Typewriter UIText.typewriter

Definition at line 25 of file UIText.cs.

Referenced by OnSetText(), and DramaEventTalk.Play().


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