mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
# VPet.Solution
修复清除失效模组功能异常的问题 修复关闭模组后,保存错误的问题
This commit is contained in:
parent
470c0d4361
commit
9b3d39690e
@ -1,7 +1,7 @@
|
|||||||
using LinePutScript;
|
using System.Collections.ObjectModel;
|
||||||
using LinePutScript.Localization.WPF;
|
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using LinePutScript;
|
||||||
|
using LinePutScript.Localization.WPF;
|
||||||
|
|
||||||
namespace VPet.Solution.Models.SettingEditor;
|
namespace VPet.Solution.Models.SettingEditor;
|
||||||
|
|
||||||
@ -94,10 +94,10 @@ public class ModSettingModel : ObservableClass<ModSettingModel>
|
|||||||
setting.Remove(ModLineName);
|
setting.Remove(ModLineName);
|
||||||
setting.Remove(PassModLineName);
|
setting.Remove(PassModLineName);
|
||||||
setting.Remove(MsgModLineName);
|
setting.Remove(MsgModLineName);
|
||||||
if (Mods.Any() is false)
|
|
||||||
return;
|
|
||||||
foreach (var mod in Mods)
|
foreach (var mod in Mods)
|
||||||
{
|
{
|
||||||
|
if (mod.IsEnabled is false)
|
||||||
|
continue;
|
||||||
setting[ModLineName].Add(new Sub(mod.ID.ToLower()));
|
setting[ModLineName].Add(new Sub(mod.ID.ToLower()));
|
||||||
setting[MsgModLineName].Add(new Sub(mod.ID, "True"));
|
setting[MsgModLineName].Add(new Sub(mod.ID, "True"));
|
||||||
if (mod.IsPass)
|
if (mod.IsPass)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
using LinePutScript.Localization.WPF;
|
using System.Windows;
|
||||||
using System.Windows;
|
using LinePutScript.Localization.WPF;
|
||||||
using VPet.Solution.Models.SettingEditor;
|
using VPet.Solution.Models.SettingEditor;
|
||||||
|
|
||||||
namespace VPet.Solution.ViewModels.SettingEditor;
|
namespace VPet.Solution.ViewModels.SettingEditor;
|
||||||
@ -37,16 +37,16 @@ public class ModSettingPageVM : ObservableClass<ModSettingPageVM>
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region CurrentModMoel
|
#region CurrentModMoel
|
||||||
private ModModel _currentModModel;
|
private ModModel _currentModModel = null!;
|
||||||
public ModModel CurrentModMoel
|
public ModModel CurrentModModel
|
||||||
{
|
{
|
||||||
get => _currentModModel;
|
get => _currentModModel;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_currentModModel is not null)
|
if (_currentModModel is not null)
|
||||||
_currentModModel.PropertyChangingX -= CurrentModModel_PropertyChangingX;
|
_currentModModel.PropertyChangingX -= CurrentModModel_PropertyChangingX;
|
||||||
SetProperty(ref _currentModModel, value);
|
SetProperty(ref _currentModModel!, value);
|
||||||
if (value is not null)
|
if (_currentModModel is not null)
|
||||||
_currentModModel.PropertyChangingX += CurrentModModel_PropertyChangingX;
|
_currentModModel.PropertyChangingX += CurrentModModel_PropertyChangingX;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -117,7 +117,7 @@ public class ModSettingPageVM : ObservableClass<ModSettingPageVM>
|
|||||||
for (var i = 0; i < ModSetting.Mods.Count; i++)
|
for (var i = 0; i < ModSetting.Mods.Count; i++)
|
||||||
{
|
{
|
||||||
if (ModSetting.Mods[i].IsEnabled is null)
|
if (ModSetting.Mods[i].IsEnabled is null)
|
||||||
ModSetting.Mods.RemoveAt(i);
|
ModSetting.Mods.RemoveAt(i--);
|
||||||
}
|
}
|
||||||
SearchMod = string.Empty;
|
SearchMod = string.Empty;
|
||||||
}
|
}
|
||||||
@ -158,8 +158,8 @@ public class ModSettingPageVM : ObservableClass<ModSettingPageVM>
|
|||||||
if (string.IsNullOrWhiteSpace(name))
|
if (string.IsNullOrWhiteSpace(name))
|
||||||
ShowMods = ModSetting.Mods;
|
ShowMods = ModSetting.Mods;
|
||||||
else
|
else
|
||||||
ShowMods = ModSetting.Mods.Where(
|
ShowMods = ModSetting.Mods.Where(s =>
|
||||||
s => s.Name.Contains(SearchMod, StringComparison.OrdinalIgnoreCase)
|
s.Name.Contains(SearchMod, StringComparison.OrdinalIgnoreCase)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
AutoGenerateColumns="False"
|
AutoGenerateColumns="False"
|
||||||
CanUserAddRows="False"
|
CanUserAddRows="False"
|
||||||
ItemsSource="{Binding ShowMods}"
|
ItemsSource="{Binding ShowMods}"
|
||||||
SelectedItem="{Binding CurrentModMoel}">
|
SelectedItem="{Binding CurrentModModel}">
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
<DataGridTextColumn
|
<DataGridTextColumn
|
||||||
Binding="{Binding Name}"
|
Binding="{Binding Name}"
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
xmlns:system="clr-namespace:System;assembly=mscorlib"
|
xmlns:system="clr-namespace:System;assembly=mscorlib"
|
||||||
xmlns:vm="clr-namespace:VPet.Solution.ViewModels.SettingEditor"
|
xmlns:vm="clr-namespace:VPet.Solution.ViewModels.SettingEditor"
|
||||||
Title="{ll:Str 'VPET 设置编辑器'}"
|
Title="{ll:Str 'VPET 设置编辑器'}"
|
||||||
Width="800"
|
Width="1000"
|
||||||
Height="450"
|
Height="600"
|
||||||
MinWidth="400"
|
MinWidth="400"
|
||||||
MinHeight="200"
|
MinHeight="200"
|
||||||
d:DataContext="{d:DesignInstance Type=vm:SettingWindowVM}"
|
d:DataContext="{d:DesignInstance Type=vm:SettingWindowVM}"
|
||||||
|
Loading…
Reference in New Issue
Block a user