mirror of
https://github.com/LorisYounger/VPet.ModMaker.git
synced 2024-08-30 18:22:21 +00:00
# 修复
- 使用`Work.FixOverLoad()`产生的异常 - 初次设置主文化时模组介绍不正确的问题 - 初次设置主文化窗口与载入中窗口重叠的问题
This commit is contained in:
@ -15,14 +15,14 @@ namespace VPet.ModMaker.Models;
|
|||||||
[DebuggerDisplay("{ID}, Count = {Datas.Count}")]
|
[DebuggerDisplay("{ID}, Count = {Datas.Count}")]
|
||||||
public class I18nData : ObservableObjectX<I18nData>
|
public class I18nData : ObservableObjectX<I18nData>
|
||||||
{
|
{
|
||||||
/// <summary>
|
#region ID
|
||||||
/// Id
|
|
||||||
/// </summary>
|
|
||||||
#region Id
|
|
||||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||||
private string _id = string.Empty;
|
private string _id = string.Empty;
|
||||||
|
|
||||||
public string Id
|
/// <summary>
|
||||||
|
/// ID
|
||||||
|
/// </summary>
|
||||||
|
public string ID
|
||||||
{
|
{
|
||||||
get => _id;
|
get => _id;
|
||||||
set => SetProperty(ref _id, value);
|
set => SetProperty(ref _id, value);
|
||||||
@ -32,5 +32,5 @@ public class I18nData : ObservableObjectX<I18nData>
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 基于 <see cref="I18nHelper.Current.CultureNames"/> 的索引的数据列表
|
/// 基于 <see cref="I18nHelper.Current.CultureNames"/> 的索引的数据列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ObservableList<ObservableValue<string>> Datas { get; } = new();
|
//public ObservableList<Func<I18nModel<>>> Datas { get; } = new();
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ namespace VPet.ModMaker.Models;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T">类型</typeparam>
|
/// <typeparam name="T">类型</typeparam>
|
||||||
public class I18nModel<T> : ObservableObjectX<I18nModel<T>>
|
public class I18nModel<T> : ObservableObjectX<I18nModel<T>>
|
||||||
where T : class, new()
|
where T : ObservableObjectX<T>, new()
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 当前I18n数据
|
/// 当前I18n数据
|
||||||
|
@ -11,6 +11,7 @@ using System.Threading;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using HKW.HKWUtils;
|
using HKW.HKWUtils;
|
||||||
|
using HKW.HKWUtils.Extensions;
|
||||||
using HKW.HKWUtils.Observable;
|
using HKW.HKWUtils.Observable;
|
||||||
using LinePutScript;
|
using LinePutScript;
|
||||||
using LinePutScript.Converter;
|
using LinePutScript.Converter;
|
||||||
@ -33,6 +34,88 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
|
|||||||
Pets.CollectionChanged += Pets_CollectionChanged;
|
Pets.CollectionChanged += Pets_CollectionChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ModInfoModel(ModLoader loader)
|
||||||
|
: this()
|
||||||
|
{
|
||||||
|
SourcePath = loader.ModPath.FullName;
|
||||||
|
ID = loader.Name;
|
||||||
|
DescriptionID = loader.Intro;
|
||||||
|
Author = loader.Author;
|
||||||
|
GameVersion = loader.GameVer;
|
||||||
|
ModVersion = loader.Ver;
|
||||||
|
ItemID = loader.ItemID;
|
||||||
|
AuthorID = loader.AuthorID;
|
||||||
|
var imagePath = Path.Combine(loader.ModPath.FullName, "icon.png");
|
||||||
|
if (File.Exists(imagePath))
|
||||||
|
Image = NativeUtils.LoadImageToMemoryStream(imagePath);
|
||||||
|
foreach (var food in loader.Foods)
|
||||||
|
Foods.Add(new(food));
|
||||||
|
foreach (var clickText in loader.ClickTexts)
|
||||||
|
ClickTexts.Add(new(clickText));
|
||||||
|
foreach (var lowText in loader.LowTexts)
|
||||||
|
LowTexts.Add(new(lowText));
|
||||||
|
foreach (var selectText in loader.SelectTexts)
|
||||||
|
SelectTexts.Add(new(selectText));
|
||||||
|
|
||||||
|
// 载入模组宠物
|
||||||
|
foreach (var pet in loader.Pets)
|
||||||
|
{
|
||||||
|
var petModel = new PetModel(pet);
|
||||||
|
// 如果检测到本体存在同名宠物
|
||||||
|
if (ModMakerInfo.MainPets.TryGetValue(petModel.ID, out var mainPet))
|
||||||
|
{
|
||||||
|
// 若宠物的值为默认值并且本体同名宠物不为默认值, 则把本体宠物的值作为模组宠物的默认值
|
||||||
|
if (
|
||||||
|
petModel.TouchHeadRectangleLocation
|
||||||
|
== PetModel.Current.TouchHeadRectangleLocation
|
||||||
|
&& petModel.TouchHeadRectangleLocation != mainPet.TouchHeadRectangleLocation
|
||||||
|
)
|
||||||
|
petModel.TouchHeadRectangleLocation = mainPet.TouchHeadRectangleLocation;
|
||||||
|
if (
|
||||||
|
petModel.TouchBodyRectangleLocation
|
||||||
|
== PetModel.Current.TouchBodyRectangleLocation
|
||||||
|
&& petModel.TouchBodyRectangleLocation != mainPet.TouchBodyRectangleLocation
|
||||||
|
)
|
||||||
|
petModel.TouchBodyRectangleLocation = mainPet.TouchBodyRectangleLocation;
|
||||||
|
if (
|
||||||
|
petModel.TouchRaisedRectangleLocation
|
||||||
|
== PetModel.Current.TouchRaisedRectangleLocation
|
||||||
|
&& petModel.TouchRaisedRectangleLocation != mainPet.TouchRaisedRectangleLocation
|
||||||
|
)
|
||||||
|
petModel.TouchRaisedRectangleLocation = mainPet.TouchRaisedRectangleLocation;
|
||||||
|
if (
|
||||||
|
petModel.RaisePoint == PetModel.Current.RaisePoint
|
||||||
|
&& petModel.RaisePoint != mainPet.RaisePoint
|
||||||
|
)
|
||||||
|
petModel.RaisePoint = mainPet.RaisePoint;
|
||||||
|
}
|
||||||
|
Pets.Add(petModel);
|
||||||
|
foreach (var p in pet.path)
|
||||||
|
LoadAnime(petModel, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
//loader.Pets.First().Name = "TestMainPet";
|
||||||
|
//Pets.Insert(0, new(loader.Pets.First(), true));
|
||||||
|
|
||||||
|
// 插入本体宠物
|
||||||
|
foreach (var pet in ModMakerInfo.MainPets)
|
||||||
|
{
|
||||||
|
// 确保Id不重复
|
||||||
|
if (Pets.All(i => i.ID != pet.Key))
|
||||||
|
Pets.Insert(0, pet.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 载入本地化
|
||||||
|
foreach (var lang in loader.I18nDatas)
|
||||||
|
I18nDatas.Add(lang.Key, lang.Value);
|
||||||
|
OtherI18nDatas = loader.OtherI18nDatas;
|
||||||
|
|
||||||
|
LoadI18nDatas();
|
||||||
|
RefreshAllId();
|
||||||
|
if (I18nHelper.Current.CultureNames.HasValue())
|
||||||
|
RefreshID();
|
||||||
|
}
|
||||||
|
|
||||||
private void ModInfoModel_PropertyChanged(object? sender, PropertyChangedEventArgs e)
|
private void ModInfoModel_PropertyChanged(object? sender, PropertyChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.PropertyName == nameof(ID))
|
if (e.PropertyName == nameof(ID))
|
||||||
@ -248,88 +331,7 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
|
|||||||
PetDisplayedCount = Pets.Count - Pets.Count(m => m.FromMain);
|
PetDisplayedCount = Pets.Count - Pets.Count(m => m.FromMain);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModInfoModel(ModLoader loader)
|
public void RefreshID()
|
||||||
: this()
|
|
||||||
{
|
|
||||||
SourcePath = loader.ModPath.FullName;
|
|
||||||
ID = loader.Name;
|
|
||||||
DescriptionID = loader.Intro;
|
|
||||||
Author = loader.Author;
|
|
||||||
GameVersion = loader.GameVer;
|
|
||||||
ModVersion = loader.Ver;
|
|
||||||
ItemID = loader.ItemID;
|
|
||||||
AuthorID = loader.AuthorID;
|
|
||||||
var imagePath = Path.Combine(loader.ModPath.FullName, "icon.png");
|
|
||||||
if (File.Exists(imagePath))
|
|
||||||
Image = NativeUtils.LoadImageToMemoryStream(imagePath);
|
|
||||||
foreach (var food in loader.Foods)
|
|
||||||
Foods.Add(new(food));
|
|
||||||
foreach (var clickText in loader.ClickTexts)
|
|
||||||
ClickTexts.Add(new(clickText));
|
|
||||||
foreach (var lowText in loader.LowTexts)
|
|
||||||
LowTexts.Add(new(lowText));
|
|
||||||
foreach (var selectText in loader.SelectTexts)
|
|
||||||
SelectTexts.Add(new(selectText));
|
|
||||||
|
|
||||||
// 载入模组宠物
|
|
||||||
foreach (var pet in loader.Pets)
|
|
||||||
{
|
|
||||||
var petModel = new PetModel(pet);
|
|
||||||
// 如果检测到本体存在同名宠物
|
|
||||||
if (ModMakerInfo.MainPets.TryGetValue(petModel.ID, out var mainPet))
|
|
||||||
{
|
|
||||||
// 若宠物的值为默认值并且本体同名宠物不为默认值, 则把本体宠物的值作为模组宠物的默认值
|
|
||||||
if (
|
|
||||||
petModel.TouchHeadRectangleLocation
|
|
||||||
== PetModel.Current.TouchHeadRectangleLocation
|
|
||||||
&& petModel.TouchHeadRectangleLocation != mainPet.TouchHeadRectangleLocation
|
|
||||||
)
|
|
||||||
petModel.TouchHeadRectangleLocation = mainPet.TouchHeadRectangleLocation;
|
|
||||||
if (
|
|
||||||
petModel.TouchBodyRectangleLocation
|
|
||||||
== PetModel.Current.TouchBodyRectangleLocation
|
|
||||||
&& petModel.TouchBodyRectangleLocation != mainPet.TouchBodyRectangleLocation
|
|
||||||
)
|
|
||||||
petModel.TouchBodyRectangleLocation = mainPet.TouchBodyRectangleLocation;
|
|
||||||
if (
|
|
||||||
petModel.TouchRaisedRectangleLocation
|
|
||||||
== PetModel.Current.TouchRaisedRectangleLocation
|
|
||||||
&& petModel.TouchRaisedRectangleLocation != mainPet.TouchRaisedRectangleLocation
|
|
||||||
)
|
|
||||||
petModel.TouchRaisedRectangleLocation = mainPet.TouchRaisedRectangleLocation;
|
|
||||||
if (
|
|
||||||
petModel.RaisePoint == PetModel.Current.RaisePoint
|
|
||||||
&& petModel.RaisePoint != mainPet.RaisePoint
|
|
||||||
)
|
|
||||||
petModel.RaisePoint = mainPet.RaisePoint;
|
|
||||||
}
|
|
||||||
Pets.Add(petModel);
|
|
||||||
foreach (var p in pet.path)
|
|
||||||
LoadAnime(petModel, p);
|
|
||||||
}
|
|
||||||
|
|
||||||
//loader.Pets.First().Name = "TestMainPet";
|
|
||||||
//Pets.Insert(0, new(loader.Pets.First(), true));
|
|
||||||
|
|
||||||
// 插入本体宠物
|
|
||||||
foreach (var pet in ModMakerInfo.MainPets)
|
|
||||||
{
|
|
||||||
// 确保Id不重复
|
|
||||||
if (Pets.All(i => i.ID != pet.Key))
|
|
||||||
Pets.Insert(0, pet.Value);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 载入本地化
|
|
||||||
foreach (var lang in loader.I18nDatas)
|
|
||||||
I18nDatas.Add(lang.Key, lang.Value);
|
|
||||||
OtherI18nDatas = loader.OtherI18nDatas;
|
|
||||||
|
|
||||||
LoadI18nDatas();
|
|
||||||
RefreshAllId();
|
|
||||||
RefreshId();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RefreshId()
|
|
||||||
{
|
{
|
||||||
DescriptionID = $"{ID}_{nameof(DescriptionID)}";
|
DescriptionID = $"{ID}_{nameof(DescriptionID)}";
|
||||||
}
|
}
|
||||||
|
@ -301,7 +301,7 @@ public class WorkModel : I18nModel<I18nWorkModel>
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 边框颜色
|
/// 边框颜色
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[AdaptIgnore]
|
||||||
public SolidColorBrush BorderBrush
|
public SolidColorBrush BorderBrush
|
||||||
{
|
{
|
||||||
get => _borderBrush;
|
get => _borderBrush;
|
||||||
@ -316,6 +316,7 @@ public class WorkModel : I18nModel<I18nWorkModel>
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 背景色
|
/// 背景色
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[AdaptIgnore]
|
||||||
public SolidColorBrush Background
|
public SolidColorBrush Background
|
||||||
{
|
{
|
||||||
get => _background;
|
get => _background;
|
||||||
@ -330,6 +331,7 @@ public class WorkModel : I18nModel<I18nWorkModel>
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 前景色
|
/// 前景色
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[AdaptIgnore]
|
||||||
public SolidColorBrush Foreground
|
public SolidColorBrush Foreground
|
||||||
{
|
{
|
||||||
get => _foreground;
|
get => _foreground;
|
||||||
@ -345,6 +347,7 @@ public class WorkModel : I18nModel<I18nWorkModel>
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 按钮背景色
|
/// 按钮背景色
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[AdaptIgnore]
|
||||||
public SolidColorBrush ButtonBackground
|
public SolidColorBrush ButtonBackground
|
||||||
{
|
{
|
||||||
get => _buttonBackground;
|
get => _buttonBackground;
|
||||||
@ -360,6 +363,7 @@ public class WorkModel : I18nModel<I18nWorkModel>
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 按钮前景色
|
/// 按钮前景色
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[AdaptIgnore]
|
||||||
public SolidColorBrush ButtonForeground
|
public SolidColorBrush ButtonForeground
|
||||||
{
|
{
|
||||||
get => _buttonForeground;
|
get => _buttonForeground;
|
||||||
|
@ -37,6 +37,7 @@ public class AnimePageVM : ObservableObjectX<AnimePageVM>
|
|||||||
},
|
},
|
||||||
FilteredList = new()
|
FilteredList = new()
|
||||||
};
|
};
|
||||||
|
CurrentPet = Pets.First();
|
||||||
PropertyChangedX += AnimePageVM_PropertyChangedX;
|
PropertyChangedX += AnimePageVM_PropertyChangedX;
|
||||||
|
|
||||||
AddCommand.ExecuteCommand += AddCommand_ExecuteCommand;
|
AddCommand.ExecuteCommand += AddCommand_ExecuteCommand;
|
||||||
|
@ -13,9 +13,48 @@ namespace VPet.ModMaker.ViewModels.ModEdit.I18nEdit;
|
|||||||
|
|
||||||
public class I18nEditWindowVM : ObservableObjectX<I18nEditWindowVM> { }
|
public class I18nEditWindowVM : ObservableObjectX<I18nEditWindowVM> { }
|
||||||
//{
|
//{
|
||||||
|
// public I18nEditWindowVM()
|
||||||
|
// {
|
||||||
|
// I18nDatas = new()
|
||||||
|
// {
|
||||||
|
// Filter = (d) =>
|
||||||
|
// {
|
||||||
|
// if (SearchTarget == nameof(ModInfoModel.ID))
|
||||||
|
// {
|
||||||
|
// return d.ID.Contains(Search, StringComparison.OrdinalIgnoreCase);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// var cultureIndex = I18nHelper.Current.CultureNames.IndexOf(SearchTarget);
|
||||||
|
|
||||||
|
// return d.Datas[cultureIndex]
|
||||||
|
// .Value.Contains(Search, StringComparison.OrdinalIgnoreCase);
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// FilteredList = new()
|
||||||
|
// };
|
||||||
|
// SearchTarget = nameof(ModInfoModel.ID);
|
||||||
|
// PropertyChanged += I18nEditWindowVM_PropertyChanged;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// private void I18nEditWindowVM_PropertyChanged(
|
||||||
|
// object? sender,
|
||||||
|
// System.ComponentModel.PropertyChangedEventArgs e
|
||||||
|
// )
|
||||||
|
// {
|
||||||
|
// if (e.PropertyName == nameof(Search))
|
||||||
|
// {
|
||||||
|
// I18nDatas.Refresh();
|
||||||
|
// }
|
||||||
|
// else if (e.PropertyName == nameof(SearchTarget))
|
||||||
|
// {
|
||||||
|
// I18nDatas.Refresh();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
// #region Search
|
// #region Search
|
||||||
// [DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
// [DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||||
// private string _search;
|
// private string _search = string.Empty;
|
||||||
|
|
||||||
// /// <summary>
|
// /// <summary>
|
||||||
// /// 搜索
|
// /// 搜索
|
||||||
@ -28,33 +67,28 @@ public class I18nEditWindowVM : ObservableObjectX<I18nEditWindowVM> { }
|
|||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
// /// <summary>
|
// /// <summary>
|
||||||
// /// 全部I18n数据 (Id, I18nData)
|
// /// 全部I18n数据 (ID, I18nData)
|
||||||
// /// </summary>
|
// /// </summary>
|
||||||
// public Dictionary<string, I18nData> AllI18nDatas { get; } = new();
|
// public Dictionary<string, I18nData> AllI18nDatas { get; } = new();
|
||||||
|
|
||||||
// /// <summary>
|
// /// <summary>
|
||||||
// /// 全部I18n数据
|
// /// 全部的I18n数据
|
||||||
// /// </summary>
|
|
||||||
// public ObservableList<I18nData> I18nDatas { get; } = new();
|
|
||||||
|
|
||||||
// /// <summary>
|
|
||||||
// /// 显示的I18n数据
|
|
||||||
// /// </summary>
|
// /// </summary>
|
||||||
// #region ShowI18nDatas
|
// #region ShowI18nDatas
|
||||||
// [DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
// [DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||||
// private ObservableList<I18nData> _showI18nDatas;
|
// private ObservableFilterList<I18nData, ObservableList<I18nData>> _i18nDatas;
|
||||||
|
|
||||||
// public ObservableList<I18nData> ShowI18nDatas
|
// public ObservableFilterList<I18nData, ObservableList<I18nData>> I18nDatas
|
||||||
// {
|
// {
|
||||||
// get => _showI18nDatas;
|
// get => _i18nDatas;
|
||||||
// set => SetProperty(ref _showI18nDatas, value);
|
// set => SetProperty(ref _i18nDatas, value);
|
||||||
// }
|
// }
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
// /// <summary>
|
// /// <summary>
|
||||||
// /// 搜索目标列表
|
// /// 搜索目标列表
|
||||||
// /// </summary>
|
// /// </summary>
|
||||||
// public ObservableList<string> SearchTargets { get; } = new() { nameof(ModInfoModel.Id) };
|
// public ObservableList<string> SearchTargets { get; } = new() { nameof(ModInfoModel.ID) };
|
||||||
|
|
||||||
// /// <summary>
|
// /// <summary>
|
||||||
// /// 搜索目标
|
// /// 搜索目标
|
||||||
@ -70,48 +104,6 @@ public class I18nEditWindowVM : ObservableObjectX<I18nEditWindowVM> { }
|
|||||||
// }
|
// }
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
// public I18nEditWindowVM()
|
|
||||||
// {
|
|
||||||
// //Search.ValueChanged += Search_ValueChanged;// TODO
|
|
||||||
// ShowI18nDatas = I18nDatas;
|
|
||||||
// SearchTarget = nameof(ModInfoModel.Id);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /// <summary>
|
|
||||||
// /// 搜索改变事件
|
|
||||||
// /// </summary>
|
|
||||||
// /// <param name="oldValue"></param>
|
|
||||||
// /// <param name="newValue"></param>
|
|
||||||
// private void Search_ValueChanged(
|
|
||||||
// ObservableValue<string> sender,
|
|
||||||
// ValueChangedEventArgs<string> e
|
|
||||||
// )
|
|
||||||
// {
|
|
||||||
// if (string.IsNullOrWhiteSpace(e.NewValue))
|
|
||||||
// {
|
|
||||||
// ShowI18nDatas = I18nDatas;
|
|
||||||
// }
|
|
||||||
// else if (SearchTarget == nameof(ModInfoModel.Id))
|
|
||||||
// {
|
|
||||||
// ShowI18nDatas = new(
|
|
||||||
// I18nDatas.Where(m =>
|
|
||||||
// m.Id?.Contains(e.NewValue, StringComparison.OrdinalIgnoreCase) is true
|
|
||||||
// )
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// var cultureIndex = I18nHelper.Current.CultureNames.IndexOf(SearchTarget);
|
|
||||||
// ShowI18nDatas = new(
|
|
||||||
// I18nDatas.Where(m =>
|
|
||||||
// m.Datas[cultureIndex]
|
|
||||||
// .Value?.Contains(e.NewValue, StringComparison.OrdinalIgnoreCase)
|
|
||||||
// is true
|
|
||||||
// )
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /// <summary>
|
// /// <summary>
|
||||||
// /// 文化列表改变事件
|
// /// 文化列表改变事件
|
||||||
// /// </summary>
|
// /// </summary>
|
||||||
@ -139,7 +131,7 @@ public class I18nEditWindowVM : ObservableObjectX<I18nEditWindowVM> { }
|
|||||||
// data.Value.Datas.RemoveAt(e.OldStartingIndex);
|
// data.Value.Datas.RemoveAt(e.OldStartingIndex);
|
||||||
// }
|
// }
|
||||||
// if (SearchTarget is null)
|
// if (SearchTarget is null)
|
||||||
// SearchTarget = nameof(ModInfoModel.Id);
|
// SearchTarget = nameof(ModInfoModel.ID);
|
||||||
// }
|
// }
|
||||||
// else if (e.Action is NotifyCollectionChangedAction.Replace)
|
// else if (e.Action is NotifyCollectionChangedAction.Replace)
|
||||||
// {
|
// {
|
||||||
@ -187,29 +179,29 @@ public class I18nEditWindowVM : ObservableObjectX<I18nEditWindowVM> { }
|
|||||||
// {
|
// {
|
||||||
// foreach (var food in model.Foods)
|
// foreach (var food in model.Foods)
|
||||||
// {
|
// {
|
||||||
// AddData(food.Id, food, (m) => m.Name);
|
// AddData(food.ID, food, (m) => m.Name);
|
||||||
// AddData(food.DescriptionId, food, (m) => m.Description);
|
// AddData(food.DescriptionID, food, (m) => m.Description);
|
||||||
// }
|
// }
|
||||||
// model.Foods.CollectionChanged += (s, e) =>
|
// model.Foods.CollectionChanged += (s, e) =>
|
||||||
// {
|
// {
|
||||||
// if (e.Action is NotifyCollectionChangedAction.Add)
|
// if (e.Action is NotifyCollectionChangedAction.Add)
|
||||||
// {
|
// {
|
||||||
// var newModel = (FoodModel)e.NewItems[0];
|
// var newModel = (FoodModel)e.NewItems[0];
|
||||||
// AddData(newModel.Id, newModel, (m) => m.Name);
|
// AddData(newModel.ID, newModel, (m) => m.Name);
|
||||||
// AddData(newModel.DescriptionId, newModel, (m) => m.Description);
|
// AddData(newModel.DescriptionID, newModel, (m) => m.Description);
|
||||||
// }
|
// }
|
||||||
// else if (e.Action is NotifyCollectionChangedAction.Remove)
|
// else if (e.Action is NotifyCollectionChangedAction.Remove)
|
||||||
// {
|
// {
|
||||||
// var oldModel = (FoodModel)e.OldItems[0];
|
// var oldModel = (FoodModel)e.OldItems[0];
|
||||||
// RemoveData(oldModel.Id, oldModel, (m) => m.Name);
|
// RemoveData(oldModel.ID, oldModel, (m) => m.Name);
|
||||||
// RemoveData(oldModel.DescriptionId, oldModel, (m) => m.Description);
|
// RemoveData(oldModel.DescriptionID, oldModel, (m) => m.Description);
|
||||||
// }
|
// }
|
||||||
// else if (e.Action is NotifyCollectionChangedAction.Replace)
|
// else if (e.Action is NotifyCollectionChangedAction.Replace)
|
||||||
// {
|
// {
|
||||||
// var newModel = (FoodModel)e.NewItems[0];
|
// var newModel = (FoodModel)e.NewItems[0];
|
||||||
// var oldModel = (FoodModel)e.OldItems[0];
|
// var oldModel = (FoodModel)e.OldItems[0];
|
||||||
// ReplaceData(newModel.Id, newModel, (m) => m.Name);
|
// ReplaceData(newModel.ID, newModel, (m) => m.Name);
|
||||||
// ReplaceData(newModel.DescriptionId, newModel, (m) => m.Description);
|
// ReplaceData(newModel.DescriptionID, newModel, (m) => m.Description);
|
||||||
// }
|
// }
|
||||||
// };
|
// };
|
||||||
// }
|
// }
|
||||||
@ -222,25 +214,25 @@ public class I18nEditWindowVM : ObservableObjectX<I18nEditWindowVM> { }
|
|||||||
// {
|
// {
|
||||||
// foreach (var text in model.ClickTexts)
|
// foreach (var text in model.ClickTexts)
|
||||||
// {
|
// {
|
||||||
// AddData(text.Id, text, (m) => m.Text);
|
// AddData(text.ID, text, (m) => m.Text);
|
||||||
// }
|
// }
|
||||||
// model.ClickTexts.CollectionChanged += (s, e) =>
|
// model.ClickTexts.CollectionChanged += (s, e) =>
|
||||||
// {
|
// {
|
||||||
// if (e.Action is NotifyCollectionChangedAction.Add)
|
// if (e.Action is NotifyCollectionChangedAction.Add)
|
||||||
// {
|
// {
|
||||||
// var newModel = (ClickTextModel)e.NewItems[0];
|
// var newModel = (ClickTextModel)e.NewItems[0];
|
||||||
// AddData(newModel.Id, newModel, (m) => m.Text);
|
// AddData(newModel.ID, newModel, (m) => m.Text);
|
||||||
// }
|
// }
|
||||||
// else if (e.Action is NotifyCollectionChangedAction.Remove)
|
// else if (e.Action is NotifyCollectionChangedAction.Remove)
|
||||||
// {
|
// {
|
||||||
// var oldModel = (ClickTextModel)e.OldItems[0];
|
// var oldModel = (ClickTextModel)e.OldItems[0];
|
||||||
// RemoveData(oldModel.Id, oldModel, (m) => m.Text);
|
// RemoveData(oldModel.ID, oldModel, (m) => m.Text);
|
||||||
// }
|
// }
|
||||||
// else if (e.Action is NotifyCollectionChangedAction.Replace)
|
// else if (e.Action is NotifyCollectionChangedAction.Replace)
|
||||||
// {
|
// {
|
||||||
// var newModel = (ClickTextModel)e.NewItems[0];
|
// var newModel = (ClickTextModel)e.NewItems[0];
|
||||||
// var oldModel = (ClickTextModel)e.OldItems[0];
|
// var oldModel = (ClickTextModel)e.OldItems[0];
|
||||||
// ReplaceData(newModel.Id, newModel, (m) => m.Text);
|
// ReplaceData(newModel.ID, newModel, (m) => m.Text);
|
||||||
// }
|
// }
|
||||||
// };
|
// };
|
||||||
// }
|
// }
|
||||||
@ -253,25 +245,25 @@ public class I18nEditWindowVM : ObservableObjectX<I18nEditWindowVM> { }
|
|||||||
// {
|
// {
|
||||||
// foreach (var text in model.LowTexts)
|
// foreach (var text in model.LowTexts)
|
||||||
// {
|
// {
|
||||||
// AddData(text.Id, text, (m) => m.Text);
|
// AddData(text.ID, text, (m) => m.Text);
|
||||||
// }
|
// }
|
||||||
// model.LowTexts.CollectionChanged += (s, e) =>
|
// model.LowTexts.CollectionChanged += (s, e) =>
|
||||||
// {
|
// {
|
||||||
// if (e.Action is NotifyCollectionChangedAction.Add)
|
// if (e.Action is NotifyCollectionChangedAction.Add)
|
||||||
// {
|
// {
|
||||||
// var newModel = (LowTextModel)e.NewItems[0];
|
// var newModel = (LowTextModel)e.NewItems[0];
|
||||||
// AddData(newModel.Id, newModel, (m) => m.Text);
|
// AddData(newModel.ID, newModel, (m) => m.Text);
|
||||||
// }
|
// }
|
||||||
// else if (e.Action is NotifyCollectionChangedAction.Remove)
|
// else if (e.Action is NotifyCollectionChangedAction.Remove)
|
||||||
// {
|
// {
|
||||||
// var oldModel = (LowTextModel)e.OldItems[0];
|
// var oldModel = (LowTextModel)e.OldItems[0];
|
||||||
// RemoveData(oldModel.Id, oldModel, (m) => m.Text);
|
// RemoveData(oldModel.ID, oldModel, (m) => m.Text);
|
||||||
// }
|
// }
|
||||||
// else if (e.Action is NotifyCollectionChangedAction.Replace)
|
// else if (e.Action is NotifyCollectionChangedAction.Replace)
|
||||||
// {
|
// {
|
||||||
// var newModel = (LowTextModel)e.NewItems[0];
|
// var newModel = (LowTextModel)e.NewItems[0];
|
||||||
// var oldModel = (LowTextModel)e.OldItems[0];
|
// var oldModel = (LowTextModel)e.OldItems[0];
|
||||||
// ReplaceData(newModel.Id, newModel, (m) => m.Text);
|
// ReplaceData(newModel.ID, newModel, (m) => m.Text);
|
||||||
// }
|
// }
|
||||||
// };
|
// };
|
||||||
// }
|
// }
|
||||||
@ -284,7 +276,7 @@ public class I18nEditWindowVM : ObservableObjectX<I18nEditWindowVM> { }
|
|||||||
// {
|
// {
|
||||||
// foreach (var text in model.SelectTexts)
|
// foreach (var text in model.SelectTexts)
|
||||||
// {
|
// {
|
||||||
// AddData(text.Id, text, (m) => m.Text);
|
// AddData(text.ID, text, (m) => m.Text);
|
||||||
// AddData(text.ChooseId, text, (m) => m.Choose);
|
// AddData(text.ChooseId, text, (m) => m.Choose);
|
||||||
// }
|
// }
|
||||||
// model.SelectTexts.CollectionChanged += (s, e) =>
|
// model.SelectTexts.CollectionChanged += (s, e) =>
|
||||||
@ -292,20 +284,20 @@ public class I18nEditWindowVM : ObservableObjectX<I18nEditWindowVM> { }
|
|||||||
// if (e.Action is NotifyCollectionChangedAction.Add)
|
// if (e.Action is NotifyCollectionChangedAction.Add)
|
||||||
// {
|
// {
|
||||||
// var newModel = (SelectTextModel)e.NewItems[0];
|
// var newModel = (SelectTextModel)e.NewItems[0];
|
||||||
// AddData(newModel.Id, newModel, (m) => m.Text);
|
// AddData(newModel.ID, newModel, (m) => m.Text);
|
||||||
// AddData(newModel.ChooseId, newModel, (m) => m.Choose);
|
// AddData(newModel.ChooseId, newModel, (m) => m.Choose);
|
||||||
// }
|
// }
|
||||||
// else if (e.Action is NotifyCollectionChangedAction.Remove)
|
// else if (e.Action is NotifyCollectionChangedAction.Remove)
|
||||||
// {
|
// {
|
||||||
// var oldModel = (SelectTextModel)e.OldItems[0];
|
// var oldModel = (SelectTextModel)e.OldItems[0];
|
||||||
// RemoveData(oldModel.Id, oldModel, (m) => m.Text);
|
// RemoveData(oldModel.ID, oldModel, (m) => m.Text);
|
||||||
// RemoveData(oldModel.ChooseId, oldModel, (m) => m.Choose);
|
// RemoveData(oldModel.ChooseId, oldModel, (m) => m.Choose);
|
||||||
// }
|
// }
|
||||||
// else if (e.Action is NotifyCollectionChangedAction.Replace)
|
// else if (e.Action is NotifyCollectionChangedAction.Replace)
|
||||||
// {
|
// {
|
||||||
// var newModel = (SelectTextModel)e.NewItems[0];
|
// var newModel = (SelectTextModel)e.NewItems[0];
|
||||||
// var oldModel = (SelectTextModel)e.OldItems[0];
|
// var oldModel = (SelectTextModel)e.OldItems[0];
|
||||||
// ReplaceData(newModel.Id, newModel, (m) => m.Text);
|
// ReplaceData(newModel.ID, newModel, (m) => m.Text);
|
||||||
// ReplaceData(newModel.ChooseId, newModel, (m) => m.Choose);
|
// ReplaceData(newModel.ChooseId, newModel, (m) => m.Choose);
|
||||||
// }
|
// }
|
||||||
// };
|
// };
|
||||||
@ -323,9 +315,9 @@ public class I18nEditWindowVM : ObservableObjectX<I18nEditWindowVM> { }
|
|||||||
// continue;
|
// continue;
|
||||||
// AddData(pet.ID, pet, (m) => m.Name);
|
// AddData(pet.ID, pet, (m) => m.Name);
|
||||||
// AddData(pet.PetNameId, pet, (m) => m.PetName);
|
// AddData(pet.PetNameId, pet, (m) => m.PetName);
|
||||||
// AddData(pet.DescriptionId, pet, (m) => m.Description);
|
// AddData(pet.DescriptionID, pet, (m) => m.Description);
|
||||||
// foreach (var work in pet.Works)
|
// foreach (var work in pet.Works)
|
||||||
// AddData(work.Id, work, (m) => m.Name);
|
// AddData(work.ID, work, (m) => m.Name);
|
||||||
// }
|
// }
|
||||||
// model.Pets.CollectionChanged += (s, e) =>
|
// model.Pets.CollectionChanged += (s, e) =>
|
||||||
// {
|
// {
|
||||||
@ -333,9 +325,9 @@ public class I18nEditWindowVM : ObservableObjectX<I18nEditWindowVM> { }
|
|||||||
// {
|
// {
|
||||||
// var newModel = (PetModel)e.NewItems[0];
|
// var newModel = (PetModel)e.NewItems[0];
|
||||||
// AddData(newModel.ID, newModel, (m) => m.Name);
|
// AddData(newModel.ID, newModel, (m) => m.Name);
|
||||||
// AddData(newModel.DescriptionId, newModel, (m) => m.Description);
|
// AddData(newModel.DescriptionID, newModel, (m) => m.Description);
|
||||||
// foreach (var work in newModel.Works)
|
// foreach (var work in newModel.Works)
|
||||||
// AddData(work.Id, work, (m) => m.Name);
|
// AddData(work.ID, work, (m) => m.Name);
|
||||||
// }
|
// }
|
||||||
// else if (e.Action is NotifyCollectionChangedAction.Remove)
|
// else if (e.Action is NotifyCollectionChangedAction.Remove)
|
||||||
// {
|
// {
|
||||||
@ -343,18 +335,18 @@ public class I18nEditWindowVM : ObservableObjectX<I18nEditWindowVM> { }
|
|||||||
// if (oldModel.FromMain.Value)
|
// if (oldModel.FromMain.Value)
|
||||||
// return;
|
// return;
|
||||||
// RemoveData(oldModel.ID, oldModel, (m) => m.Name);
|
// RemoveData(oldModel.ID, oldModel, (m) => m.Name);
|
||||||
// RemoveData(oldModel.DescriptionId, oldModel, (m) => m.Description);
|
// RemoveData(oldModel.DescriptionID, oldModel, (m) => m.Description);
|
||||||
// foreach (var work in oldModel.Works)
|
// foreach (var work in oldModel.Works)
|
||||||
// RemoveData(work.Id, work, (m) => m.Name);
|
// RemoveData(work.ID, work, (m) => m.Name);
|
||||||
// }
|
// }
|
||||||
// else if (e.Action is NotifyCollectionChangedAction.Replace)
|
// else if (e.Action is NotifyCollectionChangedAction.Replace)
|
||||||
// {
|
// {
|
||||||
// var newModel = (PetModel)e.NewItems[0];
|
// var newModel = (PetModel)e.NewItems[0];
|
||||||
// var oldModel = (PetModel)e.OldItems[0];
|
// var oldModel = (PetModel)e.OldItems[0];
|
||||||
// ReplaceData(newModel.ID, newModel, (m) => m.Name);
|
// ReplaceData(newModel.ID, newModel, (m) => m.Name);
|
||||||
// ReplaceData(newModel.DescriptionId, newModel, (m) => m.Description);
|
// ReplaceData(newModel.DescriptionID, newModel, (m) => m.Description);
|
||||||
// foreach (var work in newModel.Works)
|
// foreach (var work in newModel.Works)
|
||||||
// ReplaceData(work.Id, work, (m) => m.Name);
|
// ReplaceData(work.ID, work, (m) => m.Name);
|
||||||
// }
|
// }
|
||||||
// };
|
// };
|
||||||
// }
|
// }
|
||||||
@ -368,14 +360,10 @@ public class I18nEditWindowVM : ObservableObjectX<I18nEditWindowVM> { }
|
|||||||
// /// <param name="id"></param>
|
// /// <param name="id"></param>
|
||||||
// /// <param name="i18nModel"></param>
|
// /// <param name="i18nModel"></param>
|
||||||
// /// <param name="i18nValue"></param>
|
// /// <param name="i18nValue"></param>
|
||||||
// private void AddData<T>(
|
// private void AddData<T>(I18nModel<T> i18nModel, string id)
|
||||||
// ObservableValue<string> id,
|
// where T : I18nModel<T>, new()
|
||||||
// I18nModel<T> i18nModel,
|
|
||||||
// Func<T, ObservableValue<string>> i18nValue
|
|
||||||
// )
|
|
||||||
// where T : class, new()
|
|
||||||
// {
|
// {
|
||||||
// if (AllI18nDatas.TryGetValue(id.Value, out var outData))
|
// if (AllI18nDatas.TryGetValue(id, out var outData))
|
||||||
// {
|
// {
|
||||||
// foreach (var culture in I18nHelper.Current.CultureNames.EnumerateIndex())
|
// foreach (var culture in I18nHelper.Current.CultureNames.EnumerateIndex())
|
||||||
// {
|
// {
|
||||||
@ -391,7 +379,7 @@ public class I18nEditWindowVM : ObservableObjectX<I18nEditWindowVM> { }
|
|||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// var data = new I18nData();
|
// var data = new I18nData();
|
||||||
// data.Id = id.Value;
|
// data.ID = id.Value;
|
||||||
// foreach (var culture in I18nHelper.Current.CultureNames)
|
// foreach (var culture in I18nHelper.Current.CultureNames)
|
||||||
// data.Datas.Add(i18nValue(i18nModel.I18nDatas[culture]));
|
// data.Datas.Add(i18nValue(i18nModel.I18nDatas[culture]));
|
||||||
// I18nDatas.Add(data);
|
// I18nDatas.Add(data);
|
||||||
@ -408,7 +396,7 @@ public class I18nEditWindowVM : ObservableObjectX<I18nEditWindowVM> { }
|
|||||||
// private void IdChange(ObservableValue<string> sender, ValueChangedEventArgs<string> e)
|
// private void IdChange(ObservableValue<string> sender, ValueChangedEventArgs<string> e)
|
||||||
// {
|
// {
|
||||||
// var sourceData = AllI18nDatas[e.OldValue];
|
// var sourceData = AllI18nDatas[e.OldValue];
|
||||||
// //sourceData.Id.Group?.Remove(sourceData.Id); //TODO
|
// //sourceData.ID.Group?.Remove(sourceData.ID); //TODO
|
||||||
// if (AllI18nDatas.TryGetValue(e.OldValue, out var outData))
|
// if (AllI18nDatas.TryGetValue(e.OldValue, out var outData))
|
||||||
// {
|
// {
|
||||||
// foreach (var culture in I18nHelper.Current.CultureNames.EnumerateIndex())
|
// foreach (var culture in I18nHelper.Current.CultureNames.EnumerateIndex())
|
||||||
@ -422,7 +410,7 @@ public class I18nEditWindowVM : ObservableObjectX<I18nEditWindowVM> { }
|
|||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// sourceData.Id = e.NewValue;
|
// sourceData.ID = e.NewValue;
|
||||||
// AllI18nDatas.Remove(e.OldValue);
|
// AllI18nDatas.Remove(e.OldValue);
|
||||||
// AllI18nDatas.Add(e.NewValue, sourceData);
|
// AllI18nDatas.Add(e.NewValue, sourceData);
|
||||||
// }
|
// }
|
||||||
|
@ -204,7 +204,8 @@ public class ModEditWindowVM : ObservableObjectX<ModEditWindowVM>
|
|||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
MessageBox.Show(
|
MessageBox.Show(
|
||||||
"!!!注意!!!\n此操作会将所有Id设为当前文化的翻译内容,仅适用于初次设置多文化的模组\n确定要继续吗?".Translate(),
|
ModEditWindow,
|
||||||
|
"!!!注意!!!\n此操作会将所有ID设为当前文化的翻译内容,仅适用于初次设置多文化的模组\n确定要继续吗?".Translate(),
|
||||||
"",
|
"",
|
||||||
MessageBoxButton.YesNo
|
MessageBoxButton.YesNo
|
||||||
)
|
)
|
||||||
@ -305,6 +306,7 @@ public class ModEditWindowVM : ObservableObjectX<ModEditWindowVM>
|
|||||||
if (I18nHelper.Current.CultureNames.Count == 0)
|
if (I18nHelper.Current.CultureNames.Count == 0)
|
||||||
{
|
{
|
||||||
MessageBox.Show(
|
MessageBox.Show(
|
||||||
|
ModEditWindow,
|
||||||
"未添加任何语言".Translate(),
|
"未添加任何语言".Translate(),
|
||||||
"",
|
"",
|
||||||
MessageBoxButton.OK,
|
MessageBoxButton.OK,
|
||||||
@ -314,12 +316,24 @@ public class ModEditWindowVM : ObservableObjectX<ModEditWindowVM>
|
|||||||
}
|
}
|
||||||
if (string.IsNullOrWhiteSpace(model.ID))
|
if (string.IsNullOrWhiteSpace(model.ID))
|
||||||
{
|
{
|
||||||
MessageBox.Show("Id不可为空".Translate(), "", MessageBoxButton.OK, MessageBoxImage.Warning);
|
MessageBox.Show(
|
||||||
|
ModEditWindow,
|
||||||
|
"ID不可为空".Translate(),
|
||||||
|
"",
|
||||||
|
MessageBoxButton.OK,
|
||||||
|
MessageBoxImage.Warning
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (string.IsNullOrWhiteSpace(model.Author))
|
if (string.IsNullOrWhiteSpace(model.Author))
|
||||||
{
|
{
|
||||||
MessageBox.Show("作者不可为空".Translate(), "", MessageBoxButton.OK, MessageBoxImage.Warning);
|
MessageBox.Show(
|
||||||
|
ModEditWindow,
|
||||||
|
"作者不可为空".Translate(),
|
||||||
|
"",
|
||||||
|
MessageBoxButton.OK,
|
||||||
|
MessageBoxImage.Warning
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -24,8 +24,8 @@ public class MovePageVM : ObservableObjectX<MovePageVM>
|
|||||||
Filter = f => f.Graph.Contains(Search, StringComparison.OrdinalIgnoreCase),
|
Filter = f => f.Graph.Contains(Search, StringComparison.OrdinalIgnoreCase),
|
||||||
FilteredList = new()
|
FilteredList = new()
|
||||||
};
|
};
|
||||||
|
CurrentPet = Pets.First();
|
||||||
PropertyChanged += MovePageVM_PropertyChanged;
|
PropertyChanged += MovePageVM_PropertyChanged;
|
||||||
|
|
||||||
AddCommand.ExecuteCommand += AddCommand_ExecuteCommand;
|
AddCommand.ExecuteCommand += AddCommand_ExecuteCommand;
|
||||||
EditCommand.ExecuteCommand += EditCommand_ExecuteCommand;
|
EditCommand.ExecuteCommand += EditCommand_ExecuteCommand;
|
||||||
RemoveCommand.ExecuteCommand += RemoveCommand_ExecuteCommand;
|
RemoveCommand.ExecuteCommand += RemoveCommand_ExecuteCommand;
|
||||||
|
@ -24,6 +24,7 @@ public class WorkPageVM : ObservableObjectX<WorkPageVM>
|
|||||||
Filter = f => f.ID.Contains(Search, StringComparison.OrdinalIgnoreCase),
|
Filter = f => f.ID.Contains(Search, StringComparison.OrdinalIgnoreCase),
|
||||||
FilteredList = new()
|
FilteredList = new()
|
||||||
};
|
};
|
||||||
|
CurrentPet = Pets.First();
|
||||||
PropertyChanged += WorkPageVM_PropertyChanged;
|
PropertyChanged += WorkPageVM_PropertyChanged;
|
||||||
AddCommand.ExecuteCommand += AddCommand_ExecuteCommand;
|
AddCommand.ExecuteCommand += AddCommand_ExecuteCommand;
|
||||||
EditCommand.ExecuteCommand += EditCommand_ExecuteCommand;
|
EditCommand.ExecuteCommand += EditCommand_ExecuteCommand;
|
||||||
|
@ -133,7 +133,7 @@ public class ModMakerWindowVM : ObservableObjectX<ModMakerWindowVM>
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 保存历史
|
/// 保存历史
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void SaveHistories()
|
public void SaveHistories()
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(nameof(ModMaker));
|
Directory.CreateDirectory(nameof(ModMaker));
|
||||||
if (File.Exists(ModMakerInfo.HistoryFile) is false)
|
if (File.Exists(ModMakerInfo.HistoryFile) is false)
|
||||||
@ -260,7 +260,7 @@ public class ModMakerWindowVM : ObservableObjectX<ModMakerWindowVM>
|
|||||||
public void LoadMod(string path)
|
public void LoadMod(string path)
|
||||||
{
|
{
|
||||||
ModLoader? loader = null;
|
ModLoader? loader = null;
|
||||||
var pendingHandler = PendingBox.Show("载入中".Translate());
|
var pendingHandler = PendingBox.Show(ModMakerWindow, "载入中".Translate());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
loader = new ModLoader(new(path));
|
loader = new ModLoader(new(path));
|
||||||
@ -275,11 +275,11 @@ public class ModMakerWindowVM : ObservableObjectX<ModMakerWindowVM>
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var modInfo = new ModInfoModel(loader);
|
var modInfo = new ModInfoModel(loader);
|
||||||
|
pendingHandler.Hide();
|
||||||
EditMod(modInfo);
|
EditMod(modInfo);
|
||||||
// 更新模组
|
// 更新模组
|
||||||
if (ModUpdataHelper.CanUpdata(modInfo))
|
if (ModUpdataHelper.CanUpdata(modInfo))
|
||||||
{
|
{
|
||||||
pendingHandler.Hide();
|
|
||||||
if (
|
if (
|
||||||
MessageBox.Show(
|
MessageBox.Show(
|
||||||
ModEditWindow.Current,
|
ModEditWindow.Current,
|
||||||
@ -293,7 +293,7 @@ public class ModMakerWindowVM : ObservableObjectX<ModMakerWindowVM>
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (ModUpdataHelper.Updata(modInfo))
|
if (ModUpdataHelper.Updata(modInfo))
|
||||||
MessageBox.Show("更新完成, 请手动保存".Translate());
|
MessageBox.Show(ModEditWindow.Current, "更新完成, 请手动保存".Translate());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pendingHandler.Close();
|
pendingHandler.Close();
|
||||||
|
@ -31,7 +31,7 @@ namespace VPet.ModMaker.Views;
|
|||||||
public partial class ModMakerWindow : WindowX
|
public partial class ModMakerWindow : WindowX
|
||||||
{
|
{
|
||||||
public ModMakerWindowVM ViewModel => (ModMakerWindowVM)DataContext;
|
public ModMakerWindowVM ViewModel => (ModMakerWindowVM)DataContext;
|
||||||
public Models.ModMaker ModMaker { get; internal set; }
|
public Models.ModMaker ModMaker { get; internal set; } = null!;
|
||||||
|
|
||||||
public ModMakerWindow()
|
public ModMakerWindow()
|
||||||
{
|
{
|
||||||
@ -65,6 +65,8 @@ public partial class ModMakerWindow : WindowX
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
ViewModel.Histories.Remove(history);
|
ViewModel.Histories.Remove(history);
|
||||||
|
ViewModel.SaveHistories();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ViewModel.LoadMod(history.SourcePath);
|
ViewModel.LoadMod(history.SourcePath);
|
||||||
|
Reference in New Issue
Block a user