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];
if (i18nData.Value.TryGetValue(pet.Id.Value, out var 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))
petI18n.Description.Value = description;
foreach (var work in pet.Works)

View File

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

View File

@ -119,7 +119,7 @@ public class ModMakerWindowVM
lps.Add(
new Line(nameof(history))
{
new Sub("Id", history.Id),
new Sub("PetName", history.Id),
new Sub("SourcePath", history.SourcePath),
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 />
</Grid.RowDefinitions>
<Label Content="Id" />
@ -370,10 +371,16 @@
Grid.Column="1"
pu:TextBoxHelper.Watermark="{ll:Str 名称}"
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
Grid.Row="3"
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 描述}"
Style="{StaticResource TextBox_Wrap}"
Text="{Binding Pet.Value.CurrentI18nData.Value.Description.Value, UpdateSourceTrigger=PropertyChanged}" />

View File

@ -58,6 +58,15 @@
<TextBlock Text="{ll:Str 名称}" />
</DataGridTextColumn.Header>
</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
Binding="{Binding CurrentI18nData.Value.Description.Value}"
CanUserSort="True"