This commit is contained in:
Hakoyu 2023-10-31 23:48:33 +08:00
parent 46f4709fb7
commit 18fbc60f87
12 changed files with 354 additions and 441 deletions

View File

@ -13,7 +13,10 @@ namespace HKW.HKWViewModels.SimpleObservable;
/// </summary>
/// <typeparam name="T"></typeparam>
[DebuggerDisplay("{Value}")]
public class ObservableValue<T> : INotifyPropertyChanging, INotifyPropertyChanged
public class ObservableValue<T>
: INotifyPropertyChanging,
INotifyPropertyChanged,
IEquatable<ObservableValue<T>>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private T _value = default!;
@ -81,14 +84,6 @@ public class ObservableValue<T> : INotifyPropertyChanging, INotifyPropertyChange
}
#endregion
#region Overwrite
/// <inheritdoc/>
public override string ToString()
{
return Value?.ToString()!;
}
#endregion
#region NotifyReceiver
/// <summary>
/// 添加通知属性改变后接收器
@ -132,6 +127,57 @@ public class ObservableValue<T> : INotifyPropertyChanging, INotifyPropertyChange
NotifyReceived?.Invoke(ref temp);
Value = temp;
}
#endregion
#region Other
/// <inheritdoc/>
public override string ToString()
{
return Value?.ToString() ?? string.Empty;
}
/// <inheritdoc/>
public override bool Equals(object? obj)
{
return Equals(obj as ObservableValue<T>);
}
/// <inheritdoc/>
public override int GetHashCode()
{
return Value?.GetHashCode() ?? 0;
}
/// <inheritdoc/>
public bool Equals(ObservableValue<T>? other)
{
return Value?.Equals(other) is true;
}
/// <summary>
/// 判断 <see cref="Value"/> 相等
/// </summary>
/// <param name="value1">左值</param>
/// <param name="value2">右值</param>
/// <returns>相等为 <see langword="true"/> 否则为 <see langword="false"/></returns>
public static bool operator ==(ObservableValue<T> value1, ObservableValue<T> value2)
{
return value1.Value?.Equals(value2.Value) is true;
}
/// <summary>
/// 判断 <see cref="Value"/> 不相等
/// </summary>
/// <param name="value1">左值</param>
/// <param name="value2">右值</param>
/// <returns>不相等为 <see langword="true"/> 否则为 <see langword="false"/></returns>
public static bool operator !=(ObservableValue<T> value1, ObservableValue<T> value2)
{
return value1.Value?.Equals(value2.Value) is not true;
}
#endregion
#region Event

View File

@ -19,6 +19,20 @@
TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
</Style>
<Style
x:Key="TextBlock_Center"
BasedOn="{StaticResource {x:Type TextBlock}}"
TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>
<Style
x:Key="TextBlock_LeftCenter"
BasedOn="{StaticResource {x:Type TextBlock}}"
TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Left" />
</Style>
<Style
x:Key="TextBox_Wrap"
BasedOn="{StaticResource {x:Type TextBox}}"
@ -27,6 +41,20 @@
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="VerticalContentAlignment" Value="Top" />
</Style>
<Style
x:Key="TextBox_Center"
BasedOn="{StaticResource {x:Type TextBox}}"
TargetType="TextBox">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>
<Style
x:Key="TextBox_LeftCenter"
BasedOn="{StaticResource {x:Type TextBox}}"
TargetType="TextBox">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Left" />
</Style>
<Style x:Key="WindowXStyle" TargetType="pu:WindowX">
<Setter Property="pu:WindowXCaption.Background" Value="{DynamicResource DARKPrimary}" />
<Setter Property="pu:WindowXCaption.Foreground" Value="{DynamicResource DARKPrimaryText}" />

View File

@ -160,27 +160,19 @@ public class ModEditWindowVM
/// </summary>
private void Save()
{
if (ValidationData(ModInfo.Value) is false)
return;
if (
MessageBox.Show("确定保存吗".Translate(), "", MessageBoxButton.YesNo)
is not MessageBoxResult.Yes
)
return;
if (string.IsNullOrEmpty(ModInfo.Value.SourcePath.Value))
{
MessageBox.Show("源路径为空, 请使用 保存至".Translate());
return;
}
try
{
ModInfo.Value.SaveTo(ModInfo.Value.SourcePath.Value);
}
catch (Exception ex)
{
MessageBox.Show("保存失败 错误信息:\n{0}".Translate(ex));
return;
}
MessageBox.Show("保存成功".Translate());
SaveTo(ModInfo.Value.SourcePath.Value);
}
/// <summary>
@ -197,25 +189,32 @@ public class ModEditWindowVM
Filter = $"LPS文件|*.lps;".Translate(),
FileName = "info.lps".Translate()
};
if (saveFileDialog.ShowDialog() is true)
{
var pending = PendingBox.Show("保存中".Translate());
//try
//{
var path = Path.GetDirectoryName(saveFileDialog.FileName);
ModInfo.Value.SaveTo(path);
if (string.IsNullOrWhiteSpace(ModInfo.Value.SourcePath.Value))
ModInfo.Value.SourcePath.Value = path;
pending.Close();
MessageBox.Show(ModEditWindow, "保存成功".Translate());
//}
//catch (Exception ex)
//{
// pending.Close();
// MessageBox.Show("保存失败 错误信息:\n{0}".Translate(ex));
// return;
//}
}
if (saveFileDialog.ShowDialog() is not true)
return;
SaveTo(Path.GetDirectoryName(saveFileDialog.FileName));
}
/// <summary>
/// 保存至
/// </summary>
/// <param name="path"></param>
private void SaveTo(string path)
{
var pending = PendingBox.Show("保存中".Translate());
//try
//{
ModInfo.Value.SaveTo(path);
if (string.IsNullOrWhiteSpace(ModInfo.Value.SourcePath.Value))
ModInfo.Value.SourcePath.Value = path;
pending.Close();
MessageBox.Show(ModEditWindow, "保存成功".Translate());
//}
//catch (Exception ex)
//{
// pending.Close();
// MessageBox.Show("保存失败 错误信息:\n{0}".Translate(ex));
// return;
//}
}
/// <summary>

View File

@ -25,7 +25,7 @@
</Grid.ColumnDefinitions>
<TextBox pu:TextBoxHelper.Watermark="{ll:Str 搜索Id}" Text="{Binding Search.Value, UpdateSourceTrigger=PropertyChanged}">
<TextBox.Style>
<Style BasedOn="{StaticResource {x:Type TextBox}}" TargetType="TextBox">
<Style BasedOn="{StaticResource StandardTextBoxStyle}" TargetType="TextBox">
<Setter Property="IsEnabled" Value="True" />
<Style.Triggers>
<DataTrigger Binding="{Binding SelectedItem, ElementName=ComboBox_Pet}" Value="{x:Null}">
@ -41,7 +41,8 @@
pu:ComboBoxHelper.Watermark="{ll:Str 选择宠物}"
DisplayMemberPath="Id.Value"
ItemsSource="{Binding Pets}"
SelectedItem="{Binding CurrentPet.Value}">
SelectedItem="{Binding CurrentPet.Value}"
Style="{DynamicResource StandardComboBoxStyle}">
<ComboBox.ItemContainerStyle>
<Style BasedOn="{StaticResource {x:Type ComboBoxItem}}" TargetType="ComboBoxItem">
<Setter Property="ToolTip" Value="{Binding CurrentI18nData.Value.Name.Value}" />
@ -69,12 +70,12 @@
ItemsSource="{Binding ShowAnimes.Value}"
MouseDoubleClick="DataGrid_MouseDoubleClick"
RowDetailsVisibilityMode="Visible"
RowHeight="64"
RowHeight="50"
VirtualizingStackPanel.IsVirtualizing="True"
VirtualizingStackPanel.VirtualizationMode="Recycling">
<DataGrid.RowStyle>
<Style BasedOn="{StaticResource {x:Type DataGridRow}}" TargetType="DataGridRow">
<Setter Property="Height" Value="64" />
<Setter Property="Height" Value="50" />
<Setter Property="Tag" Value="{Binding}" />
<Setter Property="ContextMenu" Value="{StaticResource ContextMenu_DataGridRow}" />
</Style>
@ -83,57 +84,38 @@
<DataGridTextColumn
Binding="{Binding Id.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 动画类型}"
IsReadOnly="True"
SortMemberPath="Id.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 动画类型}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Id.Value" />
<DataGridTextColumn
Binding="{Binding HappyAnimes.Count}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 开心状态动画数量}"
IsReadOnly="True"
SortMemberPath="Id.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 开心状态动画数量}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Id.Value" />
<DataGridTextColumn
Binding="{Binding NomalAnimes.Count}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 普通状态动画数量}"
IsReadOnly="True"
SortMemberPath="Id.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 普通状态动画数量}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Id.Value" />
<DataGridTextColumn
Binding="{Binding PoorConditionAnimes.Count}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 不开心状态动画数量}"
IsReadOnly="True"
SortMemberPath="Id.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 不开心状态动画数量}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Id.Value" />
<DataGridTextColumn
Binding="{Binding IllAnimes.Count}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 生病状态动画数量}"
IsReadOnly="True"
SortMemberPath="Id.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 生病状态动画数量}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
<!--<DataGridTextColumn
Binding="{Binding LocateType.EnumValue.Value}"
CanUserSort="True"
IsReadOnly="True"
SortMemberPath="LocateType.EnumValue.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 动画支持的状态}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>-->
SortMemberPath="Id.Value" />
</DataGrid.Columns>
</DataGrid>
<Button

View File

@ -32,12 +32,12 @@
ItemsSource="{Binding ShowClickTexts.Value}"
MouseDoubleClick="DataGrid_MouseDoubleClick"
RowDetailsVisibilityMode="Visible"
RowHeight="64"
RowHeight="50"
VirtualizingStackPanel.IsVirtualizing="True"
VirtualizingStackPanel.VirtualizationMode="Recycling">
<DataGrid.RowStyle>
<Style BasedOn="{StaticResource {x:Type DataGridRow}}" TargetType="DataGridRow">
<Setter Property="Height" Value="64" />
<Setter Property="Height" Value="50" />
<Setter Property="Tag" Value="{Binding}" />
<Setter Property="ContextMenu" Value="{StaticResource ContextMenu_DataGridRow}" />
</Style>
@ -48,131 +48,101 @@
Binding="{Binding Id.Value}"
CanUserSort="True"
ElementStyle="{StaticResource TextBlock_Wrap}"
Header="Id"
IsReadOnly="True"
SortMemberPath="Id.Value">
<DataGridTextColumn.Header>
<TextBlock Text="Id" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Id.Value" />
<DataGridTextColumn
MaxWidth="300"
Binding="{Binding CurrentI18nData.Value.Text.Value}"
CanUserSort="True"
ElementStyle="{StaticResource TextBlock_Wrap}"
Header="{ll:Str 文本}"
IsReadOnly="True"
SortMemberPath="CurrentI18nData.Value.Text.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 文本}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="CurrentI18nData.Value.Text.Value" />
<DataGridTextColumn
Binding="{Binding Mode.EnumValue.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 状态}"
IsReadOnly="True"
SortMemberPath="Mode.EnumValue.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 状态}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Mode.EnumValue.Value" />
<DataGridTextColumn
Binding="{Binding Working.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 指定工作}"
IsReadOnly="True"
SortMemberPath="Working.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 指定工作}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Working.Value" />
<DataGridTextColumn
Binding="{Binding WorkingState.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 工作状态}"
IsReadOnly="True"
SortMemberPath="WorkingState.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 工作状态}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="WorkingState.Value" />
<DataGridTextColumn
Binding="{Binding DayTime.EnumValue.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 时间}"
IsReadOnly="True"
SortMemberPath="DayTime.EnumValue.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 时间}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="DayTime.EnumValue.Value" />
<DataGridTextColumn
Binding="{Binding Like.Info.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 好感度范围}"
IsReadOnly="True"
SortMemberPath="Like.Info.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 好感度范围}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Like.Info.Value" />
<DataGridTextColumn
Binding="{Binding Health.Info.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 健康度范围}"
IsReadOnly="True"
SortMemberPath="Health.Info.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 健康度范围}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Health.Info.Value" />
<DataGridTextColumn
Binding="{Binding Level.Info.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 等级范围}"
IsReadOnly="True"
SortMemberPath="Level.Info.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 等级范围}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Level.Info.Value" />
<DataGridTextColumn
Binding="{Binding Money.Info.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 金钱范围}"
IsReadOnly="True"
SortMemberPath="Money.Info.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 金钱范围}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Money.Info.Value" />
<DataGridTextColumn
Binding="{Binding Food.Info.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 食物范围}"
IsReadOnly="True"
SortMemberPath="Food.Info.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 食物范围}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Food.Info.Value" />
<DataGridTextColumn
Binding="{Binding Drink.Info.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 口渴范围}"
IsReadOnly="True"
SortMemberPath="Drink.Info.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 口渴范围}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Drink.Info.Value" />
<DataGridTextColumn
Binding="{Binding Feel.Info.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 心情范围}"
IsReadOnly="True"
SortMemberPath="Feel.Info.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 心情范围}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Feel.Info.Value" />
<DataGridTextColumn
Binding="{Binding Strength.Info.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 体力范围}"
IsReadOnly="True"
SortMemberPath="Strength.Info.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 体力范围}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Strength.Info.Value" />
</DataGrid.Columns>
</DataGrid>
<Button

View File

@ -46,16 +46,11 @@
<DataGridTextColumn
Binding="{Binding Id.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="Id"
IsReadOnly="True"
SortMemberPath="Id.Value">
<DataGridTextColumn.Header>
<TextBlock Text="Id" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTemplateColumn IsReadOnly="True">
<DataGridTemplateColumn.Header>
<TextBlock Text="{ll:Str 食物图片}" />
</DataGridTemplateColumn.Header>
SortMemberPath="Id.Value" />
<DataGridTemplateColumn Header="{ll:Str 食物图片}" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image
@ -81,111 +76,87 @@
<DataGridTextColumn
Binding="{Binding CurrentI18nData.Value.Name.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 食物名称}"
IsReadOnly="True"
SortMemberPath="CurrentI18nData.Value.Name.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 食物名称}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="CurrentI18nData.Value.Name.Value" />
<DataGridTextColumn
Binding="{Binding Type.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 食物类型}"
IsReadOnly="True"
SortMemberPath="Type.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 食物类型}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Type.Value" />
<DataGridTextColumn
Binding="{Binding Graph.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 指定动画}"
IsReadOnly="True"
SortMemberPath="Type.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 指定动画}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Type.Value" />
<DataGridTextColumn
Binding="{Binding StrengthFood.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 饱腹值}"
IsReadOnly="True"
SortMemberPath="StrengthFood.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 饱腹值}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="StrengthFood.Value" />
<DataGridTextColumn
Binding="{Binding StrengthDrink.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 口渴值}"
IsReadOnly="True"
SortMemberPath="StrengthDrink.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 口渴值}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="StrengthDrink.Value" />
<DataGridTextColumn
Binding="{Binding Health.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 健康值}"
IsReadOnly="True"
SortMemberPath="Health.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 健康值}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Health.Value" />
<DataGridTextColumn
Binding="{Binding Strength.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 体力值}"
IsReadOnly="True"
SortMemberPath="Strength.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 体力值}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Strength.Value" />
<DataGridTextColumn
Binding="{Binding Feeling.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 心情值}"
IsReadOnly="True"
SortMemberPath="Feeling.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 心情值}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Feeling.Value" />
<DataGridTextColumn
Binding="{Binding Likability.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 好感值}"
IsReadOnly="True"
SortMemberPath="Likability.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 好感值}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Likability.Value" />
<DataGridTextColumn
Binding="{Binding Exp.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 经验值}"
IsReadOnly="True"
SortMemberPath="Exp.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 经验值}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Exp.Value" />
<DataGridTextColumn
Binding="{Binding Price.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 价格}"
IsReadOnly="True"
SortMemberPath="Price.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 价格}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Price.Value" />
<DataGridTextColumn
Binding="{Binding CurrentI18nData.Value.Description.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 描述}"
IsReadOnly="True"
SortMemberPath="CurrentI18nData.Value.Description.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 描述}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="CurrentI18nData.Value.Description.Value" />
</DataGrid.Columns>
</DataGrid>
<Button

View File

@ -49,50 +49,38 @@
Binding="{Binding Id.Value}"
CanUserSort="True"
ElementStyle="{StaticResource TextBlock_Wrap}"
Header="Id"
IsReadOnly="True"
SortMemberPath="Id.Value">
<DataGridTextColumn.Header>
<TextBlock Text="Id" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Id.Value" />
<DataGridTextColumn
MaxWidth="300"
Binding="{Binding CurrentI18nData.Value.Text.Value}"
CanUserSort="True"
ElementStyle="{StaticResource TextBlock_Wrap}"
Header="{ll:Str 文本}"
IsReadOnly="True"
SortMemberPath="CurrentI18nData.Value.Text.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 文本}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="CurrentI18nData.Value.Text.Value" />
<DataGridTextColumn
Binding="{Binding Mode.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 状态}"
IsReadOnly="True"
SortMemberPath="Mode.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 状态}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Mode.Value" />
<DataGridTextColumn
Binding="{Binding Strength.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 饥渴需求}"
IsReadOnly="True"
SortMemberPath="Strength.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 饥渴需求}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Strength.Value" />
<DataGridTextColumn
Binding="{Binding Like.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 好感需求}"
IsReadOnly="True"
SortMemberPath="Like.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 好感需求}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Like.Value" />
</DataGrid.Columns>
</DataGrid>
<Button

View File

@ -83,66 +83,52 @@
<DataGridTextColumn
Binding="{Binding Graph.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 绑定动画}"
IsReadOnly="True"
SortMemberPath="Graph.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 绑定动画}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Graph.Value" />
<DataGridTextColumn
Binding="{Binding LocateType.EnumValue.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 定位类型}"
IsReadOnly="True"
SortMemberPath="LocateType.EnumValue.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 定位类型}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="LocateType.EnumValue.Value" />
<DataGridTextColumn
Binding="{Binding TriggerType.EnumValue.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 触发类型}"
IsReadOnly="True"
SortMemberPath="TriggerType.EnumValue.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 触发类型}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="TriggerType.EnumValue.Value" />
<DataGridTextColumn
Binding="{Binding ModeType.EnumValue.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 状态类型}"
IsReadOnly="True"
SortMemberPath="ModeType.EnumValue.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 状态类型}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="ModeType.EnumValue.Value" />
<DataGridTextColumn
Binding="{Binding Distance.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 移动距离}"
IsReadOnly="True"
SortMemberPath="Distance.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 移动距离}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Distance.Value" />
<DataGridTextColumn
Binding="{Binding Interval.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 移动间隔}"
IsReadOnly="True"
SortMemberPath="Interval.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 移动间隔}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Interval.Value" />
<DataGridTextColumn
Binding="{Binding LocateLength.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 定位长度}"
IsReadOnly="True"
SortMemberPath="LocateLength.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 定位长度}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="LocateLength.Value" />
</DataGrid.Columns>
</DataGrid>
<Button

View File

@ -57,6 +57,16 @@ public partial class PetEditWindow : Window
MessageBox.Show("名称不可为空".Translate(), "", MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
if (string.IsNullOrWhiteSpace(ViewModel.Pet.Value.CurrentI18nData.Value.PetName.Value))
{
MessageBox.Show(
"宠物名称不可为空".Translate(),
"",
MessageBoxButton.OK,
MessageBoxImage.Warning
);
return;
}
if (
ViewModel.OldPet?.Id.Value != ViewModel.Pet.Value.Id.Value
&& ModInfoModel.Current.Pets.Any(i => i.Id == ViewModel.Pet.Value.Id)

View File

@ -43,39 +43,31 @@
<DataGridTextColumn
Binding="{Binding Id.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="Id"
IsReadOnly="True"
SortMemberPath="Id.Value">
<DataGridTextColumn.Header>
<TextBlock Text="Id" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Id.Value" />
<DataGridTextColumn
Binding="{Binding CurrentI18nData.Value.Name.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 名称}"
IsReadOnly="True"
SortMemberPath="CurrentI18nData.Value.Name.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 名称}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="CurrentI18nData.Value.Name.Value" />
<DataGridTextColumn
Binding="{Binding CurrentI18nData.Value.PetName.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 宠物名称}"
IsReadOnly="True"
SortMemberPath="CurrentI18nData.Value.Name.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 宠物名称}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="CurrentI18nData.Value.Name.Value" />
<DataGridTextColumn
Binding="{Binding CurrentI18nData.Value.Description.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 描述}"
IsReadOnly="True"
SortMemberPath="CurrentI18nData.Value.Description.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 描述}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="CurrentI18nData.Value.Description.Value" />
</DataGrid.Columns>
</DataGrid>
<Button

View File

@ -48,137 +48,104 @@
Binding="{Binding Id.Value}"
CanUserSort="True"
ElementStyle="{StaticResource TextBlock_Wrap}"
Header="Id"
IsReadOnly="True"
SortMemberPath="Id.Value">
<DataGridTextColumn.Header>
<TextBlock Text="Id" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn
MaxWidth="200"
Binding="{Binding CurrentI18nData.Value.Choose.Value}"
CanUserSort="True"
ElementStyle="{StaticResource TextBlock_Wrap}"
IsReadOnly="True"
SortMemberPath="CurrentI18nData.Value.Choose.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 选择名}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Id.Value" />
<DataGridTextColumn
MaxWidth="300"
Binding="{Binding CurrentI18nData.Value.Text.Value}"
CanUserSort="True"
ElementStyle="{StaticResource TextBlock_Wrap}"
Header="{ll:Str 文本}"
IsReadOnly="True"
SortMemberPath="CurrentI18nData.Value.Text.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 文本}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="CurrentI18nData.Value.Text.Value" />
<DataGridTextColumn
MaxWidth="200"
Binding="{Binding CurrentI18nData.Value.Choose.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 选择名}"
IsReadOnly="True"
SortMemberPath="CurrentI18nData.Value.Choose.Value" />
<DataGridTextColumn
MaxWidth="200"
Binding="{Binding Tags.Value}"
CanUserSort="True"
ElementStyle="{StaticResource TextBlock_Wrap}"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 标签}"
IsReadOnly="True"
SortMemberPath="Tags.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 标签}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Tags.Value" />
<DataGridTextColumn
MaxWidth="200"
Binding="{Binding ToTags.Value}"
CanUserSort="True"
ElementStyle="{StaticResource TextBlock_Wrap}"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 跳转标签}"
IsReadOnly="True"
SortMemberPath="ToTags.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 跳转标签}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="ToTags.Value" />
<DataGridTextColumn
Binding="{Binding Mode.EnumValue}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 状态}"
IsReadOnly="True"
SortMemberPath="Mode.EnumValue">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 状态}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Mode.EnumValue" />
<DataGridTextColumn
Binding="{Binding Like.Info.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 好感度范围}"
IsReadOnly="True"
SortMemberPath="Like.Info.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 好感度范围}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Like.Info.Value" />
<DataGridTextColumn
Binding="{Binding Health.Info.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 健康度范围}"
IsReadOnly="True"
SortMemberPath="Health.Info.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 健康度范围}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Health.Info.Value" />
<DataGridTextColumn
Binding="{Binding Level.Info.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 等级范围}"
IsReadOnly="True"
SortMemberPath="Level.Info.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 等级范围}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Level.Info.Value" />
<DataGridTextColumn
Binding="{Binding Money.Info.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 金钱范围}"
IsReadOnly="True"
SortMemberPath="Money.Info.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 金钱范围}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Money.Info.Value" />
<DataGridTextColumn
Binding="{Binding Food.Info.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 食物范围}"
IsReadOnly="True"
SortMemberPath="Food.Info.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 食物范围}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Food.Info.Value" />
<DataGridTextColumn
Binding="{Binding Drink.Info.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 口渴范围}"
IsReadOnly="True"
SortMemberPath="Drink.Info.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 口渴范围}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Drink.Info.Value" />
<DataGridTextColumn
Binding="{Binding Feel.Info.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 心情范围}"
IsReadOnly="True"
SortMemberPath="Feel.Info.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 心情范围}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Feel.Info.Value" />
<DataGridTextColumn
Binding="{Binding Strength.Info.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 体力范围}"
IsReadOnly="True"
SortMemberPath="Strength.Info.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 体力范围}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Strength.Info.Value" />
</DataGrid.Columns>
</DataGrid>
<Button

View File

@ -88,120 +88,94 @@
<DataGridTextColumn
Binding="{Binding Id.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="Id"
IsReadOnly="True"
SortMemberPath="Id.Value">
<DataGridTextColumn.Header>
<TextBlock Text="Id" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Id.Value" />
<DataGridTextColumn
Binding="{Binding CurrentI18nData.Value.Name.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 工作名称}"
IsReadOnly="True"
SortMemberPath="CurrentI18nData.Value.Name.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 工作名称}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="CurrentI18nData.Value.Name.Value" />
<DataGridTextColumn
Binding="{Binding WorkType.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 工作类型}"
IsReadOnly="True"
SortMemberPath="WorkType.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 工作类型}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="WorkType.Value" />
<DataGridTextColumn
Binding="{Binding Graph.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 动画名称}"
IsReadOnly="True"
SortMemberPath="Graph.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 动画名称}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Graph.Value" />
<DataGridTextColumn
Binding="{Binding IsOverLoad.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 是否超模}"
IsReadOnly="True"
SortMemberPath="Graph.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 是否超模}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Graph.Value" />
<DataGridTextColumn
Binding="{Binding MoneyBase.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 基本倍率}"
IsReadOnly="True"
SortMemberPath="MoneyBase.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 基本倍率}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="MoneyBase.Value" />
<DataGridTextColumn
Binding="{Binding MoneyLevel.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 等级倍率}"
IsReadOnly="True"
SortMemberPath="MoneyLevel.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 等级倍率}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="MoneyLevel.Value" />
<DataGridTextColumn
Binding="{Binding StrengthFood.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 饱食度消耗倍率}"
IsReadOnly="True"
SortMemberPath="StrengthFood.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 饱食度消耗倍率}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="StrengthFood.Value" />
<DataGridTextColumn
Binding="{Binding StrengthDrink.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 口渴度消耗倍率}"
IsReadOnly="True"
SortMemberPath="StrengthDrink.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 口渴度消耗倍率}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="StrengthDrink.Value" />
<DataGridTextColumn
Binding="{Binding Feeling.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 心情消耗倍率}"
IsReadOnly="True"
SortMemberPath="Feeling.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 心情消耗倍率}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Feeling.Value" />
<DataGridTextColumn
Binding="{Binding LevelLimit.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 等级限制}"
IsReadOnly="True"
SortMemberPath="LevelLimit.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 等级限制}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="LevelLimit.Value" />
<DataGridTextColumn
Binding="{Binding Time.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 花费时间}"
IsReadOnly="True"
SortMemberPath="Time.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 花费时间}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="Time.Value" />
<DataGridTextColumn
Binding="{Binding FinishBonus.Value}"
CanUserSort="True"
ElementStyle="{DynamicResource TextBlock_LeftCenter}"
Header="{ll:Str 奖励倍率}"
IsReadOnly="True"
SortMemberPath="FinishBonus.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 奖励倍率}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
SortMemberPath="FinishBonus.Value" />
</DataGrid.Columns>
</DataGrid>
<Button