实装 SelectTextEdit

This commit is contained in:
Hakoyu 2023-09-06 23:21:03 +08:00
parent 4f1c92c82b
commit 22be8ad961
16 changed files with 563 additions and 125 deletions

View File

@ -30,7 +30,14 @@ public class FoodModel : I18nModel<I18nFoodModel>
public ObservableValue<int> Exp { get; } = new(); public ObservableValue<int> Exp { get; } = new();
public ObservableValue<BitmapImage> Image { get; } = new(); public ObservableValue<BitmapImage> Image { get; } = new();
public FoodModel() { } public FoodModel()
{
Description.Value = $"{Name.Value}_{nameof(Description)}";
Name.ValueChanged += (v) =>
{
Description.Value = $"{v}_{nameof(Description)}";
};
}
public FoodModel(FoodModel food) public FoodModel(FoodModel food)
: this() : this()
@ -81,7 +88,7 @@ public class FoodModel : I18nModel<I18nFoodModel>
return new Food() return new Food()
{ {
Name = Name.Value, Name = Name.Value,
Desc = $"{Name.Value}_{nameof(Description)}", Desc = Description.Value,
Graph = Graph.Value, Graph = Graph.Value,
Type = Type.Value, Type = Type.Value,
Strength = Strength.Value, Strength = Strength.Value,

View File

@ -34,9 +34,17 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
public Dictionary<string, Dictionary<string, string>> OtherI18nDatas { get; } = new(); public Dictionary<string, Dictionary<string, string>> OtherI18nDatas { get; } = new();
public ModInfoModel() { } public ModInfoModel()
{
Description.Value = $"{Name.Value}_{nameof(Description)}";
Name.ValueChanged += (v) =>
{
Description.Value = $"{v}_{nameof(Description)}";
};
}
public ModInfoModel(ModLoader loader) public ModInfoModel(ModLoader loader)
: this()
{ {
SourcePath.Value = loader.Path.FullName; SourcePath.Value = loader.Path.FullName;
Name.Value = loader.Name; Name.Value = loader.Name;
@ -53,6 +61,9 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
ClickTexts.Add(new(clickText)); ClickTexts.Add(new(clickText));
foreach (var lowText in loader.LowTexts) foreach (var lowText in loader.LowTexts)
LowTexts.Add(new(lowText)); LowTexts.Add(new(lowText));
foreach (var selectText in loader.SelectTexts)
SelectTexts.Add(new(selectText));
Summary.Value = GetSummary(); Summary.Value = GetSummary();
foreach (var lang in loader.I18nDatas) foreach (var lang in loader.I18nDatas)
I18nDatas.Add(lang.Key, lang.Value); I18nDatas.Add(lang.Key, lang.Value);
@ -123,9 +134,13 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
private void SaveFoods(string path) private void SaveFoods(string path)
{ {
if (Foods.Count == 0)
return;
var foodPath = Path.Combine(path, "food"); var foodPath = Path.Combine(path, "food");
if (Foods.Count == 0)
{
if (Directory.Exists(foodPath))
Directory.Delete(foodPath, true);
return;
}
Directory.CreateDirectory(foodPath); Directory.CreateDirectory(foodPath);
var foodFile = Path.Combine(foodPath, "food.lps"); var foodFile = Path.Combine(foodPath, "food.lps");
if (File.Exists(foodFile) is false) if (File.Exists(foodFile) is false)
@ -138,12 +153,31 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
private void SaveText(string path) private void SaveText(string path)
{ {
if (LowTexts.Count == 0 && ClickTexts.Count == 0)
return;
var textPath = Path.Combine(path, "text"); var textPath = Path.Combine(path, "text");
if (LowTexts.Count == 0 && ClickTexts.Count == 0 && SelectTexts.Count == 0)
{
if (Directory.Exists(textPath))
Directory.Delete(textPath, true);
return;
}
Directory.CreateDirectory(textPath); Directory.CreateDirectory(textPath);
SaveLowText(textPath); SaveLowText(textPath);
SaveClickText(textPath); SaveClickText(textPath);
SaveSelectText(textPath);
}
private void SaveSelectText(string textPath)
{
if (SelectTexts.Count == 0)
return;
var textFile = Path.Combine(textPath, "selectText.lps");
File.Create(textFile).Close();
var lps = new LPS();
foreach (var text in SelectTexts)
{
lps.Add(LPSConvert.SerializeObjectToLine<Line>(text.ToSelectText(), "SelectText"));
}
File.WriteAllText(textFile, lps.ToString());
} }
private void SaveLowText(string textPath) private void SaveLowText(string textPath)
@ -192,15 +226,18 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
new Line(food.Description.Value, food.I18nDatas[cultureName].Description.Value) new Line(food.Description.Value, food.I18nDatas[cultureName].Description.Value)
); );
} }
foreach (var lowText in LowTexts) foreach (var text in LowTexts)
{ {
lps.Add(new Line(lowText.Name.Value, lowText.I18nDatas[cultureName].Text.Value)); lps.Add(new Line(text.Name.Value, text.I18nDatas[cultureName].Text.Value));
} }
foreach (var clickText in ClickTexts) foreach (var text in ClickTexts)
{ {
lps.Add( lps.Add(new Line(text.Name.Value, text.I18nDatas[cultureName].Text.Value));
new Line(clickText.Name.Value, clickText.I18nDatas[cultureName].Text.Value) }
); foreach (var text in SelectTexts)
{
lps.Add(new Line(text.Name.Value, text.I18nDatas[cultureName].Text.Value));
lps.Add(new Line(text.Choose.Value, text.I18nDatas[cultureName].Choose.Value));
} }
File.WriteAllText(cultureFile, lps.ToString()); File.WriteAllText(cultureFile, lps.ToString());
} }
@ -217,7 +254,10 @@ public class ModInfoModel : I18nModel<I18nModInfoModel>
foreach (var food in Foods) foreach (var food in Foods)
{ {
var foodImagePath = Utils.GetImageSourceFile(food.Image.Value); var foodImagePath = Utils.GetImageSourceFile(food.Image.Value);
var targetImagePath = Path.Combine(foodPath, Path.GetFileName(foodImagePath)); var targetImagePath = Path.Combine(
foodPath,
$"{food.Name.Value}{Path.GetExtension(foodImagePath)}"
);
if (foodImagePath != targetImagePath) if (foodImagePath != targetImagePath)
File.Copy(foodImagePath, targetImagePath, true); File.Copy(foodImagePath, targetImagePath, true);
} }

View File

@ -36,10 +36,12 @@ public class ModLoader
public List<PetLoader> Pets { get; } = new(); public List<PetLoader> Pets { get; } = new();
public List<Food> Foods { get; } = new(); public List<Food> Foods { get; } = new();
public List<LowText> LowTexts { get; } = new(); public List<LowText> LowTexts { get; } = new();
public List<ClickText> ClickTexts { get; } = new();
public List<SelectText> SelectTexts { get; } = new();
public Dictionary<string, I18nModInfoModel> I18nDatas { get; } = new(); public Dictionary<string, I18nModInfoModel> I18nDatas { get; } = new();
public Dictionary<string, Dictionary<string, string>> OtherI18nDatas { get; } = new(); public Dictionary<string, Dictionary<string, string>> OtherI18nDatas { get; } = new();
public List<ClickText> ClickTexts { get; } = new();
public ModLoader(DirectoryInfo directory) public ModLoader(DirectoryInfo directory)
{ {
@ -142,11 +144,11 @@ public class ModLoader
case "clicktext": case "clicktext":
ClickTexts.Add(LPSConvert.DeserializeObject<ClickText>(li)); ClickTexts.Add(LPSConvert.DeserializeObject<ClickText>(li));
break; break;
//case "selecttext": case "selecttext":
// mw.SelectTexts.Add( SelectTexts.Add(
// LPSConvert.DeserializeObject<SelectText>(li) LPSConvert.DeserializeObject<SelectText>(li)
// ); );
// break; break;
} }
} }
} }

View File

@ -6,21 +6,128 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using VPet.ModMaker.Models; using VPet.ModMaker.Models;
using VPet_Simulator.Windows.Interface;
namespace VPet.ModMaker.Models; namespace VPet.ModMaker.Models;
public class SelectTextModel : ClickTextModel public class SelectTextModel : I18nModel<I18nSelectTextModel>
{ {
public ObservableValue<int> Exp { get; } = new(); public static ObservableCollection<ClickText.ModeType> ModeTypes => ClickTextModel.ModeTypes;
public ObservableValue<double> Money { get; } = new();
public ObservableValue<double> Strength { get; } = new(); //public ObservableValue<int> Exp { get; } = new();
public ObservableValue<double> StrengthFood { get; } = new(); //public ObservableValue<double> Money { get; } = new();
public ObservableValue<double> StrengthDrink { get; } = new(); //public ObservableValue<double> Strength { get; } = new();
public ObservableValue<double> Feeling { get; } = new(); //public ObservableValue<double> StrengthFood { get; } = new();
public ObservableValue<double> Health { get; } = new(); //public ObservableValue<double> StrengthDrink { get; } = new();
public ObservableValue<double> Likability { get; } = new(); //public ObservableValue<double> Feeling { get; } = new();
//public ObservableValue<double> Health { get; } = new();
//public ObservableValue<double> Likability { get; } = new();
public ObservableValue<string> Tags { get; } = new(); public ObservableValue<string> Tags { get; } = new();
public ObservableValue<string> ToTags { get; } = new(); public ObservableValue<string> ToTags { get; } = new();
public SelectTextModel() { } public ObservableValue<string> Name { get; } = new();
public ObservableValue<string> Choose { get; } = new();
public ObservableValue<ClickText.ModeType> Mode { get; } = new();
//public ObservableValue<string> Working { get; } = new();
//public ObservableValue<VPet_Simulator.Core.Main.WorkingState> WorkingState { get; } = new();
//public ObservableValue<ClickText.DayTime> DayTime { get; } = new();
public ObservableRange<double> Like { get; } = new(0, int.MaxValue);
public ObservableRange<double> Health { get; } = new(0, int.MaxValue);
public ObservableRange<double> Level { get; } = new(0, int.MaxValue);
public ObservableRange<double> Money { get; } = new(int.MinValue, int.MaxValue);
public ObservableRange<double> Food { get; } = new(0, int.MaxValue);
public ObservableRange<double> Drink { get; } = new(0, int.MaxValue);
public ObservableRange<double> Feel { get; } = new(0, int.MaxValue);
public ObservableRange<double> Strength { get; } = new(0, int.MaxValue);
public SelectTextModel()
{
Choose.Value = $"{Name.Value}_{nameof(Choose)}";
Name.ValueChanged += (v) =>
{
Choose.Value = $"{v}_{nameof(Choose)}";
};
}
public SelectTextModel(SelectTextModel model)
: this()
{
Name.Value = model.Name.Value;
Mode.Value = model.Mode.Value;
//Working.Value = model.Working.Value;
//WorkingState.Value = model.WorkingState.Value;
//DayTime.Value = model.DayTime.Value;
Like = model.Like.Copy();
Health = model.Health.Copy();
Level = model.Level.Copy();
Money = model.Money.Copy();
Food = model.Food.Copy();
Drink = model.Drink.Copy();
Feel = model.Feel.Copy();
Strength = model.Strength.Copy();
foreach (var item in model.I18nDatas)
{
I18nDatas[item.Key] = new();
I18nDatas[item.Key].Text.Value = model.I18nDatas[item.Key].Text.Value;
I18nDatas[item.Key].Choose.Value = model.I18nDatas[item.Key].Choose.Value;
}
CurrentI18nData.Value = I18nDatas[I18nHelper.Current.CultureName.Value];
}
public SelectTextModel(SelectText text)
: this()
{
Name.Value = text.Text;
Choose.Value = text.Choose ?? string.Empty;
Mode.Value = text.Mode;
//Working.Value = text.Working;
//WorkingState.Value = text.State;
//DayTime.Value = text.DaiTime;
Like.SetValue(text.LikeMin, text.LikeMax);
Health.SetValue(text.HealthMin, text.HealthMax);
Level.SetValue(text.LevelMin, text.LevelMax);
Money.SetValue(text.MoneyMin, text.MoneyMax);
Food.SetValue(text.FoodMin, text.FoodMax);
Drink.SetValue(text.DrinkMin, text.DrinkMax);
Feel.SetValue(text.FeelMin, text.FeelMax);
Strength.SetValue(text.StrengthMin, text.StrengthMax);
}
public SelectText ToSelectText()
{
return new()
{
Text = Name.Value,
Choose = Choose.Value,
Mode = Mode.Value,
//Working = Working.Value,
//State = WorkingState.Value,
//DaiTime = DayTime.Value,
LikeMax = Like.Max.Value,
LikeMin = Like.Min.Value,
HealthMin = Health.Min.Value,
HealthMax = Health.Max.Value,
LevelMin = Level.Min.Value,
LevelMax = Level.Max.Value,
MoneyMin = Money.Min.Value,
MoneyMax = Money.Max.Value,
FoodMin = Food.Min.Value,
FoodMax = Food.Max.Value,
DrinkMin = Drink.Min.Value,
DrinkMax = Drink.Max.Value,
FeelMin = Feel.Min.Value,
FeelMax = Feel.Max.Value,
StrengthMin = Strength.Min.Value,
StrengthMax = Strength.Max.Value,
};
}
}
public class I18nSelectTextModel
{
public ObservableValue<string> Choose { get; } = new();
public ObservableValue<string> Text { get; } = new();
} }

View File

@ -112,6 +112,8 @@
<Compile Include="ViewModels\ModEdit\ModEditWindowVM.cs" /> <Compile Include="ViewModels\ModEdit\ModEditWindowVM.cs" />
<Compile Include="ViewModels\ModEdit\PetEdit\PetEditWindowVM.cs" /> <Compile Include="ViewModels\ModEdit\PetEdit\PetEditWindowVM.cs" />
<Compile Include="ViewModels\ModEdit\PetEdit\PetPageVM.cs" /> <Compile Include="ViewModels\ModEdit\PetEdit\PetPageVM.cs" />
<Compile Include="ViewModels\ModEdit\SelectTextEdit\SelectTextEditWindowVM.cs" />
<Compile Include="ViewModels\ModEdit\SelectTextEdit\SelectTextPageVM.cs" />
<Compile Include="Views\ModEdit\ClickTextEdit\ClickTextPage.xaml.cs"> <Compile Include="Views\ModEdit\ClickTextEdit\ClickTextPage.xaml.cs">
<DependentUpon>ClickTextPage.xaml</DependentUpon> <DependentUpon>ClickTextPage.xaml</DependentUpon>
</Compile> </Compile>
@ -262,8 +264,6 @@
<Install>false</Install> <Install>false</Install>
</BootstrapperPackage> </BootstrapperPackage>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup />
<Folder Include="ViewModels\ModEdit\SelectTextEdit\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>

View File

@ -51,28 +51,36 @@ public class ModEditWindowVM
if (I18nHelper.Current.CultureNames.Count > 0) if (I18nHelper.Current.CultureNames.Count > 0)
{ {
I18nHelper.Current.CultureName.Value = I18nHelper.Current.CultureNames.First(); I18nHelper.Current.CultureName.Value = I18nHelper.Current.CultureNames.First();
foreach (var i18n in ModInfo.Value.OtherI18nDatas) foreach (var i18nData in ModInfo.Value.OtherI18nDatas)
{ {
foreach (var food in ModInfo.Value.Foods) foreach (var food in ModInfo.Value.Foods)
{ {
var foodI18n = food.I18nDatas[i18n.Key]; var foodI18n = food.I18nDatas[i18nData.Key];
if (i18n.Value.TryGetValue(food.Name.Value, out var name)) if (i18nData.Value.TryGetValue(food.Name.Value, out var name))
foodI18n.Name.Value = name; foodI18n.Name.Value = name;
if (i18n.Value.TryGetValue(food.Description.Value, out var description)) if (i18nData.Value.TryGetValue(food.Description.Value, out var description))
foodI18n.Description.Value = description; foodI18n.Description.Value = description;
} }
foreach (var lowText in ModInfo.Value.LowTexts) foreach (var lowText in ModInfo.Value.LowTexts)
{ {
var lowTextI18n = lowText.I18nDatas[i18n.Key]; var lowTextI18n = lowText.I18nDatas[i18nData.Key];
if (i18n.Value.TryGetValue(lowText.Name.Value, out var text)) if (i18nData.Value.TryGetValue(lowText.Name.Value, out var text))
lowTextI18n.Text.Value = text; lowTextI18n.Text.Value = text;
} }
foreach (var clickText in ModInfo.Value.ClickTexts) foreach (var clickText in ModInfo.Value.ClickTexts)
{ {
var clickTextI18n = clickText.I18nDatas[i18n.Key]; var clickTextI18n = clickText.I18nDatas[i18nData.Key];
if (i18n.Value.TryGetValue(clickText.Name.Value, out var text)) if (i18nData.Value.TryGetValue(clickText.Name.Value, out var text))
clickTextI18n.Text.Value = text; clickTextI18n.Text.Value = text;
} }
foreach (var selectText in ModInfo.Value.SelectTexts)
{
var selectTextI18n = selectText.I18nDatas[i18nData.Key];
if (i18nData.Value.TryGetValue(selectText.Name.Value, out var text))
selectTextI18n.Text.Value = text;
if (i18nData.Value.TryGetValue(selectText.Choose.Value, out var choose))
selectTextI18n.Choose.Value = choose;
}
} }
} }

View File

@ -0,0 +1,17 @@
using HKW.HKWViewModels.SimpleObservable;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VPet.ModMaker.Models;
namespace VPet.ModMaker.ViewModels.ModEdit.SelectTextEdit;
public class SelectTextEditWindowVM
{
#region Value
public SelectTextModel OldSelectText { get; set; }
public ObservableValue<SelectTextModel> SelectText { get; } = new(new());
#endregion
}

View File

@ -0,0 +1,95 @@
using HKW.HKWViewModels.SimpleObservable;
using LinePutScript.Localization.WPF;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using VPet.ModMaker.Models;
using VPet.ModMaker.Views.ModEdit.SelectTextEdit;
namespace VPet.ModMaker.ViewModels.ModEdit.SelectTextEdit;
public class SelectTextPageVM
{
#region Value
public ObservableValue<ObservableCollection<SelectTextModel>> ShowSelectTexts { get; } = new();
public ObservableCollection<SelectTextModel> SelectTexts => ModInfoModel.Current.SelectTexts;
public ObservableValue<string> FilterSelectText { get; } = new();
#endregion
#region Command
public ObservableCommand AddSelectTextCommand { get; } = new();
public ObservableCommand<SelectTextModel> EditSelectTextCommand { get; } = new();
public ObservableCommand<SelectTextModel> RemoveSelectTextCommand { get; } = new();
#endregion
public SelectTextPageVM()
{
ShowSelectTexts.Value = SelectTexts;
FilterSelectText.ValueChanged += FilterSelectText_ValueChanged;
AddSelectTextCommand.ExecuteEvent += AddSelectText;
EditSelectTextCommand.ExecuteEvent += EditSelectText;
RemoveSelectTextCommand.ExecuteEvent += RemoveSelectText;
}
private void FilterSelectText_ValueChanged(string value)
{
if (string.IsNullOrWhiteSpace(value))
{
ShowSelectTexts.Value = SelectTexts;
}
else
{
ShowSelectTexts.Value = new(
SelectTexts.Where(f => f.CurrentI18nData.Value.Text.Value.Contains(value))
);
}
}
private void AddSelectText()
{
var window = new SelectTextEditWindow();
var vm = window.ViewModel;
window.ShowDialog();
if (window.IsCancel)
return;
SelectTexts.Add(vm.SelectText.Value);
}
public void EditSelectText(SelectTextModel model)
{
var window = new SelectTextEditWindow();
var vm = window.ViewModel;
vm.OldSelectText = model;
var newLowTest = vm.SelectText.Value = new(model);
window.ShowDialog();
if (window.IsCancel)
return;
if (ShowSelectTexts.Value.Count == SelectTexts.Count)
{
SelectTexts[SelectTexts.IndexOf(model)] = newLowTest;
}
else
{
SelectTexts[SelectTexts.IndexOf(model)] = newLowTest;
ShowSelectTexts.Value[ShowSelectTexts.Value.IndexOf(model)] = newLowTest;
}
}
private void RemoveSelectText(SelectTextModel model)
{
if (MessageBox.Show("确定删除吗".Translate(), "", MessageBoxButton.YesNo) is MessageBoxResult.No)
return;
if (ShowSelectTexts.Value.Count == SelectTexts.Count)
{
SelectTexts.Remove(model);
}
else
{
ShowSelectTexts.Value.Remove(model);
SelectTexts.Remove(model);
}
}
}

View File

@ -42,7 +42,7 @@
x:Name="TextBox_Text" x:Name="TextBox_Text"
Grid.Row="1" Grid.Row="1"
d:Text="这是一个测试文本,这是一个测试文本,这是一个测试文本,这是一个测试文本,这是一个测试文本,这是一个测试文本,这是一个测试文本," d:Text="这是一个测试文本,这是一个测试文本,这是一个测试文本,这是一个测试文本,这是一个测试文本,这是一个测试文本,这是一个测试文本,"
pu:TextBoxHelper.Watermark="文本" pu:TextBoxHelper.Watermark="{ll:Str 文本}"
Style="{StaticResource TextBox_Wrap}" Style="{StaticResource TextBox_Wrap}"
Text="{Binding ClickText.Value.CurrentI18nData.Value.Text.Value, UpdateSourceTrigger=PropertyChanged}" /> Text="{Binding ClickText.Value.CurrentI18nData.Value.Text.Value, UpdateSourceTrigger=PropertyChanged}" />
</Grid> </Grid>
@ -66,7 +66,10 @@
<RowDefinition /> <RowDefinition />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Label Content="{ll:Str 指定工作}" /> <Label Content="{ll:Str 指定工作}" />
<TextBox Grid.Column="1" Text="{Binding ClickText.Value.Working.Value, UpdateSourceTrigger=PropertyChanged}" /> <TextBox
Grid.Column="1"
pu:TextBoxHelper.Watermark="{ll:Str 非必要}"
Text="{Binding ClickText.Value.Working.Value, UpdateSourceTrigger=PropertyChanged}" />
<Label Grid.Row="3" Content="{ll:Str 模式}" /> <Label Grid.Row="3" Content="{ll:Str 模式}" />
<ComboBox <ComboBox
Grid.Row="3" Grid.Row="3"

View File

@ -34,10 +34,7 @@
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition /> <RowDefinition />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBox <TextBox pu:TextBoxHelper.Watermark="{ll:Str 搜索文本}" Text="{Binding FilterClickText.Value, UpdateSourceTrigger=PropertyChanged}" />
x:Name="TextBox_SearchFood"
pu:TextBoxHelper.Watermark="{ll:Str 搜索文本}"
Text="{Binding FilterClickText.Value, UpdateSourceTrigger=PropertyChanged}" />
<DataGrid <DataGrid
x:Name="DataGrid_ClickText" x:Name="DataGrid_ClickText"
Grid.Row="1" Grid.Row="1"

View File

@ -160,12 +160,12 @@
Tag="{ll:Str 低状态文本}"> Tag="{ll:Str 低状态文本}">
<Frame Content="{Binding ModEditWindow.LowTextPage}" /> <Frame Content="{Binding ModEditWindow.LowTextPage}" />
</TabItem> </TabItem>
<!--<TabItem <TabItem
x:Name="TabItem_SelectText" x:Name="TabItem_SelectText"
Header="选择文本 (0)" Header="选择文本 (0)"
Tag="{ll:Str 选择文本}"> Tag="{ll:Str 选择文本}">
<Frame Content="{Binding ModEditWindow.LowTextPage}" /> <Frame Content="{Binding ModEditWindow.SelectTextPage}" />
</TabItem>--> </TabItem>
<!--<TabItem Header="物品 (0)" Tag="{ll:Str 物品}"> <!--<TabItem Header="物品 (0)" Tag="{ll:Str 物品}">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>

View File

@ -20,6 +20,7 @@ using VPet.ModMaker.ViewModels.ModEdit;
using VPet.ModMaker.Views.ModEdit.ClickTextEdit; using VPet.ModMaker.Views.ModEdit.ClickTextEdit;
using VPet.ModMaker.Views.ModEdit.FoodEdit; using VPet.ModMaker.Views.ModEdit.FoodEdit;
using VPet.ModMaker.Views.ModEdit.LowTextEdit; using VPet.ModMaker.Views.ModEdit.LowTextEdit;
using VPet.ModMaker.Views.ModEdit.SelectTextEdit;
using VPet_Simulator.Windows.Interface; using VPet_Simulator.Windows.Interface;
namespace VPet.ModMaker.Views.ModEdit; namespace VPet.ModMaker.Views.ModEdit;
@ -34,6 +35,8 @@ public partial class ModEditWindow : Window
public LowTextPage LowTextPage { get; } = new(); public LowTextPage LowTextPage { get; } = new();
public ClickTextPage ClickTextPage { get; } = new(); public ClickTextPage ClickTextPage { get; } = new();
public SelectTextPage SelectTextPage { get; } = new();
public ModEditWindow() public ModEditWindow()
{ {
InitializeComponent(); InitializeComponent();
@ -43,10 +46,19 @@ public partial class ModEditWindow : Window
FoodPage.ViewModel.Foods.CollectionChanged += Foods_CollectionChanged; FoodPage.ViewModel.Foods.CollectionChanged += Foods_CollectionChanged;
LowTextPage.ViewModel.LowTexts.CollectionChanged += LowTexts_CollectionChanged; LowTextPage.ViewModel.LowTexts.CollectionChanged += LowTexts_CollectionChanged;
ClickTextPage.ViewModel.ClickTexts.CollectionChanged += ClickTexts_CollectionChanged; ClickTextPage.ViewModel.ClickTexts.CollectionChanged += ClickTexts_CollectionChanged;
SelectTextPage.ViewModel.SelectTexts.CollectionChanged += SelectTexts_CollectionChanged;
TabItem_ClickText.Header = TabItem_ClickText.Header =
$"{TabItem_ClickText.Tag} ({ClickTextPage.ViewModel.ClickTexts.Count})"; $"{TabItem_ClickText.Tag} ({ClickTextPage.ViewModel.ClickTexts.Count})";
TabItem_LowText.Header = $"{TabItem_LowText.Tag} ({LowTextPage.ViewModel.LowTexts.Count})"; TabItem_LowText.Header = $"{TabItem_LowText.Tag} ({LowTextPage.ViewModel.LowTexts.Count})";
TabItem_Food.Header = $"{TabItem_Food.Tag} ({FoodPage.ViewModel.Foods.Count})"; TabItem_Food.Header = $"{TabItem_Food.Tag} ({FoodPage.ViewModel.Foods.Count})";
TabItem_SelectText.Header =
$"{TabItem_SelectText.Tag} ({SelectTextPage.ViewModel.SelectTexts.Count})";
}
private void SelectTexts_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
TabItem_SelectText.Header =
$"{TabItem_SelectText.Tag} ({SelectTextPage.ViewModel.SelectTexts.Count})";
} }
private void ClickTexts_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) private void ClickTexts_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)

View File

@ -7,10 +7,14 @@
xmlns:local="clr-namespace:VPet.ModMaker.Views.ModEdit.SelectTextEdit" xmlns:local="clr-namespace:VPet.ModMaker.Views.ModEdit.SelectTextEdit"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pu="https://opensource.panuon.com/wpf-ui" xmlns:pu="https://opensource.panuon.com/wpf-ui"
xmlns:vm="clr-namespace:VPet.ModMaker.ViewModels.ModEdit.SelectTextEdit"
Title="SelectTextWindow" Title="SelectTextWindow"
Width="800" Width="800"
Height="450" Height="450"
mc:Ignorable="d"> mc:Ignorable="d">
<d:Window.DataContext>
<vm:SelectTextEditWindowVM />
</d:Window.DataContext>
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition /> <ColumnDefinition />
@ -26,21 +30,33 @@
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
<ColumnDefinition /> <ColumnDefinition />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label Content="Id" /> <Label Content="Id" />
<TextBox <TextBox
Grid.Column="1" Grid.Column="1"
pu:TextBoxHelper.Watermark="Id" pu:TextBoxHelper.Watermark="Id"
Style="{StaticResource TextBox_Wrap}" Style="{StaticResource TextBox_Wrap}"
Text="{Binding ClickText.Value.Name.Value, UpdateSourceTrigger=PropertyChanged}" Text="{Binding SelectText.Value.Name.Value, UpdateSourceTrigger=PropertyChanged}"
TextWrapping="Wrap" />
<Label Grid.Row="1" Content="{ll:Str 选项名}" />
<TextBox
Grid.Row="1"
Grid.Column="1"
pu:TextBoxHelper.Watermark="{ll:Str 显示在选项列表中的名称}"
Style="{StaticResource TextBox_Wrap}"
Text="{Binding SelectText.Value.CurrentI18nData.Value.Choose.Value, UpdateSourceTrigger=PropertyChanged}"
TextWrapping="Wrap" /> TextWrapping="Wrap" />
</Grid> </Grid>
<TextBox <TextBox
x:Name="TextBox_Text" x:Name="TextBox_Text"
Grid.Row="1" Grid.Row="2"
d:Text="这是一个测试文本,这是一个测试文本,这是一个测试文本,这是一个测试文本,这是一个测试文本,这是一个测试文本,这是一个测试文本," d:Text="这是一个测试文本,这是一个测试文本,这是一个测试文本,这是一个测试文本,这是一个测试文本,这是一个测试文本,这是一个测试文本,"
pu:TextBoxHelper.Watermark="文本" pu:TextBoxHelper.Watermark="{ll:Str 文本}"
Style="{StaticResource TextBox_Wrap}" Style="{StaticResource TextBox_Wrap}"
Text="{Binding ClickText.Value.CurrentI18nData.Value.Text.Value, UpdateSourceTrigger=PropertyChanged}" /> Text="{Binding SelectText.Value.CurrentI18nData.Value.Text.Value, UpdateSourceTrigger=PropertyChanged}" />
</Grid> </Grid>
<Grid Grid.Column="1"> <Grid Grid.Column="1">
<Grid.RowDefinitions> <Grid.RowDefinitions>
@ -60,38 +76,77 @@
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Label Content="{ll:Str 指定工作}" /> <!--<Label Content="{ll:Str 指定工作}" />
<TextBox Grid.Column="1" Text="{Binding ClickText.Value.Working.Value, UpdateSourceTrigger=PropertyChanged}" /> <TextBox
<Label Grid.Row="1" Content="{ll:Str 最小好感度}" />
<pu:NumberInput
Grid.Row="1"
Grid.Column="1" Grid.Column="1"
Margin="0" pu:TextBoxHelper.Watermark="{ll:Str 非必要}"
Value="{Binding ClickText.Value.LikeMin.Value}" /> Text="{Binding SelectText.Value.Working.Value, UpdateSourceTrigger=PropertyChanged}" />-->
<Label Grid.Row="2" Content="{ll:Str 最大好感度}" /> <Label Grid.Row="2" Content="{ll:Str 标签}" />
<pu:NumberInput <TextBox
Grid.Row="2" Grid.Row="2"
Grid.Column="1" Grid.Column="1"
Value="{Binding ClickText.Value.LikeMax.Value}" /> pu:TextBoxHelper.Watermark="{ll:Str 多标签使用逗号分隔}"
<Label Grid.Row="3" Content="{ll:Str 模式}" /> Text="{Binding SelectText.Value.Tags.Value, UpdateSourceTrigger=PropertyChanged}" />
<ComboBox <Label Grid.Row="3" Content="{ll:Str 跳转标签}" />
<TextBox
Grid.Row="3" Grid.Row="3"
Grid.Column="1" Grid.Column="1"
ItemsSource="{Binding ModeTypes}" pu:TextBoxHelper.Watermark="{ll:Str 多标签使用逗号分隔}"
SelectedItem="{Binding ClickText.Value.Mode.Value}" /> Text="{Binding SelectText.Value.ToTags.Value, UpdateSourceTrigger=PropertyChanged}" />
<Label Grid.Row="4" Content="{ll:Str 工作状态}" /> <Label Grid.Row="4" Content="{ll:Str 模式}" />
<ComboBox <ComboBox
Grid.Row="4" Grid.Row="4"
Grid.Column="1" Grid.Column="1"
ItemsSource="{Binding WorkingStates}" ItemsSource="{Binding SelectText.Value.ModeTypes}"
SelectedItem="{Binding ClickText.Value.WorkingState.Value}" /> SelectedItem="{Binding SelectText.Value.Mode.Value}" />
<Label Grid.Row="5" Content="{ll:Str 日期区间}" /> <!--<Label Grid.Row="5" Content="{ll:Str 工作状态}" />
<ComboBox <ComboBox
Grid.Row="5" Grid.Row="5"
Grid.Column="1" Grid.Column="1"
ItemsSource="{Binding DayTimes}" ItemsSource="{Binding SelectText.Value.WorkingStates}"
SelectedItem="{Binding ClickText.Value.DayTime.Value}" /> SelectedItem="{Binding SelectText.Value.WorkingState.Value}" />
<Label Grid.Row="6" Content="{ll:Str 日期区间}" />
<ComboBox
Grid.Row="6"
Grid.Column="1"
ItemsSource="{Binding SelectText.Value.DayTimes}"
SelectedItem="{Binding SelectText.Value.DayTime.Value}" />-->
<ListBox Grid.Row="7" Grid.ColumnSpan="2">
<ListBoxItem
DataContext="{Binding SelectText.Value.Like}"
Tag="{ll:Str 好感度范围}"
Template="{StaticResource ListBoxItem_RangeData}" />
<ListBoxItem
DataContext="{Binding SelectText.Value.Health}"
Tag="{ll:Str 健康度范围}"
Template="{StaticResource ListBoxItem_RangeData}" />
<ListBoxItem
DataContext="{Binding SelectText.Value.Level}"
Tag="{ll:Str 等级范围}"
Template="{StaticResource ListBoxItem_RangeData}" />
<ListBoxItem
DataContext="{Binding SelectText.Value.Money}"
Tag="{ll:Str 金钱范围}"
Template="{StaticResource ListBoxItem_RangeData}" />
<ListBoxItem
DataContext="{Binding SelectText.Value.Food}"
Tag="{ll:Str 食物范围}"
Template="{StaticResource ListBoxItem_RangeData}" />
<ListBoxItem
DataContext="{Binding SelectText.Value.Drink}"
Tag="{ll:Str 口渴范围}"
Template="{StaticResource ListBoxItem_RangeData}" />
<ListBoxItem
DataContext="{Binding SelectText.Value.Feel}"
Tag="{ll:Str 心情范围}"
Template="{StaticResource ListBoxItem_RangeData}" />
<ListBoxItem
DataContext="{Binding SelectText.Value.Strength}"
Tag="{ll:Str 体力范围}"
Template="{StaticResource ListBoxItem_RangeData}" />
</ListBox>
</Grid> </Grid>
<Grid Grid.Row="1"> <Grid Grid.Row="1">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>

View File

@ -1,4 +1,5 @@
using System; using LinePutScript.Localization.WPF;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -11,6 +12,8 @@ using System.Windows.Input;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Shapes; using System.Windows.Shapes;
using VPet.ModMaker.Models;
using VPet.ModMaker.ViewModels.ModEdit.SelectTextEdit;
namespace VPet.ModMaker.Views.ModEdit.SelectTextEdit; namespace VPet.ModMaker.Views.ModEdit.SelectTextEdit;
@ -19,9 +22,13 @@ namespace VPet.ModMaker.Views.ModEdit.SelectTextEdit;
/// </summary> /// </summary>
public partial class SelectTextEditWindow : Window public partial class SelectTextEditWindow : Window
{ {
public bool IsCancel { get; private set; } = true;
public SelectTextEditWindowVM ViewModel => (SelectTextEditWindowVM)DataContext;
public SelectTextEditWindow() public SelectTextEditWindow()
{ {
InitializeComponent(); InitializeComponent();
DataContext = new SelectTextEditWindowVM();
} }
private void Button_Cancel_Click(object sender, RoutedEventArgs e) private void Button_Cancel_Click(object sender, RoutedEventArgs e)
@ -31,27 +38,39 @@ public partial class SelectTextEditWindow : Window
private void Button_Yes_Click(object sender, RoutedEventArgs e) private void Button_Yes_Click(object sender, RoutedEventArgs e)
{ {
//if (string.IsNullOrEmpty(ViewModel.ClickText.Value.Name.Value)) if (string.IsNullOrWhiteSpace(ViewModel.SelectText.Value.Name.Value))
//{ {
// MessageBox.Show("Id不可为空".Translate(), "", MessageBoxButton.OK, MessageBoxImage.Warning); MessageBox.Show("Id不可为空".Translate(), "", MessageBoxButton.OK, MessageBoxImage.Warning);
// return; return;
//} }
//if ( if (
// ViewModel.OldClickText?.Name.Value != ViewModel.ClickText.Value.Name.Value ViewModel.OldSelectText?.Name.Value != ViewModel.SelectText.Value.Name.Value
// && ModInfoModel.Current.ClickTexts.Any( && ModInfoModel.Current.SelectTexts.Any(
// i => i.Name.Value == ViewModel.ClickText.Value.Name.Value i => i.Name.Value == ViewModel.SelectText.Value.Name.Value
// ) )
//) )
//{ {
// MessageBox.Show("此Id已存在".Translate(), "", MessageBoxButton.OK, MessageBoxImage.Warning); MessageBox.Show("此Id已存在".Translate(), "", MessageBoxButton.OK, MessageBoxImage.Warning);
// return; return;
//} }
//if (string.IsNullOrEmpty(ViewModel.ClickText.Value.CurrentI18nData.Value.Text.Value)) if (
//{ string.IsNullOrWhiteSpace(ViewModel.SelectText.Value.CurrentI18nData.Value.Choose.Value)
// MessageBox.Show("文本不可为空".Translate(), "", MessageBoxButton.OK, MessageBoxImage.Warning); )
// return; {
//} MessageBox.Show(
//IsCancel = false; "选项名不可为空".Translate(),
"",
MessageBoxButton.OK,
MessageBoxImage.Warning
);
return;
}
if (string.IsNullOrWhiteSpace(ViewModel.SelectText.Value.CurrentI18nData.Value.Text.Value))
{
MessageBox.Show("文本不可为空".Translate(), "", MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
IsCancel = false;
Close(); Close();
} }
} }

View File

@ -7,27 +7,30 @@
xmlns:local="clr-namespace:VPet.ModMaker.Views.ModEdit.SelectTextEdit" xmlns:local="clr-namespace:VPet.ModMaker.Views.ModEdit.SelectTextEdit"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pu="https://opensource.panuon.com/wpf-ui" xmlns:pu="https://opensource.panuon.com/wpf-ui"
xmlns:vm="clr-namespace:VPet.ModMaker.ViewModels.ModEdit.SelectTextEdit"
Title="SelectTextPage" Title="SelectTextPage"
d:DesignHeight="450" d:DesignHeight="450"
d:DesignWidth="800" d:DesignWidth="800"
mc:Ignorable="d"> mc:Ignorable="d">
<d:Page.DataContext>
<vm:SelectTextPageVM />
</d:Page.DataContext>
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition /> <RowDefinition />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBox /> <TextBox pu:TextBoxHelper.Watermark="{ll:Str 搜索文本}" Text="{Binding FilterSelectText.Value, UpdateSourceTrigger=PropertyChanged}" />
<DataGrid <DataGrid
x:Name="DataGrid_ClickText" x:Name="DataGrid_SelectText"
Grid.Row="1" Grid.Row="1"
d:ItemsSource="{d:SampleData ItemCount=5}" d:ItemsSource="{d:SampleData ItemCount=5}"
pu:DataGridHelper.ColumnHeaderHorizontalContentAlignment="Center" pu:DataGridHelper.ColumnHeaderHorizontalContentAlignment="Center"
AutoGenerateColumns="False" AutoGenerateColumns="False"
CanUserAddRows="False" CanUserAddRows="False"
GridLinesVisibility="Horizontal" GridLinesVisibility="Horizontal"
ItemsSource="{Binding ShowClickTexts.Value}" ItemsSource="{Binding ShowSelectTexts.Value}"
MouseDoubleClick="DataGrid_ClickText_MouseDoubleClick" MouseDoubleClick="DataGrid_SelectText_MouseDoubleClick"
RowDetailsVisibilityMode="Visible" RowDetailsVisibilityMode="Visible"
RowHeight="64" RowHeight="64"
VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.IsVirtualizing="True"
@ -48,7 +51,18 @@
IsReadOnly="True" IsReadOnly="True"
SortMemberPath="Name.Value"> SortMemberPath="Name.Value">
<DataGridTextColumn.Header> <DataGridTextColumn.Header>
<Label Content="Id" /> <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.Header>
</DataGridTextColumn> </DataGridTextColumn>
<DataGridTextColumn <DataGridTextColumn
@ -59,7 +73,29 @@
IsReadOnly="True" IsReadOnly="True"
SortMemberPath="CurrentI18nData.Value.Text.Value"> SortMemberPath="CurrentI18nData.Value.Text.Value">
<DataGridTextColumn.Header> <DataGridTextColumn.Header>
<Label Content="{ll:Str 文本}" /> <TextBlock Text="{ll:Str 文本}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn
MaxWidth="200"
Binding="{Binding Tags.Value}"
CanUserSort="True"
ElementStyle="{StaticResource TextBlock_Wrap}"
IsReadOnly="True"
SortMemberPath="Tags.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 标签}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn
MaxWidth="200"
Binding="{Binding ToTags.Value}"
CanUserSort="True"
ElementStyle="{StaticResource TextBlock_Wrap}"
IsReadOnly="True"
SortMemberPath="ToTags.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 跳转标签}" />
</DataGridTextColumn.Header> </DataGridTextColumn.Header>
</DataGridTextColumn> </DataGridTextColumn>
<DataGridTextColumn <DataGridTextColumn
@ -68,55 +104,89 @@
IsReadOnly="True" IsReadOnly="True"
SortMemberPath="Mode.Value"> SortMemberPath="Mode.Value">
<DataGridTextColumn.Header> <DataGridTextColumn.Header>
<Label Content="{ll:Str 状态}" /> <TextBlock Text="{ll:Str 状态}" />
</DataGridTextColumn.Header> </DataGridTextColumn.Header>
</DataGridTextColumn> </DataGridTextColumn>
<DataGridTextColumn <DataGridTextColumn
Binding="{Binding Working.Value}" Binding="{Binding Like.Info.Value}"
CanUserSort="True" CanUserSort="True"
IsReadOnly="True" IsReadOnly="True"
SortMemberPath="Working.Value"> SortMemberPath="Like.Info.Value">
<DataGridTextColumn.Header> <DataGridTextColumn.Header>
<Label Content="{ll:Str 指定工作}" /> <TextBlock Text="{ll:Str 好感度范围}" />
</DataGridTextColumn.Header> </DataGridTextColumn.Header>
</DataGridTextColumn> </DataGridTextColumn>
<DataGridTextColumn <DataGridTextColumn
Binding="{Binding WorkingState.Value}" Binding="{Binding Health.Info.Value}"
CanUserSort="True" CanUserSort="True"
IsReadOnly="True" IsReadOnly="True"
SortMemberPath="WorkingState.Value"> SortMemberPath="Health.Info.Value">
<DataGridTextColumn.Header> <DataGridTextColumn.Header>
<Label Content="{ll:Str 工作状态}" /> <TextBlock Text="{ll:Str 健康度范围}" />
</DataGridTextColumn.Header> </DataGridTextColumn.Header>
</DataGridTextColumn> </DataGridTextColumn>
<DataGridTextColumn <DataGridTextColumn
Binding="{Binding LikeMin.Value}" Binding="{Binding Level.Info.Value}"
CanUserSort="True" CanUserSort="True"
IsReadOnly="True" IsReadOnly="True"
SortMemberPath="LikeMin.Value"> SortMemberPath="Level.Info.Value">
<DataGridTextColumn.Header> <DataGridTextColumn.Header>
<Label Content="{ll:Str 最小好感}" /> <TextBlock Text="{ll:Str 等级范围}" />
</DataGridTextColumn.Header> </DataGridTextColumn.Header>
</DataGridTextColumn> </DataGridTextColumn>
<DataGridTextColumn <DataGridTextColumn
Binding="{Binding LikeMax.Value}" Binding="{Binding Money.Info.Value}"
CanUserSort="True" CanUserSort="True"
IsReadOnly="True" IsReadOnly="True"
SortMemberPath="LikeMax.Value"> SortMemberPath="Money.Info.Value">
<DataGridTextColumn.Header> <DataGridTextColumn.Header>
<Label Content="{ll:Str 最大好感}" /> <TextBlock Text="{ll:Str 金钱范围}" />
</DataGridTextColumn.Header> </DataGridTextColumn.Header>
</DataGridTextColumn> </DataGridTextColumn>
<DataGridTextColumn <DataGridTextColumn
Binding="{Binding DayTime.Value}" Binding="{Binding Food.Info.Value}"
CanUserSort="True" CanUserSort="True"
IsReadOnly="True" IsReadOnly="True"
SortMemberPath="DayTime.Value"> SortMemberPath="Food.Info.Value">
<DataGridTextColumn.Header> <DataGridTextColumn.Header>
<Label Content="{ll:Str 时间}" /> <TextBlock Text="{ll:Str 食物范围}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn
Binding="{Binding Drink.Info.Value}"
CanUserSort="True"
IsReadOnly="True"
SortMemberPath="Drink.Info.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 口渴范围}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn
Binding="{Binding Feel.Info.Value}"
CanUserSort="True"
IsReadOnly="True"
SortMemberPath="Feel.Info.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 心情范围}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn
Binding="{Binding Strength.Info.Value}"
CanUserSort="True"
IsReadOnly="True"
SortMemberPath="Strength.Info.Value">
<DataGridTextColumn.Header>
<TextBlock Text="{ll:Str 体力范围}" />
</DataGridTextColumn.Header> </DataGridTextColumn.Header>
</DataGridTextColumn> </DataGridTextColumn>
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
<Button
Grid.Row="1"
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
Command="{Binding AddSelectTextCommand}"
Content=""
Style="{StaticResource AddButton}" />
</Grid> </Grid>
</Page> </Page>

View File

@ -12,6 +12,8 @@ using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using VPet.ModMaker.Models;
using VPet.ModMaker.ViewModels.ModEdit.SelectTextEdit;
namespace VPet.ModMaker.Views.ModEdit.SelectTextEdit; namespace VPet.ModMaker.Views.ModEdit.SelectTextEdit;
@ -20,17 +22,21 @@ namespace VPet.ModMaker.Views.ModEdit.SelectTextEdit;
/// </summary> /// </summary>
public partial class SelectTextPage : Page public partial class SelectTextPage : Page
{ {
public SelectTextPageVM ViewModel => (SelectTextPageVM)DataContext;
public SelectTextPage() public SelectTextPage()
{ {
InitializeComponent(); InitializeComponent();
DataContext = new SelectTextPageVM();
} }
private void DataGrid_ClickText_MouseDoubleClick(object sender, MouseButtonEventArgs e) private void DataGrid_SelectText_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{ {
//if ( if (
// sender is not DataGrid dataGrid || dataGrid.SelectedItem is not ClickTextModel clickText sender is not DataGrid dataGrid
//) || dataGrid.SelectedItem is not SelectTextModel clickText
// return; )
//ViewModel.EditClickText(clickText); return;
ViewModel.EditSelectText(clickText);
} }
} }