Code cleanup.

This commit is contained in:
2023-06-22 13:18:34 +08:00
parent 22cb8f0cb4
commit a7aff4d625
8 changed files with 321 additions and 302 deletions

View File

@@ -11,290 +11,290 @@ namespace Cryville.Common.Font {
} }
public class FallbackListFontMatcher : FontMatcher { public class FallbackListFontMatcher : FontMatcher {
public Dictionary<string, List<string>> MapScriptToTypefaces = new Dictionary<string, List<string>>(); public Dictionary<string, List<string>> MapScriptToTypefaces = new Dictionary<string, List<string>>();
public void LoadDefaultWindowsFallbackList() { public static Dictionary<string, List<string>> GetDefaultWindowsFallbackMap() {
if (Environment.OSVersion.Platform != PlatformID.Win32NT) return; var map = new Dictionary<string, List<string>>();
MapScriptToTypefaces.Clear(); ScriptUtils.FillKeysWithScripts(map, () => new List<string>());
ScriptUtils.FillKeysWithScripts(MapScriptToTypefaces, () => new List<string>());
// Reference: https://github.com/chromium/chromium/blob/main/third_party/blink/renderer/platform/fonts/win/font_fallback_win.cc // Reference: https://github.com/chromium/chromium/blob/main/third_party/blink/renderer/platform/fonts/win/font_fallback_win.cc
MapScriptToTypefaces["zyyy"].Insert(0, "SimSun"); // Custom map["zyyy"].Insert(0, "SimSun"); // Custom
MapScriptToTypefaces["zyyy"].Insert(0, "SimHei"); // Custom map["zyyy"].Insert(0, "SimHei"); // Custom
MapScriptToTypefaces["zyyy"].Insert(0, "Microsoft YaHei"); // Custom map["zyyy"].Insert(0, "Microsoft YaHei"); // Custom
MapScriptToTypefaces["zyyy"].Insert(0, "Arial"); map["zyyy"].Insert(0, "Arial");
MapScriptToTypefaces["zyyy"].Insert(0, "Times New Roman"); map["zyyy"].Insert(0, "Times New Roman");
MapScriptToTypefaces["zyyy"].Insert(0, "Segoe UI"); // Custom map["zyyy"].Insert(0, "Segoe UI"); // Custom
MapScriptToTypefaces["arab"].Insert(0, "Tahoma"); map["arab"].Insert(0, "Tahoma");
MapScriptToTypefaces["cyrl"].Insert(0, "Times New Roman"); map["cyrl"].Insert(0, "Times New Roman");
MapScriptToTypefaces["grek"].Insert(0, "Times New Roman"); map["grek"].Insert(0, "Times New Roman");
MapScriptToTypefaces["hebr"].Insert(0, "David"); map["hebr"].Insert(0, "David");
MapScriptToTypefaces["jpan"].Insert(0, "MS PGothic"); map["jpan"].Insert(0, "MS PGothic");
MapScriptToTypefaces["latn"].Insert(0, "Times New Roman"); map["latn"].Insert(0, "Times New Roman");
MapScriptToTypefaces["hans"].Insert(0, "SimSun"); map["hans"].Insert(0, "SimSun");
MapScriptToTypefaces["hans"].Insert(0, "SimHei"); // Custom map["hans"].Insert(0, "SimHei"); // Custom
MapScriptToTypefaces["thai"].Insert(0, "Tahoma"); map["thai"].Insert(0, "Tahoma");
MapScriptToTypefaces["hans"].Insert(0, "PMingLiU"); map["hans"].Insert(0, "PMingLiU");
// Reference: https://learn.microsoft.com/en-us/globalization/input/font-support // Reference: https://learn.microsoft.com/en-us/globalization/input/font-support
var ver = Environment.OSVersion.Version; var ver = Environment.OSVersion.Version;
if (ver >= new Version(5, 0)) { // Windows 2000 if (ver >= new Version(5, 0)) { // Windows 2000
MapScriptToTypefaces["armn"].Insert(0, "Sylfaen"); map["armn"].Insert(0, "Sylfaen");
MapScriptToTypefaces["deva"].Insert(0, "Mangal"); map["deva"].Insert(0, "Mangal");
MapScriptToTypefaces["geor"].Insert(0, "Sylfaen"); map["geor"].Insert(0, "Sylfaen");
MapScriptToTypefaces["taml"].Insert(0, "Latha"); map["taml"].Insert(0, "Latha");
} }
if (ver >= new Version(5, 1)) { // Windows XP if (ver >= new Version(5, 1)) { // Windows XP
MapScriptToTypefaces["gujr"].Insert(0, "Shruti"); map["gujr"].Insert(0, "Shruti");
MapScriptToTypefaces["guru"].Insert(0, "Raavi"); map["guru"].Insert(0, "Raavi");
MapScriptToTypefaces["knda"].Insert(0, "Tunga"); map["knda"].Insert(0, "Tunga");
MapScriptToTypefaces["syrc"].Insert(0, "Estrangelo Edessa"); map["syrc"].Insert(0, "Estrangelo Edessa");
MapScriptToTypefaces["telu"].Insert(0, "Gautami"); map["telu"].Insert(0, "Gautami");
MapScriptToTypefaces["thaa"].Insert(0, "MV Boli"); map["thaa"].Insert(0, "MV Boli");
// SP2 // SP2
MapScriptToTypefaces["beng"].Insert(0, "Vrinda"); map["beng"].Insert(0, "Vrinda");
MapScriptToTypefaces["mlym"].Insert(0, "Kartika"); map["mlym"].Insert(0, "Kartika");
} }
if (ver >= new Version(6, 0)) { // Windows Vista if (ver >= new Version(6, 0)) { // Windows Vista
MapScriptToTypefaces["cans"].Insert(0, "Euphemia"); map["cans"].Insert(0, "Euphemia");
MapScriptToTypefaces["cher"].Insert(0, "Plantagenet"); map["cher"].Insert(0, "Plantagenet");
MapScriptToTypefaces["ethi"].Insert(0, "Nyala"); map["ethi"].Insert(0, "Nyala");
MapScriptToTypefaces["khmr"].Insert(0, "DaunPenh MoolBoran"); map["khmr"].Insert(0, "DaunPenh MoolBoran");
MapScriptToTypefaces["laoo"].Insert(0, "DokChampa"); map["laoo"].Insert(0, "DokChampa");
MapScriptToTypefaces["mong"].Insert(0, "Mongolian Baiti"); map["mong"].Insert(0, "Mongolian Baiti");
MapScriptToTypefaces["orya"].Insert(0, "Kalinga"); map["orya"].Insert(0, "Kalinga");
MapScriptToTypefaces["sinh"].Insert(0, "Iskoola Pota"); map["sinh"].Insert(0, "Iskoola Pota");
MapScriptToTypefaces["tibt"].Insert(0, "Microsoft Himalaya"); map["tibt"].Insert(0, "Microsoft Himalaya");
MapScriptToTypefaces["yiii"].Insert(0, "Microsoft Yi Baiti"); map["yiii"].Insert(0, "Microsoft Yi Baiti");
MapScriptToTypefaces["arab"].Insert(0, "Segoe UI"); map["arab"].Insert(0, "Segoe UI");
MapScriptToTypefaces["cyrl"].Insert(0, "Segoe UI"); map["cyrl"].Insert(0, "Segoe UI");
MapScriptToTypefaces["grek"].Insert(0, "Segoe UI"); map["grek"].Insert(0, "Segoe UI");
MapScriptToTypefaces["latn"].Insert(0, "Segoe UI"); map["latn"].Insert(0, "Segoe UI");
MapScriptToTypefaces["hans"].Add("SimSun-ExtB"); map["hans"].Add("SimSun-ExtB");
MapScriptToTypefaces["hant"].Add("MingLiU-ExtB"); map["hant"].Add("MingLiU-ExtB");
MapScriptToTypefaces["hant"].Add("MingLiU_HKSCS-ExtB"); map["hant"].Add("MingLiU_HKSCS-ExtB");
MapScriptToTypefaces["arab"].Add("Microsoft Uighur"); map["arab"].Add("Microsoft Uighur");
MapScriptToTypefaces["zmth"].Insert(0, "Cambria Math"); map["zmth"].Insert(0, "Cambria Math");
// Reference: https://en.wikipedia.org/wiki/List_of_CJK_fonts // Reference: https://en.wikipedia.org/wiki/List_of_CJK_fonts
MapScriptToTypefaces["jpan"].Insert(0, "Meiryo"); map["jpan"].Insert(0, "Meiryo");
MapScriptToTypefaces["hans"].Insert(0, "Microsoft YaHei"); map["hans"].Insert(0, "Microsoft YaHei");
} }
if (ver >= new Version(6, 1)) { // Windows 7 if (ver >= new Version(6, 1)) { // Windows 7
MapScriptToTypefaces["brai"].Insert(0, "Segoe UI Symbol"); map["brai"].Insert(0, "Segoe UI Symbol");
MapScriptToTypefaces["dsrt"].Insert(0, "Segoe UI Symbol"); map["dsrt"].Insert(0, "Segoe UI Symbol");
MapScriptToTypefaces["talu"].Insert(0, "Microsoft New Tai Lue"); map["talu"].Insert(0, "Microsoft New Tai Lue");
MapScriptToTypefaces["ogam"].Insert(0, "Segoe UI Symbol"); map["ogam"].Insert(0, "Segoe UI Symbol");
MapScriptToTypefaces["osma"].Insert(0, "Ebrima"); map["osma"].Insert(0, "Ebrima");
MapScriptToTypefaces["phag"].Insert(0, "Microsoft PhagsPa"); map["phag"].Insert(0, "Microsoft PhagsPa");
MapScriptToTypefaces["runr"].Insert(0, "Segoe UI Symbol"); map["runr"].Insert(0, "Segoe UI Symbol");
MapScriptToTypefaces["zsym"].Insert(0, "Segoe UI Symbol"); map["zsym"].Insert(0, "Segoe UI Symbol");
MapScriptToTypefaces["tale"].Insert(0, "Microsoft Tai Le"); map["tale"].Insert(0, "Microsoft Tai Le");
MapScriptToTypefaces["tfng"].Insert(0, "Ebrima"); map["tfng"].Insert(0, "Ebrima");
MapScriptToTypefaces["vaii"].Insert(0, "Ebrima"); map["vaii"].Insert(0, "Ebrima");
} }
if (ver >= new Version(6, 2)) { // Windows 8 if (ver >= new Version(6, 2)) { // Windows 8
MapScriptToTypefaces["glag"].Insert(0, "Segoe UI Symbol"); map["glag"].Insert(0, "Segoe UI Symbol");
MapScriptToTypefaces["goth"].Insert(0, "Segoe UI Symbol"); map["goth"].Insert(0, "Segoe UI Symbol");
MapScriptToTypefaces["hang"].Add("Malgun Gothic"); map["hang"].Add("Malgun Gothic");
MapScriptToTypefaces["ital"].Insert(0, "Segoe UI Symbol"); map["ital"].Insert(0, "Segoe UI Symbol");
MapScriptToTypefaces["lisu"].Insert(0, "Segoe UI"); map["lisu"].Insert(0, "Segoe UI");
MapScriptToTypefaces["mymr"].Insert(0, "Myanmar Text"); map["mymr"].Insert(0, "Myanmar Text");
MapScriptToTypefaces["nkoo"].Insert(0, "Ebrima"); map["nkoo"].Insert(0, "Ebrima");
MapScriptToTypefaces["orkh"].Insert(0, "Segoe UI Symbol"); map["orkh"].Insert(0, "Segoe UI Symbol");
MapScriptToTypefaces["ethi"].Insert(0, "Ebrima"); map["ethi"].Insert(0, "Ebrima");
MapScriptToTypefaces["cans"].Insert(0, "Gadugi"); map["cans"].Insert(0, "Gadugi");
MapScriptToTypefaces["hant"].Insert(0, "Microsoft JhengHei UI"); map["hant"].Insert(0, "Microsoft JhengHei UI");
MapScriptToTypefaces["hans"].Insert(0, "Microsoft YaHei UI"); map["hans"].Insert(0, "Microsoft YaHei UI");
MapScriptToTypefaces["beng"].Insert(0, "Nirmala UI"); map["beng"].Insert(0, "Nirmala UI");
MapScriptToTypefaces["deva"].Insert(0, "Nirmala UI"); map["deva"].Insert(0, "Nirmala UI");
MapScriptToTypefaces["gujr"].Insert(0, "Nirmala UI"); map["gujr"].Insert(0, "Nirmala UI");
MapScriptToTypefaces["guru"].Insert(0, "Nirmala UI"); // NOT DOCUMENTED, UNVERIFIED map["guru"].Insert(0, "Nirmala UI"); // NOT DOCUMENTED, UNVERIFIED
MapScriptToTypefaces["knda"].Insert(0, "Nirmala UI"); // NOT DOCUMENTED, UNVERIFIED map["knda"].Insert(0, "Nirmala UI"); // NOT DOCUMENTED, UNVERIFIED
MapScriptToTypefaces["mlym"].Insert(0, "Nirmala UI"); map["mlym"].Insert(0, "Nirmala UI");
MapScriptToTypefaces["orya"].Insert(0, "Nirmala UI"); map["orya"].Insert(0, "Nirmala UI");
MapScriptToTypefaces["sinh"].Insert(0, "Nirmala UI"); // NOT DOCUMENTED, UNVERIFIED map["sinh"].Insert(0, "Nirmala UI"); // NOT DOCUMENTED, UNVERIFIED
MapScriptToTypefaces["taml"].Insert(0, "Nirmala UI"); // NOT DOCUMENTED, UNVERIFIED map["taml"].Insert(0, "Nirmala UI"); // NOT DOCUMENTED, UNVERIFIED
MapScriptToTypefaces["telu"].Insert(0, "Nirmala UI"); map["telu"].Insert(0, "Nirmala UI");
MapScriptToTypefaces["armn"].Insert(0, "Segoe UI"); map["armn"].Insert(0, "Segoe UI");
MapScriptToTypefaces["geor"].Insert(0, "Segoe UI"); map["geor"].Insert(0, "Segoe UI");
MapScriptToTypefaces["hebr"].Insert(0, "Segoe UI"); map["hebr"].Insert(0, "Segoe UI");
} }
if (ver >= new Version(6, 3)) { // Windows 8.1 if (ver >= new Version(6, 3)) { // Windows 8.1
MapScriptToTypefaces["bugi"].Insert(0, "Leelawadee UI"); map["bugi"].Insert(0, "Leelawadee UI");
MapScriptToTypefaces["copt"].Insert(0, "Segoe UI Symbol"); map["copt"].Insert(0, "Segoe UI Symbol");
MapScriptToTypefaces["java"].Insert(0, "Javanese Text"); map["java"].Insert(0, "Javanese Text");
MapScriptToTypefaces["merc"].Insert(0, "Segoe UI Symbol"); map["merc"].Insert(0, "Segoe UI Symbol");
MapScriptToTypefaces["olck"].Insert(0, "Nirmala UI"); map["olck"].Insert(0, "Nirmala UI");
MapScriptToTypefaces["sora"].Insert(0, "Nirmala UI"); map["sora"].Insert(0, "Nirmala UI");
MapScriptToTypefaces["khmr"].Insert(0, "Leelawadee UI"); map["khmr"].Insert(0, "Leelawadee UI");
MapScriptToTypefaces["laoo"].Insert(0, "Leelawadee UI"); map["laoo"].Insert(0, "Leelawadee UI");
MapScriptToTypefaces["thai"].Insert(0, "Leelawadee UI"); map["thai"].Insert(0, "Leelawadee UI");
MapScriptToTypefaces["zsye"].Insert(0, "Segoe UI Emoji"); map["zsye"].Insert(0, "Segoe UI Emoji");
} }
if (ver >= new Version(10, 0)) { // Windows 10 if (ver >= new Version(10, 0)) { // Windows 10
MapScriptToTypefaces["brah"].Insert(0, "Segoe UI Historic"); map["brah"].Insert(0, "Segoe UI Historic");
MapScriptToTypefaces["cari"].Insert(0, "Segoe UI Historic"); map["cari"].Insert(0, "Segoe UI Historic");
MapScriptToTypefaces["cprt"].Insert(0, "Segoe UI Historic"); map["cprt"].Insert(0, "Segoe UI Historic");
MapScriptToTypefaces["egyp"].Insert(0, "Segoe UI Historic"); map["egyp"].Insert(0, "Segoe UI Historic");
MapScriptToTypefaces["armi"].Insert(0, "Segoe UI Historic"); map["armi"].Insert(0, "Segoe UI Historic");
MapScriptToTypefaces["phli"].Insert(0, "Segoe UI Historic"); map["phli"].Insert(0, "Segoe UI Historic");
MapScriptToTypefaces["prti"].Insert(0, "Segoe UI Historic"); map["prti"].Insert(0, "Segoe UI Historic");
MapScriptToTypefaces["khar"].Insert(0, "Segoe UI Historic"); map["khar"].Insert(0, "Segoe UI Historic");
MapScriptToTypefaces["lyci"].Insert(0, "Segoe UI Historic"); map["lyci"].Insert(0, "Segoe UI Historic");
MapScriptToTypefaces["lydi"].Insert(0, "Segoe UI Historic"); map["lydi"].Insert(0, "Segoe UI Historic");
MapScriptToTypefaces["phnx"].Insert(0, "Segoe UI Historic"); map["phnx"].Insert(0, "Segoe UI Historic");
MapScriptToTypefaces["xpeo"].Insert(0, "Segoe UI Historic"); map["xpeo"].Insert(0, "Segoe UI Historic");
MapScriptToTypefaces["sarb"].Insert(0, "Segoe UI Historic"); map["sarb"].Insert(0, "Segoe UI Historic");
MapScriptToTypefaces["shaw"].Insert(0, "Segoe UI Historic"); map["shaw"].Insert(0, "Segoe UI Historic");
MapScriptToTypefaces["xsux"].Insert(0, "Segoe UI Historic"); map["xsux"].Insert(0, "Segoe UI Historic");
MapScriptToTypefaces["ugar"].Insert(0, "Segoe UI Historic"); map["ugar"].Insert(0, "Segoe UI Historic");
// Segoe UI Symbol -> Segoe UI Historic // Segoe UI Symbol -> Segoe UI Historic
MapScriptToTypefaces["glag"].Insert(0, "Segoe UI Historic"); map["glag"].Insert(0, "Segoe UI Historic");
MapScriptToTypefaces["goth"].Insert(0, "Segoe UI Historic"); map["goth"].Insert(0, "Segoe UI Historic");
MapScriptToTypefaces["merc"].Insert(0, "Segoe UI Historic"); map["merc"].Insert(0, "Segoe UI Historic");
MapScriptToTypefaces["ogam"].Insert(0, "Segoe UI Historic"); map["ogam"].Insert(0, "Segoe UI Historic");
MapScriptToTypefaces["ital"].Insert(0, "Segoe UI Historic"); map["ital"].Insert(0, "Segoe UI Historic");
MapScriptToTypefaces["orkh"].Insert(0, "Segoe UI Historic"); map["orkh"].Insert(0, "Segoe UI Historic");
MapScriptToTypefaces["runr"].Insert(0, "Segoe UI Historic"); map["runr"].Insert(0, "Segoe UI Historic");
// //
MapScriptToTypefaces["jpan"].Insert(0, "Yu Gothic UI"); map["jpan"].Insert(0, "Yu Gothic UI");
MapScriptToTypefaces["zsym"].Add("Segoe MDL2 Assets"); map["zsym"].Add("Segoe MDL2 Assets");
} }
return map;
} }
public void LoadDefaultAndroidFallbackList() { public static Dictionary<string, List<string>> GetDefaultAndroidFallbackMap() {
if (Environment.OSVersion.Platform != PlatformID.Unix) return; var map = new Dictionary<string, List<string>>();
MapScriptToTypefaces.Clear(); ScriptUtils.FillKeysWithScripts(map, () => new List<string>());
ScriptUtils.FillKeysWithScripts(MapScriptToTypefaces, () => new List<string>()); map["zyyy"].Insert(0, "Noto Sans CJK TC"); // TODO Modify default fallback
MapScriptToTypefaces["zyyy"].Insert(0, "Noto Sans CJK TC"); // TODO Modify default fallback map["zyyy"].Insert(0, "Noto Sans CJK JP");
MapScriptToTypefaces["zyyy"].Insert(0, "Noto Sans CJK JP"); map["zyyy"].Insert(0, "Noto Sans CJK SC");
MapScriptToTypefaces["zyyy"].Insert(0, "Noto Sans CJK SC"); map["zyyy"].Insert(0, "Roboto");
MapScriptToTypefaces["zyyy"].Insert(0, "Roboto"); map["zsye"].Insert(0, "Noto Color Emoji");
MapScriptToTypefaces["zsye"].Insert(0, "Noto Color Emoji"); map["zsye"].Add("Noto Color Emoji Flags");
MapScriptToTypefaces["zsye"].Add("Noto Color Emoji Flags"); map["arab"].Insert(0, "Noto Naskh Arabic");
MapScriptToTypefaces["arab"].Insert(0, "Noto Naskh Arabic"); map["adlm"].Insert(0, "Noto Sans Adlam");
MapScriptToTypefaces["adlm"].Insert(0, "Noto Sans Adlam"); map["ahom"].Insert(0, "Noto Sans Ahom");
MapScriptToTypefaces["ahom"].Insert(0, "Noto Sans Ahom"); map["hluw"].Insert(0, "Noto Sans Anatolian Hieroglyphs");
MapScriptToTypefaces["hluw"].Insert(0, "Noto Sans Anatolian Hieroglyphs"); map["armn"].Insert(0, "Noto Sans Armenian");
MapScriptToTypefaces["armn"].Insert(0, "Noto Sans Armenian"); map["avst"].Insert(0, "Noto Sans Avestan");
MapScriptToTypefaces["avst"].Insert(0, "Noto Sans Avestan"); map["bali"].Insert(0, "Noto Sans Balinese");
MapScriptToTypefaces["bali"].Insert(0, "Noto Sans Balinese"); map["bamu"].Insert(0, "Noto Sans Bamum");
MapScriptToTypefaces["bamu"].Insert(0, "Noto Sans Bamum"); map["bass"].Insert(0, "Noto Sans Bassa Vah");
MapScriptToTypefaces["bass"].Insert(0, "Noto Sans Bassa Vah"); map["batk"].Insert(0, "Noto Sans Batak");
MapScriptToTypefaces["batk"].Insert(0, "Noto Sans Batak"); map["beng"].Insert(0, "Noto Sans Bengali");
MapScriptToTypefaces["beng"].Insert(0, "Noto Sans Bengali"); map["bhks"].Insert(0, "Noto Sans Bhaiksuki");
MapScriptToTypefaces["bhks"].Insert(0, "Noto Sans Bhaiksuki"); map["brah"].Insert(0, "Noto Sans Brahmi");
MapScriptToTypefaces["brah"].Insert(0, "Noto Sans Brahmi"); map["bugi"].Insert(0, "Noto Sans Buginese");
MapScriptToTypefaces["bugi"].Insert(0, "Noto Sans Buginese"); map["buhd"].Insert(0, "Noto Sans Buhid");
MapScriptToTypefaces["buhd"].Insert(0, "Noto Sans Buhid"); map["jpan"].Insert(0, "Noto Sans CJK JP");
MapScriptToTypefaces["jpan"].Insert(0, "Noto Sans CJK JP"); map["kore"].Insert(0, "Noto Sans CJK KR");
MapScriptToTypefaces["kore"].Insert(0, "Noto Sans CJK KR"); map["hans"].Insert(0, "Noto Sans CJK SC");
MapScriptToTypefaces["hans"].Insert(0, "Noto Sans CJK SC"); map["hant"].Insert(0, "Noto Sans CJK TC");
MapScriptToTypefaces["hant"].Insert(0, "Noto Sans CJK TC"); map["hant"].Add("Noto Sans CJK HK");
MapScriptToTypefaces["hant"].Add("Noto Sans CJK HK"); map["cans"].Insert(0, "Noto Sans Canadian Aboriginal");
MapScriptToTypefaces["cans"].Insert(0, "Noto Sans Canadian Aboriginal"); map["cari"].Insert(0, "Noto Sans Carian");
MapScriptToTypefaces["cari"].Insert(0, "Noto Sans Carian"); map["cakm"].Insert(0, "Noto Sans Chakma");
MapScriptToTypefaces["cakm"].Insert(0, "Noto Sans Chakma"); map["cham"].Insert(0, "Noto Sans Cham");
MapScriptToTypefaces["cham"].Insert(0, "Noto Sans Cham"); map["cher"].Insert(0, "Noto Sans Cherokee");
MapScriptToTypefaces["cher"].Insert(0, "Noto Sans Cherokee"); map["copt"].Insert(0, "Noto Sans Coptic");
MapScriptToTypefaces["copt"].Insert(0, "Noto Sans Coptic"); map["xsux"].Insert(0, "Noto Sans Cuneiform");
MapScriptToTypefaces["xsux"].Insert(0, "Noto Sans Cuneiform"); map["cprt"].Insert(0, "Noto Sans Cypriot");
MapScriptToTypefaces["cprt"].Insert(0, "Noto Sans Cypriot"); map["dsrt"].Insert(0, "Noto Sans Deseret");
MapScriptToTypefaces["dsrt"].Insert(0, "Noto Sans Deseret"); map["deva"].Insert(0, "Noto Sans Devanagari");
MapScriptToTypefaces["deva"].Insert(0, "Noto Sans Devanagari"); map["egyp"].Insert(0, "Noto Sans Egyptian Hieroglyphs");
MapScriptToTypefaces["egyp"].Insert(0, "Noto Sans Egyptian Hieroglyphs"); map["elba"].Insert(0, "Noto Sans Elbasan");
MapScriptToTypefaces["elba"].Insert(0, "Noto Sans Elbasan"); map["ethi"].Insert(0, "Noto Sans Ethiopic");
MapScriptToTypefaces["ethi"].Insert(0, "Noto Sans Ethiopic"); map["geor"].Insert(0, "Noto Sans Georgian");
MapScriptToTypefaces["geor"].Insert(0, "Noto Sans Georgian"); map["glag"].Insert(0, "Noto Sans Glagolitic");
MapScriptToTypefaces["glag"].Insert(0, "Noto Sans Glagolitic"); map["goth"].Insert(0, "Noto Sans Gothic");
MapScriptToTypefaces["goth"].Insert(0, "Noto Sans Gothic"); map["gran"].Insert(0, "Noto Sans Grantha");
MapScriptToTypefaces["gran"].Insert(0, "Noto Sans Grantha"); map["gujr"].Insert(0, "Noto Sans Gujarati");
MapScriptToTypefaces["gujr"].Insert(0, "Noto Sans Gujarati"); map["gong"].Insert(0, "Noto Sans Gunjala Gondi");
MapScriptToTypefaces["gong"].Insert(0, "Noto Sans Gunjala Gondi"); map["guru"].Insert(0, "Noto Sans Gurmukhi");
MapScriptToTypefaces["guru"].Insert(0, "Noto Sans Gurmukhi"); map["rohg"].Insert(0, "Noto Sans Hanifi Rohingya");
MapScriptToTypefaces["rohg"].Insert(0, "Noto Sans Hanifi Rohingya"); map["hano"].Insert(0, "Noto Sans Hanunoo");
MapScriptToTypefaces["hano"].Insert(0, "Noto Sans Hanunoo"); map["hatr"].Insert(0, "Noto Sans Hatran");
MapScriptToTypefaces["hatr"].Insert(0, "Noto Sans Hatran"); map["hebr"].Insert(0, "Noto Sans Hebrew");
MapScriptToTypefaces["hebr"].Insert(0, "Noto Sans Hebrew"); map["armi"].Insert(0, "Noto Sans Imperial Aramaic");
MapScriptToTypefaces["armi"].Insert(0, "Noto Sans Imperial Aramaic"); map["phli"].Insert(0, "Noto Sans Inscriptional Pahlavi");
MapScriptToTypefaces["phli"].Insert(0, "Noto Sans Inscriptional Pahlavi"); map["prti"].Insert(0, "Noto Sans Inscriptional Parthian");
MapScriptToTypefaces["prti"].Insert(0, "Noto Sans Inscriptional Parthian"); map["java"].Insert(0, "Noto Sans Javanese");
MapScriptToTypefaces["java"].Insert(0, "Noto Sans Javanese"); map["kthi"].Insert(0, "Noto Sans Kaithi");
MapScriptToTypefaces["kthi"].Insert(0, "Noto Sans Kaithi"); map["knda"].Insert(0, "Noto Sans Kannada");
MapScriptToTypefaces["knda"].Insert(0, "Noto Sans Kannada"); map["kali"].Insert(0, "Noto Sans KayahLi");
MapScriptToTypefaces["kali"].Insert(0, "Noto Sans KayahLi"); map["khar"].Insert(0, "Noto Sans Kharoshthi");
MapScriptToTypefaces["khar"].Insert(0, "Noto Sans Kharoshthi"); map["khmr"].Insert(0, "Noto Sans Khmer");
MapScriptToTypefaces["khmr"].Insert(0, "Noto Sans Khmer"); map["khoj"].Insert(0, "Noto Sans Khojki");
MapScriptToTypefaces["khoj"].Insert(0, "Noto Sans Khojki"); map["laoo"].Insert(0, "Noto Sans Lao");
MapScriptToTypefaces["laoo"].Insert(0, "Noto Sans Lao"); map["lepc"].Insert(0, "Noto Sans Lepcha");
MapScriptToTypefaces["lepc"].Insert(0, "Noto Sans Lepcha"); map["limb"].Insert(0, "Noto Sans Limbu");
MapScriptToTypefaces["limb"].Insert(0, "Noto Sans Limbu"); map["lina"].Insert(0, "Noto Sans Linear A");
MapScriptToTypefaces["lina"].Insert(0, "Noto Sans Linear A"); map["linb"].Insert(0, "Noto Sans Linear B");
MapScriptToTypefaces["linb"].Insert(0, "Noto Sans Linear B"); map["lisu"].Insert(0, "Noto Sans Lisu");
MapScriptToTypefaces["lisu"].Insert(0, "Noto Sans Lisu"); map["lyci"].Insert(0, "Noto Sans Lycian");
MapScriptToTypefaces["lyci"].Insert(0, "Noto Sans Lycian"); map["lydi"].Insert(0, "Noto Sans Lydian");
MapScriptToTypefaces["lydi"].Insert(0, "Noto Sans Lydian"); map["mlym"].Insert(0, "Noto Sans Malayalam");
MapScriptToTypefaces["mlym"].Insert(0, "Noto Sans Malayalam"); map["mand"].Insert(0, "Noto Sans Mandiac");
MapScriptToTypefaces["mand"].Insert(0, "Noto Sans Mandiac"); map["mani"].Insert(0, "Noto Sans Manichaean");
MapScriptToTypefaces["mani"].Insert(0, "Noto Sans Manichaean"); map["marc"].Insert(0, "Noto Sans Marchen");
MapScriptToTypefaces["marc"].Insert(0, "Noto Sans Marchen"); map["gonm"].Insert(0, "Noto Sans Masaram Gondi");
MapScriptToTypefaces["gonm"].Insert(0, "Noto Sans Masaram Gondi"); map["medf"].Insert(0, "Noto Sans Medefaidrin");
MapScriptToTypefaces["medf"].Insert(0, "Noto Sans Medefaidrin"); map["mtei"].Insert(0, "Noto Sans Meetei Mayek");
MapScriptToTypefaces["mtei"].Insert(0, "Noto Sans Meetei Mayek"); map["merc"].Insert(0, "Noto Sans Meroitic");
MapScriptToTypefaces["merc"].Insert(0, "Noto Sans Meroitic"); map["mero"].Insert(0, "Noto Sans Meroitic");
MapScriptToTypefaces["mero"].Insert(0, "Noto Sans Meroitic"); map["plrd"].Insert(0, "Noto Sans Miao");
MapScriptToTypefaces["plrd"].Insert(0, "Noto Sans Miao"); map["modi"].Insert(0, "Noto Sans Modi");
MapScriptToTypefaces["modi"].Insert(0, "Noto Sans Modi"); map["mong"].Insert(0, "Noto Sans Mongolian");
MapScriptToTypefaces["mong"].Insert(0, "Noto Sans Mongolian"); map["mroo"].Insert(0, "Noto Sans Mro");
MapScriptToTypefaces["mroo"].Insert(0, "Noto Sans Mro"); map["mult"].Insert(0, "Noto Sans Multani");
MapScriptToTypefaces["mult"].Insert(0, "Noto Sans Multani"); map["mymr"].Insert(0, "Noto Sans Myanmar");
MapScriptToTypefaces["mymr"].Insert(0, "Noto Sans Myanmar"); map["nkoo"].Insert(0, "Noto Sans Nko");
MapScriptToTypefaces["nkoo"].Insert(0, "Noto Sans Nko"); map["nbat"].Insert(0, "Noto Sans Nabataean");
MapScriptToTypefaces["nbat"].Insert(0, "Noto Sans Nabataean"); map["talu"].Insert(0, "Noto Sans New Tai Lue");
MapScriptToTypefaces["talu"].Insert(0, "Noto Sans New Tai Lue"); map["newa"].Insert(0, "Noto Sans Newa");
MapScriptToTypefaces["newa"].Insert(0, "Noto Sans Newa"); map["ogam"].Insert(0, "Noto Sans Ogham");
MapScriptToTypefaces["ogam"].Insert(0, "Noto Sans Ogham"); map["olck"].Insert(0, "Noto Sans Ol Chiki");
MapScriptToTypefaces["olck"].Insert(0, "Noto Sans Ol Chiki"); map["ital"].Insert(0, "Noto Sans Old Italian");
MapScriptToTypefaces["ital"].Insert(0, "Noto Sans Old Italian"); map["narb"].Insert(0, "Noto Sans Old North Arabian");
MapScriptToTypefaces["narb"].Insert(0, "Noto Sans Old North Arabian"); map["perm"].Insert(0, "Noto Sans Old Permic");
MapScriptToTypefaces["perm"].Insert(0, "Noto Sans Old Permic"); map["xpeo"].Insert(0, "Noto Sans Old Persian");
MapScriptToTypefaces["xpeo"].Insert(0, "Noto Sans Old Persian"); map["sarb"].Insert(0, "Noto Sans Old South Arabian");
MapScriptToTypefaces["sarb"].Insert(0, "Noto Sans Old South Arabian"); map["orkh"].Insert(0, "Noto Sans Old Turkic");
MapScriptToTypefaces["orkh"].Insert(0, "Noto Sans Old Turkic"); map["orya"].Insert(0, "Noto Sans Oriya");
MapScriptToTypefaces["orya"].Insert(0, "Noto Sans Oriya"); map["osge"].Insert(0, "Noto Sans Osage");
MapScriptToTypefaces["osge"].Insert(0, "Noto Sans Osage"); map["osma"].Insert(0, "Noto Sans Osmanya");
MapScriptToTypefaces["osma"].Insert(0, "Noto Sans Osmanya"); map["hmng"].Insert(0, "Noto Sans Pahawh Hmong");
MapScriptToTypefaces["hmng"].Insert(0, "Noto Sans Pahawh Hmong"); map["palm"].Insert(0, "Noto Sans Palmyrene");
MapScriptToTypefaces["palm"].Insert(0, "Noto Sans Palmyrene"); map["pauc"].Insert(0, "Noto Sans Pau Cin Hau");
MapScriptToTypefaces["pauc"].Insert(0, "Noto Sans Pau Cin Hau"); map["phag"].Insert(0, "Noto Sans Phags Pa");
MapScriptToTypefaces["phag"].Insert(0, "Noto Sans Phags Pa"); map["phnx"].Insert(0, "Noto Sans Phoenician");
MapScriptToTypefaces["phnx"].Insert(0, "Noto Sans Phoenician"); map["rjng"].Insert(0, "Noto Sans Rejang");
MapScriptToTypefaces["rjng"].Insert(0, "Noto Sans Rejang"); map["runr"].Insert(0, "Noto Sans Runic");
MapScriptToTypefaces["runr"].Insert(0, "Noto Sans Runic"); map["samr"].Insert(0, "Noto Sans Samaritan");
MapScriptToTypefaces["samr"].Insert(0, "Noto Sans Samaritan"); map["saur"].Insert(0, "Noto Sans Saurashtra");
MapScriptToTypefaces["saur"].Insert(0, "Noto Sans Saurashtra"); map["shrd"].Insert(0, "Noto Sans Sharada");
MapScriptToTypefaces["shrd"].Insert(0, "Noto Sans Sharada"); map["shaw"].Insert(0, "Noto Sans Shavian");
MapScriptToTypefaces["shaw"].Insert(0, "Noto Sans Shavian"); map["sinh"].Insert(0, "Noto Sans Sinhala");
MapScriptToTypefaces["sinh"].Insert(0, "Noto Sans Sinhala"); map["sora"].Insert(0, "Noto Sans Sora Sompeng");
MapScriptToTypefaces["sora"].Insert(0, "Noto Sans Sora Sompeng"); map["soyo"].Insert(0, "Noto Sans Soyombo");
MapScriptToTypefaces["soyo"].Insert(0, "Noto Sans Soyombo"); map["sund"].Insert(0, "Noto Sans Sundanese");
MapScriptToTypefaces["sund"].Insert(0, "Noto Sans Sundanese"); map["sylo"].Insert(0, "Noto Sans Syloti Nagri");
MapScriptToTypefaces["sylo"].Insert(0, "Noto Sans Syloti Nagri"); map["zsym"].Insert(0, "Noto Sans Symbols");
MapScriptToTypefaces["zsym"].Insert(0, "Noto Sans Symbols"); map["syrn"].Insert(0, "Noto Sans Syriac Eastern");
MapScriptToTypefaces["syrn"].Insert(0, "Noto Sans Syriac Eastern"); map["syre"].Insert(0, "Noto Sans Syriac Estrangela");
MapScriptToTypefaces["syre"].Insert(0, "Noto Sans Syriac Estrangela"); map["syrj"].Insert(0, "Noto Sans Syriac Western");
MapScriptToTypefaces["syrj"].Insert(0, "Noto Sans Syriac Western"); map["tglg"].Insert(0, "Noto Sans Tagalog");
MapScriptToTypefaces["tglg"].Insert(0, "Noto Sans Tagalog"); map["tagb"].Insert(0, "Noto Sans Tagbanwa");
MapScriptToTypefaces["tagb"].Insert(0, "Noto Sans Tagbanwa"); map["tale"].Insert(0, "Noto Sans Tai Le");
MapScriptToTypefaces["tale"].Insert(0, "Noto Sans Tai Le"); map["lana"].Insert(0, "Noto Sans Tai Tham");
MapScriptToTypefaces["lana"].Insert(0, "Noto Sans Tai Tham"); map["tavt"].Insert(0, "Noto Sans Tai Viet");
MapScriptToTypefaces["tavt"].Insert(0, "Noto Sans Tai Viet"); map["takr"].Insert(0, "Noto Sans Takri");
MapScriptToTypefaces["takr"].Insert(0, "Noto Sans Takri"); map["taml"].Insert(0, "Noto Sans Tamil");
MapScriptToTypefaces["taml"].Insert(0, "Noto Sans Tamil"); map["telu"].Insert(0, "Noto Sans Telugu");
MapScriptToTypefaces["telu"].Insert(0, "Noto Sans Telugu"); map["thaa"].Insert(0, "Noto Sans Thaana");
MapScriptToTypefaces["thaa"].Insert(0, "Noto Sans Thaana"); map["thai"].Insert(0, "Noto Sans Thai");
MapScriptToTypefaces["thai"].Insert(0, "Noto Sans Thai"); map["tfng"].Insert(0, "Noto Sans Tifinagh");
MapScriptToTypefaces["tfng"].Insert(0, "Noto Sans Tifinagh"); map["ugar"].Insert(0, "Noto Sans Ugaritic");
MapScriptToTypefaces["ugar"].Insert(0, "Noto Sans Ugaritic"); map["vaii"].Insert(0, "Noto Sans Vai");
MapScriptToTypefaces["vaii"].Insert(0, "Noto Sans Vai"); map["wcho"].Insert(0, "Noto Sans Wancho");
MapScriptToTypefaces["wcho"].Insert(0, "Noto Sans Wancho"); map["wara"].Insert(0, "Noto Sans Warang Citi");
MapScriptToTypefaces["wara"].Insert(0, "Noto Sans Warang Citi"); map["yiii"].Insert(0, "Noto Sans Yi");
MapScriptToTypefaces["yiii"].Insert(0, "Noto Sans Yi"); return map;
} }
public FallbackListFontMatcher(FontManager manager) : base(manager) { } public FallbackListFontMatcher(FontManager manager) : base(manager) { }
public override IEnumerable<Typeface> MatchScript(string script = null, bool distinctFamily = false) { public override IEnumerable<Typeface> MatchScript(string script = null, bool distinctFamily = false) {

View File

@@ -66,7 +66,7 @@ namespace Cryville.Crtr.Browsing {
var coverFile = item.GetFiles(meta.cover); var coverFile = item.GetFiles(meta.cover);
if (coverFile.Length > 0) { if (coverFile.Length > 0) {
cover = new AsyncDelivery<Texture2D>(); cover = new AsyncDelivery<Texture2D>();
var task = new LoadTextureTask(Game.FileProtocolPrefix + coverFile[0].FullName, cover.Deliver); var task = new LoadTextureTask(PlatformConfig.FileProtocolPrefix + coverFile[0].FullName, cover.Deliver);
cover.CancelSource = task.Cancel; cover.CancelSource = task.Cancel;
Game.NetworkTaskWorker.SubmitNetworkTask(task); Game.NetworkTaskWorker.SubmitNetworkTask(task);
} }
@@ -93,7 +93,7 @@ namespace Cryville.Crtr.Browsing {
var coverFile = item.GetFiles(meta.cover); var coverFile = item.GetFiles(meta.cover);
if (coverFile.Length > 0) { if (coverFile.Length > 0) {
cover = new AsyncDelivery<Texture2D>(); cover = new AsyncDelivery<Texture2D>();
var task = new LoadTextureTask(Game.FileProtocolPrefix + coverFile[0].FullName, cover.Deliver); var task = new LoadTextureTask(PlatformConfig.FileProtocolPrefix + coverFile[0].FullName, cover.Deliver);
cover.CancelSource = task.Cancel; cover.CancelSource = task.Cancel;
Game.NetworkTaskWorker.SubmitNetworkTask(task); Game.NetworkTaskWorker.SubmitNetworkTask(task);
} }

View File

@@ -1,5 +1,3 @@
#define BUILD
using Cryville.Common; using Cryville.Common;
using Cryville.Common.Buffers; using Cryville.Common.Buffers;
using Cryville.Crtr.Config; using Cryville.Crtr.Config;
@@ -82,7 +80,6 @@ namespace Cryville.Crtr {
status = GameObject.Find("Status").GetComponent<TextMeshProUGUI>(); status = GameObject.Find("Status").GetComponent<TextMeshProUGUI>();
#if BUILD
try { try {
Play(); Play();
} }
@@ -91,7 +88,6 @@ namespace Cryville.Crtr {
Popup.CreateException(ex); Popup.CreateException(ex);
ReturnToMenu(); ReturnToMenu();
} }
#endif
// Camera.main.RenderToCubemap(); // Camera.main.RenderToCubemap();
} }
@@ -186,9 +182,7 @@ namespace Cryville.Crtr {
Logger.Log("main", 4, "Load/MainThread", "Load failed"); Logger.Log("main", 4, "Load/MainThread", "Load failed");
loadThread = null; loadThread = null;
Popup.CreateException(threadException); Popup.CreateException(threadException);
#if BUILD
ReturnToMenu(); ReturnToMenu();
#endif
} }
else if (texloaddone) { else if (texloaddone) {
if (texLoader == null) Stop(); if (texLoader == null) Stop();
@@ -377,7 +371,7 @@ namespace Cryville.Crtr {
areaJudgePrecision = 1 << Settings.Default.AreaJudgePrecision; areaJudgePrecision = 1 << Settings.Default.AreaJudgePrecision;
forceSyncFrames = Settings.Default.ForceSyncFrames; forceSyncFrames = Settings.Default.ForceSyncFrames;
texloaddone = false; texloaddone = false;
Game.NetworkTaskWorker.SuspendBackgroundTasks(); Game.SuspendBackgroundTasks();
Game.AudioSession = Game.AudioSequencer.NewSession(); Game.AudioSession = Game.AudioSequencer.NewSession();
var hitPlane = new Plane(Vector3.forward, Vector3.zero); var hitPlane = new Plane(Vector3.forward, Vector3.zero);
@@ -455,7 +449,7 @@ namespace Cryville.Crtr {
for (int i = 0; i < queue.Count; i++) { for (int i = 0; i < queue.Count; i++) {
#if UNITY_5_4_OR_NEWER #if UNITY_5_4_OR_NEWER
texHandler = new DownloadHandlerTexture(); texHandler = new DownloadHandlerTexture();
texLoader = new UnityWebRequest(Game.FileProtocolPrefix + queue[i], "GET", texHandler, null); texLoader = new UnityWebRequest(PlatformConfig.FileProtocolPrefix + queue[i], "GET", texHandler, null);
texLoader.SendWebRequest(); texLoader.SendWebRequest();
#else #else
texLoader = new WWW(Game.FileProtocolPrefix + queue[i]); texLoader = new WWW(Game.FileProtocolPrefix + queue[i]);
@@ -568,10 +562,8 @@ namespace Cryville.Crtr {
started = false; started = false;
} }
} }
Game.NetworkTaskWorker.ResumeBackgroundTasks(); Game.ResumeBackgroundTasks();
#if BUILD
ReturnToMenu(); ReturnToMenu();
#endif
} }
void OnSettingsUpdate() { void OnSettingsUpdate() {
@@ -588,11 +580,9 @@ namespace Cryville.Crtr {
} }
Exception threadException; Exception threadException;
#if !NO_THREAD
Thread loadThread = null; Thread loadThread = null;
volatile float loadPregress; volatile float loadPregress;
Stopwatch workerTimer; Stopwatch workerTimer;
#endif
void Load(object _info) { void Load(object _info) {
var info = (LoadInfo)_info; var info = (LoadInfo)_info;
try { try {

View File

@@ -22,14 +22,6 @@ namespace Cryville.Crtr {
get; get;
private set; private set;
} }
public static readonly string FileProtocolPrefix
#if UNITY_STANDALONE_WIN
= "file:///";
#elif UNITY_ANDROID
= "file://";
#else
#error No file protocol prefix is defined.
#endif
public static IAudioDeviceManager AudioManager; public static IAudioDeviceManager AudioManager;
public static AudioClient AudioClient; public static AudioClient AudioClient;
public static SimpleSequencerSource AudioSequencer; public static SimpleSequencerSource AudioSequencer;
@@ -129,19 +121,10 @@ namespace Cryville.Crtr {
Settings.Default.Save(); Settings.Default.Save();
Logger.Log("main", 1, "UI", "Initializing font manager"); Logger.Log("main", 1, "UI", "Initializing font manager");
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN TMPAutoFont.FontMatcher = new FallbackListFontMatcher(PlatformConfig.FontManager) {
var fontMatcher = new FallbackListFontMatcher(new FontManagerWindows()); MapScriptToTypefaces = PlatformConfig.ScriptFontMap
fontMatcher.LoadDefaultWindowsFallbackList(); };
TMPAutoFont.FontMatcher = fontMatcher; TMPAutoFont.DefaultShader = Resources.Load<Shader>(PlatformConfig.TextShader);
TMPAutoFont.DefaultShader = Resources.Load<Shader>("TextMesh Pro/Shaders/TMP_SDF SSD");
#elif UNITY_ANDROID
var fontMatcher = new FallbackListFontMatcher(new FontManagerAndroid());
fontMatcher.LoadDefaultAndroidFallbackList();
TMPAutoFont.FontMatcher = fontMatcher;
TMPAutoFont.DefaultShader = Resources.Load<Shader>("TextMesh Pro/Shaders/TMP_SDF-Mobile SSD");
#else
#error No font manager initialization logic.
#endif
Logger.Log("main", 1, "Game", "Initialized"); Logger.Log("main", 1, "Game", "Initialized");
} }
@@ -181,5 +164,14 @@ namespace Cryville.Crtr {
} }
Logger.Log("main", l, "Internal", "{0}\n{1}", condition, stackTrace); Logger.Log("main", l, "Internal", "{0}\n{1}", condition, stackTrace);
} }
public static void SuspendBackgroundTasks() {
NetworkTaskWorker.SuspendBackgroundTasks();
Dialog.Suppress();
}
public static void ResumeBackgroundTasks() {
Dialog.Release();
NetworkTaskWorker.ResumeBackgroundTasks();
}
} }
} }

View File

@@ -262,10 +262,9 @@ namespace Cryville.Crtr {
frame.Vector = vec; frame.Vector = vec;
} }
else frame = rc.InverseTransform(frame); else frame = rc.InverseTransform(frame);
bool locked = false; Monitor.Enter(_etor);
try { try {
Profiler.BeginSample("InputProxy.OnInput"); Profiler.BeginSample("InputProxy.OnInput");
Monitor.Enter(_etor, ref locked);
InputProxyEntry proxy; InputProxyEntry proxy;
if (_sproxies.TryGetValue(id.Source, out proxy)) { if (_sproxies.TryGetValue(id.Source, out proxy)) {
float ft, tt = (float)GetSyncedTime(frame.Time, id.Source.Handler); float ft, tt = (float)GetSyncedTime(frame.Time, id.Source.Handler);
@@ -289,8 +288,8 @@ namespace Cryville.Crtr {
} }
} }
finally { finally {
if (locked) Monitor.Exit(_etor);
Profiler.EndSample(); Profiler.EndSample();
Monitor.Exit(_etor);
} }
} }
static readonly int _var_fv = IdentifierManager.Shared.Request("input_vec_from"); static readonly int _var_fv = IdentifierManager.Shared.Request("input_vec_from");

View File

@@ -58,7 +58,7 @@ namespace Cryville.Crtr {
void OnEnable() { void OnEnable() {
Application.targetFrameRate = 60; Application.targetFrameRate = 60;
if (animatorState != null) m_targetAnimator.PlayInFixedTime(animatorState, 0, 0); if (animatorState != null) m_targetAnimator.PlayInFixedTime(animatorState, 0, 0);
Game.NetworkTaskWorker.ResumeBackgroundTasks(); Game.ResumeBackgroundTasks();
} }
#pragma warning restore IDE0051 #pragma warning restore IDE0051

View File

@@ -0,0 +1,27 @@
using Cryville.Common.Font;
using System.Collections.Generic;
namespace Cryville.Crtr {
internal static class PlatformConfig {
#if UNITY_STANDALONE_WIN
public static readonly string Name = "windows";
#elif UNITY_ANDROID
public static readonly string Name = "android";
#else
#error Unknown platform.
#endif
#if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN
public static readonly string FileProtocolPrefix = "file:///";
public static readonly FontManager FontManager = new FontManagerWindows();
public static readonly Dictionary<string, List<string>> ScriptFontMap = FallbackListFontMatcher.GetDefaultWindowsFallbackMap();
public static readonly string TextShader = "TextMesh Pro/Shaders/TMP_SDF SSD";
#elif UNITY_ANDROID
public static readonly string FileProtocolPrefix = "file://";
public static readonly FontManager FontManager = new FontManagerAndroid();
public static readonly Dictionary<string, List<string>> ScriptFontMap = FallbackListFontMatcher.GetDefaultAndroidFallbackMap();
public static readonly string TextShader = "TextMesh Pro/Shaders/TMP_SDF-Mobile SSD";
#else
#error Unknown platform.
#endif
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5b9be7f84b72ac9468dacec2d44003a9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: