- 工作,移动,动画页面设置默认选中的宠物
- 忽略`Food.Name`为空的内容
- 忽略`ClickText.Text`为空的内容
- 忽略`LowText.Text`为空的内容
- 忽略`SelectText.Text`为空的内容
This commit is contained in:
Hakoyu 2024-03-30 17:48:23 +08:00
parent eadbb20f9b
commit d7b8f23a63
8 changed files with 40 additions and 11 deletions

View File

@ -48,13 +48,23 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
var imagePath = Path.Combine(loader.ModPath.FullName, "icon.png");
if (File.Exists(imagePath))
Image = NativeUtils.LoadImageToMemoryStream(imagePath);
foreach (var food in loader.Foods)
foreach (var food in loader.Foods.Where(m => string.IsNullOrWhiteSpace(m.Name) is false))
Foods.Add(new(food));
foreach (var clickText in loader.ClickTexts)
foreach (
var clickText in loader.ClickTexts.Where(m =>
string.IsNullOrWhiteSpace(m.Text) is false
)
)
ClickTexts.Add(new(clickText));
foreach (var lowText in loader.LowTexts)
foreach (
var lowText in loader.LowTexts.Where(m => string.IsNullOrWhiteSpace(m.Text) is false)
)
LowTexts.Add(new(lowText));
foreach (var selectText in loader.SelectTexts)
foreach (
var selectText in loader.SelectTexts.Where(m =>
string.IsNullOrWhiteSpace(m.Text) is false
)
)
SelectTexts.Add(new(selectText));
// 载入模组宠物

View File

@ -57,7 +57,11 @@ public static class ModUpdataHelper
{
MessageBox.Show(
ModEditWindow.Current,
"模组更新失败\n当前版本: {0}\n目标版本: {1}\n{2}".Translate(mod.ModVersion, action.Key, ex)
"模组更新失败\n当前支持的游戏版本: {0}\n目标支持的游戏版本: {1}\n{2}".Translate(
mod.ModVersion,
action.Key,
ex
)
);
return false;
}
@ -68,11 +72,11 @@ public static class ModUpdataHelper
public static SortedDictionary<int, Action<ModInfoModel>> UpdataAction { get; } =
new()
{
[11000] = (ModInfoModel m) =>
[11000] = (m) =>
{
// 修改宠物默认ID
foreach (var pet in m.Pets)
{
// 修改宠物默认ID
if (pet.ID == "默认虚拟桌宠")
pet.ID = "vup";
foreach (var work in pet.Works)

View File

@ -7,6 +7,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using HKW.HKWUtils.Extensions;
using HKW.HKWUtils.Observable;
using LinePutScript.Localization.WPF;
using Panuon.WPF.UI;
@ -37,8 +38,12 @@ public class AnimePageVM : ObservableObjectX<AnimePageVM>
},
FilteredList = new()
};
CurrentPet = Pets.First();
PropertyChangedX += AnimePageVM_PropertyChangedX;
if (Pets.HasValue())
CurrentPet = Pets.FirstOrDefault(
m => m.FromMain is false && m.AnimeCount > 0,
Pets.First()
);
AddCommand.ExecuteCommand += AddCommand_ExecuteCommand;
EditCommand.ExecuteCommand += EditCommand_ExecuteCommand;

View File

@ -24,8 +24,12 @@ public class MovePageVM : ObservableObjectX<MovePageVM>
Filter = f => f.Graph.Contains(Search, StringComparison.OrdinalIgnoreCase),
FilteredList = new()
};
CurrentPet = Pets.First();
PropertyChanged += MovePageVM_PropertyChanged;
if (Pets.HasValue())
CurrentPet = Pets.FirstOrDefault(
m => m.FromMain is false && m.Moves.HasValue(),
Pets.First()
);
AddCommand.ExecuteCommand += AddCommand_ExecuteCommand;
EditCommand.ExecuteCommand += EditCommand_ExecuteCommand;
RemoveCommand.ExecuteCommand += RemoveCommand_ExecuteCommand;

View File

@ -24,8 +24,12 @@ public class WorkPageVM : ObservableObjectX<WorkPageVM>
Filter = f => f.ID.Contains(Search, StringComparison.OrdinalIgnoreCase),
FilteredList = new()
};
CurrentPet = Pets.First();
PropertyChanged += WorkPageVM_PropertyChanged;
if (Pets.HasValue())
CurrentPet = Pets.FirstOrDefault(
m => m.FromMain is false && m.Works.HasValue(),
Pets.First()
);
AddCommand.ExecuteCommand += AddCommand_ExecuteCommand;
EditCommand.ExecuteCommand += EditCommand_ExecuteCommand;
RemoveCommand.ExecuteCommand += RemoveCommand_ExecuteCommand;

View File

@ -38,6 +38,7 @@
<ComboBox
x:Name="ComboBox_Pet"
Grid.Column="1"
MinWidth="100"
pu:ComboBoxHelper.Watermark="{ll:Str 选择宠物}"
ItemsSource="{Binding Pets}"
SelectedItem="{Binding CurrentPet}"

View File

@ -38,6 +38,7 @@
<ComboBox
x:Name="ComboBox_Pet"
Grid.Column="1"
MinWidth="100"
pu:ComboBoxHelper.Watermark="{ll:Str 选择宠物}"
ItemsSource="{Binding Pets}"
SelectedItem="{Binding CurrentPet}"

View File

@ -41,7 +41,7 @@
<ComboBox
x:Name="ComboBox_Pet"
Grid.Column="1"
MinWidth="150"
MinWidth="100"
pu:ComboBoxHelper.Watermark="{ll:Str 选择宠物}"
ItemsSource="{Binding Pets}"
SelectedItem="{Binding CurrentPet}"