mirror of
https://github.com/LorisYounger/VPet.ModMaker.git
synced 2024-08-30 18:22:21 +00:00
#修复
- 在文化添加界面输入错误文化会出错的问题
This commit is contained in:
parent
53329f8c66
commit
bf1f989a57
@ -139,7 +139,12 @@ public class ClickTextModel : ObservableObjectX
|
||||
{
|
||||
I18nResource?.I18nObjectInfos.Add(
|
||||
this,
|
||||
new(this, OnPropertyChanged, [(nameof(ID), ID, nameof(Text), true),])
|
||||
new I18nObjectInfo<string, string>(this, OnPropertyChanged).AddPropertyInfo(
|
||||
nameof(ID),
|
||||
ID,
|
||||
nameof(Text),
|
||||
true
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ public class FoodAnimeLocationModel : ObservableObjectX, ICloneable<FoodAnimeLoc
|
||||
/// <summary>
|
||||
/// 矩形位置
|
||||
/// </summary>
|
||||
public ObservableRectangleLocation<double> RectangleLocation { get; set; } = new();
|
||||
public ObservableRectangle<double> RectangleLocation { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 旋转角度
|
||||
|
@ -127,13 +127,12 @@ public class FoodModel : ObservableObjectX
|
||||
{
|
||||
I18nResource?.I18nObjectInfos.Add(
|
||||
this,
|
||||
new(
|
||||
this,
|
||||
OnPropertyChanged,
|
||||
new I18nObjectInfo<string, string>(this, OnPropertyChanged).AddPropertyInfo(
|
||||
[
|
||||
(nameof(ID), ID, nameof(Name), true),
|
||||
(nameof(DescriptionID), DescriptionID, nameof(Description), true)
|
||||
]
|
||||
(nameof(ID), ID, nameof(Name)),
|
||||
(nameof(DescriptionID), DescriptionID, nameof(Description))
|
||||
],
|
||||
true
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -148,7 +147,7 @@ public class FoodModel : ObservableObjectX
|
||||
[AdaptIgnore]
|
||||
public string Description
|
||||
{
|
||||
get => I18nResource.GetCurrentCultureDataOrDefault(DescriptionID, string.Empty);
|
||||
get => I18nResource.GetCurrentCultureDataOrDefault(DescriptionID);
|
||||
set => I18nResource.SetCurrentCultureData(DescriptionID, value);
|
||||
}
|
||||
#endregion
|
||||
|
@ -87,7 +87,12 @@ public class LowTextModel : ObservableObjectX
|
||||
{
|
||||
I18nResource?.I18nObjectInfos.Add(
|
||||
this,
|
||||
new(this, OnPropertyChanged, [(nameof(ID), ID, nameof(Text), true)])
|
||||
new I18nObjectInfo<string, string>(this, OnPropertyChanged).AddPropertyInfo(
|
||||
nameof(ID),
|
||||
ID,
|
||||
nameof(Text),
|
||||
true
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -38,13 +38,12 @@ public class ModInfoModel : ObservableObjectX
|
||||
I18nResource.Cultures.SetChanged += Cultures_SetChanged;
|
||||
I18nResource?.I18nObjectInfos.Add(
|
||||
this,
|
||||
new(
|
||||
this,
|
||||
OnPropertyChanged,
|
||||
new I18nObjectInfo<string, string>(this, OnPropertyChanged).AddPropertyInfo(
|
||||
[
|
||||
(nameof(ID), ID, nameof(Name), true),
|
||||
(nameof(DescriptionID), DescriptionID, nameof(Description), true)
|
||||
]
|
||||
(nameof(ID), ID, nameof(Name)),
|
||||
(nameof(DescriptionID), DescriptionID, nameof(Description))
|
||||
],
|
||||
true
|
||||
)
|
||||
);
|
||||
foreach (var pet in ModMakerInfo.MainPets)
|
||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -202,14 +203,13 @@ public class PetModel : ObservableObjectX
|
||||
{
|
||||
I18nResource.I18nObjectInfos.Add(
|
||||
this,
|
||||
new(
|
||||
this,
|
||||
OnPropertyChanged,
|
||||
new I18nObjectInfo<string, string>(this, OnPropertyChanged).AddPropertyInfo(
|
||||
[
|
||||
(nameof(ID), ID, nameof(Name), true),
|
||||
(nameof(PetNameID), PetNameID, nameof(PetName), true),
|
||||
(nameof(DescriptionID), DescriptionID, nameof(Description), true)
|
||||
]
|
||||
(nameof(ID), ID, nameof(Name)),
|
||||
(nameof(PetNameID), PetNameID, nameof(PetName)),
|
||||
(nameof(DescriptionID), DescriptionID, nameof(Description))
|
||||
],
|
||||
true
|
||||
)
|
||||
);
|
||||
foreach (var work in Works)
|
||||
@ -283,13 +283,12 @@ public class PetModel : ObservableObjectX
|
||||
|
||||
#region TouchHeadRect
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
private ObservableRectangleLocation<double> _touchHeadRectangleLocation =
|
||||
new(159, 16, 189, 178);
|
||||
private ObservableRectangle<double> _touchHeadRectangleLocation = new(159, 16, 189, 178);
|
||||
|
||||
/// <summary>
|
||||
/// 头部点击区域
|
||||
/// </summary>
|
||||
public ObservableRectangleLocation<double> TouchHeadRectangleLocation
|
||||
public ObservableRectangle<double> TouchHeadRectangleLocation
|
||||
{
|
||||
get => _touchHeadRectangleLocation;
|
||||
set => SetProperty(ref _touchHeadRectangleLocation, value);
|
||||
@ -298,13 +297,12 @@ public class PetModel : ObservableObjectX
|
||||
|
||||
#region TouchBodyRect
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
private ObservableRectangleLocation<double> _touchBodyRectangleLocation =
|
||||
new(166, 206, 163, 136);
|
||||
private ObservableRectangle<double> _touchBodyRectangleLocation = new(166, 206, 163, 136);
|
||||
|
||||
/// <summary>
|
||||
/// 身体区域
|
||||
/// </summary>
|
||||
public ObservableRectangleLocation<double> TouchBodyRectangleLocation
|
||||
public ObservableRectangle<double> TouchBodyRectangleLocation
|
||||
{
|
||||
get => _touchBodyRectangleLocation;
|
||||
set => SetProperty(ref _touchBodyRectangleLocation, value);
|
||||
@ -623,8 +621,8 @@ public class ObservableMultiStateRectangleLocation
|
||||
{
|
||||
#region Happy
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
private ObservableRectangleLocation<double> _happy = null!;
|
||||
public ObservableRectangleLocation<double> Happy
|
||||
private ObservableRectangle<double> _happy = null!;
|
||||
public ObservableRectangle<double> Happy
|
||||
{
|
||||
get => _happy;
|
||||
set => SetProperty(ref _happy, value);
|
||||
@ -633,9 +631,9 @@ public class ObservableMultiStateRectangleLocation
|
||||
|
||||
#region Nomal
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
private ObservableRectangleLocation<double> _nomal = null!;
|
||||
private ObservableRectangle<double> _nomal = null!;
|
||||
|
||||
public ObservableRectangleLocation<double> Nomal
|
||||
public ObservableRectangle<double> Nomal
|
||||
{
|
||||
get => _nomal;
|
||||
set => SetProperty(ref _nomal, value);
|
||||
@ -644,8 +642,8 @@ public class ObservableMultiStateRectangleLocation
|
||||
|
||||
#region PoorCondition
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
private ObservableRectangleLocation<double> _poorCondition = null!;
|
||||
public ObservableRectangleLocation<double> PoorCondition
|
||||
private ObservableRectangle<double> _poorCondition = null!;
|
||||
public ObservableRectangle<double> PoorCondition
|
||||
{
|
||||
get => _poorCondition;
|
||||
set => SetProperty(ref _poorCondition, value);
|
||||
@ -654,8 +652,8 @@ public class ObservableMultiStateRectangleLocation
|
||||
|
||||
#region Ill
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
private ObservableRectangleLocation<double> _ill = null!;
|
||||
public ObservableRectangleLocation<double> Ill
|
||||
private ObservableRectangle<double> _ill = null!;
|
||||
public ObservableRectangle<double> Ill
|
||||
{
|
||||
get => _ill;
|
||||
set => SetProperty(ref _ill, value);
|
||||
@ -671,10 +669,10 @@ public class ObservableMultiStateRectangleLocation
|
||||
}
|
||||
|
||||
public ObservableMultiStateRectangleLocation(
|
||||
ObservableRectangleLocation<double> happy,
|
||||
ObservableRectangleLocation<double> nomal,
|
||||
ObservableRectangleLocation<double> poorCondition,
|
||||
ObservableRectangleLocation<double> ill
|
||||
ObservableRectangle<double> happy,
|
||||
ObservableRectangle<double> nomal,
|
||||
ObservableRectangle<double> poorCondition,
|
||||
ObservableRectangle<double> ill
|
||||
)
|
||||
{
|
||||
Happy = happy;
|
||||
|
@ -143,13 +143,9 @@ public class SelectTextModel : ObservableObjectX
|
||||
{
|
||||
I18nResource?.I18nObjectInfos.Add(
|
||||
this,
|
||||
new(
|
||||
this,
|
||||
OnPropertyChanged,
|
||||
[
|
||||
(nameof(ID), ID, nameof(Text), true),
|
||||
(nameof(ChooseID), ChooseID, nameof(Choose), true)
|
||||
]
|
||||
new I18nObjectInfo<string, string>(this, OnPropertyChanged).AddPropertyInfo(
|
||||
[(nameof(ID), ID, nameof(Text)), (nameof(ChooseID), ChooseID, nameof(Choose))],
|
||||
true
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -164,7 +160,7 @@ public class SelectTextModel : ObservableObjectX
|
||||
[AdaptIgnore]
|
||||
public string Choose
|
||||
{
|
||||
get => I18nResource.GetCurrentCultureDataOrDefault(ChooseID, string.Empty);
|
||||
get => I18nResource.GetCurrentCultureDataOrDefault(ChooseID);
|
||||
set => I18nResource.SetCurrentCultureData(ChooseID, value);
|
||||
}
|
||||
#endregion
|
||||
|
@ -143,7 +143,12 @@ public class WorkModel : ObservableObjectX
|
||||
{
|
||||
I18nResource?.I18nObjectInfos.Add(
|
||||
this,
|
||||
new(this, OnPropertyChanged, [(nameof(ID), ID, nameof(Name), true),])
|
||||
new I18nObjectInfo<string, string>(this, OnPropertyChanged).AddPropertyInfo(
|
||||
nameof(ID),
|
||||
ID,
|
||||
nameof(Name),
|
||||
true
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(Configuration)'!='Test'">
|
||||
<PackageReference Include="HKW.WPF" Version="1.0.7" />
|
||||
<PackageReference Include="HKW.Utils" Version="1.2.21" />
|
||||
<PackageReference Include="HKW.Utils" Version="1.2.22" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="VPet-Simulator.Core" Version="1.1.0.14-beta" />
|
||||
|
@ -38,13 +38,13 @@ public class AddCultureWindowVM : ObservableObjectX
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
private string _culture = string.Empty;
|
||||
|
||||
public string Culture
|
||||
public string CultureName
|
||||
{
|
||||
get => _culture;
|
||||
set
|
||||
{
|
||||
SetProperty(ref _culture, value);
|
||||
if (string.IsNullOrWhiteSpace(Culture))
|
||||
if (string.IsNullOrWhiteSpace(CultureName))
|
||||
{
|
||||
CultureFullName = UnknownCulture;
|
||||
return;
|
||||
@ -52,7 +52,7 @@ public class AddCultureWindowVM : ObservableObjectX
|
||||
CultureInfo info = null!;
|
||||
try
|
||||
{
|
||||
info = CultureInfo.GetCultureInfo(Culture);
|
||||
info = CultureInfo.GetCultureInfo(CultureName);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
@ -160,8 +160,8 @@ public class ModEditWindowVM : ObservableObjectX
|
||||
window.ShowDialog();
|
||||
if (window.IsCancel)
|
||||
return;
|
||||
I18nResource.AddCulture(window.ViewModel.Culture);
|
||||
I18nResource.SetCurrentCulture(window.ViewModel.Culture);
|
||||
I18nResource.AddCulture(window.ViewModel.CultureName);
|
||||
I18nResource.SetCurrentCulture(window.ViewModel.CultureName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -171,11 +171,11 @@ public class ModEditWindowVM : ObservableObjectX
|
||||
private void EditCultureCommand_ExecuteCommand(string oldCulture)
|
||||
{
|
||||
var window = new AddCultureWindow();
|
||||
window.ViewModel.Culture = oldCulture.Translate();
|
||||
window.ViewModel.CultureName = oldCulture.Translate();
|
||||
window.ShowDialog();
|
||||
if (window.IsCancel)
|
||||
return;
|
||||
I18nResource.ReplaceCulture(oldCulture, window.ViewModel.Culture);
|
||||
I18nResource.ReplaceCulture(oldCulture, window.ViewModel.CultureName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -47,7 +47,7 @@
|
||||
Grid.Row="1"
|
||||
pu:TextBoxHelper.Watermark="{ll:Str 文化名称}"
|
||||
Style="{DynamicResource StandardTextBoxStyle}"
|
||||
Text="{Binding Culture, UpdateSourceTrigger=PropertyChanged}" />
|
||||
Text="{Binding CultureName, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<TextBlock Grid.Row="2">
|
||||
<Hyperlink Click="Hyperlink_Click">
|
||||
<TextBlock Text="{ll:Str 详情请参阅 Windows 支持的语言/区域名称列表中的“语言标记”列}" />
|
||||
@ -88,7 +88,7 @@
|
||||
<ListBox
|
||||
Grid.Row="1"
|
||||
ItemsSource="{Binding AllCultures.FilteredList}"
|
||||
SelectedItem="{Binding Culture}" />
|
||||
SelectedItem="{Binding CultureName}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</pu:WindowX>
|
||||
|
@ -47,16 +47,17 @@ public partial class AddCultureWindow : WindowX
|
||||
|
||||
private void Button_Yes_Click(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(ViewModel.Culture))
|
||||
if (string.IsNullOrWhiteSpace(ViewModel.CultureName))
|
||||
{
|
||||
MessageBox.Show("文化不可为空".Translate(), "", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
return;
|
||||
}
|
||||
if (
|
||||
ModInfoModel.Current.I18nResource.Cultures.Contains(
|
||||
CultureInfo.GetCultureInfo(ViewModel.Culture)
|
||||
)
|
||||
)
|
||||
if (CultureUtils.TryGetCultureInfo(ViewModel.CultureName, out var culture) is false)
|
||||
{
|
||||
MessageBox.Show("不支持的文化".Translate(), "", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
return;
|
||||
}
|
||||
if (ModInfoModel.Current.I18nResource.Cultures.Contains(culture))
|
||||
{
|
||||
MessageBox.Show("此文化已存在".Translate(), "", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user