From 63df5c128d7bb2238c0606a1797fd41d349ec2ab Mon Sep 17 00:00:00 2001 From: Hakoyu Date: Mon, 18 Sep 2023 21:39:28 +0800 Subject: [PATCH] =?UTF-8?q?AnimeEdit=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Converters/StringFormatConverter.cs | 2 +- VPet.ModMaker/Models/ModModel/AnimeModel.cs | 180 ++++++-------- VPet.ModMaker/Models/ModModel/FoodModel.cs | 2 +- VPet.ModMaker/Models/ModModel/ImageModel.cs | 17 +- VPet.ModMaker/Models/ModModel/ModInfoModel.cs | 25 +- VPet.ModMaker/Models/ModModel/PetModel.cs | 3 +- VPet.ModMaker/Models/Utils.cs | 15 +- VPet.ModMaker/VPet.ModMaker.csproj | 7 + .../ModEdit/AnimeEdit/AnimeEditWindowVM.cs | 82 ++++-- .../ModEdit/AnimeEdit/AnimePageVM.cs | 164 ++++++------ .../ModEdit/AnimeEdit/AnimeEditWindow.xaml | 235 ++++++++++++++---- .../ModEdit/AnimeEdit/AnimeEditWindow.xaml.cs | 126 +++++++++- .../Views/ModEdit/AnimeEdit/AnimePage.xaml | 114 +++++++++ .../Views/ModEdit/AnimeEdit/AnimePage.xaml.cs | 39 +++ .../Views/ModEdit/FoodEdit/FoodPage.xaml | 4 +- .../Views/ModEdit/ModEditWindow.xaml | 9 + .../Views/ModEdit/ModEditWindow.xaml.cs | 4 +- 17 files changed, 739 insertions(+), 289 deletions(-) create mode 100644 VPet.ModMaker/Views/ModEdit/AnimeEdit/AnimePage.xaml create mode 100644 VPet.ModMaker/Views/ModEdit/AnimeEdit/AnimePage.xaml.cs diff --git a/VPet.ModMaker/Converters/StringFormatConverter.cs b/VPet.ModMaker/Converters/StringFormatConverter.cs index 599e7d3..9d18fa5 100644 --- a/VPet.ModMaker/Converters/StringFormatConverter.cs +++ b/VPet.ModMaker/Converters/StringFormatConverter.cs @@ -13,7 +13,7 @@ namespace VPet.ModMaker.Converters; /// 示例: /// -/// +/// /// /// /// diff --git a/VPet.ModMaker/Models/ModModel/AnimeModel.cs b/VPet.ModMaker/Models/ModModel/AnimeModel.cs index 7bba9d8..655d6b0 100644 --- a/VPet.ModMaker/Models/ModModel/AnimeModel.cs +++ b/VPet.ModMaker/Models/ModModel/AnimeModel.cs @@ -12,151 +12,117 @@ using static VPet_Simulator.Core.GraphInfo; namespace VPet.ModMaker.Models.ModModel; -public class AnimeModel +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 ObservableValue Id { get; } = new(); - public ObservableValue GraphType { get; } = new(); - public ObservableValue AnimeType { get; } = new(); - public ObservableValue ModeType { get; } = new(); - public ObservableCollection MultiHappyImageModels = new(); - public ObservableCollection MultiNomalImageModels = new(); - public ObservableCollection MultiPoorConditionImageModels = new(); - public ObservableCollection MultiIllImageModels = new(); + public ObservableCollection HappyAnimes { get; } = new(); + public ObservableCollection NomalAnimes { get; } = new(); + public ObservableCollection PoorConditionAnimes { get; } = new(); + public ObservableCollection IllAnimes { get; } = new(); - public AnimeModel() { } + public AnimeTypeModel() { } - //public AnimeModel() - //{ - - //} - - public static AnimeModel? Load(string path) + public AnimeTypeModel(AnimeTypeModel model) { - var model = new AnimeModel(); - var infoFile = Path.Combine(path, ModMakerInfo.InfoFile); + GraphType.Value = model.GraphType.Value; + foreach (var anime in model.HappyAnimes) + HappyAnimes.Add(anime.Copy()); + foreach (var anime in model.NomalAnimes) + NomalAnimes.Add(anime.Copy()); + foreach (var anime in model.PoorConditionAnimes) + PoorConditionAnimes.Add(anime.Copy()); + foreach (var anime in model.IllAnimes) + IllAnimes.Add(anime.Copy()); + } - if ( - Enum.TryParse(Path.GetFileName(path), true, out var graphType) - is false - ) - return null; + public AnimeTypeModel(GraphInfo.GraphType graphType, string path) + { + GraphType.Value = graphType; if (graphType is GraphInfo.GraphType.Default) + LoadDefault(path); + } + + private void LoadDefault(string path) + { + foreach (var modeDir in Directory.EnumerateDirectories(path)) { - foreach (var dir in Directory.EnumerateDirectories(path)) + var mode = Enum.Parse(typeof(GameSave.ModeType), Path.GetFileName(modeDir), true); + if (mode is GameSave.ModeType.Happy) { - var dirName = Path.GetFileName(dir); - if ( - dirName.Contains( - nameof(GameSave.ModeType.Happy), - StringComparison.OrdinalIgnoreCase - ) - ) + foreach (var imagesDir in Directory.EnumerateDirectories(modeDir)) { - if (Directory.GetFiles(dir).Length == 0) - { - foreach (var imageDir in Directory.EnumerateDirectories(dir)) - { - model.MultiHappyImageModels.Add(new(imageDir)); - } - } - else - { - model.MultiHappyImageModels.Add(new(dir)); - } + HappyAnimes.Add(new(imagesDir)); } - else if ( - dirName.Contains( - nameof(GameSave.ModeType.Nomal), - StringComparison.OrdinalIgnoreCase - ) - ) + } + else if (mode is GameSave.ModeType.Nomal) + { + foreach (var imagesDir in Directory.EnumerateDirectories(modeDir)) { - if (Directory.GetFiles(dir).Length == 0) - { - foreach (var imageDir in Directory.EnumerateDirectories(dir)) - { - model.MultiNomalImageModels.Add(new(imageDir)); - } - } - else - { - model.MultiNomalImageModels.Add(new(dir)); - } + NomalAnimes.Add(new(imagesDir)); } - else if ( - dirName.Contains( - nameof(GameSave.ModeType.PoorCondition), - StringComparison.OrdinalIgnoreCase - ) - ) + } + else if (mode is GameSave.ModeType.PoorCondition) + { + foreach (var imagesDir in Directory.EnumerateDirectories(modeDir)) { - if (Directory.GetFiles(dir).Length == 0) - { - foreach (var imageDir in Directory.EnumerateDirectories(dir)) - { - model.MultiPoorConditionImageModels.Add(new(imageDir)); - } - } - else - { - model.MultiPoorConditionImageModels.Add(new(dir)); - } + PoorConditionAnimes.Add(new(imagesDir)); } - else if ( - dirName.Contains( - nameof(GameSave.ModeType.Ill), - StringComparison.OrdinalIgnoreCase - ) - ) + } + else if (mode is GameSave.ModeType.Ill) + { + foreach (var imagesDir in Directory.EnumerateDirectories(modeDir)) { - if (Directory.GetFiles(dir).Length == 0) - { - foreach (var imageDir in Directory.EnumerateDirectories(dir)) - { - model.MultiIllImageModels.Add(new(imageDir)); - } - } - else - { - model.MultiIllImageModels.Add(new(dir)); - } + IllAnimes.Add(new(imagesDir)); } } } - else - return null; - - return model; } } -public class ImageModels : ObservableCollection +public class AnimeModel { + public ObservableValue Id { get; } = new(); + + public ObservableValue AnimeType { get; } = new(); + + //public ObservableValue ModeType { get; } = new(); + + public ObservableCollection Images { get; } = new(); private static readonly char[] _splits = new char[] { '_' }; - public ImageModels(string imagePath) + public AnimeModel() { } + + public AnimeModel(string imagesPath) { - foreach (var file in Directory.EnumerateFiles(imagePath)) + foreach (var file in Directory.EnumerateFiles(imagesPath)) { var info = Path.GetFileNameWithoutExtension(file) .Split(_splits, StringSplitOptions.RemoveEmptyEntries); - var id = info[0]; + Id.Value = info[0]; var duration = info.Last(); - var imageModel = new ImageModel(); - imageModel.Id.Value = id; - imageModel.Image.Value = Utils.LoadImageToMemoryStream(file); - imageModel.Duration.Value = int.Parse(duration); - Add(imageModel); + var imageModel = new ImageModel( + Utils.LoadImageToMemoryStream(file), + int.Parse(duration) + ); + Images.Add(imageModel); } } + + public AnimeModel Copy() + { + var model = new AnimeModel(); + model.Id.Value = Id.Value; + model.AnimeType.Value = AnimeType.Value; + foreach (var image in Images) + model.Images.Add(image); + return model; + } } diff --git a/VPet.ModMaker/Models/ModModel/FoodModel.cs b/VPet.ModMaker/Models/ModModel/FoodModel.cs index fe34d89..8f884e7 100644 --- a/VPet.ModMaker/Models/ModModel/FoodModel.cs +++ b/VPet.ModMaker/Models/ModModel/FoodModel.cs @@ -54,7 +54,7 @@ public class FoodModel : I18nModel Likability.Value = model.Likability.Value; Price.Value = model.Price.Value; Exp.Value = model.Exp.Value; - Image.Value = Utils.LoadImageToStream(model.Image.Value); + Image.Value = Utils.LoadImageToStream(model.Image.Value.GetSourceFile()); foreach (var item in model.I18nDatas) I18nDatas[item.Key] = item.Value.Copy(); CurrentI18nData.Value = I18nDatas[I18nHelper.Current.CultureName.Value]; diff --git a/VPet.ModMaker/Models/ModModel/ImageModel.cs b/VPet.ModMaker/Models/ModModel/ImageModel.cs index c543215..f713af8 100644 --- a/VPet.ModMaker/Models/ModModel/ImageModel.cs +++ b/VPet.ModMaker/Models/ModModel/ImageModel.cs @@ -10,8 +10,21 @@ namespace VPet.ModMaker.Models.ModModel; public class ImageModel { - public ObservableValue Id { get; } = new(); public ObservableValue Image { get; } = new(); - public ObservableValue Duration { get; } = new(100); + + public ImageModel(BitmapImage image, int duration = 100) + { + Image.Value = image; + Duration.Value = duration; + } + + public ImageModel Copy() + { + var model = new ImageModel( + Utils.LoadImageToStream(Image.Value.GetSourceFile()), + Duration.Value + ); + return model; + } } diff --git a/VPet.ModMaker/Models/ModModel/ModInfoModel.cs b/VPet.ModMaker/Models/ModModel/ModInfoModel.cs index 8922942..23b9b2e 100644 --- a/VPet.ModMaker/Models/ModModel/ModInfoModel.cs +++ b/VPet.ModMaker/Models/ModModel/ModInfoModel.cs @@ -13,6 +13,7 @@ using System.Threading; using System.Threading.Tasks; using System.Windows.Media.Imaging; using VPet.ModMaker.Models.ModModel; +using VPet_Simulator.Core; using VPet_Simulator.Windows.Interface; namespace VPet.ModMaker.Models; @@ -74,17 +75,19 @@ public class ModInfoModel : I18nModel var petModel = new PetModel(pet); Pets.Add(petModel); // TODO: 动画加载 - //foreach (var p in pet.path) - //{ - // foreach (var dir in Directory.EnumerateDirectories(p)) - // { - // var animeModel = AnimeModel.Load(dir); - // if (animeModel != null) - // { - // petModel.Animes.TryAdd(animeModel.GraphType.Value, animeModel); - // } - // } - //} + foreach (var p in pet.path) + { + foreach (var dir in Directory.EnumerateDirectories(p)) + { + Enum.TryParse( + Path.GetFileName(dir), + true, + out var animeType + ); + if (animeType is GraphInfo.GraphType.Default) + petModel.Animes.Add(new(animeType, dir)); + } + } } foreach (var lang in loader.I18nDatas) diff --git a/VPet.ModMaker/Models/ModModel/PetModel.cs b/VPet.ModMaker/Models/ModModel/PetModel.cs index a94f3fe..791c390 100644 --- a/VPet.ModMaker/Models/ModModel/PetModel.cs +++ b/VPet.ModMaker/Models/ModModel/PetModel.cs @@ -25,8 +25,7 @@ public class PetModel : I18nModel public ObservableCollection Moves { get; } = new(); - public ObservableValue CurrentAnime { get; } = new(); - public Dictionary Animes { get; } = new(); + public ObservableCollection Animes { get; } = new(); public PetModel() { diff --git a/VPet.ModMaker/Models/Utils.cs b/VPet.ModMaker/Models/Utils.cs index 6c16a37..2265c93 100644 --- a/VPet.ModMaker/Models/Utils.cs +++ b/VPet.ModMaker/Models/Utils.cs @@ -11,10 +11,14 @@ namespace VPet.ModMaker.Models; public static class Utils { + public const int DecodePixelWidth = 250; + public const int DecodePixelHeight = 250; + public static BitmapImage LoadImageToStream(string imagePath) { BitmapImage bitmapImage = new(); bitmapImage.BeginInit(); + bitmapImage.DecodePixelWidth = DecodePixelWidth; try { bitmapImage.StreamSource = new StreamReader(imagePath).BaseStream; @@ -26,15 +30,11 @@ public static class Utils return bitmapImage; } - public static BitmapImage LoadImageToStream(this BitmapImage image) - { - return LoadImageToStream(image.GetSourceFile()); - } - public static BitmapImage LoadImageToMemoryStream(string imagePath) { BitmapImage bitmapImage = new(); bitmapImage.BeginInit(); + bitmapImage.DecodePixelWidth = DecodePixelWidth; try { var ms = new MemoryStream(); @@ -48,9 +48,4 @@ public static class Utils } return bitmapImage; } - - public static BitmapImage LoadImageToMemoryStream(this BitmapImage image) - { - return LoadImageToMemoryStream(image.GetSourceFile()); - } } diff --git a/VPet.ModMaker/VPet.ModMaker.csproj b/VPet.ModMaker/VPet.ModMaker.csproj index 1cf123c..8936635 100644 --- a/VPet.ModMaker/VPet.ModMaker.csproj +++ b/VPet.ModMaker/VPet.ModMaker.csproj @@ -136,6 +136,9 @@ AnimeEditWindow.xaml + + AnimePage.xaml + ClickTextPage.xaml @@ -238,6 +241,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/VPet.ModMaker/ViewModels/ModEdit/AnimeEdit/AnimeEditWindowVM.cs b/VPet.ModMaker/ViewModels/ModEdit/AnimeEdit/AnimeEditWindowVM.cs index 73dae39..f038414 100644 --- a/VPet.ModMaker/ViewModels/ModEdit/AnimeEdit/AnimeEditWindowVM.cs +++ b/VPet.ModMaker/ViewModels/ModEdit/AnimeEdit/AnimeEditWindowVM.cs @@ -1,24 +1,34 @@ using HKW.HKWViewModels.SimpleObservable; +using LinePutScript.Localization.WPF; +using Microsoft.Win32; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows; using VPet.ModMaker.Models; using VPet.ModMaker.Models.ModModel; +using VPet_Simulator.Core; namespace VPet.ModMaker.ViewModels.ModEdit.AnimeEdit; public class AnimeEditWindowVM { - public AnimeModel OldAnime { get; set; } - public ObservableValue Anime { get; } = new(new()); - + public PetModel CurrentPet { get; set; } + public AnimeTypeModel OldAnime { get; set; } + public ObservableValue Anime { get; } = new(new()); public ObservableValue CurrentImageModel { get; } = new(); + public GameSave.ModeType CurrentMode { get; set; } #region Command public ObservableCommand PlayCommand { get; } = new(); public ObservableCommand PauseCommand { get; } = new(); + + public ObservableCommand AddImageCommand { get; } = new(); + public ObservableCommand ClearImageCommand { get; } = new(); + public ObservableCommand RemoveAnimeCommand { get; } = new(); + public ObservableCommand RemoveImageCommand { get; } = new(); #endregion public bool _pause = false; @@ -26,27 +36,67 @@ public class AnimeEditWindowVM public AnimeEditWindowVM() { - //foreach ( - // var file in Directory.EnumerateFiles( - // @"C:\Users\HKW\Desktop\TestPicture\0000_core\pet\vup\Default\Happy\1" - // ) - //) - //{ - // Anime.Value.MultiImageModels.Add(new(Utils.LoadImageToMemoryStream(file))); - //} - _playerTask = new(Play); - PlayCommand.ExecuteEvent += PlayCommand_ExecuteEvent; - PauseCommand.ExecuteEvent += PauseCommand_ExecuteEvent; + //_playerTask = new(Play); + //PlayCommand.ExecuteEvent += PlayCommand_ExecuteEvent; + //PauseCommand.ExecuteEvent += PauseCommand_ExecuteEvent; + AddImageCommand.ExecuteEvent += AddImageCommand_ExecuteEvent; + ClearImageCommand.ExecuteEvent += ClearImageCommand_ExecuteEvent; + RemoveAnimeCommand.ExecuteEvent += RemoveAnimeCommand_ExecuteEvent; + RemoveImageCommand.ExecuteEvent += RemoveImageCommand_ExecuteEvent; + } + + private void RemoveImageCommand_ExecuteEvent(AnimeModel value) + { + value.Images.Remove(CurrentImageModel.Value); + } + + private void RemoveAnimeCommand_ExecuteEvent(AnimeModel value) + { + if ( + MessageBox.Show("确定删除吗".Translate(), "", MessageBoxButton.YesNo) is MessageBoxResult.Yes + ) + { + if (CurrentMode is GameSave.ModeType.Happy) + Anime.Value.HappyAnimes.Remove(value); + else if (CurrentMode is GameSave.ModeType.Nomal) + Anime.Value.NomalAnimes.Remove(value); + else if (CurrentMode is GameSave.ModeType.PoorCondition) + Anime.Value.PoorConditionAnimes.Remove(value); + else if (CurrentMode is GameSave.ModeType.Ill) + Anime.Value.IllAnimes.Remove(value); + } + } + + private void ClearImageCommand_ExecuteEvent(AnimeModel value) + { + if ( + MessageBox.Show("确定清空吗".Translate(), "", MessageBoxButton.YesNo) is MessageBoxResult.Yes + ) + value.Images.Clear(); + } + + private void AddImageCommand_ExecuteEvent(AnimeModel value) + { + OpenFileDialog openFileDialog = + new() + { + Title = "选择图片".Translate(), + Filter = $"图片|*.jpg;*.jpeg;*.png;*.bmp".Translate() + }; + if (openFileDialog.ShowDialog() is true) + { + value.Images.Add(new(Utils.LoadImageToStream(openFileDialog.FileName))); + } } private void PauseCommand_ExecuteEvent() { - _pause = true; + //_pause = true; } private void PlayCommand_ExecuteEvent() { - _playerTask.Start(); + //_playerTask.Start(); } private void Play() diff --git a/VPet.ModMaker/ViewModels/ModEdit/AnimeEdit/AnimePageVM.cs b/VPet.ModMaker/ViewModels/ModEdit/AnimeEdit/AnimePageVM.cs index c980cc1..76234e1 100644 --- a/VPet.ModMaker/ViewModels/ModEdit/AnimeEdit/AnimePageVM.cs +++ b/VPet.ModMaker/ViewModels/ModEdit/AnimeEdit/AnimePageVM.cs @@ -15,95 +15,95 @@ namespace VPet.ModMaker.ViewModels.ModEdit.AnimeEdit; public class AnimePageVM { - //#region Value - //public ObservableValue> ShowAnimes { get; } = new(); - //public ObservableCollection Works => CurrentPet.Value.Works; + #region Value + public ObservableValue> ShowAnimes { get; } = new(); + public ObservableCollection Animes => CurrentPet.Value.Animes; - //public ObservableCollection Pets => ModInfoModel.Current.Pets; - //public ObservableValue CurrentPet { get; } = new(new()); + public ObservableCollection Pets => ModInfoModel.Current.Pets; + public ObservableValue CurrentPet { get; } = new(new()); //public ObservableValue Filter { get; } = new(); - //#endregion - //#region Command - //public ObservableCommand AddCommand { get; } = new(); - //public ObservableCommand EditCommand { get; } = new(); - //public ObservableCommand RemoveCommand { get; } = new(); - //#endregion - //public AnimePageVM() - //{ - // ShowAnimes.Value = Works; - // CurrentPet.ValueChanged += CurrentPet_ValueChanged; - // Filter.ValueChanged += Filter_ValueChanged; + #endregion + #region Command + public ObservableCommand AddCommand { get; } = new(); + public ObservableCommand EditCommand { get; } = new(); + public ObservableCommand RemoveCommand { get; } = new(); + #endregion + public AnimePageVM() + { + ShowAnimes.Value = Animes; + CurrentPet.ValueChanged += CurrentPet_ValueChanged; + //Filter.ValueChanged += Filter_ValueChanged; - // AddCommand.ExecuteEvent += Add; - // EditCommand.ExecuteEvent += Edit; - // RemoveCommand.ExecuteEvent += Remove; - //} + AddCommand.ExecuteEvent += Add; + EditCommand.ExecuteEvent += Edit; + RemoveCommand.ExecuteEvent += Remove; + } - //private void CurrentPet_ValueChanged(PetModel oldValue, PetModel newValue) - //{ - // //ShowAnimes.Value = newValue.Animes; - //} + private void CurrentPet_ValueChanged(PetModel oldValue, PetModel newValue) + { + ShowAnimes.Value = newValue.Animes; + } - //private void Filter_ValueChanged(string oldValue, string newValue) - //{ - // if (string.IsNullOrWhiteSpace(newValue)) - // { - // ShowAnimes.Value = Works; - // } - // else - // { - // ShowAnimes.Value = new( - // Works.Where(m => m.Id.Value.Contains(newValue, StringComparison.OrdinalIgnoreCase)) - // ); - // } - //} + private void Filter_ValueChanged(string oldValue, string newValue) + { + //if (string.IsNullOrWhiteSpace(newValue)) + //{ + // ShowAnimes.Value = Animes; + //} + //else + //{ + // ShowAnimes.Value = new( + // Animes.Where(m => m.Id.Value.Contains(newValue, StringComparison.OrdinalIgnoreCase)) + // ); + //} + } - //public void Close() { } + public void Close() { } - //private void Add() - //{ - // var window = new AnimeEditWindow(); - // var vm = window.ViewModel; - // vm.CurrentPet = CurrentPet.Value; - // window.ShowDialog(); - // if (window.IsCancel) - // return; - // Works.Add(vm.Work.Value); - //} + private void Add() + { + var window = new AnimeEditWindow(); + var vm = window.ViewModel; + vm.CurrentPet = CurrentPet.Value; + window.ShowDialog(); + if (window.IsCancel) + return; + Animes.Add(vm.Anime.Value); + } - //public void Edit(AnimeModel model) - //{ - // var window = new AnimeEditWindow(); - // var vm = window.ViewModel; - // vm.CurrentPet = CurrentPet.Value; - // vm.OldWork = model; - // var newWork = vm.Work.Value = new(model); - // window.ShowDialog(); - // if (window.IsCancel) - // return; - // if (ShowAnimes.Value.Count == Works.Count) - // { - // Works[Works.IndexOf(model)] = newWork; - // } - // else - // { - // Works[Works.IndexOf(model)] = newWork; - // ShowAnimes.Value[ShowAnimes.Value.IndexOf(model)] = newWork; - // } - //} + public void Edit(AnimeTypeModel model) + { + var window = new AnimeEditWindow(); + var vm = window.ViewModel; + vm.CurrentPet = CurrentPet.Value; + vm.OldAnime = model; + var newAnime = vm.Anime.Value = new(model); + window.ShowDialog(); + if (window.IsCancel) + return; + if (ShowAnimes.Value.Count == Animes.Count) + { + Animes[Animes.IndexOf(model)] = newAnime; + } + else + { + Animes[Animes.IndexOf(model)] = newAnime; + ShowAnimes.Value[ShowAnimes.Value.IndexOf(model)] = newAnime; + } + } - //private void Remove(AnimeModel food) - //{ - // if (MessageBox.Show("确定删除吗".Translate(), "", MessageBoxButton.YesNo) is MessageBoxResult.No) - // return; - // if (ShowAnimes.Value.Count == Works.Count) - // { - // Works.Remove(food); - // } - // else - // { - // ShowAnimes.Value.Remove(food); - // Works.Remove(food); - // } - //} + private void Remove(AnimeTypeModel food) + { + if (MessageBox.Show("确定删除吗".Translate(), "", MessageBoxButton.YesNo) is MessageBoxResult.No) + return; + if (ShowAnimes.Value.Count == Animes.Count) + { + Animes.Remove(food); + } + else + { + ShowAnimes.Value.Remove(food); + Animes.Remove(food); + } + } } diff --git a/VPet.ModMaker/Views/ModEdit/AnimeEdit/AnimeEditWindow.xaml b/VPet.ModMaker/Views/ModEdit/AnimeEdit/AnimeEditWindow.xaml index 007087c..d54f82c 100644 --- a/VPet.ModMaker/Views/ModEdit/AnimeEdit/AnimeEditWindow.xaml +++ b/VPet.ModMaker/Views/ModEdit/AnimeEdit/AnimeEditWindow.xaml @@ -9,12 +9,114 @@ xmlns:pu="https://opensource.panuon.com/wpf-ui" xmlns:vm="clr-namespace:VPet.ModMaker.ViewModels.ModEdit.AnimeEdit" Title="AnimeEditWindow" - Width="800" - Height="450" + Width="1000" + Height="600" mc:Ignorable="d"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -26,10 +128,11 @@ - + + + + + @@ -52,10 +155,14 @@ - @@ -63,62 +170,84 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +