Elin Decompiled Documentation EA 23.321 Nightly Patch 1
Loading...
Searching...
No Matches
Lang Class Reference

Classes

class  Words
 

Public Types

enum  LangCode { None = 0 , JP = 10 , EN = 20 , CN = 30 }
 

Static Public Member Functions

static bool IsBuiltin (string id)
 
static void Init (string lang)
 
static string Get (string id)
 
static bool Has (string id)
 
static string TryGet (string id)
 
static string[] GetList (string id)
 
static string ParseRaw (string text, string val1, string val2=null, string val3=null, string val4=null, string val5=null)
 
static string Parse (string idLang, string val1, string val2=null, string val3=null, string val4=null, string val5=null)
 
static string LoadText (string id)
 
static string _Number (int a)
 
static string _currency (object a, string IDCurrency)
 
static string _currency (object a, bool showUnit=false, int unitSize=14)
 
static string _weight (int a, int b, bool showUnit=true, int unitSize=0)
 
static string _gender (int id)
 
static string _weight (int a, bool showUnit=true, int unitSize=0)
 
static string _rarity (int a)
 
static string _ChangeNum (int prev, int now)
 
static ExcelData.Sheet GetDialogSheet (string idSheet)
 
static string[] GetDialog (string idSheet, string idTopic)
 

Static Public Attributes

static NaturalStringComparer comparer = new NaturalStringComparer()
 
static bool runUpdate
 
static Words words = new Words()
 
static string langCode = ""
 
static string suffix = ""
 
static string space = ""
 
static List< Dictionary< string, object > > listName
 
static List< Dictionary< string, object > > listAlias
 
static bool isJP
 
static bool isEN
 
static bool isBuiltin
 
static List< char[]> articlesToRemove
 
static LangGeneral General
 
static LangGame Game
 
static LangNote Note
 
static SourceData List
 
static LangSetting setting
 
static ExcelData excelDialog
 
static List< Func< List< string > > > excelDialogLoaders = new List<Func<List<string>>>()
 

Detailed Description

Definition at line 6 of file Lang.cs.

Member Enumeration Documentation

◆ LangCode

Enumerator
None 
JP 
EN 
CN 

Definition at line 8 of file Lang.cs.

9 {
10 None = 0,
11 JP = 10,
12 EN = 20,
13 CN = 30
14 }

Member Function Documentation

◆ _ChangeNum()

static string Lang._ChangeNum ( int  prev,
int  now 
)
inlinestatic

Definition at line 199 of file Lang.cs.

200 {
201 return prev + " ⇒ " + now;
202 }

Referenced by LittlePopper._OnAddStockpile().

◆ _currency() [1/2]

static string Lang._currency ( object  a,
bool  showUnit = false,
int  unitSize = 14 
)
inlinestatic

Definition at line 166 of file Lang.cs.

167 {
168 return $"{a:#,0}" + ((!showUnit) ? "" : ((unitSize == 0) ? "u_money".lang(a?.ToString() ?? "") : ("<size=" + unitSize + "> " + "u_money".lang(a?.ToString() ?? "") + "</size>")));
169 }

References $.

◆ _currency() [2/2]

◆ _gender()

static string Lang._gender ( int  id)
inlinestatic

Definition at line 176 of file Lang.cs.

177 {
178 return GetList("genders")[id];
179 }
static string[] GetList(string id)
Definition: Lang.cs:113

References GetList().

Referenced by Person.GetDramaTitle(), UICharaMaker.Refresh(), ButtonChara.SetChara(), and Biography.TextBio().

◆ _Number()

static string Lang._Number ( int  a)
inlinestatic

Definition at line 156 of file Lang.cs.

157 {
158 return $"{a:#,0}";
159 }

References $.

Referenced by UIRecipeInfo.RefreshBalance().

◆ _rarity()

static string Lang._rarity ( int  a)
inlinestatic

Definition at line 186 of file Lang.cs.

187 {
188 return a switch
189 {
190 4 => "SSR",
191 3 => "SR",
192 2 => "R",
193 1 => "C",
194 0 => "K",
195 _ => "LE",
196 };
197 }

Referenced by Hoard.Item.Name().

◆ _weight() [1/2]

static string Lang._weight ( int  a,
bool  showUnit = true,
int  unitSize = 0 
)
inlinestatic

Definition at line 181 of file Lang.cs.

182 {
183 return (0.001f * (float)a).ToString("#0.0") + ((!showUnit) ? "" : ((unitSize == 0) ? "s" : ("<size=" + unitSize + "> s</size>")));
184 }

◆ _weight() [2/2]

static string Lang._weight ( int  a,
int  b,
bool  showUnit = true,
int  unitSize = 0 
)
inlinestatic

Definition at line 171 of file Lang.cs.

172 {
173 return (0.001f * (float)a).ToString("#0.0") + "/" + (0.001f * (float)b).ToString("#0.0") + ((!showUnit) ? "" : ((unitSize == 0) ? "s" : ("<size=" + unitSize + "> s</size>")));
174 }

Referenced by InvOwnerDeliver._OnProcess(), UICurrency.Build(), Thing.GetHoverText(), QuestHarvest.GetTextProgress(), ZoneEventHarvest.OnReachTimeLimit(), WindowCharaMini.Refresh(), UIInventory.RefreshGrid(), UIInventory.RefreshList(), WindowChara.RefreshProfile(), ButtonGrid.SetCard(), Thing.ShowSplitMenu(), and Thing.ShowSplitMenu2().

◆ Get()

◆ GetDialog()

static string[] Lang.GetDialog ( string  idSheet,
string  idTopic 
)
inlinestatic

Definition at line 246 of file Lang.cs.

247 {
248 Dictionary<string, string> dictionary = GetDialogSheet(idSheet).map.TryGetValue(idTopic);
249 if (dictionary == null)
250 {
251 return new string[1] { idTopic };
252 }
253 string key = "text_" + langCode;
254 string text = dictionary.GetValueOrDefault(key) ?? dictionary.GetValueOrDefault("text");
255 if (text.IsEmpty())
256 {
257 text = dictionary["text_EN"];
258 }
259 return text.Split(new string[3] { "\r\n", "\r", "\n" }, StringSplitOptions.None);
260 }
static string langCode
Definition: Lang.cs:29
static ExcelData.Sheet GetDialogSheet(string idSheet)
Definition: Lang.cs:204

References GetDialogSheet(), and langCode.

Referenced by DramaCustomSequence.GetText(), BottleMessageList.Init(), TraitFortuneCookie.OnEat(), and TraitASMR.Update().

◆ GetDialogSheet()

static ExcelData.Sheet Lang.GetDialogSheet ( string  idSheet)
inlinestatic

Definition at line 204 of file Lang.cs.

205 {
206 if (excelDialog == null)
207 {
208 excelDialog = new ExcelData(CorePath.CorePackage.TextDialog + "dialog.xlsx");
210 List<ExcelData> list = new List<ExcelData>();
211 if (!isBuiltin)
212 {
213 list.Add(new ExcelData(CorePath.CorePackage.TextDialogLocal + "dialog.xlsx"));
214 }
215 foreach (Func<List<string>> excelDialogLoader in excelDialogLoaders)
216 {
217 list.AddRange(from f in excelDialogLoader()
218 select new ExcelData(f));
219 }
220 for (int i = 0; i < excelDialog.book.NumberOfSheets; i++)
221 {
222 string sheetName = excelDialog.book.GetSheetAt(i).SheetName;
223 excelDialog.BuildMap(sheetName);
224 foreach (ExcelData item in list)
225 {
226 item.BuildMap(sheetName);
227 ExcelData.Sheet sheet = item.sheets[sheetName];
228 if (item.book.GetSheet(sheetName) == null)
229 {
230 sheet.list.Clear();
231 sheet.map.Clear();
232 }
233 foreach (var (text2, value) in sheet.map)
234 {
235 if (!text2.IsEmpty())
236 {
237 excelDialog.sheets[sheetName].map[text2] = value;
238 }
239 }
240 }
241 }
242 }
243 return excelDialog.sheets[idSheet];
244 }
static string TextDialog
Definition: CorePath.cs:51
static string TextDialogLocal
Definition: CorePath.cs:53
List< Dictionary< string, string > > list
Definition: ExcelData.cs:16
Dictionary< string, Dictionary< string, string > > map
Definition: ExcelData.cs:14
Dictionary< string, Sheet > sheets
Definition: ExcelData.cs:25
void LoadBook()
Definition: ExcelData.cs:49
virtual void BuildMap(string sheetName="_default")
Definition: ExcelData.cs:77
XSSFWorkbook book
Definition: ExcelData.cs:21
static List< Func< List< string > > > excelDialogLoaders
Definition: Lang.cs:59
static ExcelData excelDialog
Definition: Lang.cs:57
static bool isBuiltin
Definition: Lang.cs:43

References ExcelData.book, ExcelData.BuildMap(), excelDialog, excelDialogLoaders, isBuiltin, item, ExcelData.Sheet.list, ExcelData.LoadBook(), ExcelData.Sheet.map, ExcelData.sheets, CorePath.CorePackage.TextDialog, and CorePath.CorePackage.TextDialogLocal.

Referenced by GetDialog(), DramaCustomSequence.HasTopic(), and TraitASMR.OnCreate().

◆ GetList()

◆ Has()

static bool Lang.Has ( string  id)
inlinestatic

Definition at line 99 of file Lang.cs.

100 {
101 return General.map.ContainsKey(id);
102 }

References General.

Referenced by Act.GetText(), LayerWorldSetting.Refresh(), ELayer.TryShowHint(), BaseStats.WriteNote(), and Thing.WriteNote().

◆ Init()

static void Lang.Init ( string  lang)
inlinestatic

Definition at line 70 of file Lang.cs.

71 {
72 setting = MOD.langs.TryGetValue(lang) ?? MOD.langs["EN"];
73 langCode = lang;
74 isJP = lang == "JP";
75 isEN = lang == "EN";
76 isBuiltin = lang == "JP" || lang == "EN";
77 suffix = ((!isBuiltin) ? "_L" : (isJP ? "_JP" : ""));
78 space = (setting.useSpace ? " " : "");
79 char.TryParse("_comma".lang(), out words.comma);
80 char.TryParse("_period".lang(), out words.period);
81 SourceData.LangSuffix = suffix;
82 articlesToRemove = new List<char[]>();
83 string[] list = GetList("_articlesToRemove");
84 foreach (string text in list)
85 {
86 articlesToRemove.Add(text.ToCharArray());
87 }
88 }
char period
Definition: Lang.cs:20
char comma
Definition: Lang.cs:18
static Words words
Definition: Lang.cs:27
static LangSetting setting
Definition: Lang.cs:55
static string suffix
Definition: Lang.cs:31
static List< char[]> articlesToRemove
Definition: Lang.cs:45
static bool isEN
Definition: Lang.cs:41
static string space
Definition: Lang.cs:33
static bool isJP
Definition: Lang.cs:39
Definition: MOD.cs:7
static Dictionary< string, LangSetting > langs
Definition: MOD.cs:8

References articlesToRemove, Lang.Words.comma, GetList(), isBuiltin, isEN, isJP, langCode, MOD.langs, Lang.Words.period, setting, space, suffix, and words.

Referenced by Core.SetLang().

◆ IsBuiltin()

static bool Lang.IsBuiltin ( string  id)
inlinestatic

Definition at line 61 of file Lang.cs.

62 {
63 if (!(id == "JP"))
64 {
65 return id == "EN";
66 }
67 return true;
68 }

Referenced by ModPackage.AddOrUpdateLang().

◆ LoadText()

static string Lang.LoadText ( string  id)
inlinestatic

Definition at line 151 of file Lang.cs.

152 {
153 return null;
154 }

◆ Parse()

static string Lang.Parse ( string  idLang,
string  val1,
string  val2 = null,
string  val3 = null,
string  val4 = null,
string  val5 = null 
)
inlinestatic

Definition at line 146 of file Lang.cs.

147 {
148 return ParseRaw(Get(idLang), val1, val2, val3, val4, val5);
149 }
static string Get(string id)
Definition: Lang.cs:90
static string ParseRaw(string text, string val1, string val2=null, string val3=null, string val4=null, string val5=null)
Definition: Lang.cs:118

References Get(), and ParseRaw().

Referenced by UIBook.Page.BuildNote(), Cell.GetBlockName(), Cell.GetBridgeName(), Cell.GetFloorName(), Cell.GetLiquidName(), ClassExtension.lang(), ClassExtension.langPlural(), ContentTop.OnSwitchContent(), ContentHallOfFame.Refresh(), Biography.TextAge(), Biography.TextAppearance(), Biography.TextBio2(), and Biography.TextBirthDate().

◆ ParseRaw()

static string Lang.ParseRaw ( string  text,
string  val1,
string  val2 = null,
string  val3 = null,
string  val4 = null,
string  val5 = null 
)
inlinestatic

Definition at line 118 of file Lang.cs.

119 {
120 StringBuilder stringBuilder = new StringBuilder(text);
121 stringBuilder.Replace("#1", val1 ?? "");
122 if (val2 != null)
123 {
124 stringBuilder.Replace("#(s2)", (val2.Replace(",", "").ToInt() <= 1) ? "" : "_s".lang());
125 }
126 stringBuilder.Replace("#(s)", (val1.Replace(",", "").ToInt() <= 1) ? "" : "_s".lang());
127 if (val2 != null)
128 {
129 stringBuilder.Replace("#2", val2);
130 }
131 if (val3 != null)
132 {
133 stringBuilder.Replace("#3", val3);
134 }
135 if (val4 != null)
136 {
137 stringBuilder.Replace("#4", val4);
138 }
139 if (val5 != null)
140 {
141 stringBuilder.Replace("#5", val5);
142 }
143 return stringBuilder.ToString();
144 }

Referenced by ZoneEvent.GetText(), Act.GetText(), and Parse().

◆ TryGet()

static string Lang.TryGet ( string  id)
inlinestatic

Definition at line 104 of file Lang.cs.

105 {
106 if (!General.map.ContainsKey(id))
107 {
108 return null;
109 }
110 return Get(id);
111 }

References General, and Get().

Referenced by TraitPerfume.GetName(), TraitPotionRandom.GetName(), and TraitScrollRandom.GetName().

Member Data Documentation

◆ articlesToRemove

List<char[]> Lang.articlesToRemove
static

Definition at line 45 of file Lang.cs.

Referenced by Init(), and GameLang.Parse().

◆ comparer

NaturalStringComparer Lang.comparer = new NaturalStringComparer()
static

◆ excelDialog

ExcelData Lang.excelDialog
static

Definition at line 57 of file Lang.cs.

Referenced by GetDialogSheet().

◆ excelDialogLoaders

List<Func<List<string> > > Lang.excelDialogLoaders = new List<Func<List<string>>>()
static

Definition at line 59 of file Lang.cs.

Referenced by GetDialogSheet().

◆ Game

LangGame Lang.Game
static

◆ General

LangGeneral Lang.General
static

Definition at line 47 of file Lang.cs.

Referenced by Get(), Has(), and TryGet().

◆ isBuiltin

◆ isEN

bool Lang.isEN
static

Definition at line 41 of file Lang.cs.

Referenced by Init().

◆ isJP

◆ langCode

◆ List

SourceData Lang.List
static

Definition at line 53 of file Lang.cs.

Referenced by GetList().

◆ listAlias

List<Dictionary<string, object> > Lang.listAlias
static

Definition at line 37 of file Lang.cs.

◆ listName

List<Dictionary<string, object> > Lang.listName
static

Definition at line 35 of file Lang.cs.

◆ Note

LangNote Lang.Note
static

Definition at line 51 of file Lang.cs.

Referenced by Thing.GetName().

◆ runUpdate

bool Lang.runUpdate
static

Definition at line 25 of file Lang.cs.

Referenced by ModPackage.AddOrUpdateLang().

◆ setting

◆ space

string Lang.space = ""
static

Definition at line 33 of file Lang.cs.

Referenced by CardRow.GetName(), Religion.GetTextBenefit(), and Init().

◆ suffix

string Lang.suffix = ""
static

Definition at line 31 of file Lang.cs.

Referenced by Init().

◆ words

Words Lang.words = new Words()
static

Definition at line 27 of file Lang.cs.

Referenced by Init(), ClassExtension.StripLastPun(), and ClassExtension.StripPun().


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