From 55739b62586d5db4986590791b8023b2a735b3a6 Mon Sep 17 00:00:00 2001 From: Hakoyu Date: Mon, 11 Dec 2023 02:30:13 +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 | 6 +++--- VPet.ModMaker/Models/ModModel/PetModel.cs | 8 +++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/VPet.ModMaker/Models/ModModel/ModInfoModel.cs b/VPet.ModMaker/Models/ModModel/ModInfoModel.cs index ca3b32a..9b4efc5 100644 --- a/VPet.ModMaker/Models/ModModel/ModInfoModel.cs +++ b/VPet.ModMaker/Models/ModModel/ModInfoModel.cs @@ -149,11 +149,10 @@ public class ModInfoModel : I18nModel { var petModel = new PetModel(pet); Pets.Add(petModel); - ModMakerInfo.MainPets.Add(petModel.Id.Value, new(pet, true)); foreach (var p in pet.path) LoadAnime(petModel, p); } - Pets.Clear(); + // 插入本体宠物 foreach (var pet in ModMakerInfo.MainPets) { @@ -402,7 +401,8 @@ public class ModInfoModel : I18nModel Directory.CreateDirectory(petPath); foreach (var pet in Pets) { - pet.Save(petPath); + if (pet.CanSave()) + pet.Save(petPath); } // 如果没有一个完成保存, 则删除文件夹 if (Directory.EnumerateFiles(petPath).Any() is false) diff --git a/VPet.ModMaker/Models/ModModel/PetModel.cs b/VPet.ModMaker/Models/ModModel/PetModel.cs index b562eab..fd0092a 100644 --- a/VPet.ModMaker/Models/ModModel/PetModel.cs +++ b/VPet.ModMaker/Models/ModModel/PetModel.cs @@ -208,7 +208,13 @@ public class PetModel : I18nModel /// public bool CanSave() { - if (FromMain.Value && Works.Count == 0 && Animes.Count == 0 && FoodAnimes.Count == 0) + if ( + FromMain.Value + && Works.Count == 0 + && Moves.Count == 0 + && Animes.Count == 0 + && FoodAnimes.Count == 0 + ) return false; return true; }