为开发者控制台添加移动测试

实现 #109
This commit is contained in:
Hakoyu 2023-08-27 20:58:41 +08:00 committed by ZouJin
parent ed3d95bda5
commit 826c571773
3 changed files with 265 additions and 117 deletions

View File

@ -1,4 +1,6 @@
using VPet_Simulator.Core;
using System.Windows.Forms;
using System.Windows.Interop;
using VPet_Simulator.Core;
namespace VPet_Simulator.Windows
{
@ -13,26 +15,38 @@ namespace VPet_Simulator.Windows
this.mw = mw;
}
public double GetWindowsDistanceDown()
{
return mw.Dispatcher.Invoke(() => System.Windows.SystemParameters.PrimaryScreenHeight - mw.Top - mw.Height);
}
public double GetWindowsDistanceLeft()
{
return mw.Dispatcher.Invoke(() => mw.Left);
}
public double GetWindowsDistanceRight()
{
return mw.Dispatcher.Invoke(() => System.Windows.SystemParameters.PrimaryScreenWidth - mw.Left - mw.Width);
}
public double GetWindowsDistanceUp()
{
return mw.Dispatcher.Invoke(() => mw.Top);
}
public double GetWindowsDistanceRight()
{
return mw.Dispatcher.Invoke(() =>
{
var windowInteropHelper = new WindowInteropHelper(mw);
var currentScreen = Screen.FromHandle(windowInteropHelper.Handle);
var currentScreenBorder = currentScreen.Bounds;
return currentScreenBorder.Width - mw.Left - mw.Width;
});
}
public double GetWindowsDistanceDown()
{
return mw.Dispatcher.Invoke(() =>
{
var windowInteropHelper = new WindowInteropHelper(mw);
var currentScreen = Screen.FromHandle(windowInteropHelper.Handle);
var currentScreenBorder = currentScreen.Bounds;
return currentScreenBorder.Height - mw.Top - mw.Height;
});
}
public void MoveWindows(double X, double Y)
{
mw.Dispatcher.Invoke(() =>

View File

@ -1,108 +1,222 @@
<Window x:Class="VPet_Simulator.Windows.winConsole" 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:pu="clr-namespace:Panuon.WPF.UI;assembly=Panuon.WPF.UI"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:VPet_Simulator.Windows" mc:Ignorable="d" Title="{ll:Str 桌宠管理开发控制台}" Height="450"
Width="450" FontSize="16">
<TabControl pu:TabControlHelper.ItemsSelectedBackground="White"
pu:TabControlHelper.HeaderPanelBackground="{DynamicResource PrimaryLight}">
<TabItem Header="{ll:Str 动画列表}">
<Grid>
<Label Background="{x:Null}" Content="{ll:Str '双击查看动画效果'}" />
<Label Background="{x:Null}" Content="{ll:Str '选择状态模式:'}" VerticalAlignment="Top" Margin="0,20,0,0" />
<Window
x:Class="VPet_Simulator.Windows.winConsole"
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_Simulator.Windows"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pu="clr-namespace:Panuon.WPF.UI;assembly=Panuon.WPF.UI"
Title="{ll:Str 桌宠管理开发控制台}"
Width="450"
Height="450"
FontSize="16"
mc:Ignorable="d">
<TabControl pu:TabControlHelper.HeaderPanelBackground="{DynamicResource PrimaryLight}" pu:TabControlHelper.ItemsSelectedBackground="White">
<TabItem Header="{ll:Str 动画列表}">
<Grid>
<Label Background="{x:Null}" Content="{ll:Str '双击查看动画效果'}" />
<Label
Margin="0,20,0,0"
VerticalAlignment="Top"
Background="{x:Null}"
Content="{ll:Str '选择状态模式:'}" />
<ComboBox x:Name="ComboxMode" VerticalAlignment="Top" Margin="110,25,5,0" SelectedIndex="1">
<ComboBoxItem Content="Happy" />
<ComboBoxItem Content="Nomal" />
<ComboBoxItem Content="PoorCondition" />
<ComboBoxItem Content="Ill" />
</ComboBox>
<Label x:Name="LabelNowPlay" Background="{x:Null}" Content="" HorizontalAlignment="Right" />
<ListBox x:Name="GraphListBox" Margin="0,49,0,0" MouseDoubleClick="GraphListBox_MouseDoubleClick" />
</Grid>
</TabItem>
<TabItem Header="{ll:Str 动画播放}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="15*" />
<RowDefinition Height="110*" />
<RowDefinition Height="10*" />
</Grid.RowDefinitions>
<Label Background="{x:Null}" Content="{ll:Str '双击添加/移除播放列表内容'}" Grid.RowSpan="2" Grid.ColumnSpan="2" />
<Label Background="{x:Null}" Content="{ll:Str '选择状态模式:'}" VerticalAlignment="Top" Margin="0,20,0,0"
Grid.RowSpan="2" Grid.ColumnSpan="2" />
<ComboBox x:Name="ComboxPlayMode" VerticalAlignment="Top" Margin="110,25,5,0" SelectedIndex="1"
Grid.ColumnSpan="2">
<ComboBoxItem Content="Happy" />
<ComboBoxItem Content="Nomal" />
<ComboBoxItem Content="PoorCondition" />
<ComboBoxItem Content="Ill" />
</ComboBox>
<ListBox x:Name="GraphListPlayerBox" Grid.Row="1" Margin="5"
MouseDoubleClick="GraphListPlayerBox_MouseDoubleClick" />
<ListBox x:Name="GraphListWillPlayBox" Grid.Row="1" Margin="5" Grid.Column="1"
MouseDoubleClick="GraphListWillPlayBox_MouseDoubleClick" />
<Button Grid.Row="2" Grid.ColumnSpan="2" Margin="5" Content="开始播放" Click="Play_Click" />
<Button VerticalAlignment="Top" Content="ADD" HorizontalAlignment="Right" Grid.Column="1" Margin="5"
Click="PlayADD_Click" />
</Grid>
</TabItem>
<TabItem Header="{ll:Str 显示逻辑}">
<Grid>
<Label Background="{x:Null}" Content="{ll:Str 双击运行显示效果}" />
<Label x:Name="LabelSuccess" Background="{x:Null}" Content="" HorizontalAlignment="Right" />
<ListBox x:Name="DisplayListBox" Margin="0,30,0,0" MouseDoubleClick="DisplayListBox_MouseDoubleClick">
<ListBoxItem Content="DisplayNomal" />
<ListBoxItem Content="DisplayTouchHead" />
<ListBoxItem Content="DisplayTouchBody" />
<ListBoxItem Content="DisplayIdel" />
<ListBoxItem Content="DisplayIdel_StateONE" />
<ListBoxItem Content="DisplaySleep" />
<ListBoxItem Content="DisplayRaised" />
<ListBoxItem Content="DisplayMove" />
<ListBoxItem Content="DisplayToNomal" />
</ListBox>
</Grid>
</TabItem>
<TabItem Header="{ll:Str 说话}">
<Grid>
<Label Background="{x:Null}" Content="{ll:Str '输入要说的话,按说话键发送'}" />
<Label Background="{x:Null}" Content="{ll:Str '选择说话类型:'}" VerticalAlignment="Top" Margin="0,20,0,0" />
<ComboBox x:Name="CombSay" VerticalAlignment="Top" Margin="110,26,5,0" />
<TextBox x:Name="SayTextBox" TextWrapping="Wrap" pu:TextBoxHelper.Watermark="{ll:Str 在这里输入要说话的内容}"
VerticalAlignment="Top" Margin="5,54,5,0" Height="200" AcceptsReturn="True"
VerticalContentAlignment="Top" />
<Button VerticalAlignment="Bottom" Content="{ll:Str 说话}" Click="Say_Click" FontSize="24" />
</Grid>
</TabItem>
<TabItem Header="{ll:Str 距离查看器}">
<Grid>
<CheckBox HorizontalAlignment="Left" VerticalAlignment="Top" Content="{ll:Str 启动距离查看器}"
Margin="10,5,5,5" Checked="CheckBox_Checked" Unchecked="CheckBox_Unchecked" />
<TextBlock Margin="10,24,0,0" FontSize="24">
<Run Text="{ll:Str '屏幕边缘距离'}" /><LineBreak />
<Run Text="{ll:Str 左侧}" />:<Run x:Name="RLeft" /><LineBreak />
<Run Text="{ll:Str 右侧}" />:<Run x:Name="RRight" /><LineBreak />
<Run Text="{ll:Str 上侧}" />:<Run x:Name="RTop" /><LineBreak />
<Run Text="{ll:Str 下侧}" />:<Run x:Name="RDown" /><LineBreak />
</TextBlock>
</Grid>
</TabItem>
<TabItem Header="{ll:Str 未翻译文档}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*" />
<RowDefinition Height="10*" />
</Grid.RowDefinitions>
<Button Content="{ll:Str 导出未翻译文档}" Click="Output_No_Local" />
<TextBox x:Name="LocalTextBox" AcceptsReturn="True" Grid.Row="1" IsReadOnly="True" MouseDown="Local_SelectAll_Click" />
</Grid>
</TabItem>
</TabControl>
<ComboBox
x:Name="ComboxMode"
Margin="110,25,5,0"
VerticalAlignment="Top"
SelectedIndex="1">
<ComboBoxItem Content="Happy" />
<ComboBoxItem Content="Nomal" />
<ComboBoxItem Content="PoorCondition" />
<ComboBoxItem Content="Ill" />
</ComboBox>
<Label
x:Name="LabelNowPlay"
HorizontalAlignment="Right"
Background="{x:Null}"
Content="" />
<ListBox
x:Name="GraphListBox"
Margin="0,49,0,0"
MouseDoubleClick="GraphListBox_MouseDoubleClick" />
</Grid>
</TabItem>
<TabItem Header="{ll:Str 动画播放}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="15*" />
<RowDefinition Height="110*" />
<RowDefinition Height="10*" />
</Grid.RowDefinitions>
<Label
Grid.RowSpan="2"
Grid.ColumnSpan="2"
Background="{x:Null}"
Content="{ll:Str '双击添加/移除播放列表内容'}" />
<Label
Grid.RowSpan="2"
Grid.ColumnSpan="2"
Margin="0,20,0,0"
VerticalAlignment="Top"
Background="{x:Null}"
Content="{ll:Str '选择状态模式:'}" />
<ComboBox
x:Name="ComboxPlayMode"
Grid.ColumnSpan="2"
Margin="110,25,5,0"
VerticalAlignment="Top"
SelectedIndex="1">
<ComboBoxItem Content="Happy" />
<ComboBoxItem Content="Nomal" />
<ComboBoxItem Content="PoorCondition" />
<ComboBoxItem Content="Ill" />
</ComboBox>
<ListBox
x:Name="GraphListPlayerBox"
Grid.Row="1"
Margin="5"
MouseDoubleClick="GraphListPlayerBox_MouseDoubleClick" />
<ListBox
x:Name="GraphListWillPlayBox"
Grid.Row="1"
Grid.Column="1"
Margin="5"
MouseDoubleClick="GraphListWillPlayBox_MouseDoubleClick" />
<Button
Grid.Row="2"
Grid.ColumnSpan="2"
Margin="5"
Click="Play_Click"
Content="开始播放" />
<Button
Grid.Column="1"
Margin="5"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Click="PlayADD_Click"
Content="ADD" />
</Grid>
</TabItem>
<TabItem Header="{ll:Str 显示逻辑}">
<Grid>
<Label Background="{x:Null}" Content="{ll:Str 双击运行显示效果}" />
<Label
x:Name="LabelSuccess"
HorizontalAlignment="Right"
Background="{x:Null}"
Content="" />
<ListBox
x:Name="DisplayListBox"
Margin="0,30,0,0"
MouseDoubleClick="DisplayListBox_MouseDoubleClick">
<ListBoxItem Content="DisplayNomal" />
<ListBoxItem Content="DisplayTouchHead" />
<ListBoxItem Content="DisplayTouchBody" />
<ListBoxItem Content="DisplayIdel" />
<ListBoxItem Content="DisplayIdel_StateONE" />
<ListBoxItem Content="DisplaySleep" />
<ListBoxItem Content="DisplayRaised" />
<ListBoxItem Content="DisplayMove" />
<ListBoxItem Content="DisplayToNomal" />
</ListBox>
</Grid>
</TabItem>
<TabItem Header="{ll:Str 说话}">
<Grid>
<Label Background="{x:Null}" Content="{ll:Str '输入要说的话,按说话键发送'}" />
<Label
Margin="0,20,0,0"
VerticalAlignment="Top"
Background="{x:Null}"
Content="{ll:Str '选择说话类型:'}" />
<ComboBox
x:Name="CombSay"
Margin="110,26,5,0"
VerticalAlignment="Top" />
<TextBox
x:Name="SayTextBox"
Height="200"
Margin="5,54,5,0"
VerticalAlignment="Top"
VerticalContentAlignment="Top"
pu:TextBoxHelper.Watermark="{ll:Str 在这里输入要说话的内容}"
AcceptsReturn="True"
TextWrapping="Wrap" />
<Button
VerticalAlignment="Bottom"
Click="Say_Click"
Content="{ll:Str 说话}"
FontSize="24" />
</Grid>
</TabItem>
<TabItem Header="{ll:Str 距离查看器}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid>
<CheckBox
Margin="10,5,5,5"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Checked="CheckBox_Checked"
Content="{ll:Str 启动距离查看器}"
Unchecked="CheckBox_Unchecked" />
<TextBlock Margin="10,24,0,0" FontSize="24">
<Run Text="{ll:Str '屏幕边缘距离'}" /><LineBreak />
<Run Text="{ll:Str 左侧}" />
:<Run x:Name="RLeft" /><LineBreak />
<Run Text="{ll:Str 右侧}" />
:<Run x:Name="RRight" /><LineBreak />
<Run Text="{ll:Str 上侧}" />
:<Run x:Name="RTop" /><LineBreak />
<Run Text="{ll:Str 下侧}" />
:<Run x:Name="RDown" /><LineBreak />
</TextBlock>
</Grid>
<Grid Grid.Row="1">
<StackPanel>
<Button
x:Name="Button_MoveToLeft"
Click="Button_MoveToLeft_Click"
Content="向左移动" />
<Button
x:Name="Button_MoveToUp"
Click="Button_MoveToUp_Click"
Content="向上移动" />
<Button
x:Name="Button_MoveToRight"
Click="Button_MoveToRight_Click"
Content="向右移动" />
<Button
x:Name="Button_MoveToButton"
Click="Button_MoveToButton_Click"
Content="向下移动" />
</StackPanel>
</Grid>
</Grid>
</TabItem>
<TabItem Header="{ll:Str 未翻译文档}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*" />
<RowDefinition Height="10*" />
</Grid.RowDefinitions>
<Button Click="Output_No_Local" Content="{ll:Str 导出未翻译文档}" />
<TextBox
x:Name="LocalTextBox"
Grid.Row="1"
AcceptsReturn="True"
IsReadOnly="True"
MouseDown="Local_SelectAll_Click" />
</Grid>
</TabItem>
</TabControl>
</Window>

View File

@ -152,6 +152,26 @@ namespace VPet_Simulator.Windows
}
LocalTextBox.Text = sb.ToString();
}
private void Button_MoveToLeft_Click(object sender, RoutedEventArgs e)
{
mw.Core.Graph.GraphConfig.Moves[8].Display(mw.Main);
}
private void Button_MoveToUp_Click(object sender, RoutedEventArgs e)
{
//mw.Core.Graph.GraphConfig.Moves[8].Display(mw.Main);
}
private void Button_MoveToButton_Click(object sender, RoutedEventArgs e)
{
//mw.Core.Graph.GraphConfig.Moves[8].Display(mw.Main);
}
private void Button_MoveToRight_Click(object sender, RoutedEventArgs e)
{
mw.Core.Graph.GraphConfig.Moves[9].Display(mw.Main);
}
//private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
//{
// switch(((TabControl)sender).SelectedIndex)