From e7fcbb00505ba155da49257e301a81f5d05ed436 Mon Sep 17 00:00:00 2001 From: Hakoyu Date: Thu, 2 Nov 2023 23:13:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VPet.ModMaker/Models/ModModel/ModInfoModel.cs | 14 ++++------- VPet.ModMaker/Models/Utils.cs | 1 + VPet.ModMaker/VPet.ModMaker.csproj | 8 ++++++ .../ModEdit/I18nEdit/I18nEditWindowVM.cs | 9 +++++++ .../ModEdit/I18nEdit/I18nEditWindow.xaml | 12 +++++++++ .../ModEdit/I18nEdit/I18nEditWindow.xaml.cs | 25 +++++++++++++++++++ 6 files changed, 60 insertions(+), 9 deletions(-) create mode 100644 VPet.ModMaker/ViewModels/ModEdit/I18nEdit/I18nEditWindowVM.cs create mode 100644 VPet.ModMaker/Views/ModEdit/I18nEdit/I18nEditWindow.xaml create mode 100644 VPet.ModMaker/Views/ModEdit/I18nEdit/I18nEditWindow.xaml.cs diff --git a/VPet.ModMaker/Models/ModModel/ModInfoModel.cs b/VPet.ModMaker/Models/ModModel/ModInfoModel.cs index 5c589d0..c3fefe9 100644 --- a/VPet.ModMaker/Models/ModModel/ModInfoModel.cs +++ b/VPet.ModMaker/Models/ModModel/ModInfoModel.cs @@ -139,25 +139,21 @@ public class ModInfoModel : I18nModel LowTexts.Add(new(lowText)); foreach (var selectText in loader.SelectTexts) SelectTexts.Add(new(selectText)); - // 缓存pets - var pets = new List(); + foreach (var pet in loader.Pets) { var petModel = new PetModel(pet); - pets.Add(petModel); + Pets.Add(petModel); foreach (var p in pet.path) LoadAnime(petModel, p); } - // 先载入本体宠物 + // 插入本体宠物 foreach (var pet in ModMakerInfo.Pets) { // 确保Id不重复 - if (pets.All(i => i.Id.Value != pet.SourceId)) - Pets.Add(pet); + if (Pets.All(i => i.Id.Value != pet.SourceId)) + Pets.Insert(0, pet); } - // 再载入模组宠物 - foreach (var pet in pets) - Pets.Add(pet); foreach (var lang in loader.I18nDatas) I18nDatas.Add(lang.Key, lang.Value); diff --git a/VPet.ModMaker/Models/Utils.cs b/VPet.ModMaker/Models/Utils.cs index daa1ac5..4f6db90 100644 --- a/VPet.ModMaker/Models/Utils.cs +++ b/VPet.ModMaker/Models/Utils.cs @@ -55,6 +55,7 @@ public static class Utils { var bytes = File.ReadAllBytes(imagePath); bitmapImage.StreamSource = new MemoryStream(bytes); + bitmapImage.DecodePixelWidth = DecodePixelWidth; } finally { diff --git a/VPet.ModMaker/VPet.ModMaker.csproj b/VPet.ModMaker/VPet.ModMaker.csproj index 7838a2d..8e71719 100644 --- a/VPet.ModMaker/VPet.ModMaker.csproj +++ b/VPet.ModMaker/VPet.ModMaker.csproj @@ -133,6 +133,7 @@ + @@ -165,6 +166,9 @@ FoodPage.xaml + + I18nEditWindow.xaml + LowTextPage.xaml @@ -286,6 +290,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/VPet.ModMaker/ViewModels/ModEdit/I18nEdit/I18nEditWindowVM.cs b/VPet.ModMaker/ViewModels/ModEdit/I18nEdit/I18nEditWindowVM.cs new file mode 100644 index 0000000..bc28db8 --- /dev/null +++ b/VPet.ModMaker/ViewModels/ModEdit/I18nEdit/I18nEditWindowVM.cs @@ -0,0 +1,9 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace VPet.ModMaker.ViewModels.ModEdit.I18nEdit; + +public class I18nEditWindowVM { } diff --git a/VPet.ModMaker/Views/ModEdit/I18nEdit/I18nEditWindow.xaml b/VPet.ModMaker/Views/ModEdit/I18nEdit/I18nEditWindow.xaml new file mode 100644 index 0000000..826277e --- /dev/null +++ b/VPet.ModMaker/Views/ModEdit/I18nEdit/I18nEditWindow.xaml @@ -0,0 +1,12 @@ + + + + + diff --git a/VPet.ModMaker/Views/ModEdit/I18nEdit/I18nEditWindow.xaml.cs b/VPet.ModMaker/Views/ModEdit/I18nEdit/I18nEditWindow.xaml.cs new file mode 100644 index 0000000..2c0ec93 --- /dev/null +++ b/VPet.ModMaker/Views/ModEdit/I18nEdit/I18nEditWindow.xaml.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; + +namespace VPet.ModMaker.Views.ModEdit.I18nEdit; +/// +/// I18nEditWindow.xaml 的交互逻辑 +/// +public partial class I18nEditWindow : Window +{ + public I18nEditWindow() + { + InitializeComponent(); + } +}