2using System.Collections.Generic;
22 public static NaturalStringComparer
comparer =
new NaturalStringComparer();
32 public static string space =
"";
34 public static List<Dictionary<string, object>>
listName;
36 public static List<Dictionary<string, object>>
listAlias;
71 public static void Init(
string lang)
79 space = (setting.useSpace ?
" " :
"");
80 char.TryParse(
"_comma".lang(), out
words.
comma);
82 SourceData.LangSuffix =
suffix;
84 string[] list =
GetList(
"_articlesToRemove");
85 foreach (
string text
in list)
91 public static string Get(
string id)
100 public static bool Has(
string id)
102 return General.map.ContainsKey(
id);
107 if (!
General.map.ContainsKey(
id))
119 public static string ParseRaw(
string text,
string val1,
string val2 =
null,
string val3 =
null,
string val4 =
null,
string val5 =
null)
121 StringBuilder stringBuilder =
new StringBuilder(text);
122 stringBuilder.Replace(
"#1", val1 ??
"");
125 stringBuilder.Replace(
"#(s2)", (val2.Replace(
",",
"").ToInt() <= 1) ?
"" :
"_s".lang());
127 stringBuilder.Replace(
"#(s)", (val1.Replace(
",",
"").ToInt() <= 1) ?
"" :
"_s".lang());
130 stringBuilder.Replace(
"#2", val2);
134 stringBuilder.Replace(
"#3", val3);
138 stringBuilder.Replace(
"#4", val4);
142 stringBuilder.Replace(
"#5", val5);
144 return stringBuilder.ToString();
147 public static string Parse(
string idLang,
string val1,
string val2 =
null,
string val3 =
null,
string val4 =
null,
string val5 =
null)
149 return ParseRaw(
Get(idLang), val1, val2, val3, val4, val5);
162 public static string _currency(
object a,
string IDCurrency)
164 return (
"u_currency_" + IDCurrency).lang(
$"{a:#,0}");
167 public static string _currency(
object a,
bool showUnit =
false,
int unitSize = 14)
169 return $"{a:#,0}" + ((!showUnit) ?
"" : ((unitSize == 0) ?
"u_money".lang(a?.ToString() ??
"") : (
"<size=" + unitSize +
"> " +
"u_money".lang(a?.ToString() ??
"") +
"</size>")));
172 public static string _weight(
int a,
int b,
bool showUnit =
true,
int unitSize = 0)
174 return (0.001f * (
float)a).ToString(
"#0.0") +
"/" + (0.001f * (float)b).ToString(
"#0.0") + ((!showUnit) ?
"" : ((unitSize == 0) ?
"s" : (
"<size=" + unitSize +
"> s</size>")));
182 public static string _weight(
int a,
bool showUnit =
true,
int unitSize = 0)
184 return (0.001f * (
float)a).ToString(
"#0.0") + ((!showUnit) ?
"" : ((unitSize == 0) ?
"s" : (
"<size=" + unitSize +
"> s</size>")));
202 return prev +
" ⇒ " + now;
205 public static string[]
GetDialog(
string idSheet,
string idTopic)
209 string path = CorePath.CorePackage.TextDialog +
"dialog.xlsx";
211 excelDialog.path = path;
216 Dictionary<string, string> dictionary = sheet.
map.TryGetValue(idTopic);
217 if (dictionary ==
null || !dictionary.ContainsKey(key))
219 return new string[1] { idTopic };
221 string text = dictionary[key];
224 text = dictionary[
"text_EN"];
226 return text.Split(
new string[3] {
"\r\n",
"\r",
"\n" }, StringSplitOptions.None);
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 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)