2using System.Collections.Generic;
23 public static NaturalStringComparer
comparer =
new NaturalStringComparer();
33 public static string space =
"";
35 public static List<Dictionary<string, object>>
listName;
37 public static List<Dictionary<string, object>>
listAlias;
74 public static void Init(
string lang)
82 space = (setting.useSpace ?
" " :
"");
83 char.TryParse(
"_comma".lang(), out
words.
comma);
85 SourceData.LangSuffix =
suffix;
87 string[] list =
GetList(
"_articlesToRemove");
88 foreach (
string text
in list)
94 public static string Get(
string id)
103 public static bool Has(
string id)
105 return General.map.ContainsKey(
id);
110 if (!
General.map.ContainsKey(
id))
122 public static string ParseRaw(
string text,
string val1,
string val2 =
null,
string val3 =
null,
string val4 =
null,
string val5 =
null)
124 StringBuilder stringBuilder =
new StringBuilder(text);
125 stringBuilder.Replace(
"#1", val1 ??
"");
128 stringBuilder.Replace(
"#(s2)", (val2.Replace(
",",
"").ToInt() <= 1) ?
"" :
"_s".lang());
130 stringBuilder.Replace(
"#(s)", (val1.Replace(
",",
"").ToInt() <= 1) ?
"" :
"_s".lang());
133 stringBuilder.Replace(
"#2", val2);
137 stringBuilder.Replace(
"#3", val3);
141 stringBuilder.Replace(
"#4", val4);
145 stringBuilder.Replace(
"#5", val5);
147 return stringBuilder.ToString();
150 public static string Parse(
string idLang,
string val1,
string val2 =
null,
string val3 =
null,
string val4 =
null,
string val5 =
null)
152 return ParseRaw(
Get(idLang), val1, val2, val3, val4, val5);
165 public static string _currency(
object a,
string IDCurrency)
167 return (
"u_currency_" + IDCurrency).lang(
$"{a:#,0}");
170 public static string _currency(
object a,
bool showUnit =
false,
int unitSize = 14)
172 return $"{a:#,0}" + ((!showUnit) ?
"" : ((unitSize == 0) ?
"u_money".lang(a?.ToString() ??
"") : (
"<size=" + unitSize +
"> " +
"u_money".lang(a?.ToString() ??
"") +
"</size>")));
175 public static string _weight(
int a,
int b,
bool showUnit =
true,
int unitSize = 0)
177 return (0.001f * (
float)a).ToString(
"#0.0") +
"/" + (0.001f * (float)b).ToString(
"#0.0") + ((!showUnit) ?
"" : ((unitSize == 0) ?
"s" : (
"<size=" + unitSize +
"> s</size>")));
185 public static string _weight(
int a,
bool showUnit =
true,
int unitSize = 0)
187 return (0.001f * (
float)a).ToString(
"#0.0") + ((!showUnit) ?
"" : ((unitSize == 0) ?
"s" : (
"<size=" + unitSize +
"> s</size>")));
205 return prev +
" ⇒ " + now;
220 item.BuildMap(sheetName);
222 if (
item.book.GetSheet(sheetName) ==
null)
227 foreach (var (text2, value) in sheet.
map)
229 if (!text2.IsEmpty())
240 public static string[]
GetDialog(
string idSheet,
string idTopic)
242 Dictionary<string, string> dictionary =
GetDialogSheet(idSheet).map.TryGetValue(idTopic);
243 if (dictionary ==
null)
245 return new string[1] { idTopic };
248 string text = dictionary.GetValueOrDefault(key) ?? dictionary.GetValueOrDefault(
"text");
251 text = dictionary[
"text_EN"];
253 return text.Split(
new string[3] {
"\r\n",
"\r",
"\n" }, StringSplitOptions.None);
List< Dictionary< string, string > > list
Dictionary< string, Dictionary< string, string > > map
Dictionary< string, Sheet > sheets
virtual void BuildMap(string sheetName="_default")
static string _weight(int a, int b, bool showUnit=true, int unitSize=0)
static string[] GetDialog(string idSheet, string idTopic)
static LangSetting setting
static NaturalStringComparer comparer
static LangGeneral General
static string _rarity(int a)
static string _currency(object a, bool showUnit=false, int unitSize=14)
static string _Number(int a)
static List< char[]> articlesToRemove
static List< Dictionary< string, object > > listAlias
static bool IsBuiltin(string id)
static string _ChangeNum(int prev, int now)
static string _gender(int id)
static List< Dictionary< string, object > > listName
static string LoadText(string id)
static string Get(string id)
static string _weight(int a, bool showUnit=true, int unitSize=0)
static string[] GetList(string id)
static ExcelData excelDialog
static string ParseRaw(string text, string val1, string val2=null, string val3=null, string val4=null, string val5=null)
static ExcelData.Sheet GetDialogSheet(string idSheet)
static HashSet< string > extraExcelDialogs
static string _currency(object a, string IDCurrency)
static void Init(string lang)
static bool Has(string id)
static string TryGet(string id)
static string Parse(string idLang, string val1, string val2=null, string val3=null, string val4=null, string val5=null)
static Dictionary< string, LangSetting > langs
virtual string[] GetList(string id)