diff --git a/VPet-Simulator.Windows.Interface/Theme.cs b/VPet-Simulator.Windows.Interface/Theme.cs index 0444d39..545c303 100644 --- a/VPet-Simulator.Windows.Interface/Theme.cs +++ b/VPet-Simulator.Windows.Interface/Theme.cs @@ -1,4 +1,5 @@ using LinePutScript; +using LinePutScript.Localization.WPF; using System.IO; using System.Windows.Media; @@ -9,6 +10,22 @@ namespace VPet_Simulator.Windows.Interface /// public class Theme { + private string transname = null; + /// + /// 名字 (翻译) + /// + public string TranslateName + { + get + { + if (transname == null) + { + transname = LocalizeCore.Translate(Name); + } + return transname; + } + } + public string Name; public string xName; public string Image; @@ -31,7 +48,25 @@ namespace VPet_Simulator.Windows.Interface /// public class IFont { + /// + /// 字体名字 + /// public string Name; + private string transname = null; + /// + /// 名字 (翻译) + /// + public string TranslateName + { + get + { + if (transname == null) + { + transname = LocalizeCore.Translate(Name); + } + return transname; + } + } public string Path; public IFont(FileInfo path) { diff --git a/VPet-Simulator.Windows/Function/CoreMOD.cs b/VPet-Simulator.Windows/Function/CoreMOD.cs index 2f47a1e..bd7722a 100644 --- a/VPet-Simulator.Windows/Function/CoreMOD.cs +++ b/VPet-Simulator.Windows/Function/CoreMOD.cs @@ -283,53 +283,53 @@ namespace VPet_Simulator.Windows try { #endif - var path = tmpfi.Name; - if (LoadedDLL.Contains(path)) - continue; - LoadedDLL.Add(path); - X509Certificate2 certificate; - try - { - certificate = new X509Certificate2(tmpfi.FullName); - } - catch - { - certificate = null; - } - if (certificate != null) - { - if (certificate.Subject == "CN=\"Shenzhen Lingban Computer Technology Co., Ltd.\", O=\"Shenzhen Lingban Computer Technology Co., Ltd.\", L=Shenzhen, S=Guangdong Province, C=CN, SERIALNUMBER=91440300MA5H8REU3K, OID.2.5.4.15=Private Organization, OID.1.3.6.1.4.1.311.60.2.1.1=Shenzhen, OID.1.3.6.1.4.1.311.60.2.1.2=Guangdong Province, OID.1.3.6.1.4.1.311.60.2.1.3=CN" - && certificate.Issuer == "CN=DigiCert Trusted G4 Code Signing RSA4096 SHA384 2021 CA1, O=\"DigiCert, Inc.\", C=US") - {//LBGame 信任的证书 - if (authtype != "FAIL") - authtype = "[认证]".Translate(); - } - else if (!(certificate.Subject.Contains("Microsoft Corporation") && - certificate.Issuer.Contains("Microsoft Corporation")) && !IsPassMOD(mw)) - {//不是通过模组,不加载 - SuccessLoad = false; + var path = tmpfi.Name; + if (LoadedDLL.Contains(path)) continue; - } - } - else - { - authtype = "FAIL"; - if (!IsPassMOD(mw)) - {//不是通过模组,不加载 - SuccessLoad = false; - Author = modlps.FindSub("author").Info.Split('[').First(); - continue; - } - } - Assembly dll = Assembly.LoadFrom(tmpfi.FullName); - var v = dll.GetExportedTypes(); - foreach (Type exportedType in v) - { - if (exportedType.BaseType == typeof(MainPlugin)) + LoadedDLL.Add(path); + X509Certificate2 certificate; + try { - mw.Plugins.Add((MainPlugin)Activator.CreateInstance(exportedType, mw)); + certificate = new X509Certificate2(tmpfi.FullName); + } + catch + { + certificate = null; + } + if (certificate != null) + { + if (certificate.Subject == "CN=\"Shenzhen Lingban Computer Technology Co., Ltd.\", O=\"Shenzhen Lingban Computer Technology Co., Ltd.\", L=Shenzhen, S=Guangdong Province, C=CN, SERIALNUMBER=91440300MA5H8REU3K, OID.2.5.4.15=Private Organization, OID.1.3.6.1.4.1.311.60.2.1.1=Shenzhen, OID.1.3.6.1.4.1.311.60.2.1.2=Guangdong Province, OID.1.3.6.1.4.1.311.60.2.1.3=CN" + && certificate.Issuer == "CN=DigiCert Trusted G4 Code Signing RSA4096 SHA384 2021 CA1, O=\"DigiCert, Inc.\", C=US") + {//LBGame 信任的证书 + if (authtype != "FAIL") + authtype = "[认证]".Translate(); + } + else if (!(certificate.Issuer.Contains("Microsoft Corporation") || certificate.Issuer.Contains(".NET Foundation Projects")) + && !IsPassMOD(mw)) + {//不是通过模组,不加载 + SuccessLoad = false; + continue; + } + } + else + { + authtype = "FAIL"; + if (!IsPassMOD(mw)) + {//不是通过模组,不加载 + SuccessLoad = false; + Author = modlps.FindSub("author").Info.Split('[').First(); + continue; + } + } + Assembly dll = Assembly.LoadFrom(tmpfi.FullName); + var v = dll.GetExportedTypes(); + foreach (Type exportedType in v) + { + if (exportedType.BaseType == typeof(MainPlugin)) + { + mw.Plugins.Add((MainPlugin)Activator.CreateInstance(exportedType, mw)); + } } - } #if !DEBUG5 } catch (Exception e) diff --git a/VPet-Simulator.Windows/MainWindow.cs b/VPet-Simulator.Windows/MainWindow.cs index 9bba876..15ff58c 100644 --- a/VPet-Simulator.Windows/MainWindow.cs +++ b/VPet-Simulator.Windows/MainWindow.cs @@ -96,7 +96,7 @@ namespace VPet_Simulator.Windows /// 主题名称 public void LoadTheme(string themename) { - Theme ctheme = Themes.Find(x => x.Name == themename || x.xName == themename); + Theme ctheme = Themes.Find(x => x.xName == themename); if (ctheme == null) { return; @@ -152,8 +152,9 @@ namespace VPet_Simulator.Windows { return; } - Application.Current.Resources["MainFont"] = cfont.Font; - Panuon.WPF.UI.GlobalSettings.Setting.FontFamily = cfont.Font; + var font = cfont.Font; + Application.Current.Resources["MainFont"] = font; + Panuon.WPF.UI.GlobalSettings.Setting.FontFamily = font; } public List Foods { get; } = new List(); diff --git a/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs b/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs index ca22076..a08d269 100644 --- a/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs +++ b/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs @@ -145,16 +145,16 @@ namespace VPet_Simulator.Windows foreach (var v in mw.Fonts) { - FontBox.Items.Add(v.Name); + FontBox.Items.Add(v.TranslateName); } - FontBox.SelectedItem = mw.Set.Font; + FontBox.SelectedIndex = mw.Fonts.FindIndex(x => x.Name == mw.Set.Font); foreach (var v in mw.Themes) { - ThemeBox.Items.Add(v.Name); + ThemeBox.Items.Add(v.TranslateName); } if (mw.Theme != null) - ThemeBox.SelectedItem = mw.Theme.Name; + ThemeBox.SelectedItem = mw.Theme.TranslateName; VoiceCatchSilder.Value = mw.Set.MusicCatch; VoiceMaxSilder.Value = mw.Set.MusicMax; @@ -487,8 +487,7 @@ namespace VPet_Simulator.Windows { if (!AllowChange) return; - string str = (string)(ThemeBox.SelectedItem); - mw.LoadTheme(str); + mw.LoadTheme(mw.Themes[ThemeBox.SelectedIndex].xName); mw.Set.Theme = mw.Theme.xName; } @@ -496,7 +495,7 @@ namespace VPet_Simulator.Windows { if (!AllowChange) return; - string str = (string)(FontBox.SelectedItem); + string str = mw.Fonts[FontBox.SelectedIndex].Name; mw.LoadFont(str); mw.Set.Font = str; } diff --git a/VPet-Simulator.Windows/mod/0000_core/lang/en/Base2403.lps b/VPet-Simulator.Windows/mod/0000_core/lang/en/Base2403.lps index 7359d22..0f0b581 100644 --- a/VPet-Simulator.Windows/mod/0000_core/lang/en/Base2403.lps +++ b/VPet-Simulator.Windows/mod/0000_core/lang/en/Base2403.lps @@ -68,3 +68,11 @@ theme#Theme:| 详细内容信息#Details:| 详细描述\reg:报错详细信息#Details\reg:Error details:| 是否上传当前游戏存档#Do you want to upload the current game archive?:| +Alibaba PuHuiTi Regular#Alibaba PuHuiTi Regular:| +HarmonyOS Sans#HarmonyOS Sans:| +MiSans Regular#MiSans Regular:| +OPPOSans R#OPPOSans R:| +凤凰点阵体 12px#Phoenix 12px:| +得意黑#DeYi Black:| +原版默认#Original Default:| +混色紫#Mixed Purple:| diff --git a/VPet-Simulator.Windows/mod/0000_core/lang/zh-Hans/Base2403.lps b/VPet-Simulator.Windows/mod/0000_core/lang/zh-Hans/Base2403.lps index bb093d1..79c3482 100644 --- a/VPet-Simulator.Windows/mod/0000_core/lang/zh-Hans/Base2403.lps +++ b/VPet-Simulator.Windows/mod/0000_core/lang/zh-Hans/Base2403.lps @@ -68,3 +68,11 @@ theme#主题:| 详细内容信息#详细内容信息:| 详细描述\reg:报错详细信息#详细描述\reg:报错详细信息:| 是否上传当前游戏存档#是否上传当前游戏存档:| +Alibaba PuHuiTi Regular#Alibaba PuHuiTi Regular:| +HarmonyOS Sans#HarmonyOS Sans:| +MiSans Regular#MiSans Regular:| +OPPOSans R#OPPOSans R:| +凤凰点阵体 12px#凤凰点阵体 12px:| +得意黑#得意黑:| +原版默认#原版默认:| +混色紫#混色紫:| diff --git a/VPet-Simulator.Windows/mod/0000_core/lang/zh-Hant/Base2403.lps b/VPet-Simulator.Windows/mod/0000_core/lang/zh-Hant/Base2403.lps index 0021d6c..101e784 100644 --- a/VPet-Simulator.Windows/mod/0000_core/lang/zh-Hant/Base2403.lps +++ b/VPet-Simulator.Windows/mod/0000_core/lang/zh-Hant/Base2403.lps @@ -68,3 +68,11 @@ theme#主題:| 详细内容信息#詳細內容信息:| 详细描述\reg:报错详细信息#詳細描述\reg:報錯詳細信息:| 是否上传当前游戏存档#是否上傳目前遊戲存檔:| +Alibaba PuHuiTi Regular#Alibaba PuHuiTi Regular:| +HarmonyOS Sans#HarmonyOS Sans:| +MiSans Regular#MiSans Regular:| +OPPOSans R#OPPOSans R:| +凤凰点阵体 12px#鳳凰點陣體 12px:| +得意黑#得意黑:| +原版默认#原版默認:| +混色紫#混色紫:| \ No newline at end of file