Skip to content

靠边检测#541

Merged
YIYuNCU merged 24 commits into
mainfrom
dev-靠边检测
May 27, 2026

Hidden character warning

The head ref may contain hidden characters: "dev-\u9760\u8fb9\u68c0\u6d4b"
Merged

靠边检测#541
YIYuNCU merged 24 commits into
mainfrom
dev-靠边检测

Conversation

@LorisYounger

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings April 29, 2026 19:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces “active screen” awareness for edge/side-hide detection, aiming to prevent side-hide behavior from triggering when the pet window is on a non-active screen, with an option to auto-switch the active screen.

Changes:

  • Add GameScreenIndex and AutoChangeWindow settings to persist the “active screen” concept and auto-switch behavior.
  • Extend IController with active-screen query/set APIs and implement them in window controllers.
  • Update side-hide edge detection to consider whether the window is on the configured active screen.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs Persist detected current screen index into settings.
VPet-Simulator.Windows/MutiPlayer/MPController.cs Add active-screen APIs for multiplayer windows (currently incomplete).
VPet-Simulator.Windows/Function/Setting.cs Add settings for auto-switch and active screen index (autochangewindow not loaded yet).
VPet-Simulator.Windows/Function/MWController.cs Implement active-screen check and switching for main window (DPI handling concerns).
VPet-Simulator.Core/Handle/IController.cs Add new controller interface members for active-screen support (breaking change risk).
VPet-Simulator.Core/Display/MainLogic.cs Gate side-hide behavior using active-screen checks and optional auto-switch.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +305 to +313
bool autochangewindow;
public bool AutoChangeWindow
{
get => autochangewindow;
set
{
autochangewindow = value;
this["gameconfig"].SetBool("autochangewindow", value);
}
Comment thread VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs Outdated
Comment thread VPet-Simulator.Core/Handle/IController.cs Outdated
Comment thread VPet-Simulator.Core/Display/MainLogic.cs Outdated
Comment on lines 545 to 546
if (Core.Controller.GetWindowsDistanceLeft() < -50 * Core.Controller.ZoomRatio && (Core.Controller.IfInActivateScreen() || Core.Controller.GetWindowsDistanceLeft() > -110 * Core.Controller.ZoomRatio))
{
if (screens[i].DeviceName == screen.DeviceName)
{
mw.Set.GameScreenIndex = i;
ScreenBorder = new Rectangle(screens[i].Bounds.X, screens[i].Bounds.Y, screens[i].Bounds.Width, screens[i].Bounds.Height);
}
catch (Exception)
{
mw.Set.GameScreenIndex = 0;

public void SetNowScreenActivate()
{

LorisYounger and others added 2 commits April 30, 2026 03:46
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 9 comments.

Comment thread VPet-Simulator.Windows/Function/Setting.cs Outdated
Comment thread VPet-Simulator.Core/Handle/IController.cs Outdated
Comment on lines +550 to +552
Core.Controller.MoveWindows(-Core.Controller.GetWindowsDistanceLeft() / Core.Controller.ZoomRatio - Core.Graph.GraphConfig.Data["side"][(gdbe)"left"], 0);
if (Core.Controller.GetWindowsDistanceDown() < 0) Core.Controller.MoveWindows(0, Core.Controller.GetWindowsDistanceDown() - 1000 * Core.Controller.ZoomRatio);
else if (Core.Controller.GetWindowsDistanceUp() < 0) Core.Controller.MoveWindows(0, -Core.Controller.GetWindowsDistanceUp());

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@YIYuNCU Check

Comment thread VPet-Simulator.Core/Display/MainLogic.cs Outdated

public void SetNowScreenActivate()
{

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread VPet-Simulator.Windows/Function/MWController.cs
Comment thread VPet-Simulator.Windows/Function/MWController.cs Outdated
Comment thread VPet-Simulator.Windows/Function/MWController.cs Outdated
Comment thread VPet-Simulator.Core/Display/MainDisplay.cs Outdated
LorisYounger and others added 4 commits May 24, 2026 21:30
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI and others added 4 commits May 27, 2026 07:47
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI requested a review from YIYuNCU May 27, 2026 07:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.

try
{
if (mw.Dispatcher.HasShutdownStarted || mw.Dispatcher.HasShutdownFinished) return false;
if (mw.winSetting != null && mw.winSetting.Visibility == Visibility.Visible) return false;
public void SetNowScreenActivate()
{
if (!mw.IsLoaded) return;
if (mw.winSetting != null && mw.winSetting.Visibility == Visibility.Visible) return;
/// 是否启用边缘重新定位
/// </summary>
bool RePostionActive { get; set; }
bool RePositionActive { get; set; }
Comment on lines +148 to +151
public void SetNowScreenActivate()
{

}
if (Core.Graph.FindName(GraphType.SideHide_Left_Main) != null)
{
Core.Controller.MoveWindows(-Core.Controller.GetWindowsDistanceLeft() / Core.Controller.ZoomRatio - Core.Graph.GraphConfig.Data["side"][(gdbe)"left"], 0);
if (Core.Controller.GetWindowsDistanceDown() < 0) Core.Controller.MoveWindows(0, Core.Controller.GetWindowsDistanceDown() / Core.Controller.ZoomRatio - 1000);
if (Core.Graph.FindName(GraphType.SideHide_Right_Main) != null)
{
Core.Controller.MoveWindows(Core.Controller.GetWindowsDistanceRight() / Core.Controller.ZoomRatio + 500 - Core.Graph.GraphConfig.Data["side"][(gdbe)"right"], 0);
if (Core.Controller.GetWindowsDistanceDown() < 0) Core.Controller.MoveWindows(0, Core.Controller.GetWindowsDistanceDown() / Core.Controller.ZoomRatio - 1000);

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.

enablefunction = !this["gameconfig"].GetBool("nofunction");
autobuy = this["gameconfig"].GetBool("autobuy");
autogift = this["gameconfig"].GetBool("autogift");
autochangewindow = !this["gameconfig"].GetBool("autochangewindow");
try
{
if (mw.Dispatcher.HasShutdownStarted || mw.Dispatcher.HasShutdownFinished) return false;
if (mw.winSetting != null && mw.winSetting.Visibility == Visibility.Visible) return false;
/// 是否启用边缘重新定位
/// </summary>
bool RePostionActive { get; set; }
bool RePositionActive { get; set; }
if (Core.Graph.FindName(GraphType.SideHide_Left_Main) != null)
{
Core.Controller.MoveWindows(-Core.Controller.GetWindowsDistanceLeft() / Core.Controller.ZoomRatio - Core.Graph.GraphConfig.Data["side"][(gdbe)"left"], 0);
if (Core.Controller.GetWindowsDistanceDown() < 0) Core.Controller.MoveWindows(0, Core.Controller.GetWindowsDistanceDown() / Core.Controller.ZoomRatio - 1000);
if (Core.Graph.FindName(GraphType.SideHide_Right_Main) != null)
{
Core.Controller.MoveWindows(Core.Controller.GetWindowsDistanceRight() / Core.Controller.ZoomRatio + 500 - Core.Graph.GraphConfig.Data["side"][(gdbe)"right"], 0);
if (Core.Controller.GetWindowsDistanceDown() < 0) Core.Controller.MoveWindows(0, Core.Controller.GetWindowsDistanceDown() / Core.Controller.ZoomRatio - 1000);
@YIYuNCU YIYuNCU requested a review from Copilot May 27, 2026 10:20
@YIYuNCU YIYuNCU merged commit 5540bec into main May 27, 2026
1 check failed
@YIYuNCU YIYuNCU deleted the dev-靠边检测 branch May 27, 2026 10:21
@YIYuNCU YIYuNCU restored the dev-靠边检测 branch May 27, 2026 10:21
@LorisYounger LorisYounger deleted the dev-靠边检测 branch May 27, 2026 10:23
@LorisYounger LorisYounger removed the request for review from Copilot May 27, 2026 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants