mirror of
https://github.com/LorisYounger/VPet.ModMaker.git
synced 2024-08-30 18:22:21 +00:00
AddFood页面规划完成
This commit is contained in:
parent
9ebcb40a1b
commit
df0ac8ee50
@ -41,8 +41,8 @@
|
||||
<Reference Include="Panuon.WPF, Version=1.0.2.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Panuon.WPF.1.0.2\lib\net462\Panuon.WPF.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Panuon.WPF.UI, Version=1.1.15.1, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Panuon.WPF.UI.1.1.15.4\lib\net462\Panuon.WPF.UI.dll</HintPath>
|
||||
<Reference Include="Panuon.WPF.UI, Version=1.1.15.6, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Panuon.WPF.UI.1.1.15.6\lib\net462\Panuon.WPF.UI.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
@ -56,10 +56,10 @@
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="VPet-Simulator.Core, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\VPet-Simulator.Core.0.5.0\lib\net462\VPet-Simulator.Core.dll</HintPath>
|
||||
<HintPath>..\packages\VPet-Simulator.Core.1.0.0\lib\net462\VPet-Simulator.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="VPet-Simulator.Windows.Interface, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\VPet-Simulator.Windows.Interface.0.5.0\lib\net462\VPet-Simulator.Windows.Interface.dll</HintPath>
|
||||
<HintPath>..\packages\VPet-Simulator.Windows.Interface.1.0.0\lib\net462\VPet-Simulator.Windows.Interface.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
|
@ -3,7 +3,7 @@
|
||||
<package id="LinePutScript" version="1.9.2" targetFramework="net462" />
|
||||
<package id="LinePutScript.Localization.WPF" version="1.0.6" targetFramework="net462" />
|
||||
<package id="Panuon.WPF" version="1.0.2" targetFramework="net462" />
|
||||
<package id="Panuon.WPF.UI" version="1.1.15.4" targetFramework="net462" />
|
||||
<package id="VPet-Simulator.Core" version="0.5.0" targetFramework="net462" />
|
||||
<package id="VPet-Simulator.Windows.Interface" version="0.5.0" targetFramework="net462" />
|
||||
<package id="Panuon.WPF.UI" version="1.1.15.6" targetFramework="net462" />
|
||||
<package id="VPet-Simulator.Core" version="1.0.0" targetFramework="net462" />
|
||||
<package id="VPet-Simulator.Windows.Interface" version="1.0.0" targetFramework="net462" />
|
||||
</packages>
|
@ -46,8 +46,8 @@
|
||||
<Reference Include="Panuon.WPF, Version=1.0.2.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Panuon.WPF.1.0.2\lib\net462\Panuon.WPF.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Panuon.WPF.UI, Version=1.1.15.1, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Panuon.WPF.UI.1.1.15.4\lib\net462\Panuon.WPF.UI.dll</HintPath>
|
||||
<Reference Include="Panuon.WPF.UI, Version=1.1.15.6, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Panuon.WPF.UI.1.1.15.6\lib\net462\Panuon.WPF.UI.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
@ -67,10 +67,10 @@
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="VPet-Simulator.Core, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\VPet-Simulator.Core.0.5.0\lib\net462\VPet-Simulator.Core.dll</HintPath>
|
||||
<HintPath>..\packages\VPet-Simulator.Core.1.0.0\lib\net462\VPet-Simulator.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="VPet-Simulator.Windows.Interface, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\VPet-Simulator.Windows.Interface.0.5.0\lib\net462\VPet-Simulator.Windows.Interface.dll</HintPath>
|
||||
<HintPath>..\packages\VPet-Simulator.Windows.Interface.1.0.0\lib\net462\VPet-Simulator.Windows.Interface.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
</ItemGroup>
|
||||
|
@ -5,9 +5,9 @@
|
||||
<package id="LinePutScript.Localization.WPF" version="1.0.6" targetFramework="net462" />
|
||||
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net462" />
|
||||
<package id="Panuon.WPF" version="1.0.2" targetFramework="net462" />
|
||||
<package id="Panuon.WPF.UI" version="1.1.15.4" targetFramework="net462" />
|
||||
<package id="Panuon.WPF.UI" version="1.1.15.6" targetFramework="net462" />
|
||||
<package id="Serilog" version="3.0.1" targetFramework="net462" />
|
||||
<package id="System.ValueTuple" version="4.5.0" targetFramework="net462" />
|
||||
<package id="VPet-Simulator.Core" version="0.5.0" targetFramework="net462" />
|
||||
<package id="VPet-Simulator.Windows.Interface" version="0.5.0" targetFramework="net462" />
|
||||
<package id="VPet-Simulator.Core" version="1.0.0" targetFramework="net462" />
|
||||
<package id="VPet-Simulator.Windows.Interface" version="1.0.0" targetFramework="net462" />
|
||||
</packages>
|
@ -2,7 +2,7 @@
|
||||
x:Class="VPet.Plugin.ModMaker.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
StartupUri="winModMaker.xaml">
|
||||
StartupUri="ModMakerWindow.xaml">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
|
21
VPet.Plugin.ModMaker/ModInfo.cs
Normal file
21
VPet.Plugin.ModMaker/ModInfo.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using VPet_Simulator.Windows.Interface;
|
||||
|
||||
namespace VPet.Plugin.ModMaker;
|
||||
|
||||
public class ModInfo
|
||||
{
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string Author { get; set; } = string.Empty;
|
||||
public string GameVersion { get; set; } = string.Empty;
|
||||
public string ModVersion { get; set; } = string.Empty;
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
public List<Food> Foods { get; set; } = new();
|
||||
public List<ClickText> ClickTexts { get; set; } = new();
|
||||
public List<LowText> LowTexts { get; set; } = new();
|
||||
}
|
@ -36,13 +36,13 @@ namespace VPet.Plugin.ModMaker
|
||||
}
|
||||
|
||||
public override string PluginName => "ModMaker";
|
||||
public WinModMaker Maker;
|
||||
public ModMakerWindow Maker;
|
||||
|
||||
public override void Setting()
|
||||
{
|
||||
if (Maker == null)
|
||||
{
|
||||
Maker = new WinModMaker();
|
||||
Maker = new ModMakerWindow();
|
||||
Maker.ModMaker = this;
|
||||
Maker.Show();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
<Window
|
||||
x:Class="VPet.Plugin.ModMaker.WinModMaker"
|
||||
x:Class="VPet.Plugin.ModMaker.ModMakerWindow"
|
||||
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"
|
||||
@ -24,14 +24,7 @@
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Background="{x:Null}" Content="打开最近的内容" />
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox pu:TextBoxHelper.Watermark="最近的内容" />
|
||||
<Button Grid.Column="1" Content="🔍" />
|
||||
</Grid>
|
||||
<TextBox Grid.Row="1" pu:TextBoxHelper.Watermark="最近的内容" />
|
||||
<ListBox
|
||||
Grid.Row="2"
|
||||
d:ItemsSource="{d:SampleData ItemCount=5}"
|
||||
@ -44,8 +37,10 @@
|
||||
</Grid.RowDefinitions>
|
||||
<Label Background="{x:Null}" Content="开始使用" />
|
||||
<StackPanel Grid.Row="1">
|
||||
|
||||
<Button Content="创建新的模组" />
|
||||
<Button
|
||||
x:Name="Button_CreateNewMod"
|
||||
Click="Button_CreateNewMod_Click"
|
||||
Content="创建新的模组" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
42
VPet.Plugin.ModMaker/ModMakerWindow.xaml.cs
Normal file
42
VPet.Plugin.ModMaker/ModMakerWindow.xaml.cs
Normal file
@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using VPet.Plugin.ModMaker.WinModEdit;
|
||||
|
||||
namespace VPet.Plugin.ModMaker;
|
||||
|
||||
/// <summary>
|
||||
/// winModMaker.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ModMakerWindow : Window
|
||||
{
|
||||
public ModMaker ModMaker { get; set; }
|
||||
public ModEditWindow WinModEdit { get; set; }
|
||||
|
||||
public ModMakerWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void Button_CreateNewMod_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
WinModEdit = new();
|
||||
WinModEdit.Show();
|
||||
this.Hide();
|
||||
WinModEdit.Closed += (s, e) =>
|
||||
{
|
||||
this.Close();
|
||||
};
|
||||
}
|
||||
}
|
25
VPet.Plugin.ModMaker/Utils.cs
Normal file
25
VPet.Plugin.ModMaker/Utils.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace VPet.Plugin.ModMaker;
|
||||
|
||||
internal static class Utils
|
||||
{
|
||||
public static BitmapImage LoadImageToMemoryStream(string imagePath)
|
||||
{
|
||||
BitmapImage bitmapImage = new();
|
||||
bitmapImage.BeginInit();
|
||||
var ms = new MemoryStream();
|
||||
var sr = new StreamReader(imagePath);
|
||||
sr.BaseStream.CopyTo(ms);
|
||||
sr.Close();
|
||||
bitmapImage.StreamSource = ms;
|
||||
bitmapImage.EndInit();
|
||||
return bitmapImage;
|
||||
}
|
||||
}
|
@ -12,7 +12,7 @@
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<LangVersion>6</LangVersion>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Deterministic>true</Deterministic>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
@ -75,10 +75,10 @@
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="VPet-Simulator.Core, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\VPet-Simulator.Core.0.5.0\lib\net462\VPet-Simulator.Core.dll</HintPath>
|
||||
<HintPath>..\packages\VPet-Simulator.Core.1.0.0\lib\net462\VPet-Simulator.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="VPet-Simulator.Windows.Interface, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\VPet-Simulator.Windows.Interface.0.5.0\lib\net462\VPet-Simulator.Windows.Interface.dll</HintPath>
|
||||
<HintPath>..\packages\VPet-Simulator.Windows.Interface.1.0.0\lib\net462\VPet-Simulator.Windows.Interface.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
@ -88,6 +88,7 @@
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ModInfo.cs" />
|
||||
<Compile Include="ModMaker.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
@ -102,11 +103,16 @@
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<Compile Include="WinModInfo.xaml.cs">
|
||||
<DependentUpon>WinModInfo.xaml</DependentUpon>
|
||||
<Compile Include="Utils.cs" />
|
||||
<Compile Include="WinModEdit\AddFoodWindow.xaml.cs">
|
||||
<DependentUpon>AddFoodWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WinModMaker.xaml.cs">
|
||||
<DependentUpon>WinModMaker.xaml</DependentUpon>
|
||||
<Compile Include="WinModEdit\ModEditWindow.cs" />
|
||||
<Compile Include="WinModEdit\ModEditWindow.xaml.cs">
|
||||
<DependentUpon>ModEditWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ModMakerWindow.xaml.cs">
|
||||
<DependentUpon>ModMakerWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
@ -123,11 +129,15 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</ApplicationDefinition>
|
||||
<Page Include="WinModInfo.xaml">
|
||||
<Page Include="WinModEdit\AddFoodWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="WinModMaker.xaml">
|
||||
<Page Include="WinModEdit\ModEditWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="ModMakerWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
|
176
VPet.Plugin.ModMaker/WinModEdit/AddFoodWindow.xaml
Normal file
176
VPet.Plugin.ModMaker/WinModEdit/AddFoodWindow.xaml
Normal file
@ -0,0 +1,176 @@
|
||||
<Window
|
||||
x:Class="VPet.Plugin.ModMaker.WinModEdit.AddFoodWindow"
|
||||
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:local="clr-namespace:VPet.Plugin.ModMaker.WinModEdit"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:pu="https://opensource.panuon.com/wpf-ui"
|
||||
Title="AddFoodWindow"
|
||||
Width="800"
|
||||
Height="450"
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Image
|
||||
x:Name="Image_FoodImage"
|
||||
Width="256"
|
||||
Height="256"
|
||||
Stretch="Uniform">
|
||||
<Image.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem
|
||||
x:Name="MenuItem_ChangeFoodImage"
|
||||
Click="MenuItem_ChangeFoodImage_Click"
|
||||
Header="修改图片" />
|
||||
</ContextMenu>
|
||||
</Image.ContextMenu>
|
||||
</Image>
|
||||
<Button
|
||||
x:Name="Button_AddFoodImage"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Click="Button_AddFoodImage_Click"
|
||||
Content="添加图片" />
|
||||
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Content="食物名称:" />
|
||||
<TextBox
|
||||
x:Name="TextBox_FoodName"
|
||||
Grid.Column="1"
|
||||
pu:TextBoxHelper.Watermark="食物名称" />
|
||||
<Label Content="食物名称:" />
|
||||
<Label Grid.Row="1" Content="食物类型:" />
|
||||
<ComboBox
|
||||
x:Name="ComboBox_FoodType"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
SelectedIndex="0">
|
||||
<ComboBoxItem Content="食物" Tag="Food" />
|
||||
<ComboBoxItem Content="收藏" Tag="Star" />
|
||||
<ComboBoxItem Content="正餐" Tag="Meal" />
|
||||
<ComboBoxItem Content="零食" Tag="Snack" />
|
||||
<ComboBoxItem Content="饮料" Tag="Drink" />
|
||||
<ComboBoxItem Content="功能性" Tag="Functional" />
|
||||
<ComboBoxItem Content="药品" Tag="Drug" />
|
||||
<!--<ComboBoxItem Content="礼物" Tag="Gift" />-->
|
||||
</ComboBox>
|
||||
<Label Grid.Row="2" Content="食物描述:" />
|
||||
<TextBox
|
||||
x:Name="TextBox_FoodDescription"
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
pu:TextBoxHelper.Watermark="食物描述" />
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
<Grid Grid.Column="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Content="食物效果:" />
|
||||
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Content="饱腹值:" />
|
||||
<TextBox
|
||||
x:Name="TextBox_StrengthFood"
|
||||
Grid.Column="1"
|
||||
pu:TextBoxHelper.Watermark="饱腹值" />
|
||||
<Label Grid.Row="2" Content="口渴值:" />
|
||||
<TextBox
|
||||
x:Name="TextBox_StrengthDrink"
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
pu:TextBoxHelper.Watermark="口渴值" />
|
||||
<Label Grid.Row="3" Content="健康值:" />
|
||||
<TextBox
|
||||
x:Name="TextBox_Health"
|
||||
Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
pu:TextBoxHelper.Watermark="健康值" />
|
||||
<Label Grid.Row="4" Content="体力值:" />
|
||||
<TextBox
|
||||
x:Name="TextBox_Strength"
|
||||
Grid.Row="4"
|
||||
Grid.Column="1"
|
||||
pu:TextBoxHelper.Watermark="体力值" />
|
||||
<Label Grid.Row="5" Content="心情值:" />
|
||||
<TextBox
|
||||
x:Name="TextBox_Feeling"
|
||||
Grid.Row="5"
|
||||
Grid.Column="1"
|
||||
pu:TextBoxHelper.Watermark="心情值" />
|
||||
<Label Grid.Row="6" Content="好感值:" />
|
||||
<TextBox
|
||||
x:Name="TextBox_Likability"
|
||||
Grid.Row="6"
|
||||
Grid.Column="1"
|
||||
pu:TextBoxHelper.Watermark="好感值" />
|
||||
<Label Grid.Row="7" Content="经验值:" />
|
||||
<TextBox
|
||||
x:Name="TextBox_Exp"
|
||||
Grid.Row="7"
|
||||
Grid.Column="1"
|
||||
pu:TextBoxHelper.Watermark="经验值" />
|
||||
<Label Grid.Row="8" Content="价格:" />
|
||||
<TextBox
|
||||
x:Name="TextBox_Price"
|
||||
Grid.Row="8"
|
||||
Grid.Column="1"
|
||||
pu:TextBoxHelper.Watermark="价格" />
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
<Grid Grid.Row="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button
|
||||
x:Name="Button_Cancel"
|
||||
Margin="10"
|
||||
Click="Button_Cancel_Click"
|
||||
Content="取消" />
|
||||
<Button
|
||||
x:Name="Button_Yes"
|
||||
Grid.Column="1"
|
||||
Margin="10"
|
||||
Click="Button_Yes_Click"
|
||||
Content="确定" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
69
VPet.Plugin.ModMaker/WinModEdit/AddFoodWindow.xaml.cs
Normal file
69
VPet.Plugin.ModMaker/WinModEdit/AddFoodWindow.xaml.cs
Normal file
@ -0,0 +1,69 @@
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace VPet.Plugin.ModMaker.WinModEdit;
|
||||
|
||||
/// <summary>
|
||||
/// AddFoodWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class AddFoodWindow : Window
|
||||
{
|
||||
public bool IsCancel { get; internal set; } = true;
|
||||
public BitmapImage FoodImage { get; internal set; }
|
||||
|
||||
public AddFoodWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void Button_AddFoodImage_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
OpenFileDialog openFileDialog =
|
||||
new() { Title = "选择图片", Filter = $"图片|*.jpg;*.jpeg;*.png;*.bmp" };
|
||||
if (openFileDialog.ShowDialog() is true)
|
||||
{
|
||||
Image_FoodImage.Source = FoodImage = Utils.LoadImageToMemoryStream(
|
||||
openFileDialog.FileName
|
||||
);
|
||||
Button_AddFoodImage.Visibility = Visibility.Hidden;
|
||||
}
|
||||
}
|
||||
|
||||
private void MenuItem_ChangeFoodImage_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
OpenFileDialog openFileDialog =
|
||||
new() { Title = "选择图片", Filter = $"图片|*.jpg;*.jpeg;*.png;*.bmp" };
|
||||
if (openFileDialog.ShowDialog() is true)
|
||||
{
|
||||
if (Image_FoodImage.Source is BitmapImage bitmapImage)
|
||||
bitmapImage.StreamSource.Close();
|
||||
Image_FoodImage.Source = FoodImage = Utils.LoadImageToMemoryStream(
|
||||
openFileDialog.FileName
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private void Button_Cancel_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
FoodImage?.StreamSource.Close();
|
||||
Close();
|
||||
}
|
||||
|
||||
private void Button_Yes_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
IsCancel = false;
|
||||
Close();
|
||||
}
|
||||
}
|
35
VPet.Plugin.ModMaker/WinModEdit/ModEditWindow.cs
Normal file
35
VPet.Plugin.ModMaker/WinModEdit/ModEditWindow.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
using VPet_Simulator.Windows.Interface;
|
||||
|
||||
namespace VPet.Plugin.ModMaker.WinModEdit;
|
||||
|
||||
public partial class ModEditWindow
|
||||
{
|
||||
public static Food CreateFoodFormWindow(AddFoodWindow addFoodWindow)
|
||||
{
|
||||
return new()
|
||||
{
|
||||
Name = addFoodWindow.TextBox_FoodName.Text,
|
||||
ImageSource = addFoodWindow.Image_FoodImage.Source,
|
||||
Desc = addFoodWindow.TextBox_FoodDescription.Text,
|
||||
Type = (Food.FoodType)
|
||||
Enum.Parse(
|
||||
typeof(Food.FoodType),
|
||||
((ComboBoxItem)addFoodWindow.ComboBox_FoodType.SelectedItem).Tag.ToString()
|
||||
),
|
||||
Strength = double.Parse(addFoodWindow.TextBox_Strength.Text),
|
||||
StrengthFood = double.Parse(addFoodWindow.TextBox_StrengthFood.Text),
|
||||
StrengthDrink = double.Parse(addFoodWindow.TextBox_StrengthDrink.Text),
|
||||
Health = double.Parse(addFoodWindow.TextBox_Health.Text),
|
||||
Feeling = double.Parse(addFoodWindow.TextBox_Feeling.Text),
|
||||
Likability = double.Parse(addFoodWindow.TextBox_Likability.Text),
|
||||
Price = double.Parse(addFoodWindow.TextBox_Price.Text),
|
||||
Exp = int.Parse(addFoodWindow.TextBox_Exp.Text),
|
||||
};
|
||||
}
|
||||
}
|
374
VPet.Plugin.ModMaker/WinModEdit/ModEditWindow.xaml
Normal file
374
VPet.Plugin.ModMaker/WinModEdit/ModEditWindow.xaml
Normal file
@ -0,0 +1,374 @@
|
||||
<Window
|
||||
x:Class="VPet.Plugin.ModMaker.WinModEdit.ModEditWindow"
|
||||
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:local="clr-namespace:VPet.Plugin.ModMaker"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:pu="https://opensource.panuon.com/wpf-ui"
|
||||
Title="WinModInfo"
|
||||
Width="800"
|
||||
Height="450"
|
||||
mc:Ignorable="d">
|
||||
<Window.Resources>
|
||||
<ResourceDictionary>
|
||||
<Style
|
||||
x:Key="AddButton"
|
||||
BasedOn="{StaticResource {x:Type Button}}"
|
||||
TargetType="Button">
|
||||
<Setter Property="Background" Value="{StaticResource DARKPrimary}" />
|
||||
<Setter Property="pu:ButtonHelper.ShadowColor" Value="{StaticResource ShadowColor}" />
|
||||
<Setter Property="FontSize" Value="24" />
|
||||
<Setter Property="Padding" Value="10" />
|
||||
<Setter Property="Margin" Value="10" />
|
||||
<Setter Property="pu:ButtonHelper.CornerRadius" Value="24" />
|
||||
</Style>
|
||||
<ContextMenu x:Key="ContextMenu_DataGridRow">
|
||||
<MenuItem x:Name="MenuItem_RemoveFood" Click="MenuItem_RemoveFood_Click" />
|
||||
</ContextMenu>
|
||||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="2*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Image
|
||||
x:Name="Image_ModImage"
|
||||
Width="256"
|
||||
Height="256"
|
||||
Stretch="Uniform">
|
||||
<Image.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem
|
||||
x:Name="MenuItem_ChangeModImage"
|
||||
Click="MenuItem_ChangeModImage_Click"
|
||||
Header="修改图片" />
|
||||
</ContextMenu>
|
||||
</Image.ContextMenu>
|
||||
</Image>
|
||||
<Button
|
||||
x:Name="Button_AddModImage"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Click="Button_AddModImage_Click"
|
||||
Content="添加图片" />
|
||||
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Content="模组名称:" />
|
||||
<Label Grid.Row="1" Content="作者:" />
|
||||
<Label Grid.Row="2" Content="游戏版本:" />
|
||||
<Label Grid.Row="3" Content="模组版本:" />
|
||||
<Label Grid.Row="4" Content="模组介绍:" />
|
||||
<TextBox
|
||||
x:Name="TextBox_ModName"
|
||||
Grid.Column="1"
|
||||
pu:TextBoxHelper.Watermark="模组名称" />
|
||||
<TextBox
|
||||
x:Name="TextBox_Author"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
pu:TextBoxHelper.Watermark="作者" />
|
||||
<TextBox
|
||||
x:Name="TextBox_GameVersion"
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
pu:TextBoxHelper.Watermark="游戏版本" />
|
||||
<TextBox
|
||||
x:Name="TextBox_ModVersion"
|
||||
Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
pu:TextBoxHelper.Watermark="模组版本" />
|
||||
<TextBox
|
||||
x:Name="TextBox_Description"
|
||||
Grid.Row="4"
|
||||
Grid.Column="1"
|
||||
pu:TextBoxHelper.Watermark="模组介绍" />
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
<Grid Grid.Column="1">
|
||||
<TabControl>
|
||||
<TabItem Header="食物 (0)">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBox x:Name="TextBox_SearchFood" />
|
||||
<DataGrid
|
||||
x:Name="DataGrid_Food"
|
||||
Grid.Row="1"
|
||||
d:ItemsSource="{d:SampleData ItemCount=5}"
|
||||
pu:DataGridHelper.ColumnHeaderHorizontalContentAlignment="Center"
|
||||
AutoGenerateColumns="False"
|
||||
CanUserAddRows="False"
|
||||
GridLinesVisibility="Horizontal"
|
||||
MouseDoubleClick="DataGrid_Food_MouseDoubleClick"
|
||||
RowDetailsVisibilityMode="Visible"
|
||||
RowHeight="64"
|
||||
VirtualizingStackPanel.IsVirtualizing="True"
|
||||
VirtualizingStackPanel.VirtualizationMode="Recycling">
|
||||
<DataGrid.RowStyle>
|
||||
<Style BasedOn="{StaticResource {x:Type DataGridRow}}" TargetType="DataGridRow">
|
||||
<Setter Property="Height" Value="64" />
|
||||
<Setter Property="Tag" Value="{Binding}" />
|
||||
<Setter Property="ContextMenu" Value="{StaticResource ContextMenu_DataGridRow}" />
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn
|
||||
Binding="{Binding Name}"
|
||||
CanUserSort="True"
|
||||
IsReadOnly="True"
|
||||
SortMemberPath="Name">
|
||||
<DataGridTextColumn.Header>
|
||||
<Label Content="食物名称" />
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTemplateColumn IsReadOnly="True">
|
||||
<DataGridTemplateColumn.Header>
|
||||
<Label Content="食物图片" />
|
||||
</DataGridTemplateColumn.Header>
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Image
|
||||
Width="64"
|
||||
Height="64"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Source="{Binding ImageSource, IsAsync=True}"
|
||||
Stretch="Uniform">
|
||||
<Image.ToolTip>
|
||||
<Image
|
||||
Width="256"
|
||||
Height="256"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Source="{Binding ImageSource, IsAsync=True}"
|
||||
Stretch="Uniform" />
|
||||
</Image.ToolTip>
|
||||
</Image>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn
|
||||
Binding="{Binding Type}"
|
||||
CanUserSort="True"
|
||||
IsReadOnly="True"
|
||||
SortMemberPath="Type">
|
||||
<DataGridTextColumn.Header>
|
||||
<Label Content="食物类型" />
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn
|
||||
Binding="{Binding StrengthFood}"
|
||||
CanUserSort="True"
|
||||
IsReadOnly="True"
|
||||
SortMemberPath="StrengthFood">
|
||||
<DataGridTextColumn.Header>
|
||||
<Label Content="饱腹值" />
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn
|
||||
Binding="{Binding StrengthDrink}"
|
||||
CanUserSort="True"
|
||||
IsReadOnly="True"
|
||||
SortMemberPath="StrengthDrink">
|
||||
<DataGridTextColumn.Header>
|
||||
<Label Content="口渴值" />
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn
|
||||
Binding="{Binding Health}"
|
||||
CanUserSort="True"
|
||||
IsReadOnly="True"
|
||||
SortMemberPath="Health">
|
||||
<DataGridTextColumn.Header>
|
||||
<Label Content="健康值" />
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn
|
||||
Binding="{Binding Strength}"
|
||||
CanUserSort="True"
|
||||
IsReadOnly="True"
|
||||
SortMemberPath="Strength">
|
||||
<DataGridTextColumn.Header>
|
||||
<Label Content="体力值" />
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn
|
||||
Binding="{Binding Feeling}"
|
||||
CanUserSort="True"
|
||||
IsReadOnly="True"
|
||||
SortMemberPath="Feeling">
|
||||
<DataGridTextColumn.Header>
|
||||
<Label Content="心情值" />
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn
|
||||
Binding="{Binding Likability}"
|
||||
CanUserSort="True"
|
||||
IsReadOnly="True"
|
||||
SortMemberPath="Likability">
|
||||
<DataGridTextColumn.Header>
|
||||
<Label Content="好感值" />
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn
|
||||
Binding="{Binding Exp}"
|
||||
CanUserSort="True"
|
||||
IsReadOnly="True"
|
||||
SortMemberPath="Exp">
|
||||
<DataGridTextColumn.Header>
|
||||
<Label Content="经验值" />
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn
|
||||
Binding="{Binding Price}"
|
||||
CanUserSort="True"
|
||||
IsReadOnly="True"
|
||||
SortMemberPath="Price">
|
||||
<DataGridTextColumn.Header>
|
||||
<Label Content="价格" />
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn
|
||||
Binding="{Binding Desc}"
|
||||
CanUserSort="True"
|
||||
IsReadOnly="True"
|
||||
SortMemberPath="Desc">
|
||||
<DataGridTextColumn.Header>
|
||||
<Label Content="描述" />
|
||||
</DataGridTextColumn.Header>
|
||||
</DataGridTextColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<Button
|
||||
x:Name="Button_AddFood"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
Click="Button_AddFood_Click"
|
||||
Content="➕"
|
||||
Style="{StaticResource AddButton}" />
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="物品 (0)">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBox x:Name="TextBox_SearchItem" />
|
||||
<ListBox x:Name="ListBox_Item" />
|
||||
<Button
|
||||
x:Name="Button_AddItem"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
Click="Button_AddItem_Click"
|
||||
Content="➕"
|
||||
Style="{StaticResource AddButton}" />
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="动画 (0)">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBox x:Name="TextBox_SearchAnime" />
|
||||
<ListBox x:Name="ListBox_Anime" />
|
||||
<Button
|
||||
x:Name="Button_AddAnime"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
Click="Button_AddAnime_Click"
|
||||
Content="➕"
|
||||
Style="{StaticResource AddButton}" />
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="语音 (0)">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBox x:Name="TextBox_SearchAudio" />
|
||||
<ListBox x:Name="ListBox_Audio" />
|
||||
<Button
|
||||
x:Name="Button_AddAudio"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
Click="Button_AddAudio_Click"
|
||||
Content="➕"
|
||||
Style="{StaticResource AddButton}" />
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="点击文本 (0)">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBox x:Name="TextBox_SearchClickText" />
|
||||
<ListBox x:Name="ListBox_ClickText" />
|
||||
<Button
|
||||
x:Name="Button_AddClickText"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
Click="Button_AddClickText_Click"
|
||||
Content="➕"
|
||||
Style="{StaticResource AddButton}" />
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="低状态文本 (0)">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBox x:Name="TextBox_SearchLowText" />
|
||||
<ListBox x:Name="ListBox_LowText" />
|
||||
<Button
|
||||
x:Name="Button_AddLowText"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
Click="Button_AddLowText_Click"
|
||||
Content="➕"
|
||||
Style="{StaticResource AddButton}" />
|
||||
</Grid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
<!--<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Content="当前功能" />
|
||||
<TextBox Grid.Row="1" pu:TextBoxHelper.Watermark="搜索功能" />
|
||||
<ListBox Grid.Row="2" d:ItemsSource="{d:SampleData ItemCount=5}" />-->
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
151
VPet.Plugin.ModMaker/WinModEdit/ModEditWindow.xaml.cs
Normal file
151
VPet.Plugin.ModMaker/WinModEdit/ModEditWindow.xaml.cs
Normal file
@ -0,0 +1,151 @@
|
||||
using Microsoft.Win32;
|
||||
using Panuon.WPF;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using VPet_Simulator.Windows.Interface;
|
||||
|
||||
namespace VPet.Plugin.ModMaker.WinModEdit;
|
||||
|
||||
/// <summary>
|
||||
/// winModInfo.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ModEditWindow : Window
|
||||
{
|
||||
public string ModName { get; set; } = string.Empty;
|
||||
public ObservableCollection<Food> Foods { get; set; } = new();
|
||||
|
||||
public Dictionary<string, Food> FoodDict { get; set; } = new();
|
||||
|
||||
public ModEditWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataGrid_Food.ItemsSource = Foods;
|
||||
Closed += WinModInfo_Closed;
|
||||
}
|
||||
|
||||
private void WinModInfo_Closed(object sender, EventArgs e)
|
||||
{
|
||||
if (Image_ModImage.Source is BitmapImage bitmapImage)
|
||||
bitmapImage.StreamSource.Close();
|
||||
}
|
||||
|
||||
private void Button_AddModImage_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
OpenFileDialog openFileDialog =
|
||||
new() { Title = "选择图片", Filter = $"图片|*.jpg;*.jpeg;*.png;*.bmp" };
|
||||
if (openFileDialog.ShowDialog() is true)
|
||||
{
|
||||
Image_ModImage.Source = new BitmapImage(new Uri(openFileDialog.FileName));
|
||||
Button_AddModImage.Visibility = Visibility.Hidden;
|
||||
}
|
||||
}
|
||||
|
||||
private void MenuItem_ChangeModImage_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
OpenFileDialog openFileDialog =
|
||||
new() { Title = "选择图片", Filter = $"图片|*.jpg;*.jpeg;*.png;*.bmp" };
|
||||
if (openFileDialog.ShowDialog() is true)
|
||||
{
|
||||
Image_ModImage.Source = new BitmapImage(new Uri(openFileDialog.FileName));
|
||||
}
|
||||
}
|
||||
|
||||
private void Button_AddFood_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.IsEnabled = false;
|
||||
var window = new AddFoodWindow();
|
||||
window.Closed += (s, e) =>
|
||||
{
|
||||
if (s is not AddFoodWindow addFoodWindow)
|
||||
return;
|
||||
if (addFoodWindow.IsCancel)
|
||||
{
|
||||
this.IsEnabled = true;
|
||||
return;
|
||||
}
|
||||
var food = CreateFoodFormWindow(addFoodWindow);
|
||||
if (FoodDict.TryGetValue(food.Name, out var oldFood))
|
||||
{
|
||||
FoodDict[food.Name] = Foods[Foods.IndexOf(oldFood)] = food;
|
||||
}
|
||||
else
|
||||
{
|
||||
Foods.Add(food);
|
||||
FoodDict.Add(food.Name, food);
|
||||
}
|
||||
this.IsEnabled = true;
|
||||
};
|
||||
window.Show();
|
||||
}
|
||||
|
||||
private void Button_AddItem_Click(object sender, RoutedEventArgs e) { }
|
||||
|
||||
private void Button_AddAnime_Click(object sender, RoutedEventArgs e) { }
|
||||
|
||||
private void Button_AddAudio_Click(object sender, RoutedEventArgs e) { }
|
||||
|
||||
private void Button_AddClickText_Click(object sender, RoutedEventArgs e) { }
|
||||
|
||||
private void Button_AddLowText_Click(object sender, RoutedEventArgs e) { }
|
||||
|
||||
private void DataGrid_Food_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (sender is not DataGrid dataGrid || dataGrid.SelectedItem is not Food oldFood)
|
||||
return;
|
||||
this.IsEnabled = false;
|
||||
var window = new AddFoodWindow();
|
||||
window.TextBox_FoodName.Text = oldFood.Name;
|
||||
window.Image_FoodImage.Source = oldFood.ImageSource;
|
||||
window.TextBox_FoodDescription.Text = oldFood.Desc;
|
||||
foreach (ComboBoxItem item in window.ComboBox_FoodType.Items)
|
||||
if (item.Tag.ToString() == oldFood.Type.ToString())
|
||||
window.ComboBox_FoodType.SelectedItem = item;
|
||||
window.TextBox_Strength.Text = oldFood.Strength.ToString();
|
||||
window.TextBox_StrengthFood.Text = oldFood.StrengthFood.ToString();
|
||||
window.TextBox_StrengthDrink.Text = oldFood.StrengthDrink.ToString();
|
||||
window.TextBox_Health.Text = oldFood.Health.ToString();
|
||||
window.TextBox_Feeling.Text = oldFood.Feeling.ToString();
|
||||
window.TextBox_Likability.Text = oldFood.Likability.ToString();
|
||||
window.TextBox_Price.Text = oldFood.Price.ToString();
|
||||
window.TextBox_Exp.Text = oldFood.Exp.ToString();
|
||||
window.Button_AddFoodImage.Visibility = Visibility.Visible;
|
||||
window.Closed += (s, e) =>
|
||||
{
|
||||
if (s is not AddFoodWindow addFoodWindow)
|
||||
return;
|
||||
if (addFoodWindow.IsCancel)
|
||||
{
|
||||
this.IsEnabled = true;
|
||||
return;
|
||||
}
|
||||
var food = CreateFoodFormWindow(addFoodWindow);
|
||||
if (FoodDict.TryGetValue(food.Name, out var tempFood))
|
||||
{
|
||||
FoodDict[food.Name] = Foods[Foods.IndexOf(tempFood)] = food;
|
||||
}
|
||||
else
|
||||
{
|
||||
Foods[Foods.IndexOf(oldFood)] = food;
|
||||
FoodDict.Remove(oldFood.Name);
|
||||
FoodDict.Add(food.Name, food);
|
||||
}
|
||||
this.IsEnabled = true;
|
||||
};
|
||||
window.Show();
|
||||
}
|
||||
|
||||
private void MenuItem_RemoveFood_Click(object sender, RoutedEventArgs e) { }
|
||||
}
|
@ -4,6 +4,6 @@
|
||||
<package id="LinePutScript.Localization.WPF" version="1.0.6" targetFramework="net462" />
|
||||
<package id="Panuon.WPF" version="1.0.2" targetFramework="net462" />
|
||||
<package id="Panuon.WPF.UI" version="1.1.15.6" targetFramework="net462" />
|
||||
<package id="VPet-Simulator.Core" version="0.5.0" targetFramework="net462" />
|
||||
<package id="VPet-Simulator.Windows.Interface" version="0.5.0" targetFramework="net462" />
|
||||
<package id="VPet-Simulator.Core" version="1.0.0" targetFramework="net462" />
|
||||
<package id="VPet-Simulator.Windows.Interface" version="1.0.0" targetFramework="net462" />
|
||||
</packages>
|
@ -1,92 +0,0 @@
|
||||
<Window
|
||||
x:Class="VPet.Plugin.ModMaker.WinModInfo"
|
||||
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:local="clr-namespace:VPet.Plugin.ModMaker"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:pu="https://opensource.panuon.com/wpf-ui"
|
||||
Title="WinModInfo"
|
||||
Width="800"
|
||||
Height="450"
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="2*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Image
|
||||
d:Height="256"
|
||||
d:Resources=""
|
||||
d:Width="256" />
|
||||
<ScrollViewer Grid.Row="1">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Content="模组名称:" />
|
||||
<Label Grid.Row="1" Content="作者:" />
|
||||
<Label Grid.Row="2" Content="游戏版本:" />
|
||||
<Label Grid.Row="3" Content="模组版本:" />
|
||||
<Label Grid.Row="4" Content="模组介绍:" />
|
||||
<Label Grid.Column="1" Content="模组名称" />
|
||||
<Label
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Content="作者" />
|
||||
<Label
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Content="游戏版本" />
|
||||
<Label
|
||||
Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
Content="模组版本" />
|
||||
<Label
|
||||
Grid.Row="4"
|
||||
Grid.Column="1"
|
||||
Content="模组介绍" />
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
<Grid Grid.Column="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Content="功能列表" />
|
||||
<TextBox Grid.Row="1" pu:TextBoxHelper.Watermark="搜索功能" />
|
||||
<ListBox Grid.Row="2" d:ItemsSource="{d:SampleData ItemCount=5}" />
|
||||
</Grid>
|
||||
<Grid Grid.Column="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Label Content="功能列表" />
|
||||
<TextBox Grid.Row="1" pu:TextBoxHelper.Watermark="搜索功能" />
|
||||
<ListBox Grid.Row="2" d:ItemsSource="{d:SampleData ItemCount=5}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
@ -1,27 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace VPet.Plugin.ModMaker
|
||||
{
|
||||
/// <summary>
|
||||
/// winModInfo.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class WinModInfo : Window
|
||||
{
|
||||
public WinModInfo()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace VPet.Plugin.ModMaker
|
||||
{
|
||||
/// <summary>
|
||||
/// winModMaker.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class WinModMaker : Window
|
||||
{
|
||||
public ModMaker ModMaker { get; set; }
|
||||
|
||||
public WinModMaker()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user