diff --git a/VPet.ModMaker/Models/ModModel/ModInfoModel.cs b/VPet.ModMaker/Models/ModModel/ModInfoModel.cs index 6510944..bf4fe2f 100644 --- a/VPet.ModMaker/Models/ModModel/ModInfoModel.cs +++ b/VPet.ModMaker/Models/ModModel/ModInfoModel.cs @@ -18,29 +18,95 @@ using VPet_Simulator.Windows.Interface; namespace VPet.ModMaker.Models; +/// +/// 模组信息模型 +/// public class ModInfoModel : I18nModel { + /// + /// 作者Id + /// public long AuthorID { get; } + + /// + /// 项目Id + /// public ulong ItemID { get; } + /// + /// 当前 + /// public static ModInfoModel Current { get; set; } = new(); + /// + /// Id + /// public ObservableValue Id { get; } = new(); + + /// + /// 描述Id + /// public ObservableValue DescriptionId { get; } = new(); + + /// + /// 作者 + /// public ObservableValue Author { get; } = new(); + + /// + /// 支持的游戏版本 + /// public ObservableValue GameVersion { get; } = new(); + + /// + /// 模组版本 + /// public ObservableValue ModVersion { get; } = new(); + + /// + /// 封面 + /// public ObservableValue Image { get; } = new(); + + /// + /// 源路径 + /// public ObservableValue SourcePath { get; } = new(); + /// + /// 食物 + /// public ObservableCollection Foods { get; } = new(); + + /// + /// 点击文本 + /// public ObservableCollection ClickTexts { get; } = new(); + + /// + /// 低状态文本 + /// public ObservableCollection LowTexts { get; } = new(); + + /// + /// 选择文本 + /// public ObservableCollection SelectTexts { get; } = new(); + + /// + /// 宠物 + /// public ObservableCollection Pets { get; } = new(); + /// + /// 其它I18n数据 + /// public Dictionary> OtherI18nDatas { get; } = new(); + /// + /// 需要保存的I18n数据 + /// + private readonly Dictionary> _saveI18nDatas = new(); public ModInfoModel() @@ -93,6 +159,11 @@ public class ModInfoModel : I18nModel } #region Load + /// + /// 加载宠物动画 + /// + /// 模型 + /// 路径 static void LoadAnime(PetModel petModel, string path) { foreach (var animeDir in Directory.EnumerateDirectories(path)) @@ -170,6 +241,9 @@ public class ModInfoModel : I18nModel } } + /// + /// 加载本地化数据 + /// private void LoadI18nData() { foreach (var lang in I18nDatas) @@ -231,12 +305,35 @@ public class ModInfoModel : I18nModel } #endregion #region Save + /// + /// 保存 + /// public void Save() { SaveTo(SourcePath.Value); } + /// + /// 保存至路径 + /// + /// 路径 public void SaveTo(string path) + { + // 保存模型信息 + SaveModInfo(path); + // 保存模组数据 + SavePets(path); + SaveFoods(path); + SaveText(path); + SaveI18nData(path); + SaveImage(path); + } + + /// + /// 保存模型信息 + /// + /// 路径 + private void SaveModInfo(string path) { var modInfoFile = Path.Combine(path, ModMakerInfo.InfoFile); if (File.Exists(modInfoFile) is false) @@ -246,7 +343,6 @@ public class ModInfoModel : I18nModel foreach (var cultureName in I18nHelper.Current.CultureNames) _saveI18nDatas.Add(cultureName, new()); - //var lps = new LpsDocument(File.ReadAllText(modInfoFile)); var lps = new LPS() { new Line("vupmod", Id.Value) @@ -272,13 +368,13 @@ public class ModInfoModel : I18nModel } Image.Value?.SaveToPng(Path.Combine(path, "icon.png")); File.WriteAllText(modInfoFile, lps.ToString()); - SavePets(path); - SaveFoods(path); - SaveText(path); - SaveLang(path); - SaveImage(path); } + #region SavePet + /// + /// 保存宠物 + /// + /// 路径 private void SavePets(string path) { var petPath = Path.Combine(path, "pet"); @@ -310,9 +406,9 @@ public class ModInfoModel : I18nModel if (File.Exists(petFile) is false) File.Create(petFile).Close(); var lps = new LPS(); - GetPetInfo(lps, pet); - GetWorksInfo(lps, pet); - GetMoveInfo(lps, pet); + SavePetInfo(lps, pet); + SaveWorksInfo(lps, pet); + SaveMoveInfo(lps, pet); File.WriteAllText(petFile, lps.ToString()); var petAnimePath = Path.Combine(petPath, pet.Id.Value); @@ -321,7 +417,12 @@ public class ModInfoModel : I18nModel } } - void GetMoveInfo(LPS lps, PetModel pet) + /// + /// 保存移动信息 + /// + /// + /// + void SaveMoveInfo(LPS lps, PetModel pet) { foreach (var move in pet.Moves) { @@ -329,7 +430,12 @@ public class ModInfoModel : I18nModel } } - void GetWorksInfo(LPS lps, PetModel pet) + /// + /// 保存工作信息 + /// + /// + /// + void SaveWorksInfo(LPS lps, PetModel pet) { foreach (var work in pet.Works) { @@ -344,7 +450,12 @@ public class ModInfoModel : I18nModel } } - private void GetPetInfo(LPS lps, PetModel pet) + /// + /// 保存宠物信息 + /// + /// + /// + private void SavePetInfo(LPS lps, PetModel pet) { lps.Add( new Line("pet", pet.Id.Value) @@ -410,7 +521,11 @@ public class ModInfoModel : I18nModel } ); } - + #endregion + /// + /// 保存食物 + /// + /// 路径 private void SaveFoods(string path) { var foodPath = Path.Combine(path, "food"); @@ -443,6 +558,11 @@ public class ModInfoModel : I18nModel File.WriteAllText(foodFile, lps.ToString()); } + #region SaveText + /// + /// 保存文本 + /// + /// 路径 private void SaveText(string path) { var textPath = Path.Combine(path, "text"); @@ -458,6 +578,10 @@ public class ModInfoModel : I18nModel SaveSelectText(textPath); } + /// + /// 保存选择文本 + /// + /// 路径 private void SaveSelectText(string textPath) { if (SelectTexts.Count == 0) @@ -483,6 +607,10 @@ public class ModInfoModel : I18nModel File.WriteAllText(textFile, lps.ToString()); } + /// + /// 保存低状态文本 + /// + /// 路径 private void SaveLowText(string textPath) { if (LowTexts.Count == 0) @@ -504,6 +632,10 @@ public class ModInfoModel : I18nModel File.WriteAllText(textFile, lps.ToString()); } + /// + /// 保存点击文本 + /// + /// 路径 private void SaveClickText(string textPath) { if (ClickTexts.Count == 0) @@ -524,8 +656,12 @@ public class ModInfoModel : I18nModel } File.WriteAllText(textFile, lps.ToString()); } - - private void SaveLang(string path) + #endregion + /// + /// 保存I18n数据 + /// + /// 路径 + private void SaveI18nData(string path) { var langPath = Path.Combine(path, "lang"); Directory.CreateDirectory(langPath); @@ -542,6 +678,10 @@ public class ModInfoModel : I18nModel } } + /// + /// 保存突破 + /// + /// 路径 private void SaveImage(string path) { var imagePath = Path.Combine(path, "image"); @@ -562,8 +702,6 @@ public class ModInfoModel : I18nModel Image.Value.CloseStream(); foreach (var food in Foods) food.Close(); - //foreach (var pet in Pets) - // pet.Close(); } } diff --git a/VPet.ModMaker/Models/ModModel/MoveModel.cs b/VPet.ModMaker/Models/ModModel/MoveModel.cs index c204b66..d1da15e 100644 --- a/VPet.ModMaker/Models/ModModel/MoveModel.cs +++ b/VPet.ModMaker/Models/ModModel/MoveModel.cs @@ -9,38 +9,112 @@ using VPet_Simulator.Core; namespace VPet.ModMaker.Models; +/// +/// 移动模型 +/// public class MoveModel { + /// + /// 移动类型 + /// public static ObservableCollection DirectionTypes { get; } = new( Enum.GetValues(typeof(GraphHelper.Move.DirectionType)) .Cast() ); + /// + /// 模式类型 + /// public static ObservableCollection ModeTypes { get; } = new(Enum.GetValues(typeof(GraphHelper.Move.ModeType)).Cast()); //public ObservableValue Id { get; } = new(); + /// + /// 指定动画 + /// public ObservableValue Graph { get; } = new(); + + /// + /// 移动距离 + /// public ObservableValue Distance { get; } = new(5); + + /// + /// 间隔 + /// public ObservableValue Interval { get; } = new(125); + + /// + /// 定位长度 + /// public ObservableValue LocateLength { get; } = new(); + + /// + /// X速度 + /// public ObservableValue SpeedX { get; } = new(); + + /// + /// Y速度 + /// public ObservableValue SpeedY { get; } = new(); + + /// + /// 左侧检测距离 + /// public ObservableValue CheckLeft { get; } = new(100); + + /// + /// 右侧检测距离 + /// public ObservableValue CheckRight { get; } = new(100); + + /// + /// 上方检测距离 + /// public ObservableValue CheckTop { get; } = new(100); + + /// + /// 下方检测距离 + /// public ObservableValue CheckBottom { get; } = new(100); + + /// + /// 左侧触发距离 + /// public ObservableValue TriggerLeft { get; } = new(100); + + /// + /// 右侧触发距离 + /// public ObservableValue TriggerRight { get; } = new(100); + + /// + /// 上方触发距离 + /// public ObservableValue TriggerTop { get; } = new(100); + + /// + /// 下方触发距离 + /// public ObservableValue TriggerBottom { get; } = new(100); + /// + /// 定位类型 + /// public ObservableEnumFlags LocateType { get; } = new(GraphHelper.Move.DirectionType.None); + + /// + /// 触发类型 + /// public ObservableEnumFlags TriggerType { get; } = new(GraphHelper.Move.DirectionType.None); + /// + /// 模式 + /// public ObservableEnumFlags ModeType { get; } = new(GraphHelper.Move.ModeType.Nomal); diff --git a/VPet.ModMaker/Models/ModModel/PetModel.cs b/VPet.ModMaker/Models/ModModel/PetModel.cs index 237d4a5..fde38f8 100644 --- a/VPet.ModMaker/Models/ModModel/PetModel.cs +++ b/VPet.ModMaker/Models/ModModel/PetModel.cs @@ -12,13 +12,35 @@ using VPet_Simulator.Core; namespace VPet.ModMaker.Models; +/// +/// 宠物模型 +/// public class PetModel : I18nModel { + /// + /// Id + /// public ObservableValue Id { get; } = new(); + + /// + /// 宠物名称Id + /// public ObservableValue PetNameId { get; } = new(); + + /// + /// 描述Id + /// public ObservableValue DescriptionId { get; } = new(); + + /// + /// 头部点击区域 + /// public ObservableValue> TouchHeadRect { get; } = new(new(159, 16, 189, 178)); + + /// + /// 提起区域 + /// public ObservableValue TouchRaisedRect { get; } = new( new( @@ -28,13 +50,26 @@ public class PetModel : I18nModel new(0, 200, 500, 300) ) ); + + /// + /// 提起定位 + /// public ObservableValue RaisePoint { get; } = new(new(new(290, 128), new(290, 128), new(290, 128), new(225, 115))); + /// + /// 工作 + /// public ObservableCollection Works { get; } = new(); + /// + /// 移动 + /// public ObservableCollection Moves { get; } = new(); + /// + /// 动画 + /// public ObservableCollection Animes { get; } = new(); public PetModel() diff --git a/VPet.ModMaker/Models/ModModel/SelectTextModel.cs b/VPet.ModMaker/Models/ModModel/SelectTextModel.cs index 8ba4436..7b2b617 100644 --- a/VPet.ModMaker/Models/ModModel/SelectTextModel.cs +++ b/VPet.ModMaker/Models/ModModel/SelectTextModel.cs @@ -10,37 +10,79 @@ using VPet_Simulator.Windows.Interface; namespace VPet.ModMaker.Models; +/// +/// 选择文本模型 +/// public class SelectTextModel : I18nModel { + /// + /// 模式类型 + /// public static ObservableCollection ModeTypes => ClickTextModel.ModeTypes; - //public ObservableValue Exp { get; } = new(); - //public ObservableValue Money { 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 Tags { get; } = new(); + + /// + /// 跳转标签 + /// public ObservableValue ToTags { get; } = new(); + /// + /// Id + /// public ObservableValue Id { get; } = new(); + + /// + /// 选择Id + /// public ObservableValue ChooseId { get; } = new(); + + /// + /// 模式 + /// public ObservableEnumFlags Mode { get; } = new(); - //public ObservableValue Working { get; } = new(); - //public ObservableValue WorkingState { get; } = new(); - //public ObservableValue 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 SelectTextModel() @@ -59,9 +101,6 @@ public class SelectTextModel : I18nModel Mode.EnumValue.Value = model.Mode.EnumValue.Value; Tags.Value = model.Tags.Value; ToTags.Value = model.ToTags.Value; - //Working.EnumValue = model.Working.EnumValue; - //WorkingState.EnumValue = model.WorkingState.EnumValue; - //DayTime.EnumValue = model.DayTime.EnumValue; Like = model.Like.Copy(); Health = model.Health.Copy(); Level = model.Level.Copy(); @@ -84,9 +123,6 @@ public class SelectTextModel : I18nModel Mode.EnumValue.Value = text.Mode; Tags.Value = text.Tags is null ? string.Empty : string.Join(", ", text.Tags); ToTags.Value = text.ToTags is null ? string.Empty : string.Join(", ", text.ToTags); - //Working.EnumValue = text.Working; - //WorkingState.EnumValue = text.State; - //DayTime.EnumValue = text.DaiTime; Like.SetValue(text.LikeMin, text.LikeMax); Health.SetValue(text.HealthMin, text.HealthMax); Level.SetValue(text.LevelMin, text.LevelMax); @@ -108,9 +144,6 @@ public class SelectTextModel : I18nModel Mode = Mode.EnumValue.Value, Tags = new(Tags.Value.Split(rs_splitChar, StringSplitOptions.RemoveEmptyEntries)), ToTags = new(ToTags.Value.Split(rs_splitChar, StringSplitOptions.RemoveEmptyEntries)), - //Working = Working.EnumValue, - //State = WorkingState.EnumValue, - //DaiTime = DayTime.EnumValue, LikeMax = Like.Max.Value, LikeMin = Like.Min.Value, HealthMin = Health.Min.Value, diff --git a/VPet.ModMaker/Models/ModModel/WorkModel.cs b/VPet.ModMaker/Models/ModModel/WorkModel.cs index 3e000de..7b62a4e 100644 --- a/VPet.ModMaker/Models/ModModel/WorkModel.cs +++ b/VPet.ModMaker/Models/ModModel/WorkModel.cs @@ -9,43 +9,124 @@ using System.Windows.Media; namespace VPet.ModMaker.Models; +/// +/// 工作模型 +/// public class WorkModel : I18nModel { + /// + /// 工作类型 + /// public static ObservableCollection WorkTypes { get; } = new( Enum.GetValues(typeof(VPet_Simulator.Core.GraphHelper.Work.WorkType)) .Cast() ); + /// + /// Id + /// + public ObservableValue Id { get; } = new(); + + /// + /// 指定动画 + /// + public ObservableValue Graph { get; } = new(); + + /// + /// 收获倍率 + /// + public ObservableValue MoneyLevel { get; } = new(); + + /// + /// 收获基础 + /// + public ObservableValue MoneyBase { get; } = new(); + + /// + /// 饱食度消耗 + /// + public ObservableValue StrengthFood { get; } = new(); + + /// + /// 口渴度消耗 + /// + public ObservableValue StrengthDrink { get; } = new(); + + /// + /// 心情消耗 + /// + public ObservableValue Feeling { get; } = new(); + + /// + /// 等级倍率 + /// + public ObservableValue LevelLimit { get; } = new(); + + /// + /// 时间 + /// + public ObservableValue Time { get; } = new(); + + /// + /// 完成奖励倍率 + /// + public ObservableValue FinishBonus { get; } = new(); + + /// + /// 是否超模 + /// + public ObservableValue IsOverLoad { get; } = new(); + + /// + /// 类型 + /// public ObservableValue WorkType { get; } = new(VPet_Simulator.Core.GraphHelper.Work.WorkType.Work); - public ObservableValue Id { get; } = new(); - - public ObservableValue Graph { get; } = new(); - public ObservableValue MoneyLevel { get; } = new(); - public ObservableValue MoneyBase { get; } = new(); - public ObservableValue StrengthFood { get; } = new(); - public ObservableValue StrengthDrink { get; } = new(); - public ObservableValue Feeling { get; } = new(); - public ObservableValue LevelLimit { get; } = new(); - public ObservableValue Time { get; } = new(); - public ObservableValue FinishBonus { get; } = new(); - public ObservableValue IsOverLoad { get; } = new(); - + /// + /// 边框颜色 + /// public ObservableValue BorderBrush { get; } = new(new((Color)ColorConverter.ConvertFromString("#FF0290D5"))); + + /// + /// 背景色 + /// public ObservableValue Background { get; } = - new(new((Color)ColorConverter.ConvertFromString("#FF81d4fa"))); + new(new((Color)ColorConverter.ConvertFromString("#FF81D4FA"))); + + /// + /// 前景色 + /// public ObservableValue Foreground { get; } = new(new((Color)ColorConverter.ConvertFromString("#FF0286C6"))); + + /// + /// 按钮背景色 + /// public ObservableValue ButtonBackground { get; } = new(new((Color)ColorConverter.ConvertFromString("#AA0286C6"))); - public ObservableValue ButtonForeground { get; } = - new(new((Color)ColorConverter.ConvertFromString("#FFffffff"))); + /// + /// 按钮前景色 + /// + public ObservableValue ButtonForeground { get; } = + new(new((Color)ColorConverter.ConvertFromString("#FFFFFFFF"))); + + /// + /// X位置 + /// public ObservableValue Left { get; } = new(100); + + /// + /// Y位置 + /// public ObservableValue Top { get; } = new(160); + + /// + /// 宽度 + /// public ObservableValue Width { get; } = new(300); public WorkModel()