支持更多桌宠设置项目

This commit is contained in:
ZouJin 2023-01-24 14:56:16 +08:00
parent 90b4cf77e5
commit 67ed01399d
12 changed files with 367 additions and 85 deletions

View File

@ -61,7 +61,14 @@ namespace VPet_Simulator.Core
EventTimer.Elapsed += EventTimer_Elapsed;
MoveTimer.Elapsed += MoveTimer_Elapsed;
SmartMoveTimer.Elapsed += SmartMoveTimer_Elapsed;
}
private void SmartMoveTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
MoveTimer.AutoReset = false;
}
public void Say(string text)
{
MsgBar.Show(Core.Save.Name, text);
@ -90,6 +97,7 @@ namespace VPet_Simulator.Core
Thread.Sleep(Core.Controller.PressLength);
Point mp = default;
Dispatcher.BeginInvoke(new Action(() => mp = Mouse.GetPosition(MainGrid))).Wait();
//mp = new Point(mp.X * Core.Controller.ZoomRatio, mp.Y * Core.Controller.ZoomRatio);
if (isPress && presstime == pth)
{//历遍长按事件
var act = Core.TouchEvent.FirstOrDefault(x => x.IsPress == true && x.Touch(mp));
@ -116,6 +124,15 @@ namespace VPet_Simulator.Core
rasetype = -1;
DisplayRaising();
}
else
{
if (SmartMove)
{
MoveTimer.AutoReset = true;
SmartMoveTimer.Stop();
SmartMoveTimer.Start();
}
}
}
private void MainGrid_MouseMove(object sender, MouseEventArgs e)

View File

@ -64,12 +64,12 @@ namespace VPet_Simulator.Core
case GraphType.Walk_Right_B_Loop:
Display(Core.Graph.FindGraph(GraphCore.GraphType.Walk_Right_C_End, Core.Save.Mode, true), EndAction);
return true;
//case GraphType.Climb_Left:
//case GraphType.Climb_Right:
//case GraphType.Climb_Top_Left:
//case GraphType.Climb_Top_Right:
// DisplayFalled_Left();
// return true;
//case GraphType.Climb_Left:
//case GraphType.Climb_Right:
//case GraphType.Climb_Top_Left:
//case GraphType.Climb_Top_Right:
// DisplayFalled_Left();
// return true;
}
return false;
}
@ -221,7 +221,7 @@ namespace VPet_Simulator.Core
CountNomal = 0;
Display(GraphCore.GraphType.Walk_Left_A_Start, () =>
{
MoveTimerPoint = new Point(-Core.Graph.GraphConfig.SpeedWalk * Core.Controller.ZoomRatio, 0);
MoveTimerPoint = new Point(-Core.Graph.GraphConfig.SpeedWalk, 0);
MoveTimer.Start();
DisplayWalk_Lefting();
});
@ -301,7 +301,7 @@ namespace VPet_Simulator.Core
CountNomal = 0;
Display(GraphCore.GraphType.Walk_Right_A_Start, () =>
{
MoveTimerPoint = new Point(Core.Graph.GraphConfig.SpeedWalk * Core.Controller.ZoomRatio, 0);
MoveTimerPoint = new Point(Core.Graph.GraphConfig.SpeedWalk, 0);
MoveTimer.Start();
DisplayWalk_Righting();
});
@ -380,7 +380,7 @@ namespace VPet_Simulator.Core
walklength = 0;
Display(GraphCore.GraphType.Crawl_Left_A_Start, () =>
{
MoveTimerPoint = new Point(-Core.Graph.GraphConfig.SpeedCrawl * Core.Controller.ZoomRatio, 0);//TODO:锚定设置
MoveTimerPoint = new Point(-Core.Graph.GraphConfig.SpeedCrawl, 0);
MoveTimer.Start();
DisplayCrawl_Lefting();
});
@ -438,7 +438,7 @@ namespace VPet_Simulator.Core
walklength = 0;
Display(GraphCore.GraphType.Crawl_Right_A_Start, () =>
{
MoveTimerPoint = new Point(Core.Graph.GraphConfig.SpeedCrawl * Core.Controller.ZoomRatio, 0);//TODO:锚定设置
MoveTimerPoint = new Point(Core.Graph.GraphConfig.SpeedCrawl, 0);
MoveTimer.Start();
DisplayCrawl_Righting();
});
@ -495,10 +495,10 @@ namespace VPet_Simulator.Core
{
walklength = 0;
CountNomal = 0;
Core.Controller.MoveWindows(-(Core.Controller.GetWindowsDistanceLeft() + Core.Graph.GraphConfig.LocateClimbLeft) / Core.Controller.ZoomRatio, 0);
Core.Controller.MoveWindows(-Core.Controller.GetWindowsDistanceLeft() / Core.Controller.ZoomRatio - Core.Graph.GraphConfig.LocateClimbLeft, 0);
Display(GraphCore.GraphType.Walk_Left_A_Start, () =>
{
MoveTimerPoint = new Point(0, -Core.Graph.GraphConfig.SpeedClimb * Core.Controller.ZoomRatio);
MoveTimerPoint = new Point(0, -Core.Graph.GraphConfig.SpeedClimb);
MoveTimer.Start();
DisplayClimb_Lefting_UP();
});
@ -558,10 +558,10 @@ namespace VPet_Simulator.Core
walklength = 0;
CountNomal = 0;
Core.Controller.MoveWindows(-(Core.Controller.GetWindowsDistanceLeft() + Core.Graph.GraphConfig.LocateClimbLeft) / Core.Controller.ZoomRatio, 0);
Core.Controller.MoveWindows(-Core.Controller.GetWindowsDistanceLeft() / Core.Controller.ZoomRatio - Core.Graph.GraphConfig.LocateClimbLeft, 0);
Display(GraphCore.GraphType.Walk_Left_A_Start, () =>
{
MoveTimerPoint = new System.Windows.Point(0, Core.Graph.GraphConfig.SpeedClimb * Core.Controller.ZoomRatio);
MoveTimerPoint = new System.Windows.Point(0, Core.Graph.GraphConfig.SpeedClimb);
MoveTimer.Start();
DisplayClimb_Lefting_DOWN();
});
@ -602,10 +602,10 @@ namespace VPet_Simulator.Core
walklength = 0;
CountNomal = 0;
Core.Controller.MoveWindows((Core.Controller.GetWindowsDistanceRight()+ Core.Graph.GraphConfig.LocateClimbRight) / Core.Controller.ZoomRatio, 0);
Core.Controller.MoveWindows(Core.Controller.GetWindowsDistanceRight() / Core.Controller.ZoomRatio + Core.Graph.GraphConfig.LocateClimbRight, 0);
Display(GraphCore.GraphType.Walk_Right_A_Start, () =>
{
MoveTimerPoint = new Point(0, -Core.Graph.GraphConfig.SpeedClimb * Core.Controller.ZoomRatio);
MoveTimerPoint = new Point(0, -Core.Graph.GraphConfig.SpeedClimb);
MoveTimer.Start();
DisplayClimb_Righting_UP();
});
@ -665,10 +665,10 @@ namespace VPet_Simulator.Core
walklength = 0;
CountNomal = 0;
Core.Controller.MoveWindows((Core.Controller.GetWindowsDistanceRight() + Core.Graph.GraphConfig.LocateClimbRight) / Core.Controller.ZoomRatio, 0);
Core.Controller.MoveWindows(Core.Controller.GetWindowsDistanceRight() / Core.Controller.ZoomRatio + Core.Graph.GraphConfig.LocateClimbRight, 0);
Display(GraphCore.GraphType.Walk_Right_A_Start, () =>
{
MoveTimerPoint = new Point(0, Core.Graph.GraphConfig.SpeedClimb * Core.Controller.ZoomRatio);
MoveTimerPoint = new Point(0, Core.Graph.GraphConfig.SpeedClimb);
MoveTimer.Start();
DisplayClimb_Righting_DOWN();
});
@ -709,8 +709,8 @@ namespace VPet_Simulator.Core
walklength = 0;
CountNomal = 0;
Core.Controller.MoveWindows(0, -(Core.Controller.GetWindowsDistanceUp()+ Core.Graph.GraphConfig.LocateClimbTop) / Core.Controller.ZoomRatio);
MoveTimerPoint = new Point(Core.Graph.GraphConfig.SpeedClimbTop * Core.Controller.ZoomRatio, 0);
Core.Controller.MoveWindows(0, -Core.Controller.GetWindowsDistanceUp() / Core.Controller.ZoomRatio - Core.Graph.GraphConfig.LocateClimbTop);
MoveTimerPoint = new Point(Core.Graph.GraphConfig.SpeedClimbTop, 0);
MoveTimer.Start();
DisplayClimb_Top_Righting();
}
@ -761,8 +761,8 @@ namespace VPet_Simulator.Core
walklength = 0;
CountNomal = 0;
Core.Controller.MoveWindows(0, -(Core.Controller.GetWindowsDistanceUp() + Core.Graph.GraphConfig.LocateClimbTop) / Core.Controller.ZoomRatio);
MoveTimerPoint = new Point(-Core.Graph.GraphConfig.SpeedClimbTop * Core.Controller.ZoomRatio, 0);
Core.Controller.MoveWindows(0, -Core.Controller.GetWindowsDistanceUp() / Core.Controller.ZoomRatio - Core.Graph.GraphConfig.LocateClimbTop);
MoveTimerPoint = new Point(-Core.Graph.GraphConfig.SpeedClimbTop, 0);
MoveTimer.Start();
DisplayClimb_Top_Lefting();
}
@ -813,7 +813,7 @@ namespace VPet_Simulator.Core
walklength = 0;
CountNomal = 0;
//Core.Controller.MoveWindows(0, -Core.Controller.GetWindowsDistanceUp() / Core.Controller.ZoomRatio - 150);
MoveTimerPoint = new Point(-Core.Graph.GraphConfig.SpeedFallX * Core.Controller.ZoomRatio, Core.Graph.GraphConfig.SpeedFallY * Core.Controller.ZoomRatio);
MoveTimerPoint = new Point(-Core.Graph.GraphConfig.SpeedFallX, Core.Graph.GraphConfig.SpeedFallY);
MoveTimer.Start();
Display(GraphType.Fall_Left_A_Start, DisplayFall_Lefting);
}
@ -876,7 +876,7 @@ namespace VPet_Simulator.Core
walklength = 0;
CountNomal = 0;
//Core.Controller.MoveWindows(0, -Core.Controller.GetWindowsDistanceUp() / Core.Controller.ZoomRatio - 150);
MoveTimerPoint = new Point(Core.Graph.GraphConfig.SpeedFallX * Core.Controller.ZoomRatio, Core.Graph.GraphConfig.SpeedFallY * Core.Controller.ZoomRatio);
MoveTimerPoint = new Point(Core.Graph.GraphConfig.SpeedFallX, Core.Graph.GraphConfig.SpeedFallY);
MoveTimer.Start();
Display(GraphType.Fall_Right_A_Start, DisplayFall_Righting);
}

View File

@ -58,8 +58,8 @@ namespace VPet_Simulator.Core
{
Core.Save.Health -= Function.Rnd.Next(0, 1);
}
else if(Core.Save.StrengthDrink >= 75)
Core.Save.Health += Function.Rnd.Next(0, 1);
else if (Core.Save.StrengthDrink >= 75)
Core.Save.Health += Function.Rnd.Next(0, 1);
var newmod = Core.Save.CalMode();
if (Core.Save.Mode != newmod)
{
@ -77,7 +77,7 @@ namespace VPet_Simulator.Core
Dispatcher.Invoke(() => TimeUIHandle.Invoke(this));
if (DisplayType == GraphCore.GraphType.Default && !isPress)
switch (1)//Function.Rnd.Next(Math.Max(23, 200 - CountNomal)))
switch (Function.Rnd.Next(Math.Max(23, Core.Controller.InteractionCycle - CountNomal)))
{
case 0:
case 7:
@ -144,5 +144,50 @@ namespace VPet_Simulator.Core
{
AutoReset = true,
};
/// <summary>
/// 设置计算间隔
/// </summary>
/// <param name="Interval">计算间隔</param>
public void SetLogicInterval(int Interval)
{
EventTimer.Interval = Interval;
}
private Timer SmartMoveTimer = new Timer(20 * 60)
{
AutoReset = true,
};
/// <summary>
/// 是否启用智能移动
/// </summary>
private bool SmartMove;
/// <summary>
/// 设置移动模式
/// </summary>
/// <param name="AllowMove">允许移动</param>
/// <param name="SmartMove">启用智能移动</param>
/// <param name="SmartMoveInterval">智能移动周期</param>
public void SetMoveMode(bool AllowMove, bool smartMove, int SmartMoveInterval)
{
MoveTimer.Stop();
if (AllowMove)
{
MoveTimer.AutoReset = true;
if (smartMove)
{
SmartMoveTimer.Interval = SmartMoveInterval;
SmartMoveTimer.Start();
SmartMove = true;
}
else
{
SmartMoveTimer.Stop();
SmartMove = false;
}
}
else
{
MoveTimer.AutoReset = false;
}
}
}
}

View File

@ -13,7 +13,7 @@ namespace VPet_Simulator.Core
public interface IController
{
/// <summary>
/// 移动桌宠位置
/// 移动桌宠位置 (自带缩放倍率)
/// </summary>
/// <param name="X">X轴</param>
/// <param name="Y">Y轴</param>
@ -60,5 +60,9 @@ namespace VPet_Simulator.Core
/// 启用计算等数据功能
/// </summary>
bool EnableFunction { get; }
/// <summary>
/// 互动周期
/// </summary>
int InteractionCycle { get; }
}
}

View File

@ -13,5 +13,23 @@ namespace VPet_Simulator.Windows
/// </summary>
public partial class App : Application
{
public App() : base()
{
base.DispatcherUnhandledException += App_DispatcherUnhandledException;
//AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
}
private void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
e.Handled = true;
string errstr = "游戏发生错误,可能是" + (string.IsNullOrWhiteSpace(CoreMOD.NowLoading) ? "游戏或者MOD" : $"MOD({CoreMOD.NowLoading})") + "导致的\n如有可能请发送 错误信息截图和引发错误之前的操作 给开发者:service@exlb.net\n感谢您对游戏开发的支持\n" + e.Exception.ToString();
if (MainWindow == null)
{
MessageBox.Show(errstr, "游戏致命性错误");
return;
}
MainWindow mw = ((MainWindow)MainWindow);
}
}
}

View File

@ -61,8 +61,11 @@ namespace VPet_Simulator.Windows
public double ZoomRatio => mw.Set.ZoomLevel;
public int PressLength => 500;
public int PressLength => mw.Set.PressLength;
public bool EnableFunction => false;//mw.Set.EnableFunction;
public int InteractionCycle => mw.Set.InteractionCycle;
public bool EnableFunction => false;
}
}

View File

@ -25,8 +25,8 @@ namespace VPet_Simulator.Windows
}
presslength = this["gameconfig"].GetInt("presslength", 500);
intercycle = this["gameconfig"].GetInt("intercycle", 200);
moveevent = !this["gameconfig"].GetBool("moveevent");
smartmoveevent = this["gameconfig"].GetBool("smartmoveevent");
allowmove = !this["gameconfig"].GetBool("allowmove");
smartmove = this["gameconfig"].GetBool("smartmove");
enablefunction = !this["gameconfig"].GetBool("enablefunction");
}
@ -204,35 +204,35 @@ namespace VPet_Simulator.Windows
get => this["gameconfig"].GetDouble("logicinterval", 15);
set => this["gameconfig"].SetDouble("logicinterval", value);
}
bool moveevent;
bool allowmove;
/// <summary>
/// 允许移动事件
/// </summary>
public bool MoveEvent
public bool AllowMove
{
get => moveevent;
get => allowmove;
set
{
moveevent = value;
this["gameconfig"].SetBool("moveevent", !value);
allowmove = value;
this["gameconfig"].SetBool("allowmove", !value);
}
}
bool smartmoveevent;
bool smartmove;
/// <summary>
/// 智能移动
/// </summary>
public bool SmartMoveEvent
public bool SmartMove
{
get => smartmoveevent;
get => smartmove;
set
{
smartmoveevent = value;
this["gameconfig"].SetBool("smartmoveevent", value);
smartmove = value;
this["gameconfig"].SetBool("smartmove", value);
}
}
bool enablefunction;
/// <summary>
/// 允许移动
/// 启用计算等数据功能
/// </summary>
public bool EnableFunction
{
@ -243,5 +243,13 @@ namespace VPet_Simulator.Windows
this["gameconfig"].SetBool("function", !value);
}
}
/// <summary>
/// 智能移动周期 (秒)
/// </summary>
public int SmartMoveInterval
{
get => this["gameconfig"].GetInt("smartmoveinterval", 20*60);
set => this["gameconfig"].SetInt("smartmoveinterval", value);
}
}
}

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -31,5 +32,17 @@ namespace VPet_Simulator.Windows
this.Height = 500 * zl;
this.Width = 500 * zl;
}
/// <summary>
/// 保存设置
/// </summary>
public void Save()
{
//游戏存档
if (Set != null)
File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + @"\Setting.lps", Set.ToString());
if (Core != null && Core.Save != null)
File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + @"\Save.lps", Core.Save.ToLine().ToString());
}
}
}

View File

@ -23,6 +23,7 @@ using MessageBox = System.Windows.MessageBox;
using ContextMenu = System.Windows.Forms.ContextMenu;
using MenuItem = System.Windows.Forms.MenuItem;
using Application = System.Windows.Application;
using System.Timers;
namespace VPet_Simulator.Windows
{
@ -32,6 +33,7 @@ namespace VPet_Simulator.Windows
public partial class MainWindow : Window
{
private NotifyIcon notifyIcon;
public System.Timers.Timer AutoSaveTimer = new System.Timers.Timer();
public MainWindow()
{
//判断是不是Steam用户,因为本软件会发布到Steam
@ -113,21 +115,33 @@ namespace VPet_Simulator.Windows
//加载游戏内容
Core.Controller = new MWController(this);
Core.Save = new Save("萝莉斯");
AutoSaveTimer.Elapsed += AutoSaveTimer_Elapsed;
if (Set.AutoSaveInterval > 0)
{
AutoSaveTimer.Interval = Set.AutoSaveInterval * 60000;
AutoSaveTimer.Start();
}
Dispatcher.Invoke(new Action(() =>
{
Core.Graph = Pets[0].Graph();
LoadingText.Visibility = Visibility.Collapsed;
winSetting = new winGameSetting(this);
var main = new Main(Core) { };
main.DefaultClickAction = () => { Dispatcher.Invoke(() => { main.Say("你知道吗? 鼠标右键可以打开菜单栏"); }); };
DisplayGrid.Child = main;
main.ToolBar.AddMenuButton(VPet_Simulator.Core.ToolBar.MenuType.Setting, "设置面板", () =>
Main = new Main(Core) { };
Main.DefaultClickAction = () => { Dispatcher.Invoke(() => { Main.Say("你知道吗? 鼠标右键可以打开菜单栏"); }); };
DisplayGrid.Child = Main;
Main.ToolBar.AddMenuButton(VPet_Simulator.Core.ToolBar.MenuType.Setting, "退出桌宠", () => { Close(); });
Main.ToolBar.AddMenuButton(VPet_Simulator.Core.ToolBar.MenuType.Setting, "设置面板", () =>
{
Topmost = false;
winSetting.Show();
});
main.ToolBar.AddMenuButton(VPet_Simulator.Core.ToolBar.MenuType.Setting, "退出桌宠", () => { Close(); });
Main.SetMoveMode(Set.AllowMove, Set.SmartMove, Set.SmartMoveInterval * 1000);
Main.SetLogicInterval((int)(Set.LogicInterval * 1000));
//加载图标
notifyIcon = new NotifyIcon();
ContextMenu m_menu;
@ -135,8 +149,8 @@ namespace VPet_Simulator.Windows
m_menu = new ContextMenu();
m_menu.MenuItems.Add(new MenuItem("重置状态", (x, y) =>
{
main.CleanState();
main.DisplayNomal();
Main.CleanState();
Main.DisplayNomal();
}));
m_menu.MenuItems.Add(new MenuItem("屏幕居中", (x, y) =>
{
@ -163,22 +177,23 @@ namespace VPet_Simulator.Windows
Task.Run(() =>
{
Thread.Sleep(1000);
main.Say("欢迎使用虚拟桌宠模拟器\n这是个早期的测试版,若有bug请多多包涵\n欢迎在菜单栏-管理-反馈中提交bug或建议");
Main.Say("欢迎使用虚拟桌宠模拟器\n这是个早期的测试版,若有bug请多多包涵\n欢迎在菜单栏-管理-反馈中提交bug或建议");
});
}
}));
}
private void AutoSaveTimer_Elapsed(object sender, ElapsedEventArgs e)
{
Save();
}
public Main Main;
private void Window_Closed(object sender, EventArgs e)
{
//游戏存档
if (Set != null)
File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + @"\Setting.lps", Set.ToString());
if (Core != null && Core.Save != null)
File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + @"\Save.lps", Core.Save.ToLine().ToString());
if (DisplayGrid.Child != null)
((Main)DisplayGrid.Child).Dispose();
Save();
Main?.Dispose();
notifyIcon?.Dispose();
System.Environment.Exit(0);
}

View File

@ -3,7 +3,8 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:VPet_Simulator.Windows"
xmlns:pu="clr-namespace:Panuon.WPF.UI;assembly=Panuon.WPF.UI" mc:Ignorable="d" d:DesignHeight="450" Title="设置"
xmlns:pu="clr-namespace:Panuon.WPF.UI;assembly=Panuon.WPF.UI"
xmlns:system="clr-namespace:System;assembly=mscorlib" mc:Ignorable="d" d:DesignHeight="450" Title="设置"
Style="{DynamicResource BaseWindowXStyle}" WindowStartupLocation="CenterScreen" Closing="WindowX_Closing"
Width="400" Height="450">
<Viewbox>
@ -103,6 +104,9 @@
CheckedToggleBrush="{DynamicResource DARKPrimaryText}"
ToolTip="从Steam启动该游戏, 统计时长不能停" Grid.Column="1" />
</Grid>
<TextBlock Grid.Row="6" Text="宠物动画" VerticalAlignment="Center" FontSize="14" />
<ComboBox x:Name="PetBox" Grid.Row="6" Grid.Column="2" ToolTip="加载的宠物动画,重启后生效"
Style="{DynamicResource StandardComboBoxStyle}" Margin="0,3,0,2" />
</Grid>
</TabItem>
<TabItem Header="系统" BorderBrush="{DynamicResource PrimaryDarker}">
@ -115,12 +119,36 @@
<ComboBox x:Name="CBAutoSave" SelectedIndex="3" VerticalAlignment="Top" Margin="10,5,0,0"
HorizontalAlignment="Left" Style="{DynamicResource StandardComboBoxStyle}" Width="200"
SelectionChanged="CBAutoSave_SelectionChanged">
<ComboBoxItem>关闭自动保存</ComboBoxItem>
<ComboBoxItem>每5分钟一次</ComboBoxItem>
<ComboBoxItem>每10分钟一次</ComboBoxItem>
<ComboBoxItem>每20分钟一次</ComboBoxItem>
<ComboBoxItem>每半小时一次</ComboBoxItem>
<ComboBoxItem>每小时一次</ComboBoxItem>
<ComboBoxItem>
<ComboBoxItem.Tag>
<system:Int32>-1</system:Int32>
</ComboBoxItem.Tag> 关闭自动保存
</ComboBoxItem>
<ComboBoxItem>
<ComboBoxItem.Tag>
<system:Int32>5</system:Int32>
</ComboBoxItem.Tag> 每5分钟一次
</ComboBoxItem>
<ComboBoxItem>
<ComboBoxItem.Tag>
<system:Int32>10</system:Int32>
</ComboBoxItem.Tag> 每10分钟一次
</ComboBoxItem>
<ComboBoxItem>
<ComboBoxItem.Tag>
<system:Int32>20</system:Int32>
</ComboBoxItem.Tag> 每20分钟一次
</ComboBoxItem>
<ComboBoxItem>
<ComboBoxItem.Tag>
<system:Int32>30</system:Int32>
</ComboBoxItem.Tag> 每半小时一次
</ComboBoxItem>
<ComboBoxItem>
<ComboBoxItem.Tag>
<system:Int32>60</system:Int32>
</ComboBoxItem.Tag> 每小时一次
</ComboBoxItem>
</ComboBox>
<TextBlock HorizontalAlignment="Left" VerticalAlignment="Top" Background="{x:Null}"
TextWrapping="Wrap" Margin="0,10,0,0">
@ -199,7 +227,8 @@
BoxWidth="35" BoxHeight="18" ToggleSize="14" ToggleShadowColor="{x:Null}"
ToggleBrush="{DynamicResource PrimaryDark}" IsChecked="True"
CheckedToggleBrush="{DynamicResource DARKPrimaryText}" Margin="10,0,0,0"
ToolTip="启用移动互动,桌宠会在屏幕上乱动,移动互动概率为普通互动的一半.&#13;如果嫌麻烦可以关掉" />
ToolTip="启用移动互动,桌宠会在屏幕上乱动,移动互动概率为普通互动的一半.&#13;如果嫌麻烦可以关掉"
Checked="MoveEventBox_Checked" Unchecked="MoveEventBox_Checked" />
<pu:Switch x:Name="SmartMoveEventBox" BorderBrush="{DynamicResource PrimaryDark}"
IsEnabled="{Binding ElementName=MoveEventBox,Path=IsChecked}"
CheckedBackground="{DynamicResource Primary}" Content="智能移动"
@ -207,7 +236,8 @@
BoxWidth="35" BoxHeight="18" ToggleSize="14" ToggleShadowColor="{x:Null}"
ToggleBrush="{DynamicResource PrimaryDark}" Grid.Column="1"
CheckedToggleBrush="{DynamicResource DARKPrimaryText}" Margin="10,0,0,0"
ToolTip="当玩家在指定时间未对桌宠进行交互的时候,智能禁用移动功能&#13;将在下次交互时解除" />
ToolTip="当玩家在指定时间未对桌宠进行交互的时候,智能禁用移动功能&#13;将在下次交互时解除"
Checked="SmartMoveEventBox_Checked" Unchecked="SmartMoveEventBox_Checked" />
</Grid>
<TextBlock Grid.Row="0" Text="数据计算" VerticalAlignment="Center" FontSize="14" />
@ -221,7 +251,8 @@
</Grid.ColumnDefinitions>
<Slider x:Name="CalSlider" TickFrequency="0.1" IsSnapToTickEnabled="True"
Style="{DynamicResource StandardSliderStyle}" VerticalAlignment="Center"
Maximum="60" SmallChange=".5" Minimum="5" LargeChange="1" Value="15" />
Maximum="60" SmallChange=".5" Minimum="5" LargeChange="1" Value="15"
ValueChanged="CalSlider_ValueChanged" />
<TextBlock Grid.Column="1" Margin="10,0,0,0" VerticalAlignment="Center"
Text="{Binding ElementName=CalSlider,Path=Value,StringFormat={}{0:f1} 秒}"
FontSize="14" Foreground="{DynamicResource DARKPrimaryDarker}" FontWeight="Bold"
@ -247,20 +278,61 @@
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Text="智能移动判断时间间隔"/>
<TextBlock Text="智能移动判断时间间隔" />
<ComboBox x:Name="CBSmartMove" Style="{DynamicResource StandardComboBoxStyle}"
IsEnabled="{Binding ElementName=SmartMoveEventBox,Path=IsChecked}"
SelectionChanged="CBAutoSave_SelectionChanged" SelectedIndex="5" Grid.Column="1">
<ComboBoxItem>30 秒</ComboBoxItem>
<ComboBoxItem>1 分钟</ComboBoxItem>
<ComboBoxItem>2 分钟</ComboBoxItem>
<ComboBoxItem>5 分钟</ComboBoxItem>
<ComboBoxItem>10 分钟</ComboBoxItem>
<ComboBoxItem>20 分钟</ComboBoxItem>
<ComboBoxItem>30 分钟</ComboBoxItem>
<ComboBoxItem>40 分钟</ComboBoxItem>
<ComboBoxItem>50 分钟</ComboBoxItem>
<ComboBoxItem>60 分钟</ComboBoxItem>
SelectionChanged="CBSmartMove_SelectionChanged" SelectedIndex="5"
Grid.Column="1">
<ComboBoxItem>
<ComboBoxItem.Tag>
<system:Int32>30</system:Int32>
</ComboBoxItem.Tag> 30 秒
</ComboBoxItem>
<ComboBoxItem>
<ComboBoxItem.Tag>
<system:Int32>60</system:Int32>
</ComboBoxItem.Tag> 1 分钟
</ComboBoxItem>
<ComboBoxItem>
<ComboBoxItem.Tag>
<system:Int32>120</system:Int32>
</ComboBoxItem.Tag> 2 分钟
</ComboBoxItem>
<ComboBoxItem>
<ComboBoxItem.Tag>
<system:Int32>300</system:Int32>
</ComboBoxItem.Tag> 5 分钟
</ComboBoxItem>
<ComboBoxItem>
<ComboBoxItem.Tag>
<system:Int32>600</system:Int32>
</ComboBoxItem.Tag> 10 分钟
</ComboBoxItem>
<ComboBoxItem>
<ComboBoxItem.Tag>
<system:Int32>1200</system:Int32>
</ComboBoxItem.Tag> 20 分钟
</ComboBoxItem>
<ComboBoxItem>
<ComboBoxItem.Tag>
<system:Int32>1800</system:Int32>
</ComboBoxItem.Tag> 30 分钟
</ComboBoxItem>
<ComboBoxItem>
<ComboBoxItem.Tag>
<system:Int32>2400</system:Int32>
</ComboBoxItem.Tag> 40 分钟
</ComboBoxItem>
<ComboBoxItem>
<ComboBoxItem.Tag>
<system:Int32>3000</system:Int32>
</ComboBoxItem.Tag> 50 分钟
</ComboBoxItem>
<ComboBoxItem>
<ComboBoxItem.Tag>
<system:Int32>3600</system:Int32>
</ComboBoxItem.Tag> 60 分钟
</ComboBoxItem>
</ComboBox>
</Grid>

View File

@ -45,6 +45,36 @@ namespace VPet_Simulator.Windows
this.Width = 400 * ZoomSlider.Value;
this.Height = 450 * ZoomSlider.Value;
sDesktopAlignment.IsChecked = mw.Set.EnableFunction;
CalSlider.Value = mw.Set.LogicInterval;
InteractionSlider.Value = mw.Set.InteractionCycle;
MoveEventBox.IsChecked = mw.Set.AllowMove;
SmartMoveEventBox.IsChecked = mw.Set.SmartMove;
PressLengthSlider.Value = mw.Set.PressLength;
foreach (PetLoader pl in mw.Pets)
{
PetBox.Items.Add(pl.Name);
}
PetBox.SelectedIndex = 0;
foreach (ComboBoxItem v in CBAutoSave.Items)
{
if ((int)v.Tag == mw.Set.AutoSaveInterval)
{
CBAutoSave.SelectedItem = v;
break;
}
}
foreach (ComboBoxItem v in CBSmartMove.Items)
{
if ((int)v.Tag == mw.Set.SmartMoveInterval)
{
CBSmartMove.SelectedItem = v;
break;
}
}
#if X64
GameVerison.Content = $"游戏版本v{mw.Verison} x64";
#else
@ -216,7 +246,18 @@ namespace VPet_Simulator.Windows
private void CBAutoSave_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (!AllowChange)
return;
mw.Set.AutoSaveInterval = (int)((ComboBoxItem)CBAutoSave.SelectedItem).Tag;
if (mw.Set.AutoSaveInterval > 0)
{
mw.AutoSaveTimer.Interval = mw.Set.AutoSaveInterval * 60000;
mw.AutoSaveTimer.Start();
}
else
{
mw.AutoSaveTimer.Stop();
}
}
@ -384,11 +425,15 @@ namespace VPet_Simulator.Windows
private void TopMostBox_Checked(object sender, RoutedEventArgs e)
{
if (!AllowChange)
return;
mw.Set.TopMost = true;
}
private void TopMostBox_Unchecked(object sender, RoutedEventArgs e)
{
if (!AllowChange)
return;
mw.Set.TopMost = false;
}
@ -401,14 +446,18 @@ namespace VPet_Simulator.Windows
private void PressLengthSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
if (!AllowChange)
return;
mw.Set.PressLength = (int)(PressLengthSlider.Value * 1000);
}
private void InteractionSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
if (!AllowChange)
return;
mw.Set.InteractionCycle = (int)(InteractionSlider.Value);
}
#region Link
private void Git_Click(object sender, RoutedEventArgs e)
{
Process.Start("https://github.com/LorisYounger/VPet/graphs/contributors");
@ -433,10 +482,48 @@ namespace VPet_Simulator.Windows
{
Process.Start("https://www.exlb.net/");
}
#endregion
private void sDesktopAlignment_Checked_1(object sender, RoutedEventArgs e)
{
if (!AllowChange)
return;
MessageBoxX.Show("由于没做完,暂不支持数据计算\n敬请期待后续更新", "没做完!", MessageBoxButton.OK, MessageBoxIcon.Warning);
}
private void CalSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
if (!AllowChange)
return;
mw.Set.LogicInterval = CalSlider.Value;
mw.Main.SetLogicInterval((int)(CalSlider.Value * 1000));
}
private void MoveEventBox_Checked(object sender, RoutedEventArgs e)
{
if (!AllowChange)
return;
mw.Set.AllowMove = MoveEventBox.IsChecked == true;
SetSmartMove();
}
private void SmartMoveEventBox_Checked(object sender, RoutedEventArgs e)
{
if (!AllowChange)
return;
mw.Set.SmartMove = SmartMoveEventBox.IsChecked == true;
SetSmartMove();
}
private void CBSmartMove_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (!AllowChange)
return;
mw.Set.SmartMoveInterval = (int)((ComboBoxItem)CBSmartMove.SelectedItem).Tag;
SetSmartMove();
}
public void SetSmartMove()
{
mw.Main.SetMoveMode(mw.Set.AllowMove, mw.Set.SmartMove, mw.Set.SmartMoveInterval * 1000);
}
}
}

View File

@ -2,5 +2,5 @@ pet#默认虚拟桌宠:|intor#虚拟主播模拟器默认人物形象:|path#vup:
touchhead:|px#159:|py#16:|sw#189:|sh#178:|
touchraised:|px#0:|py#50:|sw#500:|sh#200:|
raisepoint:|x#290:|y#128:|
speed:|walk#40:|climb#20:|climbtop#16:|crawl#16:|fallx#28:|fally#20:|crawl#20:|
speed:|walk#20:|climb#10:|climbtop#8:|crawl#8:|fallx#14:|fally#10:|crawl#10:|
locate:|climbleft#145:|climbright#185:|climbtop#150:|