Conversation
Contributor
There was a problem hiding this comment.
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
GameScreenIndexandAutoChangeWindowsettings to persist the “active screen” concept and auto-switch behavior. - Extend
IControllerwith 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 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() | ||
| { | ||
|
|
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 stopped work on behalf of
LorisYounger due to an error
April 29, 2026 20:16
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()); |
|
|
||
| public void SetNowScreenActivate() | ||
| { | ||
|
|
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>
Agent-Logs-Url: https://github.com/LorisYounger/VPet/sessions/56ef3e98-745b-48c8-b445-67fd036268c6 Co-authored-by: LorisYounger <34806646+LorisYounger@users.noreply.github.com>
| 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); |
| 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.