This commit is contained in:
Hakoyu 2023-08-31 18:08:07 +08:00
parent 974af3999b
commit 1497559061
18 changed files with 191 additions and 137 deletions

View File

@ -13,4 +13,18 @@
<Setter Property="Margin" Value="10" />
<Setter Property="pu:ButtonHelper.CornerRadius" Value="24" />
</Style>
<Style
x:Key="TextBlock_Wrap"
BasedOn="{StaticResource {x:Type TextBlock}}"
TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
</Style>
<Style
x:Key="TextBox_Wrap"
BasedOn="{StaticResource {x:Type TextBox}}"
TargetType="TextBox">
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="VerticalContentAlignment" Value="Top" />
</Style>
</ResourceDictionary>

View File

@ -1,4 +1,5 @@
using HKW.HKWViewModels.SimpleObservable;
using LinePutScript.Localization.WPF;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@ -79,7 +80,7 @@ public class ClickTextPageVM
private void RemoveClickText(ClickTextModel clickText)
{
if (MessageBox.Show("确定删除吗", "", MessageBoxButton.YesNo) is MessageBoxResult.No)
if (MessageBox.Show("确定删除吗".Translate(), "", MessageBoxButton.YesNo) is MessageBoxResult.No)
return;
if (ShowClickTexts.Value.Count == ClickTexts.Count)
{

View File

@ -1,4 +1,5 @@
using HKW.HKWViewModels.SimpleObservable;
using LinePutScript.Localization.WPF;
using Microsoft.Win32;
using System;
using System.Collections.Generic;
@ -46,7 +47,11 @@ public class FoodEditWindowVM
private void AddImage()
{
OpenFileDialog openFileDialog =
new() { Title = "选择图片", Filter = $"图片|*.jpg;*.jpeg;*.png;*.bmp" };
new()
{
Title = "选择图片".Translate(),
Filter = $"图片|*.jpg;*.jpeg;*.png;*.bmp".Translate()
};
if (openFileDialog.ShowDialog() is true)
{
Food.Value.Image.Value = Utils.LoadImageToStream(openFileDialog.FileName);
@ -56,7 +61,11 @@ public class FoodEditWindowVM
private void ChangeImage()
{
OpenFileDialog openFileDialog =
new() { Title = "选择图片", Filter = $"图片|*.jpg;*.jpeg;*.png;*.bmp" };
new()
{
Title = "选择图片".Translate(),
Filter = $"图片|*.jpg;*.jpeg;*.png;*.bmp".Translate()
};
if (openFileDialog.ShowDialog() is true)
{
Food.Value.Image.Value?.StreamSource?.Close();

View File

@ -1,4 +1,5 @@
using HKW.HKWViewModels.SimpleObservable;
using LinePutScript.Localization.WPF;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@ -84,7 +85,7 @@ public class FoodPageVM
private void RemoveFood(FoodModel food)
{
if (MessageBox.Show("确定删除吗", "", MessageBoxButton.YesNo) is MessageBoxResult.No)
if (MessageBox.Show("确定删除吗".Translate(), "", MessageBoxButton.YesNo) is MessageBoxResult.No)
return;
if (ShowFoods.Value.Count == Foods.Count)
{

View File

@ -1,4 +1,5 @@
using HKW.HKWViewModels.SimpleObservable;
using LinePutScript.Localization.WPF;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@ -82,7 +83,7 @@ public class LowTextPageVM
private void RemoveLowText(LowTextModel lowText)
{
if (MessageBox.Show("确定删除吗", "", MessageBoxButton.YesNo) is MessageBoxResult.No)
if (MessageBox.Show("确定删除吗".Translate(), "", MessageBoxButton.YesNo) is MessageBoxResult.No)
return;
if (ShowLowTexts.Value.Count == LowTexts.Count)
{

View File

@ -56,22 +56,22 @@ public class ModEditWindowVM
foreach (var food in ModInfo.Value.Foods)
{
var foodI18n = food.I18nDatas[i18n.Key];
if (i18n.Value.TryGetValue(food.Name.Value, out var i18nName))
foodI18n.Name.Value = i18nName.Translate();
if (i18n.Value.TryGetValue(food.Description.Value, out var i18nDescription))
foodI18n.Description.Value = i18nDescription.Translate();
if (i18n.Value.TryGetValue(food.Name.Value, out var name))
foodI18n.Name.Value = name;
if (i18n.Value.TryGetValue(food.Description.Value, out var description))
foodI18n.Description.Value = description;
}
foreach (var lowText in ModInfo.Value.LowTexts)
{
var lowTextI18n = lowText.I18nDatas[i18n.Key];
if (i18n.Value.TryGetValue(lowText.Name.Value, out var text))
lowTextI18n.Text.Value = text.Translate();
lowTextI18n.Text.Value = text;
}
foreach (var clickText in ModInfo.Value.ClickTexts)
{
var clickTextI18n = clickText.I18nDatas[i18n.Key];
if (i18n.Value.TryGetValue(clickText.Name.Value, out var text))
clickTextI18n.Text.Value = text.Translate();
clickTextI18n.Text.Value = text;
}
}
}
@ -195,7 +195,7 @@ public class ModEditWindowVM
}
catch (Exception ex)
{
MessageBox.Show($"保存失败 错误信息:\n{ex}");
MessageBox.Show("保存失败 错误信息:\n{0}".Translate(ex));
return;
}
MessageBox.Show("保存成功".Translate());
@ -220,7 +220,7 @@ public class ModEditWindowVM
}
catch (Exception ex)
{
MessageBox.Show($"保存失败 错误信息:\n{ex}");
MessageBox.Show($"保存失败 错误信息:\n{0}".Translate(ex));
return;
}
MessageBox.Show("保存成功".Translate());

View File

@ -1,4 +1,5 @@
using HKW.HKWViewModels.SimpleObservable;
using LinePutScript.Localization.WPF;
using Microsoft.Win32;
using System;
using System.Collections.Generic;
@ -81,8 +82,8 @@ public class ModMakerWindowVM
OpenFileDialog openFileDialog =
new()
{
Title = "模组信息文件",
Filter = $"LPS文件|*.lps;",
Title = "模组信息文件".Translate(),
Filter = $"LPS文件|*.lps;".Translate(),
FileName = "info.lps"
};
if (openFileDialog.ShowDialog() is true)
@ -93,7 +94,7 @@ public class ModMakerWindowVM
var mod = new ModLoader(new DirectoryInfo(path));
if (mod.SuccessLoad is false)
{
MessageBox.Show("模组载入失败");
MessageBox.Show("模组载入失败".Translate());
return;
}
ModInfoModel.Current = new ModInfoModel(mod);
@ -101,7 +102,7 @@ public class ModMakerWindowVM
}
catch (Exception ex)
{
MessageBox.Show($"模组载入失败:\n{ex}");
MessageBox.Show("模组载入失败:\n{0}".Translate(ex));
}
}
}

View File

@ -3,6 +3,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ll="clr-namespace:LinePutScript.Localization.WPF;assembly=LinePutScript.Localization.WPF"
xmlns:local="clr-namespace:VPet.ModMaker.Views.ModEdit.ClickTextEdit"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pu="https://opensource.panuon.com/wpf-ui"
@ -17,16 +18,15 @@
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" MinWidth="200" />
<ColumnDefinition Width="200" />
</Grid.ColumnDefinitions>
<Grid>
<TextBox
x:Name="TextBox_Text"
VerticalContentAlignment="Top"
d:Text="这是一个测试文本,这是一个测试文本,这是一个测试文本,这是一个测试文本,这是一个测试文本,这是一个测试文本,这是一个测试文本,"
pu:TextBoxHelper.Watermark="文本"
Text="{Binding ClickText.Value.CurrentI18nData.Value.Text.Value, UpdateSourceTrigger=PropertyChanged}"
TextWrapping="Wrap" />
Style="{StaticResource TextBox_Wrap}"
Text="{Binding ClickText.Value.CurrentI18nData.Value.Text.Value, UpdateSourceTrigger=PropertyChanged}" />
</Grid>
<Grid Grid.Column="1">
<Grid.RowDefinitions>
@ -39,7 +39,7 @@
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
@ -48,35 +48,39 @@
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label Content="Id" />
<TextBox Grid.Column="1" Text="{Binding ClickText.Value.Name.Value, UpdateSourceTrigger=PropertyChanged}" />
<Label Grid.Row="1" Content="指定工作" />
<TextBox
Grid.Column="1"
Style="{StaticResource TextBox_Wrap}"
Text="{Binding ClickText.Value.Name.Value, UpdateSourceTrigger=PropertyChanged}"
TextWrapping="Wrap" />
<Label Grid.Row="1" Content="{ll:Str 指定工作}" />
<TextBox
Grid.Row="1"
Grid.Column="1"
Text="{Binding ClickText.Value.Working.Value, UpdateSourceTrigger=PropertyChanged}" />
<Label Grid.Row="2" Content="最小好感度" />
<Label Grid.Row="2" Content="{ll:Str 最小好感度}" />
<pu:NumberInput
Grid.Row="2"
Grid.Column="1"
Value="{Binding ClickText.Value.LikeMin.Value}" />
<Label Grid.Row="3" Content="最大好感度" />
<Label Grid.Row="3" Content="{ll:Str 最大好感度}" />
<pu:NumberInput
Grid.Row="3"
Grid.Column="1"
Value="{Binding ClickText.Value.LikeMax.Value}" />
<Label Grid.Row="4" Content="模式" />
<Label Grid.Row="4" Content="{ll:Str 模式}" />
<ComboBox
Grid.Row="4"
Grid.Column="1"
ItemsSource="{Binding ModeTypes}"
SelectedItem="{Binding ClickText.Value.Mode.Value}" />
<Label Grid.Row="5" Content="工作状态" />
<Label Grid.Row="5" Content="{ll:Str 工作状态}" />
<ComboBox
Grid.Row="5"
Grid.Column="1"
ItemsSource="{Binding WorkingStates}"
SelectedItem="{Binding ClickText.Value.WorkingState.Value}" />
<Label Grid.Row="6" Content="日期区间" />
<Label Grid.Row="6" Content="{ll:Str 日期区间}" />
<ComboBox
Grid.Row="6"
Grid.Column="1"
@ -92,13 +96,13 @@
x:Name="Button_Cancel"
Margin="10"
Click="Button_Cancel_Click"
Content="取消" />
Content="{ll:Str 取消}" />
<Button
x:Name="Button_Yes"
Grid.Column="1"
Margin="10"
Click="Button_Yes_Click"
Content="确定" />
Content="{ll:Str 确定}" />
</Grid>
</Grid>
</Grid>

View File

@ -1,4 +1,5 @@
using System;
using LinePutScript.Localization.WPF;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -39,7 +40,7 @@ public partial class ClickTextEditWindow : Window
{
if (string.IsNullOrEmpty(ViewModel.ClickText.Value.Name.Value))
{
MessageBox.Show("Id不可为空", "", MessageBoxButton.OK, MessageBoxImage.Warning);
MessageBox.Show("Id不可为空".Translate(), "", MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
if (
@ -49,12 +50,12 @@ public partial class ClickTextEditWindow : Window
)
)
{
MessageBox.Show("此Id已存在", "", MessageBoxButton.OK, MessageBoxImage.Warning);
MessageBox.Show("此Id已存在".Translate(), "", MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
if (string.IsNullOrEmpty(ViewModel.ClickText.Value.CurrentI18nData.Value.Text.Value))
{
MessageBox.Show("文本不可为空", "", MessageBoxButton.OK, MessageBoxImage.Warning);
MessageBox.Show("文本不可为空".Translate(), "", MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
IsCancel = false;

View File

@ -3,6 +3,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ll="clr-namespace:LinePutScript.Localization.WPF;assembly=LinePutScript.Localization.WPF"
xmlns:local="clr-namespace:VPet.ModMaker.Views.ModEdit.ClickTextEdit"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pu="https://opensource.panuon.com/wpf-ui"
@ -20,11 +21,11 @@
<MenuItem
Command="{Binding DataContext.EditLowTextCommand, RelativeSource={RelativeSource AncestorType=Page, Mode=FindAncestor}}"
CommandParameter="{Binding DataContext, RelativeSource={RelativeSource AncestorType=DataGridRow, Mode=FindAncestor}}"
Header="修改点击文本" />
Header="{ll:Str 修改点击文本}" />
<MenuItem
Command="{Binding DataContext.RemoveLowTextCommand, RelativeSource={RelativeSource AncestorType=Page, Mode=FindAncestor}}"
CommandParameter="{Binding DataContext, RelativeSource={RelativeSource AncestorType=DataGridRow, Mode=FindAncestor}}"
Header="删除点击文本" />
Header="{ll:Str 删除点击文本}" />
</ContextMenu>
</ResourceDictionary>
</Page.Resources>
@ -35,7 +36,7 @@
</Grid.RowDefinitions>
<TextBox
x:Name="TextBox_SearchFood"
pu:TextBoxHelper.Watermark="搜索文本"
pu:TextBoxHelper.Watermark="{ll:Str 搜索文本}"
Text="{Binding FilterClickText.Value, UpdateSourceTrigger=PropertyChanged}" />
<DataGrid
x:Name="DataGrid_ClickText"
@ -60,8 +61,10 @@
</DataGrid.RowStyle>
<DataGrid.Columns>
<DataGridTextColumn
MaxWidth="200"
Binding="{Binding Name.Value}"
CanUserSort="True"
ElementStyle="{StaticResource TextBlock_Wrap}"
IsReadOnly="True"
SortMemberPath="Name.Value">
<DataGridTextColumn.Header>
@ -69,12 +72,14 @@
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn
MaxWidth="300"
Binding="{Binding CurrentI18nData.Value.Text.Value}"
CanUserSort="True"
ElementStyle="{StaticResource TextBlock_Wrap}"
IsReadOnly="True"
SortMemberPath="CurrentI18nData.Value.Text.Value">
<DataGridTextColumn.Header>
<Label Content="文本" />
<Label Content="{ll:Str 文本}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn
@ -83,7 +88,7 @@
IsReadOnly="True"
SortMemberPath="Mode.Value">
<DataGridTextColumn.Header>
<Label Content="状态" />
<Label Content="{ll:Str 状态}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn
@ -92,7 +97,7 @@
IsReadOnly="True"
SortMemberPath="Working.Value">
<DataGridTextColumn.Header>
<Label Content="指定工作" />
<Label Content="{ll:Str 指定工作}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn
@ -101,7 +106,7 @@
IsReadOnly="True"
SortMemberPath="WorkingState.Value">
<DataGridTextColumn.Header>
<Label Content="工作状态" />
<Label Content="{ll:Str 工作状态}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn
@ -110,7 +115,7 @@
IsReadOnly="True"
SortMemberPath="LikeMin.Value">
<DataGridTextColumn.Header>
<Label Content="最小好感" />
<Label Content="{ll:Str 最小好感}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn
@ -119,7 +124,7 @@
IsReadOnly="True"
SortMemberPath="LikeMax.Value">
<DataGridTextColumn.Header>
<Label Content="最大好感" />
<Label Content="{ll:Str 最大好感}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn
@ -128,7 +133,7 @@
IsReadOnly="True"
SortMemberPath="DayTime.Value">
<DataGridTextColumn.Header>
<Label Content="时间" />
<Label Content="{ll:Str 时间}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
</DataGrid.Columns>

View File

@ -3,6 +3,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ll="clr-namespace:LinePutScript.Localization.WPF;assembly=LinePutScript.Localization.WPF"
xmlns:local="clr-namespace:VPet.ModMaker.Views.ModEdit.FoodEdit"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pu="https://opensource.panuon.com/wpf-ui"
@ -32,7 +33,7 @@
Stretch="Uniform">
<Image.ContextMenu>
<ContextMenu>
<MenuItem Command="{Binding ChangeImageCommand}" Header="修改图片" />
<MenuItem Command="{Binding ChangeImageCommand}" Header="{ll:Str 修改图片}" />
</ContextMenu>
</Image.ContextMenu>
</Image>
@ -40,7 +41,7 @@
HorizontalAlignment="Center"
VerticalAlignment="Center"
Command="{Binding AddImageCommand}"
Content="添加图片">
Content="{ll:Str 添加图片}">
<Button.Style>
<Style BasedOn="{StaticResource {x:Type Button}}" TargetType="Button">
<Setter Property="Visibility" Value="Hidden" />
@ -64,29 +65,29 @@
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Label Content="食物Id:" />
<Label Content="{ll:Str 食物Id}" />
<TextBox
Grid.Column="1"
pu:TextBoxHelper.Watermark="Id"
Text="{Binding Food.Value.Name.Value, UpdateSourceTrigger=PropertyChanged}" />
<Label Grid.Row="1" Content="食物类型:" />
<Label Grid.Row="1" Content="{ll:Str 食物类型}" />
<ComboBox
x:Name="ComboBox_FoodType"
Grid.Row="1"
Grid.Column="1"
ItemsSource="{Binding FoodTypes}"
SelectedItem="{Binding Food.Value.Type.Value}" />
<Label Grid.Row="2" Content="食物名称:" />
<Label Grid.Row="2" Content="{ll:Str 食物名称}" />
<TextBox
Grid.Row="2"
Grid.Column="1"
pu:TextBoxHelper.Watermark="食物名称"
pu:TextBoxHelper.Watermark="{ll:Str 食物名称}"
Text="{Binding Food.Value.CurrentI18nData.Value.Name.Value, UpdateSourceTrigger=PropertyChanged}" />
<Label Grid.Row="3" Content="食物描述:" />
<Label Grid.Row="3" Content="{ll:Str 食物描述}" />
<TextBox
Grid.Row="3"
Grid.Column="1"
pu:TextBoxHelper.Watermark="食物描述"
pu:TextBoxHelper.Watermark="{ll:Str 食物描述}"
Text="{Binding Food.Value.CurrentI18nData.Value.Description.Value, UpdateSourceTrigger=PropertyChanged}" />
</Grid>
</ScrollViewer>
@ -97,7 +98,7 @@
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label Content="食物效果:" />
<Label Content="{ll:Str 食物效果}" />
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
<Grid>
<Grid.ColumnDefinitions>
@ -115,42 +116,42 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label Content="饱腹值:" />
<Label Content="{ll:Str 饱腹值}" />
<pu:NumberInput
x:Name="NumberInput_StrengthFood"
Grid.Column="1"
Value="{Binding Food.Value.StrengthFood.Value, Mode=TwoWay}" />
<Label Grid.Row="2" Content="口渴值:" />
<Label Grid.Row="2" Content="{ll:Str 口渴值}" />
<pu:NumberInput
Grid.Row="2"
Grid.Column="1"
Value="{Binding Food.Value.StrengthDrink.Value, Mode=TwoWay}" />
<Label Grid.Row="3" Content="健康值:" />
<Label Grid.Row="3" Content="{ll:Str 健康值}" />
<pu:NumberInput
Grid.Row="3"
Grid.Column="1"
Value="{Binding Food.Value.Health.Value, Mode=TwoWay}" />
<Label Grid.Row="4" Content="体力值:" />
<Label Grid.Row="4" Content="{ll:Str 体力值}" />
<pu:NumberInput
Grid.Row="4"
Grid.Column="1"
Value="{Binding Food.Value.Strength.Value, Mode=TwoWay}" />
<Label Grid.Row="5" Content="心情值:" />
<Label Grid.Row="5" Content="{ll:Str 心情值}" />
<pu:NumberInput
Grid.Row="5"
Grid.Column="1"
Value="{Binding Food.Value.Feeling.Value, Mode=TwoWay}" />
<Label Grid.Row="6" Content="好感值:" />
<Label Grid.Row="6" Content="{ll:Str 好感值}" />
<pu:NumberInput
Grid.Row="6"
Grid.Column="1"
Value="{Binding Food.Value.Likability.Value, Mode=TwoWay}" />
<Label Grid.Row="7" Content="经验值:" />
<Label Grid.Row="7" Content="{ll:Str 经验值}" />
<pu:NumberInput
Grid.Row="7"
Grid.Column="1"
Value="{Binding Food.Value.Exp.Value, Mode=TwoWay}" />
<Label Grid.Row="8" Content="价格:" />
<Label Grid.Row="8" Content="{ll:Str 价格}" />
<pu:NumberInput
x:Name="NumberInput_Price"
Grid.Row="8"
@ -167,13 +168,13 @@
x:Name="Button_Cancel"
Margin="10"
Click="Button_Cancel_Click"
Content="取消" />
Content="{ll:Str 取消}" />
<Button
x:Name="Button_Yes"
Grid.Column="1"
Margin="10"
Click="Button_Yes_Click"
Content="确定" />
Content="{ll:Str 确定}" />
</Grid>
</Grid>
</Grid>

View File

@ -1,4 +1,5 @@
using Microsoft.Win32;
using LinePutScript.Localization.WPF;
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Linq;
@ -48,17 +49,17 @@ public partial class FoodEditWindow : Window
{
if (string.IsNullOrEmpty(ViewModel.Food.Value.Name.Value))
{
MessageBox.Show("Id不可为空", "", MessageBoxButton.OK, MessageBoxImage.Warning);
MessageBox.Show("Id不可为空".Translate(), "", MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
if (ViewModel.Food.Value.CurrentI18nData.Value.Name.Value is null)
{
MessageBox.Show("名称不可为空", "", MessageBoxButton.OK, MessageBoxImage.Warning);
MessageBox.Show("名称不可为空".Translate(), "", MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
if (ViewModel.Food.Value.Image.Value is null)
{
MessageBox.Show("图像不可为空", "", MessageBoxButton.OK, MessageBoxImage.Warning);
MessageBox.Show("图像不可为空".Translate(), "", MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
if (

View File

@ -3,6 +3,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ll="clr-namespace:LinePutScript.Localization.WPF;assembly=LinePutScript.Localization.WPF"
xmlns:local="clr-namespace:VPet.ModMaker.Views.ModEdit.FoodEdit"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pu="https://opensource.panuon.com/wpf-ui"
@ -20,11 +21,11 @@
<MenuItem
Command="{Binding DataContext.EditFoodCommand, RelativeSource={RelativeSource AncestorType=Page, Mode=FindAncestor}}"
CommandParameter="{Binding DataContext, RelativeSource={RelativeSource AncestorType=DataGridRow, Mode=FindAncestor}}"
Header="修改食物" />
Header="{ll:Str 修改食物}" />
<MenuItem
Command="{Binding DataContext.RemoveFoodCommand, RelativeSource={RelativeSource AncestorType=Page, Mode=FindAncestor}}"
CommandParameter="{Binding DataContext, RelativeSource={RelativeSource AncestorType=DataGridRow, Mode=FindAncestor}}"
Header="删除食物" />
Header="{ll:Str 删除食物}" />
</ContextMenu>
</ResourceDictionary>
</Page.Resources>
@ -33,7 +34,7 @@
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<TextBox pu:TextBoxHelper.Watermark="搜索食物" Text="{Binding FilterFoodText.Value, UpdateSourceTrigger=PropertyChanged}" />
<TextBox pu:TextBoxHelper.Watermark="{ll:Str 搜索食物}" Text="{Binding FilterFoodText.Value, UpdateSourceTrigger=PropertyChanged}" />
<DataGrid
x:Name="DataGrid_Food"
Grid.Row="1"
@ -62,12 +63,12 @@
IsReadOnly="True"
SortMemberPath="Name.Value">
<DataGridTextColumn.Header>
<Label Content="食物ID" />
<Label Content="{ll:Str 食物Id}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTemplateColumn IsReadOnly="True">
<DataGridTemplateColumn.Header>
<Label Content="食物图片" />
<Label Content="{ll:Str 食物图片}" />
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
@ -97,7 +98,7 @@
IsReadOnly="True"
SortMemberPath="CurrentI18nData.Value.Name.Value">
<DataGridTextColumn.Header>
<Label Content="食物名称" />
<Label Content="{ll:Str 食物名称}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn
@ -106,7 +107,7 @@
IsReadOnly="True"
SortMemberPath="Type.Value">
<DataGridTextColumn.Header>
<Label Content="食物类型" />
<Label Content="{ll:Str 食物类型}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn
@ -115,7 +116,7 @@
IsReadOnly="True"
SortMemberPath="StrengthFood.Value">
<DataGridTextColumn.Header>
<Label Content="饱腹值" />
<Label Content="{ll:Str 饱腹值}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn
@ -124,7 +125,7 @@
IsReadOnly="True"
SortMemberPath="StrengthDrink.Value">
<DataGridTextColumn.Header>
<Label Content="口渴值" />
<Label Content="{ll:Str 口渴值}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn
@ -133,7 +134,7 @@
IsReadOnly="True"
SortMemberPath="Health.Value">
<DataGridTextColumn.Header>
<Label Content="健康值" />
<Label Content="{ll:Str 健康值}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn
@ -142,7 +143,7 @@
IsReadOnly="True"
SortMemberPath="Strength.Value">
<DataGridTextColumn.Header>
<Label Content="体力值" />
<Label Content="{ll:Str 体力值}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn
@ -151,7 +152,7 @@
IsReadOnly="True"
SortMemberPath="Feeling.Value">
<DataGridTextColumn.Header>
<Label Content="心情值" />
<Label Content="{ll:Str 心情值}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn
@ -160,7 +161,7 @@
IsReadOnly="True"
SortMemberPath="Likability.Value">
<DataGridTextColumn.Header>
<Label Content="好感值" />
<Label Content="{ll:Str 好感值}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn
@ -169,7 +170,7 @@
IsReadOnly="True"
SortMemberPath="Exp.Value">
<DataGridTextColumn.Header>
<Label Content="经验值" />
<Label Content="{ll:Str 经验值}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn
@ -178,7 +179,7 @@
IsReadOnly="True"
SortMemberPath="Price.Value">
<DataGridTextColumn.Header>
<Label Content="价格" />
<Label Content="{ll:Str 价格}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn
@ -187,7 +188,7 @@
IsReadOnly="True"
SortMemberPath="CurrentI18nData.Value.Description.Value">
<DataGridTextColumn.Header>
<Label Content="描述" />
<Label Content="{ll:Str 描述}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
</DataGrid.Columns>

View File

@ -3,6 +3,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ll="clr-namespace:LinePutScript.Localization.WPF;assembly=LinePutScript.Localization.WPF"
xmlns:local="clr-namespace:VPet.ModMaker.Views.ModEdit.LowTextEdit"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pu="https://opensource.panuon.com/wpf-ui"
@ -16,17 +17,16 @@
</d:Window.DataContext>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" MinWidth="200" />
<ColumnDefinition MinWidth="300" />
<ColumnDefinition Width="200" />
</Grid.ColumnDefinitions>
<Grid>
<TextBox
x:Name="TextBox_Text"
VerticalContentAlignment="Top"
d:Text="这是一个测试文本,这是一个测试文本,这是一个测试文本,这是一个测试文本,这是一个测试文本,这是一个测试文本,这是一个测试文本,"
pu:TextBoxHelper.Watermark="文本"
Text="{Binding LowText.Value.CurrentI18nData.Value.Text.Value, UpdateSourceTrigger=PropertyChanged}"
TextWrapping="Wrap" />
pu:TextBoxHelper.Watermark="{ll:Str 文本}"
Style="{StaticResource TextBox_Wrap}"
Text="{Binding LowText.Value.CurrentI18nData.Value.Text.Value, UpdateSourceTrigger=PropertyChanged}" />
</Grid>
<Grid Grid.Column="1">
<Grid.RowDefinitions>
@ -39,27 +39,29 @@
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label Content="Id" />
<TextBox Grid.Column="1" Text="{Binding LowText.Value.Name.Value, UpdateSourceTrigger=PropertyChanged}" />
<Label Grid.Row="1" Content="口渴/饥饿状态" />
<Label Grid.Row="1" Content="状态" />
<TextBox
Grid.Column="1"
Style="{StaticResource TextBox_Wrap}"
Text="{Binding LowText.Value.Name.Value, UpdateSourceTrigger=PropertyChanged}" />
<Label Grid.Row="1" Content="{ll:Str 状态}" />
<ComboBox
Grid.Row="1"
Grid.Column="1"
ItemsSource="{Binding ModeTypes}"
SelectedItem="{Binding LowText.Value.Mode.Value}" />
<Label Grid.Row="2" Content="口渴/饥饿状态" />
<Label Grid.Row="2" Content="{ll:Str 饥渴状态}" />
<ComboBox
Grid.Row="2"
Grid.Column="1"
ItemsSource="{Binding StrengthTypes}"
SelectedItem="{Binding LowText.Value.Strength.Value}" />
<Label Grid.Row="3" Content="好感度需求" />
<Label Grid.Row="3" Content="{ll:Str 好感度需求}" />
<ComboBox
Grid.Row="3"
Grid.Column="1"
@ -75,13 +77,13 @@
x:Name="Button_Cancel"
Margin="10"
Click="Button_Cancel_Click"
Content="取消" />
Content="{ll:Str 取消}" />
<Button
x:Name="Button_Yes"
Grid.Column="1"
Margin="10"
Click="Button_Yes_Click"
Content="确定" />
Content="{ll:Str 确定}" />
</Grid>
</Grid>
</Grid>

View File

@ -1,4 +1,5 @@
using System;
using LinePutScript.Localization.WPF;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -40,7 +41,7 @@ public partial class LowTextEditWindow : Window
{
if (string.IsNullOrEmpty(ViewModel.LowText.Value.Name.Value))
{
MessageBox.Show("Id不可为空", "", MessageBoxButton.OK, MessageBoxImage.Warning);
MessageBox.Show("Id不可为空".Translate(), "", MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
if (
@ -50,7 +51,12 @@ public partial class LowTextEditWindow : Window
)
)
{
MessageBox.Show("此Id已存在", "", MessageBoxButton.OK, MessageBoxImage.Warning);
MessageBox.Show("此Id已存在".Translate(), "", MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
if (string.IsNullOrEmpty(ViewModel.LowText.Value.CurrentI18nData.Value.Text.Value))
{
MessageBox.Show("文本不可为空".Translate(), "", MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
IsCancel = false;

View File

@ -3,6 +3,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ll="clr-namespace:LinePutScript.Localization.WPF;assembly=LinePutScript.Localization.WPF"
xmlns:local="clr-namespace:VPet.ModMaker.Views.ModEdit.LowTextEdit"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pu="https://opensource.panuon.com/wpf-ui"
@ -20,11 +21,11 @@
<MenuItem
Command="{Binding DataContext.EditLowTextCommand, RelativeSource={RelativeSource AncestorType=Page, Mode=FindAncestor}}"
CommandParameter="{Binding DataContext, RelativeSource={RelativeSource AncestorType=DataGridRow, Mode=FindAncestor}}"
Header="修改低状态文本" />
Header="{ll:Str 修改低状态文本}" />
<MenuItem
Command="{Binding DataContext.RemoveLowTextCommand, RelativeSource={RelativeSource AncestorType=Page, Mode=FindAncestor}}"
CommandParameter="{Binding DataContext, RelativeSource={RelativeSource AncestorType=DataGridRow, Mode=FindAncestor}}"
Header="删除低状态文本" />
Header="{ll:Str 删除低状态文本}" />
</ContextMenu>
</ResourceDictionary>
</Page.Resources>
@ -33,7 +34,7 @@
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<TextBox pu:TextBoxHelper.Watermark="搜索文本" Text="{Binding FilterLowText.Value, UpdateSourceTrigger=PropertyChanged}" />
<TextBox pu:TextBoxHelper.Watermark="{ll:Str 搜索文本}" Text="{Binding FilterLowText.Value, UpdateSourceTrigger=PropertyChanged}" />
<DataGrid
x:Name="DataGrid_LowText"
Grid.Row="1"
@ -57,21 +58,25 @@
</DataGrid.RowStyle>
<DataGrid.Columns>
<DataGridTextColumn
MaxWidth="200"
Binding="{Binding Name.Value}"
CanUserSort="True"
ElementStyle="{StaticResource TextBlock_Wrap}"
IsReadOnly="True"
SortMemberPath="Id.Value">
<DataGridTextColumn.Header>
<Label Content="Id" />
<TextBlock Text="Id" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn
MaxWidth="300"
Binding="{Binding CurrentI18nData.Value.Text.Value}"
CanUserSort="True"
ElementStyle="{StaticResource TextBlock_Wrap}"
IsReadOnly="True"
SortMemberPath="CurrentI18nData.Value.Text.Value">
<DataGridTextColumn.Header>
<Label Content="文本" />
<TextBlock Text="{ll:Str 文本}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn
@ -80,7 +85,7 @@
IsReadOnly="True"
SortMemberPath="Mode.Value">
<DataGridTextColumn.Header>
<Label Content="状态" />
<TextBlock Text="{ll:Str 状态}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn
@ -89,7 +94,7 @@
IsReadOnly="True"
SortMemberPath="Strength.Value">
<DataGridTextColumn.Header>
<Label Content="口渴/饥饿需求" />
<TextBlock Text="{ll:Str 饥渴需求}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn
@ -98,7 +103,7 @@
IsReadOnly="True"
SortMemberPath="Like.Value">
<DataGridTextColumn.Header>
<Label Content="好感需求" />
<TextBlock Text="{ll:Str 好感需求}" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
</DataGrid.Columns>

View File

@ -3,6 +3,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ll="clr-namespace:LinePutScript.Localization.WPF;assembly=LinePutScript.Localization.WPF"
xmlns:local="clr-namespace:VPet.ModMaker.Views.ModEdit"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pu="https://opensource.panuon.com/wpf-ui"
@ -20,11 +21,11 @@
<MenuItem
Command="{Binding DataContext.ChangeLangCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}"
CommandParameter="{Binding Content, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBoxItem}}"
Header="修改语言" />
Header="{ll:Str 修改语言}" />
<MenuItem
Command="{Binding DataContext.RemoveLangCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}"
CommandParameter="{Binding Content, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBoxItem}}"
Header="删除语言" />
Header="{ll:Str 删除语言}" />
</ContextMenu>
</ResourceDictionary>
</Window.Resources>
@ -64,7 +65,7 @@
<MenuItem
x:Name="MenuItem_ChangeModImage"
Command="{Binding ChangeImageCommand}"
Header="修改图片" />
Header="{ll:Str 修改图片}" />
</ContextMenu>
</Image.ContextMenu>
</Image>
@ -73,7 +74,7 @@
HorizontalAlignment="Center"
VerticalAlignment="Center"
Command="{Binding AddImageCommand}"
Content="添加图片">
Content="{ll:Str 添加图片}">
<Button.Style>
<Style BasedOn="{StaticResource {x:Type Button}}" TargetType="Button">
<Setter Property="Visibility" Value="Hidden" />
@ -98,34 +99,34 @@
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Label Content="模组名称:" />
<Label Content="{ll:Str 模组名称}" />
<TextBox
x:Name="TextBox_ModName"
Grid.Column="1"
pu:TextBoxHelper.Watermark="模组名称"
pu:TextBoxHelper.Watermark="{ll:Str 模组名称}"
Text="{Binding ModInfo.Value.CurrentI18nData.Value.Name.Value}" />
<Label Grid.Row="1" Content="作者:" />
<Label Grid.Row="1" Content="{ll:Str 作者}" />
<TextBox
x:Name="TextBox_Author"
Grid.Row="1"
Grid.Column="1"
pu:TextBoxHelper.Watermark="作者"
pu:TextBoxHelper.Watermark="{ll:Str 作者}"
Text="{Binding ModInfo.Value.Author.Value}" />
<Label Grid.Row="2" Content="游戏版本:" />
<Label Grid.Row="2" Content="{ll:Str 游戏版本}" />
<TextBox
x:Name="TextBox_GameVersion"
Grid.Row="2"
Grid.Column="1"
pu:TextBoxHelper.Watermark="游戏版本"
pu:TextBoxHelper.Watermark="{ll:Str 游戏版本}"
Text="{Binding ModInfo.Value.GameVersion.Value}" />
<Label Grid.Row="3" Content="模组版本:" />
<Label Grid.Row="3" Content="{ll:Str 模组版本}" />
<TextBox
x:Name="TextBox_ModVersion"
Grid.Row="3"
Grid.Column="1"
pu:TextBoxHelper.Watermark="模组版本"
pu:TextBoxHelper.Watermark="{ll:Str 模组版本}"
Text="{Binding ModInfo.Value.ModVersion.Value}" />
<Label Grid.Row="4" Content="模组介绍:" />
<Label Grid.Row="4" Content="{ll:Str 模组介绍}" />
<TextBox
x:Name="TextBox_Description"
Grid.Row="4"
@ -133,7 +134,7 @@
HorizontalContentAlignment="Left"
VerticalContentAlignment="Top"
d:Text="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
pu:TextBoxHelper.Watermark="模组介绍"
pu:TextBoxHelper.Watermark="{ll:Str 模组介绍}"
Text="{Binding ModInfo.Value.CurrentI18nData.Value.Description.Value}"
TextWrapping="Wrap" />
</Grid>
@ -144,10 +145,10 @@
<TabItem
x:Name="TabItem_Food"
Header="食物 (0)"
Tag="食物">
Tag="{ll:Str 食物}">
<Frame Content="{Binding ModEditWindow.FoodPage}" />
</TabItem>
<TabItem Header="物品 (0)" Tag="物品">
<TabItem Header="物品 (0)" Tag="{ll:Str 物品}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
@ -204,13 +205,13 @@
<TabItem
x:Name="TabItem_ClickText"
Header="点击文本 (0)"
Tag="点击文本">
Tag="{ll:Str 点击文本}">
<Frame Content="{Binding ModEditWindow.ClickTextPage}" />
</TabItem>
<TabItem
x:Name="TabItem_LowText"
Header="低状态文本 (0)"
Tag="低状态文本">
Tag="{ll:Str 低状态文本}">
<Frame Content="{Binding ModEditWindow.LowTextPage}" />
</TabItem>
</TabControl>
@ -225,7 +226,7 @@
<Button
x:Name="Button_AddLang"
Command="{Binding AddLangCommand}"
Content="添加语言" />
Content="{ll:Str 添加语言}" />
<ListBox
x:Name="ListBox_Langs"
Grid.Row="1"
@ -244,11 +245,11 @@
<Button
x:Name="Button_Save"
Command="{Binding SaveCommand}"
Content="保存" />
Content="{ll:Str 保存}" />
<Button
x:Name="Button_SaveTo"
Command="{Binding SaveToCommand}"
Content="保存至" />
Content="{ll:Str 保存至}" />
</StackPanel>
</Grid>
</Grid>

View File

@ -27,8 +27,8 @@
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Label Background="{x:Null}" Content="打开最近的内容" />
<TextBox Grid.Row="1" pu:TextBoxHelper.Watermark="最近的内容" />
<Label Background="{x:Null}" Content="{ll:Str 打开最近的内容}" />
<TextBox Grid.Row="1" pu:TextBoxHelper.Watermark="{ll:Str 最近的内容}" />
<ListBox
Grid.Row="2"
d:ItemsSource="{d:SampleData ItemCount=5}"
@ -53,12 +53,12 @@
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock
d:Text="Mod名称"
d:Text="{ll:Str Mod名称}"
Text="{Binding Name.Value}"
TextWrapping="Wrap" />
<TextBlock
Grid.Row="1"
d:Text="Mod描述"
d:Text="{ll:Str Mod描述}"
Text="{Binding Description.Value}"
TextWrapping="Wrap" />
</Grid>
@ -75,16 +75,16 @@
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Label Background="{x:Null}" Content="开始使用" />
<Label Background="{x:Null}" Content="{ll:Str 开始使用}" />
<StackPanel Grid.Row="1">
<Button
x:Name="Button_CreateNewMod"
Command="{Binding CreateNewModCommand}"
Content="创建新的模组" />
Content="{ll:Str 创建新的模组}" />
<Button
x:Name="Button_OpenFromFile"
Command="{Binding LoadModFromFileCommand}"
Content="从文件中载入" />
Content="{ll:Str 从文件中载入}" />
</StackPanel>
</Grid>
</Grid>