diff --git a/VPet.ModMaker/Models/ModModel/ModInfoModel.cs b/VPet.ModMaker/Models/ModModel/ModInfoModel.cs index 7da2dfa..2b1c6f2 100644 --- a/VPet.ModMaker/Models/ModModel/ModInfoModel.cs +++ b/VPet.ModMaker/Models/ModModel/ModInfoModel.cs @@ -48,13 +48,23 @@ public class ModInfoModel : I18nModel var imagePath = Path.Combine(loader.ModPath.FullName, "icon.png"); if (File.Exists(imagePath)) Image = NativeUtils.LoadImageToMemoryStream(imagePath); - foreach (var food in loader.Foods) + foreach (var food in loader.Foods.Where(m => string.IsNullOrWhiteSpace(m.Name) is false)) Foods.Add(new(food)); - foreach (var clickText in loader.ClickTexts) + foreach ( + var clickText in loader.ClickTexts.Where(m => + string.IsNullOrWhiteSpace(m.Text) is false + ) + ) ClickTexts.Add(new(clickText)); - foreach (var lowText in loader.LowTexts) + foreach ( + var lowText in loader.LowTexts.Where(m => string.IsNullOrWhiteSpace(m.Text) is false) + ) LowTexts.Add(new(lowText)); - foreach (var selectText in loader.SelectTexts) + foreach ( + var selectText in loader.SelectTexts.Where(m => + string.IsNullOrWhiteSpace(m.Text) is false + ) + ) SelectTexts.Add(new(selectText)); // 载入模组宠物 diff --git a/VPet.ModMaker/Models/ModModel/ModUpdataHelper.cs b/VPet.ModMaker/Models/ModModel/ModUpdataHelper.cs index d54871c..c101fef 100644 --- a/VPet.ModMaker/Models/ModModel/ModUpdataHelper.cs +++ b/VPet.ModMaker/Models/ModModel/ModUpdataHelper.cs @@ -57,7 +57,11 @@ public static class ModUpdataHelper { MessageBox.Show( ModEditWindow.Current, - "模组更新失败\n当前版本: {0}\n目标版本: {1}\n{2}".Translate(mod.ModVersion, action.Key, ex) + "模组更新失败\n当前支持的游戏版本: {0}\n目标支持的游戏版本: {1}\n{2}".Translate( + mod.ModVersion, + action.Key, + ex + ) ); return false; } @@ -68,11 +72,11 @@ public static class ModUpdataHelper public static SortedDictionary> UpdataAction { get; } = new() { - [11000] = (ModInfoModel m) => + [11000] = (m) => { - // 修改宠物默认ID foreach (var pet in m.Pets) { + // 修改宠物默认ID if (pet.ID == "默认虚拟桌宠") pet.ID = "vup"; foreach (var work in pet.Works) diff --git a/VPet.ModMaker/ViewModels/ModEdit/AnimeEdit/AnimePageVM.cs b/VPet.ModMaker/ViewModels/ModEdit/AnimeEdit/AnimePageVM.cs index b35c070..f124e08 100644 --- a/VPet.ModMaker/ViewModels/ModEdit/AnimeEdit/AnimePageVM.cs +++ b/VPet.ModMaker/ViewModels/ModEdit/AnimeEdit/AnimePageVM.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; +using HKW.HKWUtils.Extensions; using HKW.HKWUtils.Observable; using LinePutScript.Localization.WPF; using Panuon.WPF.UI; @@ -37,8 +38,12 @@ public class AnimePageVM : ObservableObjectX }, FilteredList = new() }; - CurrentPet = Pets.First(); PropertyChangedX += AnimePageVM_PropertyChangedX; + if (Pets.HasValue()) + CurrentPet = Pets.FirstOrDefault( + m => m.FromMain is false && m.AnimeCount > 0, + Pets.First() + ); AddCommand.ExecuteCommand += AddCommand_ExecuteCommand; EditCommand.ExecuteCommand += EditCommand_ExecuteCommand; diff --git a/VPet.ModMaker/ViewModels/ModEdit/MoveEdit/MovePageVM.cs b/VPet.ModMaker/ViewModels/ModEdit/MoveEdit/MovePageVM.cs index fc025d8..a898984 100644 --- a/VPet.ModMaker/ViewModels/ModEdit/MoveEdit/MovePageVM.cs +++ b/VPet.ModMaker/ViewModels/ModEdit/MoveEdit/MovePageVM.cs @@ -24,8 +24,12 @@ public class MovePageVM : ObservableObjectX Filter = f => f.Graph.Contains(Search, StringComparison.OrdinalIgnoreCase), FilteredList = new() }; - CurrentPet = Pets.First(); PropertyChanged += MovePageVM_PropertyChanged; + if (Pets.HasValue()) + CurrentPet = Pets.FirstOrDefault( + m => m.FromMain is false && m.Moves.HasValue(), + Pets.First() + ); AddCommand.ExecuteCommand += AddCommand_ExecuteCommand; EditCommand.ExecuteCommand += EditCommand_ExecuteCommand; RemoveCommand.ExecuteCommand += RemoveCommand_ExecuteCommand; diff --git a/VPet.ModMaker/ViewModels/ModEdit/WorkEdit/WorkPageVM.cs b/VPet.ModMaker/ViewModels/ModEdit/WorkEdit/WorkPageVM.cs index 96f1f92..d1d27ff 100644 --- a/VPet.ModMaker/ViewModels/ModEdit/WorkEdit/WorkPageVM.cs +++ b/VPet.ModMaker/ViewModels/ModEdit/WorkEdit/WorkPageVM.cs @@ -24,8 +24,12 @@ public class WorkPageVM : ObservableObjectX Filter = f => f.ID.Contains(Search, StringComparison.OrdinalIgnoreCase), FilteredList = new() }; - CurrentPet = Pets.First(); PropertyChanged += WorkPageVM_PropertyChanged; + if (Pets.HasValue()) + CurrentPet = Pets.FirstOrDefault( + m => m.FromMain is false && m.Works.HasValue(), + Pets.First() + ); AddCommand.ExecuteCommand += AddCommand_ExecuteCommand; EditCommand.ExecuteCommand += EditCommand_ExecuteCommand; RemoveCommand.ExecuteCommand += RemoveCommand_ExecuteCommand; diff --git a/VPet.ModMaker/Views/ModEdit/AnimeEdit/AnimePage.xaml b/VPet.ModMaker/Views/ModEdit/AnimeEdit/AnimePage.xaml index 0e9dbd7..8dc8b8d 100644 --- a/VPet.ModMaker/Views/ModEdit/AnimeEdit/AnimePage.xaml +++ b/VPet.ModMaker/Views/ModEdit/AnimeEdit/AnimePage.xaml @@ -38,6 +38,7 @@