From 7a223ebeb6c65eff82bf5c37cef079d33fae4b56 Mon Sep 17 00:00:00 2001 From: Hakoyu Date: Fri, 27 Oct 2023 01:01:51 +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 | 2 ++ VPet.ModMaker/Models/ModModel/PetModel.cs | 20 ++++++++++++++++--- VPet.ModMaker/ViewModels/ModMakerWindowVM.cs | 2 +- .../Views/ModEdit/PetEdit/PetEditWindow.xaml | 9 ++++++++- .../Views/ModEdit/PetEdit/PetPage.xaml | 9 +++++++++ 5 files changed, 37 insertions(+), 5 deletions(-) diff --git a/VPet.ModMaker/Models/ModModel/ModInfoModel.cs b/VPet.ModMaker/Models/ModModel/ModInfoModel.cs index 078a42e..87296b4 100644 --- a/VPet.ModMaker/Models/ModModel/ModInfoModel.cs +++ b/VPet.ModMaker/Models/ModModel/ModInfoModel.cs @@ -292,6 +292,8 @@ public class ModInfoModel : I18nModel var petI18n = pet.I18nDatas[i18nData.Key]; if (i18nData.Value.TryGetValue(pet.Id.Value, out var name)) petI18n.Name.Value = name; + if (i18nData.Value.TryGetValue(pet.PetNameId.Value, out var petName)) + petI18n.PetName.Value = petName; if (i18nData.Value.TryGetValue(pet.DescriptionId.Value, out var description)) petI18n.Description.Value = description; foreach (var work in pet.Works) diff --git a/VPet.ModMaker/Models/ModModel/PetModel.cs b/VPet.ModMaker/Models/ModModel/PetModel.cs index 7899232..22e8059 100644 --- a/VPet.ModMaker/Models/ModModel/PetModel.cs +++ b/VPet.ModMaker/Models/ModModel/PetModel.cs @@ -25,6 +25,11 @@ public class PetModel : I18nModel /// public ObservableValue Id { get; } = new(); + /// + /// 名称Id + /// + public ObservableValue PetNameId { get; } = new(); + /// /// 描述Id /// @@ -90,6 +95,7 @@ public class PetModel : I18nModel DescriptionId.Value = $"{Id.Value}_{nameof(DescriptionId)}"; Id.ValueChanged += (o, n) => { + PetNameId.Value = $"{n}_{nameof(PetNameId)}"; DescriptionId.Value = $"{n}_{nameof(DescriptionId)}"; }; AnimeCount.AddNotifyReceiver(Animes); @@ -104,6 +110,7 @@ public class PetModel : I18nModel : this() { Id.Value = model.Id.Value; + PetNameId.Value = model.PetNameId.Value; TouchHeadRect.Value = model.TouchHeadRect.Value.Copy(); TouchBodyRect.Value = model.TouchBodyRect.Value.Copy(); TouchRaisedRect.Value = model.TouchRaisedRect.Value.Copy(); @@ -119,7 +126,8 @@ public class PetModel : I18nModel public PetModel(PetLoader loader) : this() { - Id.Value = loader.PetName; + Id.Value = loader.Name; + PetNameId.Value = loader.PetName; DescriptionId.Value = loader.Intor; TouchHeadRect.Value.SetValue( @@ -187,7 +195,7 @@ public class PetModel : I18nModel public PetModel(PetLoader loader, bool isSimplePet) : this() { - Id.Value = loader.PetName; + Id.Value = loader.Name; IsSimplePetModel = isSimplePet; } @@ -211,6 +219,10 @@ public class PetModel : I18nModel Id.Value, I18nDatas[cultureName].Name.Value ); + ModInfoModel.SaveI18nDatas[cultureName].TryAdd( + PetNameId.Value, + I18nDatas[cultureName].PetName.Value + ); ModInfoModel.SaveI18nDatas[cultureName].TryAdd( DescriptionId.Value, I18nDatas[cultureName].Description.Value @@ -291,7 +303,7 @@ public class PetModel : I18nModel { new Sub("intor", DescriptionId.Value), new Sub("path", Id.Value), - new Sub("petname", Id.Value) + new Sub("petname", PetNameId.Value) } ); lps.Add( @@ -359,12 +371,14 @@ public class PetModel : I18nModel public class I18nPetInfoModel { public ObservableValue Name { get; } = new(); + public ObservableValue PetName { get; } = new(); public ObservableValue Description { get; } = new(); public I18nPetInfoModel Copy() { var result = new I18nPetInfoModel(); result.Name.Value = Name.Value; + result.PetName.Value = PetName.Value; result.Description.Value = Description.Value; return result; } diff --git a/VPet.ModMaker/ViewModels/ModMakerWindowVM.cs b/VPet.ModMaker/ViewModels/ModMakerWindowVM.cs index 38e88b3..428808c 100644 --- a/VPet.ModMaker/ViewModels/ModMakerWindowVM.cs +++ b/VPet.ModMaker/ViewModels/ModMakerWindowVM.cs @@ -119,7 +119,7 @@ public class ModMakerWindowVM lps.Add( new Line(nameof(history)) { - new Sub("Id", history.Id), + new Sub("PetName", history.Id), new Sub("SourcePath", history.SourcePath), new Sub("LastTime", history.LastTime.ToString("yyyy/MM/dd HH:mm")) } diff --git a/VPet.ModMaker/Views/ModEdit/PetEdit/PetEditWindow.xaml b/VPet.ModMaker/Views/ModEdit/PetEdit/PetEditWindow.xaml index 978c203..df4f4d6 100644 --- a/VPet.ModMaker/Views/ModEdit/PetEdit/PetEditWindow.xaml +++ b/VPet.ModMaker/Views/ModEdit/PetEdit/PetEditWindow.xaml @@ -351,6 +351,7 @@ +