mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
设置桌宠启动位置
This commit is contained in:
parent
03f96651e4
commit
88cd9af244
@ -36,7 +36,7 @@ namespace VPet_Simulator.Core
|
|||||||
/// <param name="text">说话内容</param>
|
/// <param name="text">说话内容</param>
|
||||||
public void Say(string text, GraphCore.Helper.SayType type = GraphCore.Helper.SayType.Shining)
|
public void Say(string text, GraphCore.Helper.SayType type = GraphCore.Helper.SayType.Shining)
|
||||||
{
|
{
|
||||||
OnSay.Invoke(text);
|
OnSay?.Invoke(text);
|
||||||
if (type != GraphCore.Helper.SayType.None && DisplayType == GraphCore.GraphType.Default)
|
if (type != GraphCore.Helper.SayType.None && DisplayType == GraphCore.GraphType.Default)
|
||||||
Display(GraphCore.Helper.Convert(type, GraphCore.Helper.AnimatType.A_Start), () =>
|
Display(GraphCore.Helper.Convert(type, GraphCore.Helper.AnimatType.A_Start), () =>
|
||||||
{
|
{
|
||||||
@ -211,7 +211,7 @@ namespace VPet_Simulator.Core
|
|||||||
/// <param name="SmartMoveInterval">智能移动周期</param>
|
/// <param name="SmartMoveInterval">智能移动周期</param>
|
||||||
public void SetMoveMode(bool AllowMove, bool smartMove, int SmartMoveInterval)
|
public void SetMoveMode(bool AllowMove, bool smartMove, int SmartMoveInterval)
|
||||||
{
|
{
|
||||||
MoveTimer.Enabled = false; ;
|
MoveTimer.Enabled = false;
|
||||||
if (AllowMove)
|
if (AllowMove)
|
||||||
{
|
{
|
||||||
MoveTimer.AutoReset = true;
|
MoveTimer.AutoReset = true;
|
||||||
|
@ -11,6 +11,10 @@ namespace VPet_Simulator.Windows.Interface
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class MainPlugin
|
public abstract class MainPlugin
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 通过插件名称定位插件
|
||||||
|
/// </summary>
|
||||||
|
public abstract string PluginName { get; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 主窗体, 主程序提供的各种功能和设置等 大部分参数和调用均在这里
|
/// 主窗体, 主程序提供的各种功能和设置等 大部分参数和调用均在这里
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -5,6 +5,7 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
namespace VPet_Simulator.Windows.Interface
|
namespace VPet_Simulator.Windows.Interface
|
||||||
{
|
{
|
||||||
@ -283,5 +284,52 @@ namespace VPet_Simulator.Windows.Interface
|
|||||||
get => this["gameconfig"].GetString("petgraph", "默认虚拟桌宠");
|
get => this["gameconfig"].GetString("petgraph", "默认虚拟桌宠");
|
||||||
set => this["gameconfig"].SetString("petgraph", value);
|
set => this["gameconfig"].SetString("petgraph", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否记录游戏退出位置 (默认:是)
|
||||||
|
/// </summary>
|
||||||
|
public bool StartRecordLast
|
||||||
|
{
|
||||||
|
get => !this["gameconfig"].GetBool("startboot");
|
||||||
|
set => this["gameconfig"].SetBool("startboot", !value);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 记录上次退出位置
|
||||||
|
/// </summary>
|
||||||
|
public Point StartRecordLastPoint
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var line = FindLine("startrecordlast");
|
||||||
|
if (line == null)
|
||||||
|
return new Point();
|
||||||
|
return new Point(line.GetDouble("x", 0), line.GetDouble("y", 0));
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
var line = FindorAddLine("startrecordlast");
|
||||||
|
line.SetDouble("x", value.X);
|
||||||
|
line.SetDouble("y", value.Y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 设置中桌宠启动的位置
|
||||||
|
/// </summary>
|
||||||
|
public Point StartRecordPoint
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var line = FindLine("startrecord");
|
||||||
|
if (line == null)
|
||||||
|
return StartRecordLastPoint;
|
||||||
|
return new Point(line.GetDouble("x", 0), line.GetDouble("y", 0));
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
var line = FindorAddLine("startrecord");
|
||||||
|
line.SetDouble("x", value.X);
|
||||||
|
line.SetDouble("y", value.Y);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,11 +101,11 @@ namespace VPet_Simulator.Windows
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var path = tmpfi.FullName;
|
var path = tmpfi.Name;
|
||||||
if (LoadedDLL.Contains(path))
|
if (LoadedDLL.Contains(path))
|
||||||
continue;
|
continue;
|
||||||
LoadedDLL.Add(path);
|
LoadedDLL.Add(path);
|
||||||
Assembly dll = Assembly.LoadFrom(path);
|
Assembly dll = Assembly.LoadFrom(tmpfi.FullName);
|
||||||
var v = dll.GetExportedTypes();
|
var v = dll.GetExportedTypes();
|
||||||
foreach (Type exportedType in v)
|
foreach (Type exportedType in v)
|
||||||
{
|
{
|
||||||
|
@ -70,12 +70,26 @@ namespace VPet_Simulator.Windows
|
|||||||
CGPTClient = ChatGPTClient.Load(File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + @"\ChatGPTSetting.json"));
|
CGPTClient = ChatGPTClient.Load(File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + @"\ChatGPTSetting.json"));
|
||||||
//this.Width = 400 * ZoomSlider.Value;
|
//this.Width = 400 * ZoomSlider.Value;
|
||||||
//this.Height = 450 * ZoomSlider.Value;
|
//this.Height = 450 * ZoomSlider.Value;
|
||||||
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
this.Height = 500 * Set.ZoomLevel;
|
this.Height = 500 * Set.ZoomLevel;
|
||||||
this.Width = 500 * Set.ZoomLevel;
|
this.Width = 500 * Set.ZoomLevel;
|
||||||
|
|
||||||
|
if (Set.StartRecordLast)
|
||||||
|
{
|
||||||
|
var point = Set.StartRecordLastPoint;
|
||||||
|
if (point.X != 0 || point.Y != 0)
|
||||||
|
{
|
||||||
|
this.Left = point.X;
|
||||||
|
this.Top = point.Y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var point = Set.StartRecordPoint;
|
||||||
|
Left = point.X; Top = point.Y;
|
||||||
|
}
|
||||||
|
|
||||||
//不存在就关掉
|
//不存在就关掉
|
||||||
var modpath = new DirectoryInfo(ModPath + @"\0000_core\pet\vup");
|
var modpath = new DirectoryInfo(ModPath + @"\0000_core\pet\vup");
|
||||||
if (!modpath.Exists)
|
if (!modpath.Exists)
|
||||||
|
@ -43,6 +43,8 @@
|
|||||||
<RowDefinition Height="35" />
|
<RowDefinition Height="35" />
|
||||||
<RowDefinition Height="35"/>
|
<RowDefinition Height="35"/>
|
||||||
<RowDefinition Height="35"/>
|
<RowDefinition Height="35"/>
|
||||||
|
<RowDefinition Height="35" />
|
||||||
|
<RowDefinition Height="35" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
@ -87,9 +89,35 @@
|
|||||||
<TextBlock Grid.Row="4" Text="字体" VerticalAlignment="Center" />
|
<TextBlock Grid.Row="4" Text="字体" VerticalAlignment="Center" />
|
||||||
<ComboBox x:Name="FontBox" Grid.Row="4" Grid.Column="2"
|
<ComboBox x:Name="FontBox" Grid.Row="4" Grid.Column="2"
|
||||||
SelectionChanged="FontBox_SelectionChanged" IsEnabled="False"
|
SelectionChanged="FontBox_SelectionChanged" IsEnabled="False"
|
||||||
Style="{DynamicResource StandardComboBoxStyle}" Margin="0,3,0,2" FontSize="16" />
|
Style="{DynamicResource StandardComboBoxStyle}" FontSize="16" Margin="0,2,0,3" />
|
||||||
<TextBlock Grid.Row="5" Text="开机启动" VerticalAlignment="Center" />
|
<TextBlock Grid.Row="5" Text="启动位置" VerticalAlignment="Center" />
|
||||||
<Grid Grid.Row="5" Grid.Column="2">
|
<Grid Grid.Row="5" Grid.Column="2">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="1.5*"/>
|
||||||
|
<ColumnDefinition Width="1*"/>
|
||||||
|
<ColumnDefinition Width="1*"/>
|
||||||
|
<ColumnDefinition Width="1*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<pu:Switch x:Name="StartPlace" BorderBrush="{DynamicResource PrimaryDark}"
|
||||||
|
CheckedBackground="{DynamicResource Primary}" IsChecked="True"
|
||||||
|
CheckedBorderBrush="{DynamicResource Primary}" Background="Transparent"
|
||||||
|
BoxWidth="35" BoxHeight="18" ToggleSize="14" ToggleShadowColor="{x:Null}"
|
||||||
|
ToggleBrush="{DynamicResource PrimaryDark}" Content="退出位置"
|
||||||
|
CheckedToggleBrush="{DynamicResource DARKPrimaryText}" ToolTip="该游戏随着开机启动该程序"
|
||||||
|
Unchecked="StartPlace_Checked" VerticalAlignment="Center" Checked="StartPlace_Checked" />
|
||||||
|
<TextBox x:Name="TextBoxStartUpX" Grid.Column="1" Style="{DynamicResource StandardTextBoxStyle}" ToolTip="X轴" pu:TextBoxHelper.Icon="X"
|
||||||
|
FontSize="16" Margin="0,0,5,0" pu:TextBoxHelper.InputLimit="Digit" pu:TextBoxHelper.Watermark="X轴"
|
||||||
|
TextChanged="TextBoxStartUp_TextChanged" pu:IconHelper.Margin="5,0,0,0"/>
|
||||||
|
<TextBox x:Name="TextBoxStartUpY" Grid.Column="2" Style="{DynamicResource StandardTextBoxStyle}" ToolTip="Y轴" pu:TextBoxHelper.Icon="Y"
|
||||||
|
FontSize="16" pu:TextBoxHelper.InputLimit="Digit" pu:TextBoxHelper.Watermark="Y轴" Margin="0,0,5,0"
|
||||||
|
TextChanged="TextBoxStartUp_TextChanged" pu:IconHelper.Margin="5,0,0,0"/>
|
||||||
|
<Button x:Name="BtnStartUpGet" pu:ButtonHelper.CornerRadius="4" Content="当前位置" Grid.Column="3"
|
||||||
|
Background="{DynamicResource SecondaryLight}" HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center" Height="30" BorderBrush="{DynamicResource SecondaryDark}" BorderThickness="2" Click="BtnStartUpGet_Click"/>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
<TextBlock Grid.Row="7" Text="开机启动" VerticalAlignment="Center" />
|
||||||
|
<Grid Grid.Row="7" Grid.Column="2">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
@ -111,11 +139,11 @@
|
|||||||
ToolTip="从Steam启动该游戏, 统计时长不能停" Grid.Column="1" Checked="StartUpSteamBox_Checked"
|
ToolTip="从Steam启动该游戏, 统计时长不能停" Grid.Column="1" Checked="StartUpSteamBox_Checked"
|
||||||
Unchecked="StartUpSteamBox_Checked" />
|
Unchecked="StartUpSteamBox_Checked" />
|
||||||
</Grid>
|
</Grid>
|
||||||
<TextBlock Grid.Row="6" Text="宠物动画" VerticalAlignment="Center" />
|
<TextBlock Grid.Row="8" Text="宠物动画" VerticalAlignment="Center" />
|
||||||
<TextBlock x:Name="PetIntor" Grid.Row="7" Text="动画描述动画描述动画描述动画描述动画描述" VerticalAlignment="Top" Grid.Column="2" Margin="0,0,0,5" TextWrapping="WrapWithOverflow" FontSize="14" />
|
<TextBlock x:Name="PetIntor" Grid.Row="9" Text="动画描述动画描述动画描述动画描述动画描述" VerticalAlignment="Center" Grid.Column="2" TextWrapping="WrapWithOverflow" FontSize="14" />
|
||||||
<ComboBox x:Name="PetBox" Grid.Row="6" Grid.Column="2" ToolTip="加载的宠物动画,重启后生效"
|
<ComboBox x:Name="PetBox" Grid.Row="8" Grid.Column="2" ToolTip="加载的宠物动画,重启后生效"
|
||||||
Style="{DynamicResource StandardComboBoxStyle}" Margin="0,3,0,2" SelectionChanged="PetBox_SelectionChanged" FontSize="16" />
|
Style="{DynamicResource StandardComboBoxStyle}" Margin="0,3,0,2" SelectionChanged="PetBox_SelectionChanged" FontSize="16" />
|
||||||
<Button x:Name="ButtonRestartGraph" Content="重启软件以应用更改" Margin="0,2,0,0" Visibility="Collapsed"
|
<Button x:Name="ButtonRestartGraph" Content="重启软件以应用更改" Visibility="Collapsed"
|
||||||
VerticalAlignment="Bottom" Background="{DynamicResource DARKPrimary}"
|
VerticalAlignment="Bottom" Background="{DynamicResource DARKPrimary}"
|
||||||
Foreground="{DynamicResource DARKPrimaryText}"
|
Foreground="{DynamicResource DARKPrimaryText}"
|
||||||
Click="ButtonRestart_Click" Grid.ColumnSpan="3" Grid.Row="10" />
|
Click="ButtonRestart_Click" Grid.ColumnSpan="3" Grid.Row="10" />
|
||||||
|
@ -75,6 +75,23 @@ namespace VPet_Simulator.Windows
|
|||||||
PetBox.SelectedIndex = petboxid;
|
PetBox.SelectedIndex = petboxid;
|
||||||
PetIntor.Text = mw.Pets[petboxid].Intor;
|
PetIntor.Text = mw.Pets[petboxid].Intor;
|
||||||
|
|
||||||
|
TextBoxStartUpX.Text = mw.Set.StartRecordPoint.X.ToString();
|
||||||
|
TextBoxStartUpY.Text = mw.Set.StartRecordPoint.Y.ToString();
|
||||||
|
if (mw.Set.StartRecordLast == true)
|
||||||
|
{
|
||||||
|
StartPlace.IsChecked = true;
|
||||||
|
TextBoxStartUpX.IsEnabled = false;
|
||||||
|
TextBoxStartUpY.IsEnabled = false;
|
||||||
|
BtnStartUpGet.IsEnabled = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
StartPlace.IsChecked = false;
|
||||||
|
TextBoxStartUpX.IsEnabled = true;
|
||||||
|
TextBoxStartUpY.IsEnabled = true;
|
||||||
|
BtnStartUpGet.IsEnabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (ComboBoxItem v in CBAutoSave.Items)
|
foreach (ComboBoxItem v in CBAutoSave.Items)
|
||||||
{
|
{
|
||||||
if ((int)v.Tag == mw.Set.AutoSaveInterval)
|
if ((int)v.Tag == mw.Set.AutoSaveInterval)
|
||||||
@ -723,5 +740,42 @@ namespace VPet_Simulator.Windows
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void StartPlace_Checked(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (!AllowChange)
|
||||||
|
return;
|
||||||
|
if (StartPlace.IsChecked == true)
|
||||||
|
{
|
||||||
|
mw.Set.StartRecordLast = true;
|
||||||
|
TextBoxStartUpX.IsEnabled = false;
|
||||||
|
TextBoxStartUpY.IsEnabled = false;
|
||||||
|
BtnStartUpGet.IsEnabled = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mw.Set.StartRecordLast = false;
|
||||||
|
TextBoxStartUpX.IsEnabled = true;
|
||||||
|
TextBoxStartUpY.IsEnabled = true;
|
||||||
|
BtnStartUpGet.IsEnabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TextBoxStartUp_TextChanged(object sender, TextChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (!AllowChange)
|
||||||
|
return;
|
||||||
|
if (double.TryParse(TextBoxStartUpX.Text, out double x) && double.TryParse(TextBoxStartUpY.Text, out double y))
|
||||||
|
mw.Set.StartRecordPoint = new Point(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BtnStartUpGet_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
AllowChange = false;
|
||||||
|
TextBoxStartUpX.Text = mw.Left.ToString();
|
||||||
|
TextBoxStartUpY.Text = mw.Top.ToString();
|
||||||
|
mw.Set.StartRecordPoint = new Point(mw.Left, mw.Top);
|
||||||
|
AllowChange = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
14
VPet.sln
14
VPet.sln
@ -11,6 +11,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VPet-Simulator.Windows", "V
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VPet-Simulator.Windows.Interface", "VPet-Simulator.Windows.Interface\VPet-Simulator.Windows.Interface.csproj", "{DCAD838A-1A02-4BDF-962C-FD47C6006D28}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VPet-Simulator.Windows.Interface", "VPet-Simulator.Windows.Interface\VPet-Simulator.Windows.Interface.csproj", "{DCAD838A-1A02-4BDF-962C-FD47C6006D28}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VPet-Simulator.Windows.Interface.Demo", "VPet-Simulator.Windows.Interface.Demo\VPet-Simulator.Windows.Interface.Demo.csproj", "{4DB2457C-143A-4100-9A93-A8AD2D973BDA}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@ -69,6 +71,18 @@ Global
|
|||||||
{DCAD838A-1A02-4BDF-962C-FD47C6006D28}.Release|x64.Build.0 = Release|Any CPU
|
{DCAD838A-1A02-4BDF-962C-FD47C6006D28}.Release|x64.Build.0 = Release|Any CPU
|
||||||
{DCAD838A-1A02-4BDF-962C-FD47C6006D28}.Release|x86.ActiveCfg = Release|Any CPU
|
{DCAD838A-1A02-4BDF-962C-FD47C6006D28}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
{DCAD838A-1A02-4BDF-962C-FD47C6006D28}.Release|x86.Build.0 = Release|Any CPU
|
{DCAD838A-1A02-4BDF-962C-FD47C6006D28}.Release|x86.Build.0 = Release|Any CPU
|
||||||
|
{4DB2457C-143A-4100-9A93-A8AD2D973BDA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{4DB2457C-143A-4100-9A93-A8AD2D973BDA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{4DB2457C-143A-4100-9A93-A8AD2D973BDA}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{4DB2457C-143A-4100-9A93-A8AD2D973BDA}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{4DB2457C-143A-4100-9A93-A8AD2D973BDA}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{4DB2457C-143A-4100-9A93-A8AD2D973BDA}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{4DB2457C-143A-4100-9A93-A8AD2D973BDA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{4DB2457C-143A-4100-9A93-A8AD2D973BDA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{4DB2457C-143A-4100-9A93-A8AD2D973BDA}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{4DB2457C-143A-4100-9A93-A8AD2D973BDA}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{4DB2457C-143A-4100-9A93-A8AD2D973BDA}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{4DB2457C-143A-4100-9A93-A8AD2D973BDA}.Release|x86.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
Loading…
Reference in New Issue
Block a user