FoodEdit支持Graph

This commit is contained in:
Hakoyu 2023-09-05 20:36:33 +08:00
parent e9198a2c8d
commit 41fd4bf738
7 changed files with 55 additions and 25 deletions

View File

@ -18,6 +18,7 @@ public class FoodModel : I18nModel<I18nFoodModel>
public ObservableValue<string> Name { get; } = new();
public ObservableValue<string> Description { get; } = new();
public ObservableValue<string> Graph { get; } = new();
public ObservableValue<Food.FoodType> Type { get; } = new();
public ObservableValue<double> Strength { get; } = new();
public ObservableValue<double> StrengthFood { get; } = new();
@ -36,6 +37,7 @@ public class FoodModel : I18nModel<I18nFoodModel>
{
Name.Value = food.Name.Value;
Description.Value = food.Description.Value;
Graph.Value = food.Graph.Value;
Type.Value = food.Type.Value;
Strength.Value = food.Strength.Value;
StrengthFood.Value = food.StrengthFood.Value;
@ -60,6 +62,7 @@ public class FoodModel : I18nModel<I18nFoodModel>
{
Name.Value = food.Name;
Description.Value = food.Desc;
Graph.Value = food.Graph;
Type.Value = food.Type;
Strength.Value = food.Strength;
StrengthDrink.Value = food.StrengthDrink;
@ -79,6 +82,7 @@ public class FoodModel : I18nModel<I18nFoodModel>
{
Name = Name.Value,
Desc = $"{Name.Value}_{nameof(Description)}",
Graph = Graph.Value,
Type = Type.Value,
Strength = Strength.Value,
StrengthFood = StrengthFood.Value,

View File

@ -17,7 +17,7 @@ namespace VPet.ModMaker.Models;
public class ModInfoModel : I18nModel<I18nModInfoModel>
{
public static ModInfoModel Current { get; set; }
public static ModInfoModel Current { get; set; } = new();
public ObservableValue<string> Name { get; } = new();
public ObservableValue<string> Description { get; } = new();

View File

@ -104,7 +104,18 @@ public class ModMakerWindowVM
public void CreateNewMod()
{
ModInfoModel.Current ??= new();
ModInfoModel.Current = new();
ShowEditWindow();
}
public void EditMod(ModInfoModel modInfo)
{
ModInfoModel.Current = modInfo;
ShowEditWindow();
}
private void ShowEditWindow()
{
ModEditWindow = new();
ModEditWindow.Show();
ModMakerWindow.Hide();

View File

@ -68,7 +68,7 @@
IsReadOnly="True"
SortMemberPath="Name.Value">
<DataGridTextColumn.Header>
<Label Content="Id" />
<TextBlock Text="Id" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn
@ -79,7 +79,7 @@
IsReadOnly="True"
SortMemberPath="CurrentI18nData.Value.Text.Value">
<DataGridTextColumn.Header>
<Label Content="{ll:Str 文本}" />
<TextBlock Text="{ll:Str 文本}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn
@ -88,7 +88,7 @@
IsReadOnly="True"
SortMemberPath="Mode.Value">
<DataGridTextColumn.Header>
<Label Content="{ll:Str 状态}" />
<TextBlock Text="{ll:Str 状态}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn
@ -97,7 +97,7 @@
IsReadOnly="True"
SortMemberPath="Working.Value">
<DataGridTextColumn.Header>
<Label Content="{ll:Str 指定工作}" />
<TextBlock Text="{ll:Str 指定工作}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn
@ -106,7 +106,7 @@
IsReadOnly="True"
SortMemberPath="WorkingState.Value">
<DataGridTextColumn.Header>
<Label Content="{ll:Str 工作状态}" />
<TextBlock Text="{ll:Str 工作状态}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn

View File

@ -63,6 +63,7 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Label Content="{ll:Str 食物Id}" />
@ -77,16 +78,22 @@
Grid.Column="1"
ItemsSource="{Binding Food.Value.FoodTypes}"
SelectedItem="{Binding Food.Value.Type.Value}" />
<Label Grid.Row="2" Content="{ll:Str 食物名称}" />
<Label Grid.Row="2" Content="{ll:Str 动画名称}" />
<TextBox
Grid.Row="2"
Grid.Column="1"
pu:TextBoxHelper.Watermark="{ll:Str 食物名称}"
Text="{Binding Food.Value.CurrentI18nData.Value.Name.Value, UpdateSourceTrigger=PropertyChanged}" />
<Label Grid.Row="3" Content="{ll:Str 食物描述}" />
pu:TextBoxHelper.Watermark="{ll:Str 动画名称(非必要)}"
Text="{Binding Food.Value.Graph.Value, UpdateSourceTrigger=PropertyChanged}" />
<Label Grid.Row="3" Content="{ll:Str 食物名称}" />
<TextBox
Grid.Row="3"
Grid.Column="1"
pu:TextBoxHelper.Watermark="{ll:Str 食物名称}"
Text="{Binding Food.Value.CurrentI18nData.Value.Name.Value, UpdateSourceTrigger=PropertyChanged}" />
<Label Grid.Row="4" Content="{ll:Str 食物描述}" />
<TextBox
Grid.Row="4"
Grid.Column="1"
pu:TextBoxHelper.Watermark="{ll:Str 食物描述}"
Text="{Binding Food.Value.CurrentI18nData.Value.Description.Value, UpdateSourceTrigger=PropertyChanged}" />
</Grid>

View File

@ -21,8 +21,24 @@
<ColumnDefinition Width="200" />
</Grid.ColumnDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label Content="Id" />
<TextBox
Grid.Column="1"
Style="{StaticResource TextBox_Wrap}"
Text="{Binding LowText.Value.Name.Value, UpdateSourceTrigger=PropertyChanged}" />
</Grid>
<TextBox
x:Name="TextBox_Text"
Grid.Row="1"
d:Text="这是一个测试文本,这是一个测试文本,这是一个测试文本,这是一个测试文本,这是一个测试文本,这是一个测试文本,这是一个测试文本,"
pu:TextBoxHelper.Watermark="{ll:Str 文本}"
Style="{StaticResource TextBox_Wrap}"
@ -39,31 +55,24 @@
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label Content="Id" />
<TextBox
Grid.Column="1"
Style="{StaticResource TextBox_Wrap}"
Text="{Binding LowText.Value.Name.Value, UpdateSourceTrigger=PropertyChanged}" />
<Label Grid.Row="1" Content="{ll:Str 状态}" />
<Label Content="{ll:Str 状态}" />
<ComboBox
Grid.Row="1"
Grid.Column="1"
ItemsSource="{Binding LowText.Value.ModeTypes}"
SelectedItem="{Binding LowText.Value.Mode.Value}" />
<Label Grid.Row="2" Content="{ll:Str 饥渴状态}" />
<Label Grid.Row="1" Content="{ll:Str 饥渴状态}" />
<ComboBox
Grid.Row="2"
Grid.Row="1"
Grid.Column="1"
ItemsSource="{Binding LowText.Value.StrengthTypes}"
SelectedItem="{Binding LowText.Value.Strength.Value}" />
<Label Grid.Row="3" Content="{ll:Str 好感度需求}" />
<Label Grid.Row="2" Content="{ll:Str 好感度需求}" />
<ComboBox
Grid.Row="3"
Grid.Row="2"
Grid.Column="1"
ItemsSource="{Binding LowText.Value.LikeTypes}"
SelectedItem="{Binding LowText.Value.Like.Value}" />

View File

@ -57,8 +57,7 @@ public partial class ModMakerWindow : Window
var loader = new ModLoader(new(history.SourcePath));
if (loader.SuccessLoad)
{
ModInfoModel.Current = new(loader);
ViewModel.CreateNewMod();
ViewModel.EditMod(new(loader));
}
else
MessageBox.Show($"载入失败".Translate());