From 1f3cda4023bce299026a54b793564b25860e811f Mon Sep 17 00:00:00 2001 From: Hakoyu Date: Wed, 30 Aug 2023 04:45:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E8=A3=85=20=E6=A8=A1=E7=BB=84?= =?UTF-8?q?=E8=BD=BD=E5=85=A5=E5=92=8C=E6=A8=A1=E7=BB=84=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E5=8C=96=E6=96=87=E4=BB=B6=E8=AF=BB=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VPet.Plugin.ModMaker/Models/ClickTextModel.cs | 33 +- VPet.Plugin.ModMaker/Models/FoodModel.cs | 34 +- VPet.Plugin.ModMaker/Models/I18nModel.cs | 52 ++ VPet.Plugin.ModMaker/Models/II18nData.cs | 15 - VPet.Plugin.ModMaker/Models/LowTextModel.cs | 33 +- VPet.Plugin.ModMaker/Models/ModInfoModel.cs | 53 +- VPet.Plugin.ModMaker/Models/ModLoader.cs | 219 +++++ VPet.Plugin.ModMaker/Models/ModMakeHistory.cs | 20 + VPet.Plugin.ModMaker/Models/ModMakerInfo.cs | 12 + VPet.Plugin.ModMaker/Models/PetModel.cs | 12 +- .../VPet.Plugin.ModMaker.csproj | 13 +- .../ClickTextEdit/ClickTextEditWindowVM.cs | 1 - .../ModEdit/ClickTextEdit/ClickTextPageVM.cs | 53 +- .../ModEdit/FoodEdit/FoodEditWindowVM.cs | 2 - .../ViewModels/ModEdit/FoodEdit/FoodPageVM.cs | 52 +- .../LowTextEdit/LowTextEditWindowVM.cs | 2 - .../ModEdit/LowTextEdit/LowTextPageVM.cs | 53 +- .../ViewModels/ModEdit/ModEditWindowVM.cs | 65 +- .../ViewModels/ModMakerWindowVM.cs | 46 +- .../ClickTextEdit/ClickTextEditWindow.xaml.cs | 7 +- .../ModEdit/FoodEdit/FoodEditWindow.xaml.cs | 3 +- .../Views/ModEdit/FoodEdit/FoodPage.xaml | 8 +- .../LowTextEdit/LowTextEditWindow.xaml.cs | 3 +- .../Views/ModEdit/ModEditWindow.xaml | 13 +- .../Views/ModEdit/ModEditWindow.xaml.cs | 9 +- .../Views/ModEdit/PetEdit/PetEditWindow.xaml | 787 +++++++++--------- .../Views/ModMakerWindow.xaml | 33 +- .../Views/ModMakerWindow.xaml.cs | 18 +- VPet.Plugin.ModMaker/packages.config | 6 +- 29 files changed, 986 insertions(+), 671 deletions(-) create mode 100644 VPet.Plugin.ModMaker/Models/I18nModel.cs delete mode 100644 VPet.Plugin.ModMaker/Models/II18nData.cs create mode 100644 VPet.Plugin.ModMaker/Models/ModLoader.cs create mode 100644 VPet.Plugin.ModMaker/Models/ModMakeHistory.cs create mode 100644 VPet.Plugin.ModMaker/Models/ModMakerInfo.cs diff --git a/VPet.Plugin.ModMaker/Models/ClickTextModel.cs b/VPet.Plugin.ModMaker/Models/ClickTextModel.cs index a11df1c..6b448e6 100644 --- a/VPet.Plugin.ModMaker/Models/ClickTextModel.cs +++ b/VPet.Plugin.ModMaker/Models/ClickTextModel.cs @@ -8,26 +8,19 @@ using VPet_Simulator.Windows.Interface; namespace VPet.Plugin.ModMaker.Models; -public class ClickTextModel : II18nData +public class ClickTextModel : I18nModel { + public string Text { get; set; } public ObservableValue Id { get; } = new(); public ObservableValue Mode { get; } = new(); public ObservableValue Working { get; } = new(); - public ObservableValue LikeMin { get; } = new(); - public ObservableValue LikeMax { get; } = new(); + public ObservableValue LikeMin { get; } = new(); + public ObservableValue LikeMax { get; } = new(); public ObservableValue WorkingState { get; } = new(); public ObservableValue DayTime { get; } = new(); - public ObservableValue CurrentI18nData { get; } = new(); - public Dictionary I18nDatas { get; } = new(); - - public ClickTextModel() - { - foreach (var lang in I18nHelper.Current.CultureNames) - I18nDatas.Add(lang, new()); - CurrentI18nData.Value = I18nDatas[I18nHelper.Current.CultureName.Value]; - } + public ClickTextModel() { } public ClickTextModel(ClickTextModel clickText) : this() @@ -38,15 +31,25 @@ public class ClickTextModel : II18nData LikeMax.Value = clickText.LikeMax.Value; LikeMin.Value = clickText.LikeMin.Value; DayTime.Value = clickText.DayTime.Value; - foreach (var item in clickText.I18nDatas) - I18nDatas[item.Key] = item.Value; - CurrentI18nData.Value = I18nDatas[I18nHelper.Current.CultureName.Value]; + } + + public ClickTextModel(ClickText clickText) + : this() + { + Text = clickText.Text; + Mode.Value = clickText.Mode; + Working.Value = clickText.Working; + WorkingState.Value = clickText.State; + DayTime.Value = clickText.DaiTime; + LikeMax.Value = clickText.LikeMax; + LikeMin.Value = clickText.LikeMin; } public ClickText ToClickText() { return new() { + Text = Text, Mode = Mode.Value, Working = Working.Value, State = WorkingState.Value, diff --git a/VPet.Plugin.ModMaker/Models/FoodModel.cs b/VPet.Plugin.ModMaker/Models/FoodModel.cs index 91180d0..2250358 100644 --- a/VPet.Plugin.ModMaker/Models/FoodModel.cs +++ b/VPet.Plugin.ModMaker/Models/FoodModel.cs @@ -10,8 +10,10 @@ using VPet_Simulator.Windows.Interface; namespace VPet.Plugin.ModMaker.Models; -public class FoodModel : II18nData +public class FoodModel : I18nModel { + public string Name { get; set; } + public string Description { get; set; } public ObservableValue Id { get; } = new(); public ObservableValue Type { get; } = new(); public ObservableValue Strength { get; } = new(); @@ -23,15 +25,8 @@ public class FoodModel : II18nData public ObservableValue Price { get; } = new(); public ObservableValue Exp { get; } = new(); public ObservableValue Image { get; } = new(); - public ObservableValue CurrentI18nData { get; } = new(); - public Dictionary I18nDatas { get; } = new(); - public FoodModel() - { - foreach (var lang in I18nHelper.Current.CultureNames) - I18nDatas.Add(lang, new()); - CurrentI18nData.Value = I18nDatas[I18nHelper.Current.CultureName.Value]; - } + public FoodModel() { } public FoodModel(FoodModel food) : this() @@ -47,9 +42,24 @@ public class FoodModel : II18nData Price.Value = food.Price.Value; Exp.Value = food.Exp.Value; Image.Value = Utils.LoadImageToStream(food.Image.Value); - foreach (var item in food.I18nDatas) - I18nDatas[item.Key] = item.Value; - CurrentI18nData.Value = I18nDatas[I18nHelper.Current.CultureName.Value]; + } + + public FoodModel(Food food) + : this() + { + Name = food.Name; + Description = food.Description; + Type.Value = food.Type; + Strength.Value = food.Strength; + StrengthDrink.Value = food.StrengthDrink; + StrengthFood.Value = food.StrengthFood; + Feeling.Value = food.Feeling; + Health.Value = food.Health; + Likability.Value = food.Likability; + Price.Value = food.Price; + Exp.Value = food.Exp; + if (File.Exists(food.Image)) + Image.Value = Utils.LoadImageToStream(food.Image); } public Food ToFood() diff --git a/VPet.Plugin.ModMaker/Models/I18nModel.cs b/VPet.Plugin.ModMaker/Models/I18nModel.cs new file mode 100644 index 0000000..50dd766 --- /dev/null +++ b/VPet.Plugin.ModMaker/Models/I18nModel.cs @@ -0,0 +1,52 @@ +using HKW.HKWViewModels.SimpleObservable; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace VPet.Plugin.ModMaker.Models; + +public class I18nModel + where T : class, new() +{ + public ObservableValue CurrentI18nData { get; } = new(); + public Dictionary I18nDatas { get; } = new(); + + public I18nModel() + { + I18nHelper.Current.CultureName.ValueChanged += LangChanged; + I18nHelper.Current.AddLang += AddLang; + I18nHelper.Current.RemoveLang += RemoveLang; + I18nHelper.Current.ReplaceLang += ReplaceLang; + if (I18nDatas.Count == 0) + return; + foreach (var item in I18nDatas) + I18nDatas[item.Key] = item.Value; + CurrentI18nData.Value = I18nDatas[I18nHelper.Current.CultureName.Value]; + } + + private void LangChanged(string value) + { + if (I18nDatas.TryGetValue(value, out var result)) + CurrentI18nData.Value = result; + } + + private void AddLang(string lang) + { + if (I18nDatas.ContainsKey(lang) is false) + I18nDatas.Add(lang, new()); + } + + private void RemoveLang(string lang) + { + I18nDatas.Remove(lang); + } + + private void ReplaceLang(string oldLang, string newLang) + { + var item = I18nDatas[oldLang]; + I18nDatas.Remove(oldLang); + I18nDatas.Add(newLang, item); + } +} diff --git a/VPet.Plugin.ModMaker/Models/II18nData.cs b/VPet.Plugin.ModMaker/Models/II18nData.cs deleted file mode 100644 index 0dcb737..0000000 --- a/VPet.Plugin.ModMaker/Models/II18nData.cs +++ /dev/null @@ -1,15 +0,0 @@ -using HKW.HKWViewModels.SimpleObservable; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VPet.Plugin.ModMaker.Models; - -public interface II18nData - where T : class -{ - public ObservableValue CurrentI18nData { get; } - public Dictionary I18nDatas { get; } -} diff --git a/VPet.Plugin.ModMaker/Models/LowTextModel.cs b/VPet.Plugin.ModMaker/Models/LowTextModel.cs index 47aa553..de556de 100644 --- a/VPet.Plugin.ModMaker/Models/LowTextModel.cs +++ b/VPet.Plugin.ModMaker/Models/LowTextModel.cs @@ -4,36 +4,36 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Xml.Serialization; using VPet_Simulator.Windows.Interface; namespace VPet.Plugin.ModMaker.Models; -public class LowTextModel : II18nData +public class LowTextModel : I18nModel { + public string Text { get; set; } public ObservableValue Id { get; } = new(); public ObservableValue Mode { get; } = new(); public ObservableValue Strength { get; } = new(); public ObservableValue Like { get; } = new(); - public ObservableValue CurrentI18nData { get; } = new(); - public Dictionary I18nDatas { get; } = new(); - - public LowTextModel() - { - foreach (var lang in I18nHelper.Current.CultureNames) - I18nDatas.Add(lang, new()); - CurrentI18nData.Value = I18nDatas[I18nHelper.Current.CultureName.Value]; - } + public LowTextModel() { } public LowTextModel(LowTextModel lowText) : this() { - Mode = lowText.Mode; - Strength = lowText.Strength; - Like = lowText.Like; - foreach (var item in lowText.I18nDatas) - I18nDatas[item.Key] = item.Value; - CurrentI18nData.Value = I18nDatas[I18nHelper.Current.CultureName.Value]; + Mode.Value = lowText.Mode.Value; + Strength.Value = lowText.Strength.Value; + Like.Value = lowText.Like.Value; + } + + public LowTextModel(LowText lowText) + : this() + { + Text = lowText.Text; + Mode.Value = lowText.Mode; + Strength.Value = lowText.Strength; + Like.Value = lowText.Like; } public void Close() { } @@ -43,6 +43,7 @@ public class LowTextModel : II18nData // 没有 Text return new() { + Text = Text, Mode = Mode.Value, Strength = Strength.Value, Like = Like.Value, diff --git a/VPet.Plugin.ModMaker/Models/ModInfoModel.cs b/VPet.Plugin.ModMaker/Models/ModInfoModel.cs index 41cd9fa..4308adc 100644 --- a/VPet.Plugin.ModMaker/Models/ModInfoModel.cs +++ b/VPet.Plugin.ModMaker/Models/ModInfoModel.cs @@ -1,6 +1,9 @@ using HKW.HKWViewModels.SimpleObservable; using System; using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Collections.Specialized; +using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -9,17 +12,55 @@ using VPet_Simulator.Windows.Interface; namespace VPet.Plugin.ModMaker.Models; -public class ModInfoModel +public class ModInfoModel : I18nModel { + public static ModInfoModel Current { get; set; } + + public ObservableValue Id { get; } = new(); + + public ObservableValue Summary { get; } = new(); public ObservableValue Author { get; } = new(); public ObservableValue GameVersion { get; } = new(); public ObservableValue ModVersion { get; } = new(); public ObservableValue ModImage { get; } = new(); - public ObservableValue CurrentI18nData { get; } = new(); - public Dictionary I18nDatas { get; } = new(); - public List Foods { get; set; } = new(); - //public List ClickTexts { get; set; } = new(); - //public List LowTexts { get; set; } = new(); + public ObservableCollection Foods { get; } = new(); + public ObservableCollection ClickTexts { get; } = new(); + public ObservableCollection LowTexts { get; } = new(); + public ObservableValue SourcePath { get; } = new(); + + public Dictionary> OtherI18nDatas { get; } = new(); + + public ModInfoModel() { } + + public ModInfoModel(ModLoader loader) + { + SourcePath.Value = loader.Path.FullName; + Id.Value = loader.Name; + var imagePath = Path.Combine(loader.Path.FullName, "icon.png"); + if (File.Exists(imagePath)) + ModImage.Value = Utils.LoadImageToStream(imagePath); + Author.Value = loader.Author; + GameVersion.Value = loader.GameVer.ToString(); + ModVersion.Value = loader.Ver.ToString(); + foreach (var food in loader.Foods) + Foods.Add(new(food)); + foreach (var clickText in loader.ClickTexts) + ClickTexts.Add(new(clickText)); + foreach (var lowText in loader.LowTexts) + LowTexts.Add(new(lowText)); + Summary.Value = GetSummary(); + foreach (var lang in loader.I18nDatas) + I18nDatas.Add(lang.Key, lang.Value); + OtherI18nDatas = loader.OtherI18nDatas; + } + + public string GetSummary() + { + return $@"包含以下内容: +食物: {Foods.Count} +点击文本: {ClickTexts.Count} +低状态文本: {LowTexts.Count}"; + } } public class I18nModInfoModel diff --git a/VPet.Plugin.ModMaker/Models/ModLoader.cs b/VPet.Plugin.ModMaker/Models/ModLoader.cs new file mode 100644 index 0000000..f512464 --- /dev/null +++ b/VPet.Plugin.ModMaker/Models/ModLoader.cs @@ -0,0 +1,219 @@ +using LinePutScript; +using LinePutScript.Converter; +using LinePutScript.Dictionary; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using VPet_Simulator.Core; +using VPet_Simulator.Windows.Interface; + +namespace VPet.Plugin.ModMaker.Models; + +public class ModLoader +{ + public string Name { get; } + public string Author { get; } + + /// + /// 如果是上传至Steam,则为SteamUserID + /// + public long AuthorID { get; } + + /// + /// 上传至Steam的ItemID + /// + public ulong ItemID { get; } + public string Intro { get; } + public DirectoryInfo Path { get; } + public int GameVer { get; } + public int Ver { get; } + public HashSet Tag { get; } = new(); + public bool SuccessLoad { get; } = true; + public DateTime CacheDate { get; } = DateTime.MinValue; + public List Pets { get; } = new(); + public List Foods { get; } = new(); + public List LowTexts { get; } = new(); + public Dictionary I18nDatas { get; } = new(); + + public Dictionary> OtherI18nDatas { get; } = new(); + public List ClickTexts { get; } = new(); + + public ModLoader(DirectoryInfo directory) + { + try + { + Path = directory; + LpsDocument modlps = new LpsDocument( + File.ReadAllText(directory.FullName + @"\info.lps") + ); + Name = modlps.FindLine("vupmod").Info; + Intro = modlps.FindLine("intro").Info; + GameVer = modlps.FindSub("gamever").InfoToInt; + Ver = modlps.FindSub("ver").InfoToInt; + Author = modlps.FindSub("author").Info.Split('[').First(); + if (modlps.FindLine("authorid") != null) + AuthorID = modlps.FindLine("authorid").InfoToInt64; + else + AuthorID = 0; + if (modlps.FindLine("itemid") != null) + ItemID = Convert.ToUInt64(modlps.FindLine("itemid").info); + else + ItemID = 0; + CacheDate = modlps.GetDateTime("cachedate", DateTime.MinValue); + + //MOD未加载时支持翻译 + foreach (var line in modlps.FindAllLine("lang")) + { + var i18nData = new I18nModInfoModel(); + foreach (var sub in line) + { + if (sub.Name == Name) + i18nData.Name.Value = sub.Info; + else if (sub.Name == Intro) + i18nData.Description.Value = sub.Info; + } + I18nDatas.Add(line.Info, i18nData); + } + DirectoryInfo? langDirectory = null; + foreach (DirectoryInfo di in Path.EnumerateDirectories()) + { + switch (di.Name.ToLower()) + { + case "pet": + //宠物模型 + Tag.Add("pet"); + foreach (FileInfo fi in di.EnumerateFiles("*.lps")) + { + var lps = new LpsDocument(File.ReadAllText(fi.FullName)); + if (lps.First().Name.ToLower() == "pet") + { + var name = lps.First().Info; + Pets.Add(new PetLoader(lps, di)); + //var p = mw.Pets.FirstOrDefault(x => x.Name == name); + //if (p == null) + // mw.Pets.Add(new PetLoader(lps, di)); + //else + //{ + // p.path.Add(di.FullName + "\\" + lps.First()["path"].Info); + // p.Config.Set(lps); + //} + } + } + break; + case "food": + Tag.Add("food"); + foreach (FileInfo fi in di.EnumerateFiles("*.lps")) + { + var tmp = new LpsDocument(File.ReadAllText(fi.FullName)); + foreach (ILine li in tmp) + { + var food = LPSConvert.DeserializeObject(li); + var imagePath = $"{Path.FullName}\\image\\food\\{food.Name}.png"; + if (File.Exists(imagePath)) + food.Image = imagePath; + Foods.Add(food); + //string tmps = li.Find("name").info; + //mw.Foods.RemoveAll(x => x.Name == tmps); + //mw.Foods.Add(LPSConvert.DeserializeObject(li)); + } + } + break; + case "image": + Tag.Add("image"); + break; + case "text": + Tag.Add("text"); + foreach (FileInfo fi in di.EnumerateFiles("*.lps")) + { + var tmp = new LpsDocument(File.ReadAllText(fi.FullName)); + foreach (ILine li in tmp) + { + switch (li.Name.ToLower()) + { + case "lowfoodtext": + LowTexts.Add(LPSConvert.DeserializeObject(li)); + break; + case "lowdrinktext": + LowTexts.Add(LPSConvert.DeserializeObject(li)); + break; + case "clicktext": + ClickTexts.Add(LPSConvert.DeserializeObject(li)); + break; + //case "selecttext": + // mw.SelectTexts.Add( + // LPSConvert.DeserializeObject(li) + // ); + // break; + } + } + } + break; + case "lang": + Tag.Add("lang"); + langDirectory = di; + //foreach (FileInfo fi in di.EnumerateFiles("*.lps")) + //{ + // //LocalizeCore.AddCulture( + // // fi.Name.Substring(0, fi.Name.Length - fi.Extension.Length), + // // new LPS_D(File.ReadAllText(fi.FullName)) + // //); + //} + //foreach (DirectoryInfo dis in di.EnumerateDirectories()) + //{ + // foreach (FileInfo fi in dis.EnumerateFiles("*.lps")) + // { + // //LocalizeCore.AddCulture( + // // dis.Name, + // // new LPS_D(File.ReadAllText(fi.FullName)) + // //); + // } + //} + + //if (mw.Set.Language == "null") + //{ + // LocalizeCore.LoadDefaultCulture(); + //} + //else + // LocalizeCore.LoadCulture(mw.Set.Language); + break; + } + } + if (langDirectory is null) + return; + foreach (DirectoryInfo dis in langDirectory.EnumerateDirectories()) + { + OtherI18nDatas.Add(dis.Name, new()); + foreach (FileInfo fi in dis.EnumerateFiles("*.lps")) + { + var lps = new LPS(File.ReadAllText(fi.FullName)); + foreach (var item in lps) + { + if (OtherI18nDatas[dis.Name].ContainsKey(item.Name) is false) + OtherI18nDatas[dis.Name].Add(item.Name, item.Info); + } + } + } + } + catch (Exception ex) + { + Tag.Add("该模组已损坏"); + SuccessLoad = false; + } + } + + public void WriteFile() + { + var lps = new LpsDocument(File.ReadAllText(Path.FullName + @"\info.lps")); + lps.FindLine("vupmod").Info = Name; + lps.FindLine("intro").Info = Intro; + lps.FindSub("gamever").InfoToInt = GameVer; + lps.FindSub("ver").InfoToInt = Ver; + lps.FindSub("author").Info = Author; + lps.FindorAddLine("authorid").InfoToInt64 = AuthorID; + lps.FindorAddLine("itemid").info = ItemID.ToString(); + File.WriteAllText(Path.FullName + @"\info.lps", lps.ToString()); + } +} diff --git a/VPet.Plugin.ModMaker/Models/ModMakeHistory.cs b/VPet.Plugin.ModMaker/Models/ModMakeHistory.cs new file mode 100644 index 0000000..0a8b1fd --- /dev/null +++ b/VPet.Plugin.ModMaker/Models/ModMakeHistory.cs @@ -0,0 +1,20 @@ +using LinePutScript.Converter; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace VPet.Plugin.ModMaker.Models; + +public class ModMakeHistory +{ + [Line(ignoreCase: true)] + public string Name { get; set; } + + [Line(ignoreCase: true)] + public string Path { get; set; } + + [Line(ignoreCase: true)] + public DateTime LastOpenTime { get; set; } +} diff --git a/VPet.Plugin.ModMaker/Models/ModMakerInfo.cs b/VPet.Plugin.ModMaker/Models/ModMakerInfo.cs new file mode 100644 index 0000000..117f55d --- /dev/null +++ b/VPet.Plugin.ModMaker/Models/ModMakerInfo.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace VPet.Plugin.ModMaker.Models; + +public static class ModMakerInfo +{ + public const string BaseDirectory = nameof(ModMaker); +} diff --git a/VPet.Plugin.ModMaker/Models/PetModel.cs b/VPet.Plugin.ModMaker/Models/PetModel.cs index 722acc1..0974a0f 100644 --- a/VPet.Plugin.ModMaker/Models/PetModel.cs +++ b/VPet.Plugin.ModMaker/Models/PetModel.cs @@ -9,12 +9,22 @@ using System.Windows.Media.Imaging; namespace VPet.Plugin.ModMaker.Models; -public class PetModel +public class PetModel : I18nModel { + public ObservableValue Id { get; } = new(); public ObservableValue Image { get; } = new(); public ObservableValue TouchHeadRect { get; } = new(new()); public ObservableValue TouchRaisedRect { get; } = new(new()); public ObservableValue RaisePoint { get; } = new(new()); + + public ObservableValue CurrentI18nData { get; } = new(); + public Dictionary I18nDatas { get; } = new(); +} + +public class I18nPetInfoModel +{ + public ObservableValue Name { get; set; } = new(); + public ObservableValue Description { get; set; } = new(); } public class MultiStateRect diff --git a/VPet.Plugin.ModMaker/VPet.Plugin.ModMaker.csproj b/VPet.Plugin.ModMaker/VPet.Plugin.ModMaker.csproj index 0fb65bf..5a8990c 100644 --- a/VPet.Plugin.ModMaker/VPet.Plugin.ModMaker.csproj +++ b/VPet.Plugin.ModMaker/VPet.Plugin.ModMaker.csproj @@ -61,8 +61,8 @@ ..\packages\Panuon.WPF.1.0.2\lib\net462\Panuon.WPF.dll - - ..\packages\Panuon.WPF.UI.1.1.15.6\lib\net462\Panuon.WPF.UI.dll + + ..\packages\Panuon.WPF.UI.1.1.15.7\lib\net462\Panuon.WPF.UI.dll @@ -76,10 +76,10 @@ 4.0 - ..\packages\VPet-Simulator.Core.1.0.0\lib\net462\VPet-Simulator.Core.dll + ..\packages\VPet-Simulator.Core.1.0.2\lib\net462\VPet-Simulator.Core.dll - ..\packages\VPet-Simulator.Windows.Interface.1.0.0\lib\net462\VPet-Simulator.Windows.Interface.dll + ..\packages\VPet-Simulator.Windows.Interface.1.0.2\lib\net462\VPet-Simulator.Windows.Interface.dll @@ -94,8 +94,11 @@ - + + + + diff --git a/VPet.Plugin.ModMaker/ViewModels/ModEdit/ClickTextEdit/ClickTextEditWindowVM.cs b/VPet.Plugin.ModMaker/ViewModels/ModEdit/ClickTextEdit/ClickTextEditWindowVM.cs index a53287a..7bc84a1 100644 --- a/VPet.Plugin.ModMaker/ViewModels/ModEdit/ClickTextEdit/ClickTextEditWindowVM.cs +++ b/VPet.Plugin.ModMaker/ViewModels/ModEdit/ClickTextEdit/ClickTextEditWindowVM.cs @@ -12,7 +12,6 @@ namespace VPet.Plugin.ModMaker.ViewModels.ModEdit.ClickTextEdit; public class ClickTextEditWindowVM { - public ObservableCollection ClickTexts { get; set; } #region Value public ObservableValue ClickText { get; } = new(new()); public ObservableCollection ModeTypes { get; } = new(); diff --git a/VPet.Plugin.ModMaker/ViewModels/ModEdit/ClickTextEdit/ClickTextPageVM.cs b/VPet.Plugin.ModMaker/ViewModels/ModEdit/ClickTextEdit/ClickTextPageVM.cs index edfbb71..d8573e6 100644 --- a/VPet.Plugin.ModMaker/ViewModels/ModEdit/ClickTextEdit/ClickTextPageVM.cs +++ b/VPet.Plugin.ModMaker/ViewModels/ModEdit/ClickTextEdit/ClickTextPageVM.cs @@ -15,7 +15,8 @@ public class ClickTextPageVM { #region Value public ObservableValue> ShowClickTexts { get; } = new(); - public ObservableCollection ClickTexts { get; } = new(); + public ObservableCollection ClickTexts { get; } = + new(ModInfoModel.Current.ClickTexts); public ObservableValue FilterClickText { get; } = new(); #endregion #region Command @@ -31,11 +32,6 @@ public class ClickTextPageVM AddClickTextCommand.ExecuteAction = AddClickText; EditClickTextCommand.ExecuteAction = EditClickText; RemoveClickTextCommand.ExecuteAction = RemoveClickText; - - I18nHelper.Current.CultureName.ValueChanged += CurrentLang_ValueChanged; - I18nHelper.Current.AddLang += Instance_AddLang; - I18nHelper.Current.RemoveLang += Instance_RemoveLang; - I18nHelper.Current.ReplaceLang += Instance_ReplaceLang; } private void FilterClickText_ValueChanged(string value) @@ -54,7 +50,7 @@ public class ClickTextPageVM private void AddClickText() { - var window = CreateClickTextEditWindow(); + var window = new ClickTextEditWindow(); var vm = window.ViewModel; window.ShowDialog(); if (window.IsCancel) @@ -64,7 +60,7 @@ public class ClickTextPageVM public void EditClickText(ClickTextModel clickText) { - var window = CreateClickTextEditWindow(); + var window = new ClickTextEditWindow(); var vm = window.ViewModel; var newLowTest = vm.ClickText.Value = new(clickText); window.ShowDialog(); @@ -95,45 +91,4 @@ public class ClickTextPageVM ClickTexts.Remove(clickText); } } - - private void CurrentLang_ValueChanged(string value) - { - foreach (var lowText in ClickTexts) - { - lowText.CurrentI18nData.Value = lowText.I18nDatas[value]; - } - } - - private void Instance_AddLang(string lang) - { - foreach (var lowText in ClickTexts) - { - lowText.I18nDatas.Add(lang, new()); - } - } - - private void Instance_RemoveLang(string lang) - { - foreach (var lowText in ClickTexts) - { - lowText.I18nDatas.Remove(lang); - } - } - - private void Instance_ReplaceLang(string oldLang, string newLang) - { - foreach (var lowText in ClickTexts) - { - var item = lowText.I18nDatas[oldLang]; - lowText.I18nDatas.Remove(oldLang); - lowText.I18nDatas.Add(newLang, item); - } - } - - private ClickTextEditWindow CreateClickTextEditWindow() - { - var window = new ClickTextEditWindow(); - window.ViewModel.ClickTexts = ClickTexts; - return window; - } } diff --git a/VPet.Plugin.ModMaker/ViewModels/ModEdit/FoodEdit/FoodEditWindowVM.cs b/VPet.Plugin.ModMaker/ViewModels/ModEdit/FoodEdit/FoodEditWindowVM.cs index ef1081d..aa4f37c 100644 --- a/VPet.Plugin.ModMaker/ViewModels/ModEdit/FoodEdit/FoodEditWindowVM.cs +++ b/VPet.Plugin.ModMaker/ViewModels/ModEdit/FoodEdit/FoodEditWindowVM.cs @@ -15,8 +15,6 @@ namespace VPet.Plugin.ModMaker.ViewModels.ModEdit.FoodEdit; public class FoodEditWindowVM { - public ObservableCollection Foods { get; set; } - #region Value public ObservableValue Food { get; } = new(new()); public ObservableCollection FoodTypes { get; } = new(); diff --git a/VPet.Plugin.ModMaker/ViewModels/ModEdit/FoodEdit/FoodPageVM.cs b/VPet.Plugin.ModMaker/ViewModels/ModEdit/FoodEdit/FoodPageVM.cs index 70633c7..d914d03 100644 --- a/VPet.Plugin.ModMaker/ViewModels/ModEdit/FoodEdit/FoodPageVM.cs +++ b/VPet.Plugin.ModMaker/ViewModels/ModEdit/FoodEdit/FoodPageVM.cs @@ -17,7 +17,7 @@ public class FoodPageVM { #region Value public ObservableValue> ShowFoods { get; } = new(); - public ObservableCollection Foods { get; } = new(); + public ObservableCollection Foods { get; } = new(ModInfoModel.Current.Foods); public ObservableValue FilterFoodText { get; } = new(); #endregion #region Command @@ -33,45 +33,6 @@ public class FoodPageVM AddFoodCommand.ExecuteAction = AddFood; EditFoodCommand.ExecuteAction = EditFood; RemoveFoodCommand.ExecuteAction = RemoveFood; - - I18nHelper.Current.CultureName.ValueChanged += CurrentLang_ValueChanged; - I18nHelper.Current.AddLang += Instance_AddLang; - I18nHelper.Current.RemoveLang += Instance_RemoveLang; - I18nHelper.Current.ReplaceLang += Instance_ReplaceLang; - } - - private void CurrentLang_ValueChanged(string value) - { - foreach (var food in Foods) - { - food.CurrentI18nData.Value = food.I18nDatas[value]; - } - } - - private void Instance_AddLang(string lang) - { - foreach (var food in Foods) - { - food.I18nDatas.Add(lang, new()); - } - } - - private void Instance_RemoveLang(string lang) - { - foreach (var food in Foods) - { - food.I18nDatas.Remove(lang); - } - } - - private void Instance_ReplaceLang(string oldLang, string newLang) - { - foreach (var food in Foods) - { - var item = food.I18nDatas[oldLang]; - food.I18nDatas.Remove(oldLang); - food.I18nDatas.Add(newLang, item); - } } private void FilterFoodText_ValueChanged(string value) @@ -92,7 +53,7 @@ public class FoodPageVM private void AddFood() { - var window = CreateAddFoodWindow(); + var window = new FoodEditWindow(); var vm = window.ViewModel; window.ShowDialog(); if (window.IsCancel) @@ -102,7 +63,7 @@ public class FoodPageVM public void EditFood(FoodModel food) { - var window = CreateAddFoodWindow(); + var window = new FoodEditWindow(); var vm = window.ViewModel; var newFood = vm.Food.Value = new(food); window.ShowDialog(); @@ -134,11 +95,4 @@ public class FoodPageVM Foods.Remove(food); } } - - private FoodEditWindow CreateAddFoodWindow() - { - var window = new FoodEditWindow(); - window.ViewModel.Foods = Foods; - return window; - } } diff --git a/VPet.Plugin.ModMaker/ViewModels/ModEdit/LowTextEdit/LowTextEditWindowVM.cs b/VPet.Plugin.ModMaker/ViewModels/ModEdit/LowTextEdit/LowTextEditWindowVM.cs index d34b509..b3d1258 100644 --- a/VPet.Plugin.ModMaker/ViewModels/ModEdit/LowTextEdit/LowTextEditWindowVM.cs +++ b/VPet.Plugin.ModMaker/ViewModels/ModEdit/LowTextEdit/LowTextEditWindowVM.cs @@ -12,8 +12,6 @@ namespace VPet.Plugin.ModMaker.ViewModels.ModEdit.LowTextEdit; public class LowTextEditWindowVM { - public ObservableCollection LowTexts { get; set; } - #region Value public ObservableValue LowText { get; } = new(new()); diff --git a/VPet.Plugin.ModMaker/ViewModels/ModEdit/LowTextEdit/LowTextPageVM.cs b/VPet.Plugin.ModMaker/ViewModels/ModEdit/LowTextEdit/LowTextPageVM.cs index 9b85e4f..4f5b818 100644 --- a/VPet.Plugin.ModMaker/ViewModels/ModEdit/LowTextEdit/LowTextPageVM.cs +++ b/VPet.Plugin.ModMaker/ViewModels/ModEdit/LowTextEdit/LowTextPageVM.cs @@ -19,7 +19,8 @@ public class LowTextPageVM #region Value public ObservableValue FilterLowText { get; } = new(); public ObservableValue> ShowLowTexts { get; } = new(); - public ObservableCollection LowTexts { get; } = new(); + public ObservableCollection LowTexts { get; } = + new(ModInfoModel.Current.LowTexts); #endregion #region Command public ObservableCommand AddLowTextCommand { get; } = new(); @@ -34,11 +35,6 @@ public class LowTextPageVM AddLowTextCommand.ExecuteAction = AddLowText; EditLowTextCommand.ExecuteAction = EditLowText; RemoveLowTextCommand.ExecuteAction = RemoveLowText; - - I18nHelper.Current.CultureName.ValueChanged += CurrentLang_ValueChanged; - I18nHelper.Current.AddLang += Instance_AddLang; - I18nHelper.Current.RemoveLang += Instance_RemoveLang; - I18nHelper.Current.ReplaceLang += Instance_ReplaceLang; } private void FilterLowText_ValueChanged(string value) @@ -57,7 +53,7 @@ public class LowTextPageVM private void AddLowText() { - var window = CreateLowTextEditWindow(); + var window = new LowTextEditWindow(); var vm = window.ViewModel; window.ShowDialog(); if (window.IsCancel) @@ -67,7 +63,7 @@ public class LowTextPageVM public void EditLowText(LowTextModel lowText) { - var window = CreateLowTextEditWindow(); + var window = new LowTextEditWindow(); var vm = window.ViewModel; var newLowTest = vm.LowText.Value = new(lowText); window.ShowDialog(); @@ -98,45 +94,4 @@ public class LowTextPageVM LowTexts.Remove(lowText); } } - - private void CurrentLang_ValueChanged(string value) - { - foreach (var lowText in LowTexts) - { - lowText.CurrentI18nData.Value = lowText.I18nDatas[value]; - } - } - - private void Instance_AddLang(string lang) - { - foreach (var lowText in LowTexts) - { - lowText.I18nDatas.Add(lang, new()); - } - } - - private void Instance_RemoveLang(string lang) - { - foreach (var lowText in LowTexts) - { - lowText.I18nDatas.Remove(lang); - } - } - - private void Instance_ReplaceLang(string oldLang, string newLang) - { - foreach (var lowText in LowTexts) - { - var item = lowText.I18nDatas[oldLang]; - lowText.I18nDatas.Remove(oldLang); - lowText.I18nDatas.Add(newLang, item); - } - } - - private LowTextEditWindow CreateLowTextEditWindow() - { - var window = new LowTextEditWindow(); - window.ViewModel.LowTexts = LowTexts; - return window; - } } diff --git a/VPet.Plugin.ModMaker/ViewModels/ModEdit/ModEditWindowVM.cs b/VPet.Plugin.ModMaker/ViewModels/ModEdit/ModEditWindowVM.cs index 7a012ad..476fabc 100644 --- a/VPet.Plugin.ModMaker/ViewModels/ModEdit/ModEditWindowVM.cs +++ b/VPet.Plugin.ModMaker/ViewModels/ModEdit/ModEditWindowVM.cs @@ -20,8 +20,7 @@ public class ModEditWindowVM public ModEditWindow ModEditWindow { get; } #region Value - public ObservableValue ModImage { get; } = new(); - public ObservableValue ModInfo { get; } = new(new()); + public ObservableValue ModInfo { get; } = new(ModInfoModel.Current); public ObservableValue CurrentLang { get; } = new(); public I18nHelper I18nData => I18nHelper.Current; #endregion @@ -33,16 +32,48 @@ public class ModEditWindowVM public ObservableCommand EditLangCommand { get; } = new(); public ObservableCommand RemoveLangCommand { get; } = new(); + + public ObservableCommand SaveCommand { get; } = new(); + public ObservableCommand SaveToCommand { get; } = new(); #endregion public ModEditWindowVM() { } public ModEditWindowVM(ModEditWindow window) { -#if DEBUG - I18nHelper.Current.CultureNames.Add("zh-CN"); - I18nHelper.Current.CultureName.Value = I18nHelper.Current.CultureNames.First(); -#endif + foreach (var lang in ModInfo.Value.I18nDatas) + { + if (I18nHelper.Current.CultureNames.Contains(lang.Key) is false) + I18nHelper.Current.CultureNames.Add(lang.Key); + } + if (I18nHelper.Current.CultureNames.Count > 0) + { + I18nHelper.Current.CultureName.Value = I18nHelper.Current.CultureNames.First(); + foreach (var i18n in ModInfo.Value.OtherI18nDatas) + { + foreach (var food in ModInfo.Value.Foods) + { + var foodI18n = food.I18nDatas[i18n.Key]; + if (i18n.Value.TryGetValue(food.Name, out var i18nName)) + foodI18n.Name.Value = i18nName; + if (i18n.Value.TryGetValue(food.Description, out var i18nDescription)) + foodI18n.Description.Value = i18nDescription; + } + foreach (var lowText in ModInfo.Value.LowTexts) + { + var lowTextI18n = lowText.I18nDatas[i18n.Key]; + if (i18n.Value.TryGetValue(lowText.Text, out var text)) + lowTextI18n.Text.Value = text; + } + foreach (var clickText in ModInfo.Value.ClickTexts) + { + var clickTextI18n = clickText.I18nDatas[i18n.Key]; + if (i18n.Value.TryGetValue(clickText.Text, out var text)) + clickTextI18n.Text.Value = text; + } + } + } + ModEditWindow = window; I18nHelper.Current.AddLang += I18nData_AddLang; @@ -50,11 +81,13 @@ public class ModEditWindowVM I18nHelper.Current.ReplaceLang += I18nData_ReplaceLang; CurrentLang.ValueChanged += CurrentLang_ValueChanged; - AddImageCommand.ExecuteAction = AddImage; - ChangeImageCommand.ExecuteAction = ChangeImage; - AddLangCommand.ExecuteAction = AddLang; - EditLangCommand.ExecuteAction = EditLang; - RemoveLangCommand.ExecuteAction = RemoveLang; + AddImageCommand.ExecuteAction += AddImage; + ChangeImageCommand.ExecuteAction += ChangeImage; + AddLangCommand.ExecuteAction += AddLang; + EditLangCommand.ExecuteAction += EditLang; + RemoveLangCommand.ExecuteAction += RemoveLang; + SaveCommand.ExecuteAction += Save; + SaveToCommand.ExecuteAction += SaveTo; } private void I18nData_AddLang(string lang) @@ -135,4 +168,14 @@ public class ModEditWindowVM return; I18nHelper.Current.CultureNames.Remove(oldLang); } + + private void Save() + { + return; + } + + private void SaveTo() + { + return; + } } diff --git a/VPet.Plugin.ModMaker/ViewModels/ModMakerWindowVM.cs b/VPet.Plugin.ModMaker/ViewModels/ModMakerWindowVM.cs index 11b81ee..b4e23b2 100644 --- a/VPet.Plugin.ModMaker/ViewModels/ModMakerWindowVM.cs +++ b/VPet.Plugin.ModMaker/ViewModels/ModMakerWindowVM.cs @@ -1,6 +1,8 @@ using HKW.HKWViewModels.SimpleObservable; using System; using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -10,26 +12,56 @@ using VPet.Plugin.ModMaker.Views.ModEdit; namespace VPet.Plugin.ModMaker.ViewModels; -public class WindowVM_ModMaker +public class ModMakerWindowVM { public ModMakerWindow ModMakerWindow { get; } public ModEditWindow ModEditWindow { get; private set; } - public ObservableCommand CreateNewModCommand { get; set; } = - new() { ExecuteAction = () => { } }; + public ObservableCommand CreateNewModCommand { get; set; } = new(); - public WindowVM_ModMaker() { } + public ObservableValue ModFilterText { get; } = new(); - public WindowVM_ModMaker(ModMakerWindow window) + public ObservableCollection ShowMods { get; set; } + public ObservableCollection Mods { get; } = new(); + + public ModMakerWindowVM() { } + + public ModMakerWindowVM(ModMakerWindow window) { + LoadMods(); ModMakerWindow = window; + ShowMods = Mods; CreateNewModCommand.ExecuteAction = CreateNewMod; + ModFilterText.ValueChanged += ModFilterText_ValueChanged; } - private void CreateNewMod() + private void LoadMods() { - I18nHelper.Current = new(); + var dic = Directory.CreateDirectory(ModMakerInfo.BaseDirectory); + foreach (var modDic in dic.EnumerateDirectories()) + { + var mod = new ModLoader(modDic); + if (mod.SuccessLoad is false) + continue; + var modModel = new ModInfoModel(mod); + Mods.Add(modModel); + if (mod.OtherI18nDatas.Count == 0) + continue; + } + } + + private void ModFilterText_ValueChanged(string value) + { + if (string.IsNullOrEmpty(value)) + ShowMods = Mods; + else + ShowMods = new(Mods.Where(i => i.Id.Value.Contains(value))); + } + + public void CreateNewMod() + { + // I18nHelper.Current = new(); ModEditWindow = new(); ModEditWindow.Show(); ModMakerWindow.Hide(); diff --git a/VPet.Plugin.ModMaker/Views/ModEdit/ClickTextEdit/ClickTextEditWindow.xaml.cs b/VPet.Plugin.ModMaker/Views/ModEdit/ClickTextEdit/ClickTextEditWindow.xaml.cs index 970e96a..135ebb9 100644 --- a/VPet.Plugin.ModMaker/Views/ModEdit/ClickTextEdit/ClickTextEditWindow.xaml.cs +++ b/VPet.Plugin.ModMaker/Views/ModEdit/ClickTextEdit/ClickTextEditWindow.xaml.cs @@ -11,6 +11,7 @@ using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; +using VPet.Plugin.ModMaker.Models; using VPet.Plugin.ModMaker.ViewModels.ModEdit.ClickTextEdit; namespace VPet.Plugin.ModMaker.Views.ModEdit.ClickTextEdit; @@ -41,7 +42,11 @@ public partial class ClickTextEditWindow : Window MessageBox.Show("Id不可为空", "", MessageBoxButton.OK, MessageBoxImage.Warning); return; } - if (ViewModel.ClickTexts.Any(i => i.Id.Value == ViewModel.ClickText.Value.Id.Value)) + if ( + ModInfoModel.Current.ClickTexts.Any( + i => i.Id.Value == ViewModel.ClickText.Value.Id.Value + ) + ) { MessageBox.Show("此Id已存在", "", MessageBoxButton.OK, MessageBoxImage.Warning); return; diff --git a/VPet.Plugin.ModMaker/Views/ModEdit/FoodEdit/FoodEditWindow.xaml.cs b/VPet.Plugin.ModMaker/Views/ModEdit/FoodEdit/FoodEditWindow.xaml.cs index 7ca6ec4..c60d166 100644 --- a/VPet.Plugin.ModMaker/Views/ModEdit/FoodEdit/FoodEditWindow.xaml.cs +++ b/VPet.Plugin.ModMaker/Views/ModEdit/FoodEdit/FoodEditWindow.xaml.cs @@ -12,6 +12,7 @@ using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; +using VPet.Plugin.ModMaker.Models; using VPet.Plugin.ModMaker.ViewModels.ModEdit.FoodEdit; using VPet_Simulator.Windows.Interface; @@ -60,7 +61,7 @@ public partial class FoodEditWindow : Window MessageBox.Show("图像不可为空", "", MessageBoxButton.OK, MessageBoxImage.Warning); return; } - if (ViewModel.Foods.Any(i => i.Id.Value == ViewModel.Food.Value.Id.Value)) + if (ModInfoModel.Current.Foods.Any(i => i.Id.Value == ViewModel.Food.Value.Id.Value)) { MessageBox.Show("此Id已存在", "", MessageBoxButton.OK, MessageBoxImage.Warning); return; diff --git a/VPet.Plugin.ModMaker/Views/ModEdit/FoodEdit/FoodPage.xaml b/VPet.Plugin.ModMaker/Views/ModEdit/FoodEdit/FoodPage.xaml index 38147d8..b50fadb 100644 --- a/VPet.Plugin.ModMaker/Views/ModEdit/FoodEdit/FoodPage.xaml +++ b/VPet.Plugin.ModMaker/Views/ModEdit/FoodEdit/FoodPage.xaml @@ -42,7 +42,7 @@ AutoGenerateColumns="False" CanUserAddRows="False" GridLinesVisibility="Horizontal" - ItemsSource="{Binding Foods}" + ItemsSource="{Binding ShowFoods.Value}" MouseDoubleClick="DataGrid_Food_MouseDoubleClick" RowDetailsVisibilityMode="Visible" RowHeight="64" @@ -76,7 +76,7 @@ Height="64" HorizontalAlignment="Center" VerticalAlignment="Center" - Source="{Binding Image.Value, IsAsync=True}" + Source="{Binding Image.Value}" Stretch="Uniform"> @@ -104,7 +104,7 @@ Binding="{Binding Type.Value}" CanUserSort="True" IsReadOnly="True" - SortMemberPath="Type"> + SortMemberPath="Type.Value"> diff --git a/VPet.Plugin.ModMaker/Views/ModEdit/LowTextEdit/LowTextEditWindow.xaml.cs b/VPet.Plugin.ModMaker/Views/ModEdit/LowTextEdit/LowTextEditWindow.xaml.cs index bb622a8..3feb49b 100644 --- a/VPet.Plugin.ModMaker/Views/ModEdit/LowTextEdit/LowTextEditWindow.xaml.cs +++ b/VPet.Plugin.ModMaker/Views/ModEdit/LowTextEdit/LowTextEditWindow.xaml.cs @@ -12,6 +12,7 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using VPet.Plugin.ModMaker.Models; using VPet.Plugin.ModMaker.ViewModels.ModEdit.LowTextEdit; namespace VPet.Plugin.ModMaker.Views.ModEdit.LowTextEdit; @@ -42,7 +43,7 @@ public partial class LowTextEditWindow : Window MessageBox.Show("Id不可为空", "", MessageBoxButton.OK, MessageBoxImage.Warning); return; } - if (ViewModel.LowTexts.Any(i => i.Id.Value == ViewModel.LowText.Value.Id.Value)) + if (ModInfoModel.Current.LowTexts.Any(i => i.Id.Value == ViewModel.LowText.Value.Id.Value)) { MessageBox.Show("此Id已存在", "", MessageBoxButton.OK, MessageBoxImage.Warning); return; diff --git a/VPet.Plugin.ModMaker/Views/ModEdit/ModEditWindow.xaml b/VPet.Plugin.ModMaker/Views/ModEdit/ModEditWindow.xaml index 1f55dee..64de26c 100644 --- a/VPet.Plugin.ModMaker/Views/ModEdit/ModEditWindow.xaml +++ b/VPet.Plugin.ModMaker/Views/ModEdit/ModEditWindow.xaml @@ -48,7 +48,7 @@ - + @@ -130,8 +130,12 @@ x:Name="TextBox_Description" Grid.Row="4" Grid.Column="1" + HorizontalContentAlignment="Left" + VerticalContentAlignment="Top" + d:Text="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" pu:TextBoxHelper.Watermark="模组介绍" - Text="{Binding ModInfo.Value.CurrentI18nData.Value.Description.Value}" /> + Text="{Binding ModInfo.Value.CurrentI18nData.Value.Description.Value}" + TextWrapping="Wrap" /> @@ -216,6 +220,7 @@ +