This commit is contained in:
Hakoyu 2023-10-27 01:01:51 +08:00
parent 3d70fa4b56
commit 7a223ebeb6
5 changed files with 37 additions and 5 deletions

View File

@ -292,6 +292,8 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
var petI18n = pet.I18nDatas[i18nData.Key]; var petI18n = pet.I18nDatas[i18nData.Key];
if (i18nData.Value.TryGetValue(pet.Id.Value, out var name)) if (i18nData.Value.TryGetValue(pet.Id.Value, out var name))
petI18n.Name.Value = name; petI18n.Name.Value = name;
if (i18nData.Value.TryGetValue(pet.PetNameId.Value, out var petName))
petI18n.PetName.Value = petName;
if (i18nData.Value.TryGetValue(pet.DescriptionId.Value, out var description)) if (i18nData.Value.TryGetValue(pet.DescriptionId.Value, out var description))
petI18n.Description.Value = description; petI18n.Description.Value = description;
foreach (var work in pet.Works) foreach (var work in pet.Works)

View File

@ -25,6 +25,11 @@ public class PetModel : I18nModel<I18nPetInfoModel>
/// </summary> /// </summary>
public ObservableValue<string> Id { get; } = new(); public ObservableValue<string> Id { get; } = new();
/// <summary>
/// 名称Id
/// </summary>
public ObservableValue<string> PetNameId { get; } = new();
/// <summary> /// <summary>
/// 描述Id /// 描述Id
/// </summary> /// </summary>
@ -90,6 +95,7 @@ public class PetModel : I18nModel<I18nPetInfoModel>
DescriptionId.Value = $"{Id.Value}_{nameof(DescriptionId)}"; DescriptionId.Value = $"{Id.Value}_{nameof(DescriptionId)}";
Id.ValueChanged += (o, n) => Id.ValueChanged += (o, n) =>
{ {
PetNameId.Value = $"{n}_{nameof(PetNameId)}";
DescriptionId.Value = $"{n}_{nameof(DescriptionId)}"; DescriptionId.Value = $"{n}_{nameof(DescriptionId)}";
}; };
AnimeCount.AddNotifyReceiver(Animes); AnimeCount.AddNotifyReceiver(Animes);
@ -104,6 +110,7 @@ public class PetModel : I18nModel<I18nPetInfoModel>
: this() : this()
{ {
Id.Value = model.Id.Value; Id.Value = model.Id.Value;
PetNameId.Value = model.PetNameId.Value;
TouchHeadRect.Value = model.TouchHeadRect.Value.Copy(); TouchHeadRect.Value = model.TouchHeadRect.Value.Copy();
TouchBodyRect.Value = model.TouchBodyRect.Value.Copy(); TouchBodyRect.Value = model.TouchBodyRect.Value.Copy();
TouchRaisedRect.Value = model.TouchRaisedRect.Value.Copy(); TouchRaisedRect.Value = model.TouchRaisedRect.Value.Copy();
@ -119,7 +126,8 @@ public class PetModel : I18nModel<I18nPetInfoModel>
public PetModel(PetLoader loader) public PetModel(PetLoader loader)
: this() : this()
{ {
Id.Value = loader.PetName; Id.Value = loader.Name;
PetNameId.Value = loader.PetName;
DescriptionId.Value = loader.Intor; DescriptionId.Value = loader.Intor;
TouchHeadRect.Value.SetValue( TouchHeadRect.Value.SetValue(
@ -187,7 +195,7 @@ public class PetModel : I18nModel<I18nPetInfoModel>
public PetModel(PetLoader loader, bool isSimplePet) public PetModel(PetLoader loader, bool isSimplePet)
: this() : this()
{ {
Id.Value = loader.PetName; Id.Value = loader.Name;
IsSimplePetModel = isSimplePet; IsSimplePetModel = isSimplePet;
} }
@ -211,6 +219,10 @@ public class PetModel : I18nModel<I18nPetInfoModel>
Id.Value, Id.Value,
I18nDatas[cultureName].Name.Value I18nDatas[cultureName].Name.Value
); );
ModInfoModel.SaveI18nDatas[cultureName].TryAdd(
PetNameId.Value,
I18nDatas[cultureName].PetName.Value
);
ModInfoModel.SaveI18nDatas[cultureName].TryAdd( ModInfoModel.SaveI18nDatas[cultureName].TryAdd(
DescriptionId.Value, DescriptionId.Value,
I18nDatas[cultureName].Description.Value I18nDatas[cultureName].Description.Value
@ -291,7 +303,7 @@ public class PetModel : I18nModel<I18nPetInfoModel>
{ {
new Sub("intor", DescriptionId.Value), new Sub("intor", DescriptionId.Value),
new Sub("path", Id.Value), new Sub("path", Id.Value),
new Sub("petname", Id.Value) new Sub("petname", PetNameId.Value)
} }
); );
lps.Add( lps.Add(
@ -359,12 +371,14 @@ public class PetModel : I18nModel<I18nPetInfoModel>
public class I18nPetInfoModel public class I18nPetInfoModel
{ {
public ObservableValue<string> Name { get; } = new(); public ObservableValue<string> Name { get; } = new();
public ObservableValue<string> PetName { get; } = new();
public ObservableValue<string> Description { get; } = new(); public ObservableValue<string> Description { get; } = new();
public I18nPetInfoModel Copy() public I18nPetInfoModel Copy()
{ {
var result = new I18nPetInfoModel(); var result = new I18nPetInfoModel();
result.Name.Value = Name.Value; result.Name.Value = Name.Value;
result.PetName.Value = PetName.Value;
result.Description.Value = Description.Value; result.Description.Value = Description.Value;
return result; return result;
} }

View File

@ -119,7 +119,7 @@ public class ModMakerWindowVM
lps.Add( lps.Add(
new Line(nameof(history)) new Line(nameof(history))
{ {
new Sub("Id", history.Id), new Sub("PetName", history.Id),
new Sub("SourcePath", history.SourcePath), new Sub("SourcePath", history.SourcePath),
new Sub("LastTime", history.LastTime.ToString("yyyy/MM/dd HH:mm")) new Sub("LastTime", history.LastTime.ToString("yyyy/MM/dd HH:mm"))
} }

View File

@ -351,6 +351,7 @@
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition /> <RowDefinition />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Label Content="Id" /> <Label Content="Id" />
@ -370,10 +371,16 @@
Grid.Column="1" Grid.Column="1"
pu:TextBoxHelper.Watermark="{ll:Str 名称}" pu:TextBoxHelper.Watermark="{ll:Str 名称}"
Text="{Binding Pet.Value.CurrentI18nData.Value.Name.Value, UpdateSourceTrigger=PropertyChanged}" /> Text="{Binding Pet.Value.CurrentI18nData.Value.Name.Value, UpdateSourceTrigger=PropertyChanged}" />
<Label Grid.Row="3" Content="{ll:Str 描述}" /> <Label Grid.Row="3" Content="{ll:Str 宠物名称}" />
<TextBox <TextBox
Grid.Row="3" Grid.Row="3"
Grid.Column="1" Grid.Column="1"
pu:TextBoxHelper.Watermark="{ll:Str 宠物名称}"
Text="{Binding Pet.Value.CurrentI18nData.Value.PetName.Value, UpdateSourceTrigger=PropertyChanged}" />
<Label Grid.Row="4" Content="{ll:Str 描述}" />
<TextBox
Grid.Row="4"
Grid.Column="1"
pu:TextBoxHelper.Watermark="{ll:Str 描述}" pu:TextBoxHelper.Watermark="{ll:Str 描述}"
Style="{StaticResource TextBox_Wrap}" Style="{StaticResource TextBox_Wrap}"
Text="{Binding Pet.Value.CurrentI18nData.Value.Description.Value, UpdateSourceTrigger=PropertyChanged}" /> Text="{Binding Pet.Value.CurrentI18nData.Value.Description.Value, UpdateSourceTrigger=PropertyChanged}" />

View File

@ -58,6 +58,15 @@
<TextBlock Text="{ll:Str 名称}" /> <TextBlock Text="{ll:Str 名称}" />
</DataGridTextColumn.Header> </DataGridTextColumn.Header>
</DataGridTextColumn> </DataGridTextColumn>
<DataGridTextColumn
Binding="{Binding CurrentI18nData.Value.PetName.Value}"
CanUserSort="True"
IsReadOnly="True"
SortMemberPath="CurrentI18nData.Value.Name.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 宠物名称}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn <DataGridTextColumn
Binding="{Binding CurrentI18nData.Value.Description.Value}" Binding="{Binding CurrentI18nData.Value.Description.Value}"
CanUserSort="True" CanUserSort="True"