diff --git a/VPet.ModMaker/Converters.xaml b/VPet.ModMaker/Converters.xaml
index 7656ef2..fc11c66 100644
--- a/VPet.ModMaker/Converters.xaml
+++ b/VPet.ModMaker/Converters.xaml
@@ -13,4 +13,5 @@
+
\ No newline at end of file
diff --git a/VPet.ModMaker/Converters/AllTrueToCollapsedConverter.cs b/VPet.ModMaker/Converters/AllTrueToCollapsedConverter.cs
new file mode 100644
index 0000000..3ab2a07
--- /dev/null
+++ b/VPet.ModMaker/Converters/AllTrueToCollapsedConverter.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Data;
+
+namespace VPet.ModMaker.Converters;
+
+///
+/// 全部为真时设置隐藏转换器
+///
+public class AllTrueToCollapsedConverter : IMultiValueConverter
+{
+ public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (values.Length == 0)
+ throw new ArgumentException("No values", nameof(values));
+ return values.All(i => i is true) ? Visibility.Collapsed : Visibility.Visible;
+ }
+
+ public object[] ConvertBack(
+ object value,
+ Type[] targetTypes,
+ object parameter,
+ CultureInfo culture
+ )
+ {
+ throw new NotImplementedException();
+ }
+}
diff --git a/VPet.ModMaker/Converters/AnyFalseToVisibleConverter.cs b/VPet.ModMaker/Converters/AnyFalseToVisibleConverter.cs
new file mode 100644
index 0000000..298c839
--- /dev/null
+++ b/VPet.ModMaker/Converters/AnyFalseToVisibleConverter.cs
@@ -0,0 +1,28 @@
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+
+namespace VPet.ModMaker.Converters;
+
+///
+/// 任意为假时设置显示转换器
+///
+public class AnyFalseToVisibleConverter : IMultiValueConverter
+{
+ public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (values.Length == 0)
+ throw new ArgumentException("No values", nameof(values));
+ return values.Any(i => i is not true) ? Visibility.Visible : Visibility.Collapsed;
+ }
+
+ public object[] ConvertBack(
+ object value,
+ Type[] targetTypes,
+ object parameter,
+ CultureInfo culture
+ )
+ {
+ throw new NotImplementedException();
+ }
+}
diff --git a/VPet.ModMaker/Models/I18nHelper.cs b/VPet.ModMaker/Models/I18nHelper.cs
index eb23bdc..cb85819 100644
--- a/VPet.ModMaker/Models/I18nHelper.cs
+++ b/VPet.ModMaker/Models/I18nHelper.cs
@@ -2,12 +2,14 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
+using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VPet.ModMaker.Models;
+// TODO: 更新事件
///
/// I18n助手
///
@@ -33,10 +35,7 @@ public class I18nHelper
CultureNames.CollectionChanged += Cultures_CollectionChanged;
}
- private void Cultures_CollectionChanged(
- object sender,
- System.Collections.Specialized.NotifyCollectionChangedEventArgs e
- )
+ private void Cultures_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
// 替换
if (e.NewStartingIndex == e.OldStartingIndex)
diff --git a/VPet.ModMaker/Models/I18nModelBase.cs b/VPet.ModMaker/Models/I18nModelBase.cs
new file mode 100644
index 0000000..48a4b20
--- /dev/null
+++ b/VPet.ModMaker/Models/I18nModelBase.cs
@@ -0,0 +1,89 @@
+using HKW.HKWUtils.Observable;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace VPet.ModMaker.Models;
+
+///
+/// I18n模型
+///
+/// 类型
+public class I18nModelBase : ObservableClass>
+ where T : class, new()
+{
+ ///
+ /// 当前I18n数据
+ ///
+
+ private T _CurrentI18nData = new();
+ public T CurrentI18nData
+ {
+ get => _CurrentI18nData;
+ set => SetProperty(ref _CurrentI18nData, value);
+ }
+
+ ///
+ /// 所有I18n数据
+ ///
+ public Dictionary I18nDatas { get; } = new();
+
+ public I18nModelBase()
+ {
+ I18nHelper.Current.CultureName.ValueChanged += CultureChanged;
+ I18nHelper.Current.AddCulture += AddCulture;
+ I18nHelper.Current.RemoveCulture += RemoveCulture;
+ I18nHelper.Current.ReplaceCulture += ReplaceCulture;
+ if (I18nHelper.Current.CultureNames.Count == 0)
+ return;
+ foreach (var item in I18nHelper.Current.CultureNames)
+ I18nDatas.Add(item, new());
+ CurrentI18nData = I18nDatas[I18nHelper.Current.CultureName.Value];
+ }
+
+ ///
+ /// 文化改变
+ ///
+ ///
+ ///
+ private void CultureChanged(ObservableValue sender, ValueChangedEventArgs e)
+ {
+ if (e.NewValue is null)
+ CurrentI18nData = null;
+ else if (I18nDatas.TryGetValue(e.NewValue, out var result))
+ CurrentI18nData = result;
+ }
+
+ ///
+ /// 添加文化
+ ///
+ /// 文化名称
+ private void AddCulture(string culture)
+ {
+ if (I18nDatas.ContainsKey(culture) is false)
+ I18nDatas.Add(culture, new());
+ }
+
+ ///
+ /// 删除文化
+ ///
+ /// 文化名称
+ private void RemoveCulture(string culture)
+ {
+ I18nDatas.Remove(culture);
+ }
+
+ ///
+ /// 替换文化
+ ///
+ /// 旧文化名称
+ /// 新文化名称
+ private void ReplaceCulture(string oldCulture, string newCulture)
+ {
+ var item = I18nDatas[oldCulture];
+ I18nDatas.Remove(oldCulture);
+ I18nDatas.Add(newCulture, item);
+ }
+}
diff --git a/VPet.ModMaker/Models/ModModel/ModInfoModel.cs b/VPet.ModMaker/Models/ModModel/ModInfoModel.cs
index 5e0765d..7fcdd17 100644
--- a/VPet.ModMaker/Models/ModModel/ModInfoModel.cs
+++ b/VPet.ModMaker/Models/ModModel/ModInfoModel.cs
@@ -21,12 +21,22 @@ using VPet_Simulator.Windows.Interface;
namespace VPet.ModMaker.Models;
-// TODO: 本体模组显示开关
///
/// 模组信息模型
///
public class ModInfoModel : I18nModel
{
+ ///
+ /// 自动设置食物推荐价格
+ ///
+ public ObservableValue AutoSetFoodPrice { get; } = new();
+
+ ///
+ /// 不显示本体宠物
+ ///
+ public ObservableValue DontShowMainPet { get; } = new(true);
+
+ #region ModInfo
///
/// 作者Id
///
@@ -77,6 +87,9 @@ public class ModInfoModel : I18nModel
///
public ObservableValue SourcePath { get; } = new();
+ #endregion
+
+ #region ModDatas
///
/// 食物
///
@@ -102,6 +115,11 @@ public class ModInfoModel : I18nModel
///
public ObservableCollection Pets { get; } = new();
+ ///
+ /// 宠物实际数量
+ ///
+ public ObservableValue PetDisplayedCount { get; } = new();
+
///
/// 其它I18n数据
///
@@ -111,7 +129,7 @@ public class ModInfoModel : I18nModel
/// 需要保存的I18n数据
///
public static Dictionary> SaveI18nDatas { get; } = new();
-
+ #endregion
public ModInfoModel()
{
DescriptionId.Value = $"{Id.Value}_{nameof(DescriptionId)}";
@@ -119,6 +137,24 @@ public class ModInfoModel : I18nModel
{
DescriptionId.Value = $"{n}_{nameof(DescriptionId)}";
};
+ Pets.CollectionChanged += Pets_CollectionChanged;
+ DontShowMainPet.ValueChanged += ShowMainPet_ValueChanged;
+ }
+
+ private void ShowMainPet_ValueChanged(
+ ObservableValue sender,
+ ValueChangedEventArgs e
+ )
+ {
+ Pets_CollectionChanged(null, null);
+ }
+
+ private void Pets_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
+ {
+ if (DontShowMainPet.Value)
+ PetDisplayedCount.Value = Pets.Count - Pets.Count(m => m.FromMain.Value);
+ else
+ PetDisplayedCount.Value = Pets.Count;
}
public ModInfoModel(ModLoader loader)
@@ -178,6 +214,9 @@ public class ModInfoModel : I18nModel
LoadAnime(petModel, p);
}
+ loader.Pets.First().Name = "TestMainPet";
+ Pets.Insert(0, new(loader.Pets.First(), true));
+
// 插入本体宠物
foreach (var pet in ModMakerInfo.MainPets)
{
diff --git a/VPet.ModMaker/Templates.xaml b/VPet.ModMaker/Templates.xaml
index ac14da7..43083a8 100644
--- a/VPet.ModMaker/Templates.xaml
+++ b/VPet.ModMaker/Templates.xaml
@@ -33,13 +33,13 @@
+ Value="{Binding DataContext.Min, RelativeSource={RelativeSource AncestorType=ListBoxItem}}" />
+ Value="{Binding DataContext.Max, RelativeSource={RelativeSource AncestorType=ListBoxItem}}" />
diff --git a/VPet.ModMaker/Usings.cs b/VPet.ModMaker/Usings.cs
index 2d09127..4f88b49 100644
--- a/VPet.ModMaker/Usings.cs
+++ b/VPet.ModMaker/Usings.cs
@@ -5,5 +5,6 @@ global using global::System.Linq;
global using global::System.Net.Http;
global using global::System.Threading;
global using global::System.Threading.Tasks;
+global using global::System.Collections.ObjectModel;
global using global::HKW.HKWUtils;
global using global::HKW.HKWUtils.Observable;
diff --git a/VPet.ModMaker/VPet.ModMaker.csproj b/VPet.ModMaker/VPet.ModMaker.csproj
index 3ffcaea..0bfebc1 100644
--- a/VPet.ModMaker/VPet.ModMaker.csproj
+++ b/VPet.ModMaker/VPet.ModMaker.csproj
@@ -98,6 +98,9 @@
App.xaml
+
+
+
diff --git a/VPet.ModMaker/ViewModels/ModEdit/AnimeEdit/AnimePageVM.cs b/VPet.ModMaker/ViewModels/ModEdit/AnimeEdit/AnimePageVM.cs
index 9fa6fd0..f81cf9d 100644
--- a/VPet.ModMaker/ViewModels/ModEdit/AnimeEdit/AnimePageVM.cs
+++ b/VPet.ModMaker/ViewModels/ModEdit/AnimeEdit/AnimePageVM.cs
@@ -18,6 +18,8 @@ namespace VPet.ModMaker.ViewModels.ModEdit.AnimeEdit;
public class AnimePageVM
{
+ public static ModInfoModel ModInfo => ModInfoModel.Current;
+
#region Value
///
/// 显示的动画
diff --git a/VPet.ModMaker/ViewModels/ModEdit/FoodEdit/FoodEditWindowVM.cs b/VPet.ModMaker/ViewModels/ModEdit/FoodEdit/FoodEditWindowVM.cs
index 98b0111..15d60a8 100644
--- a/VPet.ModMaker/ViewModels/ModEdit/FoodEdit/FoodEditWindowVM.cs
+++ b/VPet.ModMaker/ViewModels/ModEdit/FoodEdit/FoodEditWindowVM.cs
@@ -17,17 +17,16 @@ namespace VPet.ModMaker.ViewModels.ModEdit.FoodEdit;
public class FoodEditWindowVM
{
- public I18nHelper I18nData => I18nHelper.Current;
+ public static ModInfoModel ModInfo => ModInfoModel.Current;
+ public static I18nHelper I18nData => I18nHelper.Current;
#region Value
public FoodModel OldFood { get; set; }
public ObservableValue Food { get; } = new(new());
- public ObservableValue AutoSetReferencePrice { get; } = new(false);
#endregion
#region Command
public ObservableCommand AddImageCommand { get; } = new();
public ObservableCommand ChangeImageCommand { get; } = new();
-
public ObservableCommand SetReferencePriceCommand { get; } = new();
#endregion
@@ -35,28 +34,16 @@ public class FoodEditWindowVM
{
AddImageCommand.ExecuteCommand += AddImage;
ChangeImageCommand.ExecuteCommand += ChangeImage;
- AutoSetReferencePrice.ValueChanged += AutoSetReferencePrice_ValueChanged;
SetReferencePriceCommand.ExecuteCommand += SetReferencePriceToPrice;
Food.Value.ReferencePrice.ValueChanged += ReferencePrice_ValueChanged;
}
- private void AutoSetReferencePrice_ValueChanged(
- ObservableValue sender,
- ValueChangedEventArgs e
- )
- {
- if (e.NewValue)
- {
- SetReferencePriceToPrice(Food.Value.ReferencePrice.Value);
- }
- }
-
private void ReferencePrice_ValueChanged(
ObservableValue sender,
ValueChangedEventArgs e
)
{
- if (AutoSetReferencePrice.Value)
+ if (ModInfo.AutoSetFoodPrice.Value)
{
SetReferencePriceToPrice(e.NewValue);
}
diff --git a/VPet.ModMaker/ViewModels/ModEdit/MoveEdit/MovePageVM.cs b/VPet.ModMaker/ViewModels/ModEdit/MoveEdit/MovePageVM.cs
index 0cef5c4..81ed515 100644
--- a/VPet.ModMaker/ViewModels/ModEdit/MoveEdit/MovePageVM.cs
+++ b/VPet.ModMaker/ViewModels/ModEdit/MoveEdit/MovePageVM.cs
@@ -15,6 +15,7 @@ namespace VPet.ModMaker.ViewModels.ModEdit.MoveEdit;
public class MovePageVM
{
+ public static ModInfoModel ModInfo => ModInfoModel.Current;
#region Value
public ObservableValue> ShowMoves { get; } = new();
public ObservableCollection Moves => CurrentPet.Value.Moves;
diff --git a/VPet.ModMaker/ViewModels/ModEdit/PetEdit/PetPageVM.cs b/VPet.ModMaker/ViewModels/ModEdit/PetEdit/PetPageVM.cs
index 0f9dab0..fb62374 100644
--- a/VPet.ModMaker/ViewModels/ModEdit/PetEdit/PetPageVM.cs
+++ b/VPet.ModMaker/ViewModels/ModEdit/PetEdit/PetPageVM.cs
@@ -17,6 +17,7 @@ namespace VPet.ModMaker.ViewModels.ModEdit.PetEdit;
public class PetPageVM
{
+ public static ModInfoModel ModInfo => ModInfoModel.Current;
#region Value
public ObservableValue> ShowPets { get; } = new();
public ObservableCollection Pets => ModInfoModel.Current.Pets;
diff --git a/VPet.ModMaker/ViewModels/ModEdit/WorkEdit/WorkEditWindowVM.cs b/VPet.ModMaker/ViewModels/ModEdit/WorkEdit/WorkEditWindowVM.cs
index 33be058..e26aa3c 100644
--- a/VPet.ModMaker/ViewModels/ModEdit/WorkEdit/WorkEditWindowVM.cs
+++ b/VPet.ModMaker/ViewModels/ModEdit/WorkEdit/WorkEditWindowVM.cs
@@ -14,7 +14,8 @@ namespace VPet.ModMaker.ViewModels.ModEdit.WorkEdit;
public class WorkEditWindowVM
{
- public I18nHelper I18nData => I18nHelper.Current;
+ public static ModInfoModel ModInfo => ModInfoModel.Current;
+ public static I18nHelper I18nData => I18nHelper.Current;
#region Value
public PetModel CurrentPet { get; set; }
public WorkModel OldWork { get; set; }
diff --git a/VPet.ModMaker/ViewModels/ModEdit/WorkEdit/WorkPageVM.cs b/VPet.ModMaker/ViewModels/ModEdit/WorkEdit/WorkPageVM.cs
index 84859e6..9e44cda 100644
--- a/VPet.ModMaker/ViewModels/ModEdit/WorkEdit/WorkPageVM.cs
+++ b/VPet.ModMaker/ViewModels/ModEdit/WorkEdit/WorkPageVM.cs
@@ -15,6 +15,7 @@ namespace VPet.ModMaker.ViewModels.ModEdit.WorkEdit;
public class WorkPageVM
{
+ public static ModInfoModel ModInfo => ModInfoModel.Current;
#region Value
public ObservableValue> ShowWorks { get; } = new();
public ObservableCollection Works => CurrentPet.Value.Works;
diff --git a/VPet.ModMaker/ViewModels/ModMakerWindowVM.cs b/VPet.ModMaker/ViewModels/ModMakerWindowVM.cs
index 0b59975..581dd66 100644
--- a/VPet.ModMaker/ViewModels/ModMakerWindowVM.cs
+++ b/VPet.ModMaker/ViewModels/ModMakerWindowVM.cs
@@ -40,7 +40,7 @@ public class ModMakerWindowVM
///
/// 历史
///
- public ObservableCollection Histories { get; } = new();
+ public ObservableCollection Histories { get; set; } = new();
#endregion
#region Command
///
@@ -108,6 +108,7 @@ public class ModMakerWindowVM
if (Histories.All(h => h.InfoFile != history.InfoFile))
Histories.Add(history);
}
+ Histories = new(Histories.OrderByDescending(h => h.LastTime));
}
///
diff --git a/VPet.ModMaker/Views/ModEdit/AnimeEdit/AnimePage.xaml b/VPet.ModMaker/Views/ModEdit/AnimeEdit/AnimePage.xaml
index d91bbf6..29ca90a 100644
--- a/VPet.ModMaker/Views/ModEdit/AnimeEdit/AnimePage.xaml
+++ b/VPet.ModMaker/Views/ModEdit/AnimeEdit/AnimePage.xaml
@@ -45,6 +45,14 @@
diff --git a/VPet.ModMaker/Views/ModEdit/ClickTextEdit/ClickTextPage.xaml b/VPet.ModMaker/Views/ModEdit/ClickTextEdit/ClickTextPage.xaml
index 9edf5d2..224acb1 100644
--- a/VPet.ModMaker/Views/ModEdit/ClickTextEdit/ClickTextPage.xaml
+++ b/VPet.ModMaker/Views/ModEdit/ClickTextEdit/ClickTextPage.xaml
@@ -81,68 +81,116 @@
IsReadOnly="True"
SortMemberPath="WorkingState.Value" />
+ SortMemberPath="DayTime.EnumValue" />
+ SortMemberPath="Like.Min">
+
+
+
+
+
+
+
+ SortMemberPath="Health.Min">
+
+
+
+
+
+
+
+ SortMemberPath="Level.Min">
+
+
+
+
+
+
+
+ SortMemberPath="Money.Min">
+
+
+
+
+
+
+
+ SortMemberPath="Food.Min">
+
+
+
+
+
+
+
+ SortMemberPath="Drink.Min">
+
+
+
+
+
+
+
+ SortMemberPath="Feel.Min">
+
+
+
+
+
+
+
+ SortMemberPath="Strength.Min">
+
+
+
+
+
+
+
+ IsChecked="{Binding ModInfo.AutoSetFoodPrice.Value}" />
diff --git a/VPet.ModMaker/Views/ModEdit/ModEditWindow.xaml b/VPet.ModMaker/Views/ModEdit/ModEditWindow.xaml
index 7f173c7..3a29857 100644
--- a/VPet.ModMaker/Views/ModEdit/ModEditWindow.xaml
+++ b/VPet.ModMaker/Views/ModEdit/ModEditWindow.xaml
@@ -176,7 +176,7 @@
-
+
diff --git a/VPet.ModMaker/Views/ModEdit/MoveEdit/MovePage.xaml b/VPet.ModMaker/Views/ModEdit/MoveEdit/MovePage.xaml
index fc97e29..467a103 100644
--- a/VPet.ModMaker/Views/ModEdit/MoveEdit/MovePage.xaml
+++ b/VPet.ModMaker/Views/ModEdit/MoveEdit/MovePage.xaml
@@ -45,6 +45,14 @@
diff --git a/VPet.ModMaker/Views/ModEdit/PetEdit/PetPage.xaml b/VPet.ModMaker/Views/ModEdit/PetEdit/PetPage.xaml
index b4222f4..7fc12e9 100644
--- a/VPet.ModMaker/Views/ModEdit/PetEdit/PetPage.xaml
+++ b/VPet.ModMaker/Views/ModEdit/PetEdit/PetPage.xaml
@@ -18,10 +18,20 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/VPet.ModMaker/Views/ModEdit/SelectTextEdit/SelectTextPage.xaml b/VPet.ModMaker/Views/ModEdit/SelectTextEdit/SelectTextPage.xaml
index d728915..88433ee 100644
--- a/VPet.ModMaker/Views/ModEdit/SelectTextEdit/SelectTextPage.xaml
+++ b/VPet.ModMaker/Views/ModEdit/SelectTextEdit/SelectTextPage.xaml
@@ -91,61 +91,109 @@
IsReadOnly="True"
SortMemberPath="Mode.EnumValue" />
+ SortMemberPath="Like.Min">
+
+
+
+
+
+
+
+ SortMemberPath="Health.Min">
+
+
+
+
+
+
+
+ SortMemberPath="Level.Min">
+
+
+
+
+
+
+
+ SortMemberPath="Money.Min">
+
+
+
+
+
+
+
+ SortMemberPath="Food.Min">
+
+
+
+
+
+
+
+ SortMemberPath="Drink.Min">
+
+
+
+
+
+
+
+ SortMemberPath="Feel.Min">
+
+
+
+
+
+
+
+ SortMemberPath="Strength.Min">
+
+
+
+
+
+
+