From 530f32e3f6590dc6432f907215c907a699f1b0ed Mon Sep 17 00:00:00 2001 From: Hakoyu Date: Sat, 7 Oct 2023 21:59:37 +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/AnimeModel.cs | 19 +++ .../Models/ModModel/AnimeTypeModel.cs | 125 +++++++++++++++--- .../Models/ModModel/ClickTextModel.cs | 64 +++++++++ VPet.ModMaker/Models/ModModel/FoodModel.cs | 57 ++++++++ VPet.ModMaker/Models/ModModel/ImageModel.cs | 10 ++ VPet.ModMaker/Models/ModModel/LowTextModel.cs | 29 ++++ VPet.ModMaker/Models/Utils.cs | 2 +- 7 files changed, 283 insertions(+), 23 deletions(-) diff --git a/VPet.ModMaker/Models/ModModel/AnimeModel.cs b/VPet.ModMaker/Models/ModModel/AnimeModel.cs index 3ddec24..d97ee2a 100644 --- a/VPet.ModMaker/Models/ModModel/AnimeModel.cs +++ b/VPet.ModMaker/Models/ModModel/AnimeModel.cs @@ -6,12 +6,24 @@ using VPet_Simulator.Core; namespace VPet.ModMaker.Models.ModModel; +/// +/// 动画模型 +/// public class AnimeModel { + /// + /// Id + /// public ObservableValue Id { get; } = new(); + /// + /// 动画类型 + /// public ObservableValue AnimeType { get; } = new(); + /// + /// 图像列表 + /// public ObservableCollection Images { get; } = new(); public AnimeModel() { } @@ -31,6 +43,10 @@ public class AnimeModel } } + /// + /// 复制 + /// + /// public AnimeModel Copy() { var model = new AnimeModel(); @@ -41,6 +57,9 @@ public class AnimeModel return model; } + /// + /// 关闭所有图像流 + /// public void Close() { foreach (var image in Images) diff --git a/VPet.ModMaker/Models/ModModel/AnimeTypeModel.cs b/VPet.ModMaker/Models/ModModel/AnimeTypeModel.cs index 6dfab88..3ccbc2e 100644 --- a/VPet.ModMaker/Models/ModModel/AnimeTypeModel.cs +++ b/VPet.ModMaker/Models/ModModel/AnimeTypeModel.cs @@ -14,13 +14,27 @@ namespace VPet.ModMaker.Models.ModModel; public class AnimeTypeModel { + /// + /// 动作类型 + /// public static ObservableCollection GraphTypes { get; } = new(Enum.GetValues(typeof(GraphInfo.GraphType)).Cast()); + + /// + /// 动画类型 + /// public static ObservableCollection AnimatTypes { get; } = new(Enum.GetValues(typeof(GraphInfo.AnimatType)).Cast()); + + /// + /// 模式类型 + /// public static ObservableCollection ModeTypes { get; } = new(Enum.GetValues(typeof(GameSave.ModeType)).Cast()); + /// + /// 含有名称的动作列表 + /// public static HashSet HasNameAnimes { get; } = new() { @@ -31,6 +45,9 @@ public class AnimeTypeModel GraphInfo.GraphType.Say }; + /// + /// 含有不同动画类型的动作列表 + /// public static HashSet HasMultiTypeAnimes { get; } = new() { @@ -47,14 +64,39 @@ public class AnimeTypeModel GraphInfo.GraphType.Say }; + /// + /// Id + /// public ObservableValue Id { get; } = new(); + /// + /// 名称 + /// public ObservableValue Name { get; } = new(); + + /// + /// 动作类型 + /// public ObservableValue GraphType { get; } = new(); + /// + /// 开心动画 + /// public ObservableCollection HappyAnimes { get; } = new(); + + /// + /// 普通动画 (默认) + /// public ObservableCollection NomalAnimes { get; } = new(); + + /// + /// 低状态动画 + /// public ObservableCollection PoorConditionAnimes { get; } = new(); + + /// + /// 生病动画 + /// public ObservableCollection IllAnimes { get; } = new(); public AnimeTypeModel() @@ -81,6 +123,12 @@ public class AnimeTypeModel IllAnimes.Add(anime.Copy()); } + /// + /// 创建动画类型模型 + /// + /// 动作类型 + /// 路径 + /// public static AnimeTypeModel? Create(GraphInfo.GraphType graphType, string path) { try @@ -132,6 +180,10 @@ public class AnimeTypeModel } #region Load + /// + /// 默认载入方式 (只有一个动画类型 ) + /// + /// 路径 private void LoadDefault(string path) { foreach (var dir in Directory.EnumerateDirectories(path)) @@ -180,6 +232,10 @@ public class AnimeTypeModel } } + /// + /// 有多个动画类型的载入方式 + /// + /// 路径 private void LoadMultiType(string path) { foreach (var dir in Directory.EnumerateDirectories(path)) @@ -242,6 +298,12 @@ public class AnimeTypeModel } } + /// + /// 添加动画到不同模式 + /// + /// 路径 + /// 模式类型 + /// 动画类型 private void AddAnimeForModeType( string path, GameSave.ModeType modeType, @@ -277,6 +339,12 @@ public class AnimeTypeModel }; } + /// + /// 添加动画至动画列表 + /// + /// 动画列表 + /// 路径 + /// 动画类型 private static void AddAnime( ObservableCollection collection, string path, @@ -285,12 +353,14 @@ public class AnimeTypeModel { if (Directory.EnumerateFiles(path).Any()) { + // 如果没有文件夹 则载入全部文件 var animeModel = new AnimeModel(path); animeModel.AnimeType.Value = animatType; collection.Add(animeModel); } else { + // 否则遍历文件夹 foreach (var imagesDir in Directory.EnumerateDirectories(path)) { var animeModel = new AnimeModel(imagesDir); @@ -301,6 +371,10 @@ public class AnimeTypeModel } #endregion #region Save + /// + /// 保存至指定路径 + /// + /// 路径 public void Save(string path) { if ( @@ -330,7 +404,7 @@ public class AnimeTypeModel is GraphInfo.GraphType.Raised_Dynamic or GraphInfo.GraphType.Raised_Static ) - SaveRaise(path, this); + SaveRaised(path, this); else if (GraphType.Value is GraphInfo.GraphType.StateONE or GraphInfo.GraphType.StateTWO) SaveState(path, this); else if (GraphType.Value is GraphInfo.GraphType.Common) @@ -339,6 +413,11 @@ public class AnimeTypeModel SaveHasNameAnime(path, this); } + /// + /// 保存为带有名称的动画样式 + /// + /// 路径 + /// 动画模型 void SaveHasNameAnime(string path, AnimeTypeModel animeTypeModel) { var animeTypePath = Path.Combine(path, animeTypeModel.GraphType.Value.ToString()); @@ -348,6 +427,11 @@ public class AnimeTypeModel SaveWithModeType(animePath, animeTypeModel); } + /// + /// 保存为通用样式 + /// + /// 路径 + /// 模型 void SaveCommon(string path, AnimeTypeModel animeTypeModel) { var animePath = Path.Combine(path, animeTypeModel.Name.Value); @@ -355,6 +439,11 @@ public class AnimeTypeModel SaveWithModeType(animePath, animeTypeModel); } + /// + /// 保存为 样式 + /// + /// 路径 + /// 模型 void SaveState(string path, AnimeTypeModel animeTypeModel) { var animePath = Path.Combine(path, "State"); @@ -362,7 +451,12 @@ public class AnimeTypeModel SaveMultiType(animePath, animeTypeModel); } - void SaveRaise(string path, AnimeTypeModel animeTypeModel) + /// + /// 保存为 样式 + /// + /// 路径 + /// 模型 + void SaveRaised(string path, AnimeTypeModel animeTypeModel) { var animePath = Path.Combine(path, "Raise"); Directory.CreateDirectory(animePath); @@ -372,6 +466,11 @@ public class AnimeTypeModel SaveMultiType(animePath, animeTypeModel); } + /// + /// 保存为 + /// + /// 路径 + /// 模型 void SaveSwitch(string path, AnimeTypeModel animeTypeModel) { var animePath = Path.Combine(path, "Switch"); @@ -405,17 +504,7 @@ public class AnimeTypeModel } /// - /// 保存为 ModeType 划分的样式 - /// - /// + /// 保存为 Happy/A/0 的路径样式 /// /// /// @@ -476,15 +565,7 @@ public class AnimeTypeModel } /// - /// 保存为 AnimeType 划分的样式 - /// - /// + /// 保存为 Happy/0 的路径样式 /// /// /// diff --git a/VPet.ModMaker/Models/ModModel/ClickTextModel.cs b/VPet.ModMaker/Models/ModModel/ClickTextModel.cs index ad571e0..4803a7f 100644 --- a/VPet.ModMaker/Models/ModModel/ClickTextModel.cs +++ b/VPet.ModMaker/Models/ModModel/ClickTextModel.cs @@ -10,31 +10,95 @@ using VPet_Simulator.Windows.Interface; namespace VPet.ModMaker.Models; +/// +/// 点击文本模型 +/// public class ClickTextModel : I18nModel { + /// + /// 模式类型 + /// public static ObservableCollection ModeTypes { get; } = new(Enum.GetValues(typeof(ClickText.ModeType)).Cast()); + + /// + /// 日期区间 + /// public static ObservableCollection DayTimes { get; } = new(Enum.GetValues(typeof(ClickText.DayTime)).Cast()); + + /// + /// 工作状态 + /// public static ObservableCollection WorkingStates { get; } = new( Enum.GetValues(typeof(VPet_Simulator.Core.Main.WorkingState)) .Cast() ); + /// + /// Id + /// public ObservableValue Id { get; } = new(); + + /// + /// 指定工作 + /// public ObservableValue Working { get; } = new(); + + /// + /// 模式 + /// public ObservableEnumFlags Mode { get; } = new(); + + /// + /// 工作状态 + /// public ObservableValue WorkingState { get; } = new(); + + /// + /// 日期区间 + /// public ObservableEnumFlags DayTime { get; } = new(); + /// + /// 好感度 + /// public ObservableRange Like { get; } = new(0, int.MaxValue); + + /// + /// 健康值 + /// public ObservableRange Health { get; } = new(0, int.MaxValue); + + /// + /// 等级 + /// public ObservableRange Level { get; } = new(0, int.MaxValue); + + /// + /// 金钱 + /// public ObservableRange Money { get; } = new(int.MinValue, int.MaxValue); + + /// + /// 饱食度 + /// public ObservableRange Food { get; } = new(0, int.MaxValue); + + /// + /// 口渴度 + /// public ObservableRange Drink { get; } = new(0, int.MaxValue); + + /// + /// 心情 + /// public ObservableRange Feel { get; } = new(0, int.MaxValue); + + /// + /// 体力 + /// public ObservableRange Strength { get; } = new(0, int.MaxValue); public ClickTextModel() { } diff --git a/VPet.ModMaker/Models/ModModel/FoodModel.cs b/VPet.ModMaker/Models/ModModel/FoodModel.cs index a25af85..f2f4e1f 100644 --- a/VPet.ModMaker/Models/ModModel/FoodModel.cs +++ b/VPet.ModMaker/Models/ModModel/FoodModel.cs @@ -11,23 +11,80 @@ using VPet_Simulator.Windows.Interface; namespace VPet.ModMaker.Models; +/// +/// 食物模型 +/// public class FoodModel : I18nModel { + /// + /// 食物类型 + /// public static ObservableCollection FoodTypes { get; } = new(Enum.GetValues(typeof(Food.FoodType)).Cast()); + /// + /// Id + /// public ObservableValue Id { get; } = new(); + + /// + /// 详情Id + /// public ObservableValue DescriptionId { get; } = new(); + + /// + /// 指定动画 + /// public ObservableValue Graph { get; } = new("eat"); + + /// + /// 类型 + /// public ObservableValue Type { get; } = new(); + + /// + /// 体力 + /// public ObservableValue Strength { get; } = new(); + + /// + /// 饱食度 + /// public ObservableValue StrengthFood { get; } = new(); + + /// + /// 口渴度 + /// public ObservableValue StrengthDrink { get; } = new(); + + /// + /// 心情 + /// public ObservableValue Feeling { get; } = new(); + + /// + /// 健康度 + /// public ObservableValue Health { get; } = new(); + + /// + /// 好感度 + /// public ObservableValue Likability { get; } = new(); + + /// + /// 价格 + /// public ObservableValue Price { get; } = new(); + + /// + /// 经验 + /// public ObservableValue Exp { get; } = new(); + + /// + /// 图片 + /// public ObservableValue Image { get; } = new(); public FoodModel() diff --git a/VPet.ModMaker/Models/ModModel/ImageModel.cs b/VPet.ModMaker/Models/ModModel/ImageModel.cs index 507fba0..1dd8d64 100644 --- a/VPet.ModMaker/Models/ModModel/ImageModel.cs +++ b/VPet.ModMaker/Models/ModModel/ImageModel.cs @@ -8,9 +8,19 @@ using System.Windows.Media.Imaging; namespace VPet.ModMaker.Models.ModModel; +/// +/// 图像模型 +/// public class ImageModel { + /// + /// 图像 + /// public ObservableValue Image { get; } = new(); + + /// + /// 持续时间 + /// public ObservableValue Duration { get; } = new(100); public ImageModel(BitmapImage image, int duration = 100) diff --git a/VPet.ModMaker/Models/ModModel/LowTextModel.cs b/VPet.ModMaker/Models/ModModel/LowTextModel.cs index f72e344..e54d306 100644 --- a/VPet.ModMaker/Models/ModModel/LowTextModel.cs +++ b/VPet.ModMaker/Models/ModModel/LowTextModel.cs @@ -10,18 +10,47 @@ using VPet_Simulator.Windows.Interface; namespace VPet.ModMaker.Models; +/// +/// 低状态文本 +/// public class LowTextModel : I18nModel { + /// + /// 状态类型 + /// public static ObservableCollection ModeTypes { get; } = new(Enum.GetValues(typeof(LowText.ModeType)).Cast()); + + /// + /// 好感度类型 + /// public static ObservableCollection LikeTypes { get; } = new(Enum.GetValues(typeof(LowText.LikeType)).Cast()); + + /// + /// 体力类型 + /// public static ObservableCollection StrengthTypes { get; } = new(Enum.GetValues(typeof(LowText.StrengthType)).Cast()); + /// + /// Id + /// public ObservableValue Id { get; } = new(); + + /// + /// 状态 + /// public ObservableValue Mode { get; } = new(); + + /// + /// 体力 + /// public ObservableValue Strength { get; } = new(); + + /// + /// 好感度 + /// public ObservableValue Like { get; } = new(); public LowTextModel() { } diff --git a/VPet.ModMaker/Models/Utils.cs b/VPet.ModMaker/Models/Utils.cs index 73d8533..b84cea2 100644 --- a/VPet.ModMaker/Models/Utils.cs +++ b/VPet.ModMaker/Models/Utils.cs @@ -20,7 +20,7 @@ public static class Utils public const int DecodePixelWidth = 250; /// - /// 节码像素高度 + /// 解码像素高度 /// public const int DecodePixelHeight = 250; public static char[] Separator { get; } = new char[] { '_' };