diff --git a/VPet.ModMaker/VPet.ModMaker.csproj b/VPet.ModMaker/VPet.ModMaker.csproj
index dcdec11..348deec 100644
--- a/VPet.ModMaker/VPet.ModMaker.csproj
+++ b/VPet.ModMaker/VPet.ModMaker.csproj
@@ -59,11 +59,11 @@
..\packages\LinePutScript.Localization.WPF.1.0.6\lib\net462\LinePutScript.Localization.WPF.dll
-
- ..\packages\Panuon.WPF.1.0.2\lib\net462\Panuon.WPF.dll
+
+ ..\packages\Panuon.WPF.1.0.3\lib\net462\Panuon.WPF.dll
-
- ..\packages\Panuon.WPF.UI.1.1.15.8\lib\net462\Panuon.WPF.UI.dll
+
+ ..\packages\Panuon.WPF.UI.1.1.16.2\lib\net462\Panuon.WPF.UI.dll
@@ -77,10 +77,10 @@
4.0
- ..\packages\VPet-Simulator.Core.1.0.5.1\lib\net462\VPet-Simulator.Core.dll
+ ..\packages\VPet-Simulator.Core.1.0.7\lib\net462\VPet-Simulator.Core.dll
- ..\packages\VPet-Simulator.Windows.Interface.1.0.5.2\lib\net462\VPet-Simulator.Windows.Interface.dll
+ ..\packages\VPet-Simulator.Windows.Interface.1.0.7\lib\net462\VPet-Simulator.Windows.Interface.dll
@@ -117,6 +117,7 @@
+
@@ -158,8 +159,8 @@
LowTextEditWindow.xaml
-
- AddLangWindow.xaml
+
+ AddCultureWindow.xaml
@@ -277,7 +278,7 @@
Designer
MSBuild:Compile
-
+
Designer
MSBuild:Compile
diff --git a/VPet.ModMaker/ViewModels/ModEdit/AddCultureWindowVM.cs b/VPet.ModMaker/ViewModels/ModEdit/AddCultureWindowVM.cs
new file mode 100644
index 0000000..57f503c
--- /dev/null
+++ b/VPet.ModMaker/ViewModels/ModEdit/AddCultureWindowVM.cs
@@ -0,0 +1,43 @@
+using HKW.HKWViewModels.SimpleObservable;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using VPet.ModMaker.Models;
+
+namespace VPet.ModMaker.ViewModels.ModEdit;
+
+public class AddCultureWindowVM
+{
+ public ObservableValue> ShowCultures { get; } = new();
+ public static ObservableCollection AllCultures { get; set; } =
+ new(LinePutScript.Localization.WPF.LocalizeCore.AvailableCultures);
+ public ObservableValue Culture { get; } = new();
+
+ public ObservableValue Search { get; } = new();
+
+ public AddCultureWindowVM()
+ {
+ ShowCultures.Value = AllCultures;
+ AllCultures.Add("zh-Hans");
+ AllCultures.Add("zh-Hant");
+ AllCultures.Add("en-US");
+ Search.ValueChanged += Search_ValueChanged;
+ }
+
+ private void Search_ValueChanged(string oldValue, string newValue)
+ {
+ if (string.IsNullOrWhiteSpace(newValue))
+ {
+ ShowCultures.Value = AllCultures;
+ }
+ else
+ {
+ ShowCultures.Value = new(
+ AllCultures.Where(s => s.Contains(newValue, StringComparison.OrdinalIgnoreCase))
+ );
+ }
+ }
+}
diff --git a/VPet.ModMaker/ViewModels/ModEdit/ModEditWindowVM.cs b/VPet.ModMaker/ViewModels/ModEdit/ModEditWindowVM.cs
index 65a5e2a..faa2afb 100644
--- a/VPet.ModMaker/ViewModels/ModEdit/ModEditWindowVM.cs
+++ b/VPet.ModMaker/ViewModels/ModEdit/ModEditWindowVM.cs
@@ -30,10 +30,10 @@ public class ModEditWindowVM
#region Command
public ObservableCommand AddImageCommand { get; } = new();
public ObservableCommand ChangeImageCommand { get; } = new();
- public ObservableCommand AddLangCommand { get; } = new();
+ public ObservableCommand AddCultureCommand { get; } = new();
- public ObservableCommand EditLangCommand { get; } = new();
- public ObservableCommand RemoveLangCommand { get; } = new();
+ public ObservableCommand EditCultureCommand { get; } = new();
+ public ObservableCommand RemoveCultureCommand { get; } = new();
public ObservableCommand SaveCommand { get; } = new();
public ObservableCommand SaveToCommand { get; } = new();
@@ -48,9 +48,9 @@ public class ModEditWindowVM
AddImageCommand.ExecuteEvent += AddImage;
ChangeImageCommand.ExecuteEvent += ChangeImage;
- AddLangCommand.ExecuteEvent += AddLang;
- EditLangCommand.ExecuteEvent += EditLang;
- RemoveLangCommand.ExecuteEvent += RemoveLang;
+ AddCultureCommand.ExecuteEvent += AddCulture;
+ EditCultureCommand.ExecuteEvent += EditCulture;
+ RemoveCultureCommand.ExecuteEvent += RemoveLang;
SaveCommand.ExecuteEvent += Save;
SaveToCommand.ExecuteEvent += SaveTo;
}
@@ -96,28 +96,29 @@ public class ModEditWindowVM
}
}
- private void AddLang()
+ private void AddCulture()
{
- var window = new Window_AddLang();
+ var window = new AddCultureWindow();
window.ShowDialog();
if (window.IsCancel)
return;
- I18nHelper.Current.CultureNames.Add(window.Lang.Value);
+ I18nHelper.Current.CultureNames.Add(window.ViewModel.Culture.Value);
if (I18nHelper.Current.CultureNames.Count == 1)
- I18nHelper.Current.CultureName.Value = window.Lang.Value;
+ I18nHelper.Current.CultureName.Value = window.ViewModel.Culture.Value;
}
- private void EditLang(string oldLang)
+ private void EditCulture(string oldLang)
{
- var window = new Window_AddLang();
- window.Lang.Value = oldLang.Translate();
+ var window = new AddCultureWindow();
+ window.ViewModel.Culture.Value = oldLang.Translate();
window.ShowDialog();
if (window.IsCancel)
return;
I18nHelper.Current.CultureNames[I18nHelper.Current.CultureNames.IndexOf(oldLang)] = window
- .Lang
+ .ViewModel
+ .Culture
.Value;
- CurrentLang.Value = window.Lang.Value;
+ CurrentLang.Value = window.ViewModel.Culture.Value;
}
private void RemoveLang(string oldLang)
diff --git a/VPet.ModMaker/Views/ModEdit/AddCultureWindow.xaml b/VPet.ModMaker/Views/ModEdit/AddCultureWindow.xaml
new file mode 100644
index 0000000..8331bcd
--- /dev/null
+++ b/VPet.ModMaker/Views/ModEdit/AddCultureWindow.xaml
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/VPet.ModMaker/Views/ModEdit/AddLangWindow.xaml.cs b/VPet.ModMaker/Views/ModEdit/AddCultureWindow.xaml.cs
similarity index 69%
rename from VPet.ModMaker/Views/ModEdit/AddLangWindow.xaml.cs
rename to VPet.ModMaker/Views/ModEdit/AddCultureWindow.xaml.cs
index eaa6dc7..fc6686e 100644
--- a/VPet.ModMaker/Views/ModEdit/AddLangWindow.xaml.cs
+++ b/VPet.ModMaker/Views/ModEdit/AddCultureWindow.xaml.cs
@@ -15,6 +15,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using VPet.ModMaker.Models;
+using VPet.ModMaker.ViewModels;
using VPet.ModMaker.ViewModels.ModEdit;
namespace VPet.ModMaker.Views.ModEdit;
@@ -22,16 +23,16 @@ namespace VPet.ModMaker.Views.ModEdit;
///
/// Window_AddLang.xaml 的交互逻辑
///
-public partial class Window_AddLang : Window
+public partial class AddCultureWindow : Window
{
- public bool IsCancel { get; internal set; } = true;
+ public bool IsCancel { get; private set; } = true;
- public ObservableValue Lang { get; } = new();
+ public AddCultureWindowVM ViewModel => (AddCultureWindowVM)DataContext;
- public Window_AddLang()
+ public AddCultureWindow()
{
InitializeComponent();
- this.DataContext = this;
+ DataContext = new AddCultureWindowVM();
TextBox_Lang.Focus();
}
@@ -42,14 +43,14 @@ public partial class Window_AddLang : Window
private void Button_Yes_Click(object sender, RoutedEventArgs e)
{
- if (string.IsNullOrEmpty(Lang.Value))
+ if (string.IsNullOrEmpty(ViewModel.Culture.Value))
{
- MessageBox.Show("Lang不可为空", "", MessageBoxButton.OK, MessageBoxImage.Warning);
+ MessageBox.Show("文化不可为空", "", MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
- if (I18nHelper.Current.CultureNames.Contains(Lang.Value))
+ if (I18nHelper.Current.CultureNames.Contains(ViewModel.Culture.Value))
{
- MessageBox.Show("此语言已存在", "", MessageBoxButton.OK, MessageBoxImage.Warning);
+ MessageBox.Show("此文化已存在", "", MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
IsCancel = false;
diff --git a/VPet.ModMaker/Views/ModEdit/AddLangWindow.xaml b/VPet.ModMaker/Views/ModEdit/AddLangWindow.xaml
deleted file mode 100644
index 32e837c..0000000
--- a/VPet.ModMaker/Views/ModEdit/AddLangWindow.xaml
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/VPet.ModMaker/Views/ModEdit/ModEditWindow.xaml b/VPet.ModMaker/Views/ModEdit/ModEditWindow.xaml
index de4951c..6b4db9a 100644
--- a/VPet.ModMaker/Views/ModEdit/ModEditWindow.xaml
+++ b/VPet.ModMaker/Views/ModEdit/ModEditWindow.xaml
@@ -18,13 +18,13 @@
-
+
@@ -44,7 +44,7 @@
diff --git a/VPet.ModMaker/packages.config b/VPet.ModMaker/packages.config
index 46fc1db..2d65b26 100644
--- a/VPet.ModMaker/packages.config
+++ b/VPet.ModMaker/packages.config
@@ -2,8 +2,8 @@
-
-
-
-
+
+
+
+
\ No newline at end of file