mirror of
https://github.com/LorisYounger/VPet.ModMaker.git
synced 2024-08-30 18:22:21 +00:00
# 修复
- 启动时本体宠物无法载入的问题
This commit is contained in:
@ -5,7 +5,7 @@
|
|||||||
<c:MarginMultiConverter x:Key="MarginConverter" />
|
<c:MarginMultiConverter x:Key="MarginConverter" />
|
||||||
<c:MarginMultiConverter x:Key="RatioMarginConverter" HasRatio="True" />
|
<c:MarginMultiConverter x:Key="RatioMarginConverter" HasRatio="True" />
|
||||||
<c:CalculatorMultiConverter x:Key="CalculatorConverter" />
|
<c:CalculatorMultiConverter x:Key="CalculatorConverter" />
|
||||||
<c:StringFormatMultiConverter x:Key="StringFormatConverter" />
|
<c:StringFormatMultiConverter x:Key="StringFormatConverter" HiddenUnsetAndNull="True" />
|
||||||
<c:SolidColorBrushToMediaColorConverter x:Key="BrushToMediaColorConverter" />
|
<c:SolidColorBrushToMediaColorConverter x:Key="BrushToMediaColorConverter" />
|
||||||
<!--<c:MaxConverter x:Key="MaxConverter" />-->
|
<!--<c:MaxConverter x:Key="MaxConverter" />-->
|
||||||
<c:BoolToVisibilityConverter x:Key="FalseToCollapsedConverter" />
|
<c:BoolToVisibilityConverter x:Key="FalseToCollapsedConverter" />
|
||||||
|
@ -40,7 +40,7 @@ public class ModMaker : MainPlugin
|
|||||||
Application.Current.Resources.MergedDictionaries.Add(ModMakerInfo.NativeStyles);
|
Application.Current.Resources.MergedDictionaries.Add(ModMakerInfo.NativeStyles);
|
||||||
}
|
}
|
||||||
|
|
||||||
public I18nResource<string, string> I18nResource { get; } =
|
public static I18nResource<string, string> I18nResource { get; } =
|
||||||
new() { FillDefaultValueForNewCulture = true, DefaultValue = string.Empty };
|
new() { FillDefaultValueForNewCulture = true, DefaultValue = string.Empty };
|
||||||
|
|
||||||
public override void Setting()
|
public override void Setting()
|
||||||
|
@ -55,4 +55,19 @@ public static class ModMakerInfo
|
|||||||
{
|
{
|
||||||
return AnimeTypeModel.HasNameAnimes.Contains(graphType);
|
return AnimeTypeModel.HasNameAnimes.Contains(graphType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static ModMakerInfo()
|
||||||
|
{
|
||||||
|
//#if DEBUG
|
||||||
|
// MainPets.TryAdd(
|
||||||
|
// "TestMainPet",
|
||||||
|
// new()
|
||||||
|
// {
|
||||||
|
// ID = "TestMainPet",
|
||||||
|
// FromMain = true,
|
||||||
|
// I18nResource = new()
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
//#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,12 @@ public class ModInfoModel : ObservableObjectX
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
foreach (var pet in ModMakerInfo.MainPets)
|
||||||
|
{
|
||||||
|
// 确保ID不重复
|
||||||
|
if (Pets.All(i => i.ID != pet.Key))
|
||||||
|
Pets.Add(pet.Value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModInfoModel(ModLoader loader)
|
public ModInfoModel(ModLoader loader)
|
||||||
@ -118,14 +124,6 @@ public class ModInfoModel : ObservableObjectX
|
|||||||
foreach (var p in pet.path)
|
foreach (var p in pet.path)
|
||||||
LoadAnime(petModel, p);
|
LoadAnime(petModel, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 插入本体宠物
|
|
||||||
foreach (var pet in ModMakerInfo.MainPets)
|
|
||||||
{
|
|
||||||
// 确保ID不重复
|
|
||||||
if (Pets.All(i => i.ID != pet.Key))
|
|
||||||
Pets.Insert(0, pet.Value);
|
|
||||||
}
|
|
||||||
if (loader.I18nDatas.HasValue() is false)
|
if (loader.I18nDatas.HasValue() is false)
|
||||||
return;
|
return;
|
||||||
LoadI18nDatas(loader);
|
LoadI18nDatas(loader);
|
||||||
|
@ -112,12 +112,7 @@ public class PetModel : ObservableObjectX
|
|||||||
RaisePoint.Ill = new(loader.Config.RaisePoint[3].X, loader.Config.RaisePoint[3].Y);
|
RaisePoint.Ill = new(loader.Config.RaisePoint[3].X, loader.Config.RaisePoint[3].Y);
|
||||||
// 如果这个宠物数据来自本体, 则不载入 Work 和 Move
|
// 如果这个宠物数据来自本体, 则不载入 Work 和 Move
|
||||||
if (FromMain = fromMain)
|
if (FromMain = fromMain)
|
||||||
{
|
|
||||||
Name = ID.Translate();
|
|
||||||
PetName = PetNameID.Translate();
|
|
||||||
Description = DescriptionID.Translate();
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var work in loader.Config.Works)
|
foreach (var work in loader.Config.Works)
|
||||||
Works.Add(new(work) { I18nResource = I18nResource! });
|
Works.Add(new(work) { I18nResource = I18nResource! });
|
||||||
@ -163,7 +158,7 @@ public class PetModel : ObservableObjectX
|
|||||||
private string _petNameID = string.Empty;
|
private string _petNameID = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 名称Id
|
/// 名称ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string PetNameID
|
public string PetNameID
|
||||||
{
|
{
|
||||||
@ -177,7 +172,7 @@ public class PetModel : ObservableObjectX
|
|||||||
private string _descriptionID = string.Empty;
|
private string _descriptionID = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 描述Id
|
/// 描述ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string DescriptionID
|
public string DescriptionID
|
||||||
{
|
{
|
||||||
@ -217,6 +212,32 @@ public class PetModel : ObservableObjectX
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
if (FromMain)
|
||||||
|
{
|
||||||
|
foreach (var cultureName in LocalizeCore.AvailableCultures)
|
||||||
|
{
|
||||||
|
if (LocalizeCore.Localizations.TryGetValue(cultureName, out var data) is false)
|
||||||
|
continue;
|
||||||
|
foreach (var line in data)
|
||||||
|
{
|
||||||
|
if (line?.Name == ID)
|
||||||
|
{
|
||||||
|
I18nResource.AddCultureData(cultureName, ID, line.Info);
|
||||||
|
}
|
||||||
|
else if (line?.Name == PetNameID)
|
||||||
|
{
|
||||||
|
I18nResource.AddCultureData(cultureName, PetNameID, line.Info);
|
||||||
|
}
|
||||||
|
else if (line?.Name == DescriptionID)
|
||||||
|
{
|
||||||
|
I18nResource.AddCultureData(cultureName, DescriptionID, line.Info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
I18nResource.AddCultureData(cultureName, ID, ID);
|
||||||
|
I18nResource.AddCultureData(cultureName, PetNameID, PetNameID);
|
||||||
|
I18nResource.AddCultureData(cultureName, DescriptionID, DescriptionID);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[AdaptIgnore]
|
[AdaptIgnore]
|
||||||
|
@ -14,34 +14,34 @@
|
|||||||
<Configurations>Debug;Release;Test</Configurations>
|
<Configurations>Debug;Release;Test</Configurations>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
<DebugType>embedded</DebugType>
|
<DebugType>embedded</DebugType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||||
<DebugType>embedded</DebugType>
|
<DebugType>embedded</DebugType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Test|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Test|AnyCPU'">
|
||||||
<DebugType>embedded</DebugType>
|
<DebugType>embedded</DebugType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="Resources\food.png" />
|
<EmbeddedResource Include="Resources\food.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Condition="'$(Configuration)'=='Test'">
|
<ItemGroup Condition="'$(Configuration)'=='Test'">
|
||||||
<Reference Include="HKW.Utils">
|
<Reference Include="HKW.Utils">
|
||||||
<HintPath>..\..\HKW.Utils\HKW.Utils\bin\Debug\net8.0\HKW.Utils.dll</HintPath>
|
<HintPath>..\..\HKW.Utils\HKW.Utils\bin\Debug\net8.0\HKW.Utils.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="HKW.WPF">
|
<Reference Include="HKW.WPF">
|
||||||
<HintPath>..\..\HKW.WPF\HKW.WPF\bin\Debug\net8.0-windows\HKW.WPF.dll</HintPath>
|
<HintPath>..\..\HKW.WPF\HKW.WPF\bin\Debug\net8.0-windows\HKW.WPF.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Condition="'$(Configuration)'!='Test'">
|
<ItemGroup Condition="'$(Configuration)'!='Test'">
|
||||||
<PackageReference Include="HKW.WPF" Version="1.0.6" />
|
<PackageReference Include="HKW.WPF" Version="1.0.7" />
|
||||||
<PackageReference Include="HKW.Utils" Version="1.2.21" />
|
<PackageReference Include="HKW.Utils" Version="1.2.21" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="VPet-Simulator.Core" Version="1.1.0.4" />
|
<PackageReference Include="VPet-Simulator.Core" Version="1.1.0.12" />
|
||||||
<PackageReference Include="VPet-Simulator.Windows.Interface" Version="1.1.0.5" />
|
<PackageReference Include="VPet-Simulator.Windows.Interface" Version="1.1.0.12" />
|
||||||
<PackageReference Include="LinePutScript" Version="1.11.6" />
|
<PackageReference Include="LinePutScript" Version="1.11.6" />
|
||||||
<PackageReference Include="LinePutScript.Localization.WPF" Version="1.0.6" />
|
<PackageReference Include="LinePutScript.Localization.WPF" Version="1.0.7" />
|
||||||
<PackageReference Include="Ookii.Dialogs.Wpf" Version="5.0.1" />
|
<PackageReference Include="Ookii.Dialogs.Wpf" Version="5.0.1" />
|
||||||
<PackageReference Include="Panuon.WPF" Version="1.1.0" />
|
<PackageReference Include="Panuon.WPF" Version="1.1.0" />
|
||||||
<PackageReference Include="Panuon.WPF.UI" Version="1.2.1.2" />
|
<PackageReference Include="Panuon.WPF.UI" Version="1.2.1.2" />
|
||||||
|
@ -48,6 +48,21 @@ public class AnimePageVM : ObservableObjectX
|
|||||||
AddCommand.ExecuteCommand += AddCommand_ExecuteCommand;
|
AddCommand.ExecuteCommand += AddCommand_ExecuteCommand;
|
||||||
EditCommand.ExecuteCommand += EditCommand_ExecuteCommand;
|
EditCommand.ExecuteCommand += EditCommand_ExecuteCommand;
|
||||||
RemoveCommand.ExecuteCommand += RemoveCommand_ExecuteCommand;
|
RemoveCommand.ExecuteCommand += RemoveCommand_ExecuteCommand;
|
||||||
|
ModInfo.PropertyChangedX += ModInfo_PropertyChangedX;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ModInfo_PropertyChangedX(object? sender, PropertyChangedXEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.PropertyName == nameof(ModInfoModel.ShowMainPet))
|
||||||
|
{
|
||||||
|
if (e.NewValue is false)
|
||||||
|
{
|
||||||
|
if (CurrentPet.FromMain)
|
||||||
|
{
|
||||||
|
CurrentPet = null!;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AnimePageVM_PropertyChangedX(object? sender, PropertyChangedXEventArgs e)
|
private void AnimePageVM_PropertyChangedX(object? sender, PropertyChangedXEventArgs e)
|
||||||
|
@ -21,7 +21,12 @@ public class PetPageVM : ObservableObjectX
|
|||||||
{
|
{
|
||||||
Pets = new(ModInfoModel.Current.Pets)
|
Pets = new(ModInfoModel.Current.Pets)
|
||||||
{
|
{
|
||||||
Filter = f => f.ID.Contains(Search, StringComparison.OrdinalIgnoreCase),
|
Filter = (f) =>
|
||||||
|
{
|
||||||
|
if (ShowMainPet is false && f.FromMain)
|
||||||
|
return false;
|
||||||
|
return f.ID.Contains(Search, StringComparison.OrdinalIgnoreCase);
|
||||||
|
},
|
||||||
FilteredList = new()
|
FilteredList = new()
|
||||||
};
|
};
|
||||||
Pets.BindingList(ModInfoModel.Current.Pets);
|
Pets.BindingList(ModInfoModel.Current.Pets);
|
||||||
@ -59,6 +64,24 @@ public class PetPageVM : ObservableObjectX
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region ShowMainPet
|
||||||
|
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||||
|
private bool _showMainPet;
|
||||||
|
|
||||||
|
public bool ShowMainPet
|
||||||
|
{
|
||||||
|
get => _showMainPet;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _showMainPet, value);
|
||||||
|
ModInfo.ShowMainPet = value;
|
||||||
|
Pets.Refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
#region Command
|
#region Command
|
||||||
public ObservableCommand AddCommand { get; } = new();
|
public ObservableCommand AddCommand { get; } = new();
|
||||||
|
@ -34,6 +34,21 @@ public class WorkPageVM : ObservableObjectX
|
|||||||
AddCommand.ExecuteCommand += AddCommand_ExecuteCommand;
|
AddCommand.ExecuteCommand += AddCommand_ExecuteCommand;
|
||||||
EditCommand.ExecuteCommand += EditCommand_ExecuteCommand;
|
EditCommand.ExecuteCommand += EditCommand_ExecuteCommand;
|
||||||
RemoveCommand.ExecuteCommand += RemoveCommand_ExecuteCommand;
|
RemoveCommand.ExecuteCommand += RemoveCommand_ExecuteCommand;
|
||||||
|
ModInfo.PropertyChangedX += ModInfo_PropertyChangedX;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ModInfo_PropertyChangedX(object? sender, PropertyChangedXEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.PropertyName == nameof(ModInfoModel.ShowMainPet))
|
||||||
|
{
|
||||||
|
if (e.NewValue is false)
|
||||||
|
{
|
||||||
|
if (CurrentPet.FromMain)
|
||||||
|
{
|
||||||
|
CurrentPet = null!;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ModInfoModel ModInfo => ModInfoModel.Current;
|
public static ModInfoModel ModInfo => ModInfoModel.Current;
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
<pu:Switch
|
<pu:Switch
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Content="{ll:Str 显示本体宠物}"
|
Content="{ll:Str 显示本体宠物}"
|
||||||
IsChecked="{Binding ModInfo.ShowMainPet}" />
|
IsChecked="{Binding ShowMainPet}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
<DataGrid
|
<DataGrid
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
|
Reference in New Issue
Block a user