public OverlayWindow(GameV2 game) { _game = game; InitializeComponent(); _heroNotificationBehavior = new OverlayElementBehavior(HeroNotificationPanel) { GetRight = () => 0, GetBottom = () => Height * 0.04, GetScaling = () => AutoScaling, AnchorSide = Side.Bottom, HideCallback = () => { ShowBgsTopBar(); }, EntranceAnimation = AnimationType.Slide, ExitAnimation = AnimationType.Slide, }; _bgsTopBarBehavior = new OverlayElementBehavior(BgsTopBar) { GetRight = () => 0, GetTop = () => 0, GetScaling = () => AutoScaling, AnchorSide = Side.Top, EntranceAnimation = AnimationType.Slide, ExitAnimation = AnimationType.Slide, }; if (Config.Instance.ExtraFeatures && Config.Instance.ForceMouseHook) { HookMouse(); } ShowInTaskbar = Config.Instance.ShowInTaskbar; if (Config.Instance.VisibleOverlay) { Background = (SolidColorBrush) new BrushConverter().ConvertFrom("#4C0000FF"); } _offsetX = Config.Instance.OffsetX; _offsetY = Config.Instance.OffsetY; _customWidth = Config.Instance.CustomWidth; _customHeight = Config.Instance.CustomHeight; if (Config.Instance.ShowBatteryLife) { EnableBatteryMonitor(); } InitializeCollections(); GridMain.Visibility = Hidden; if (User32.GetHearthstoneWindow() != IntPtr.Zero) { UpdatePosition(); } Update(true); UpdateScaling(); UpdatePlayerLayout(); UpdateOpponentLayout(); GridMain.Visibility = Visible; }
public OverlayWindow(GameV2 game) { // These need to be set before InitializeComponent is called OverlayExtensions.OnRegisterHitTestVisible += (e, clickable) => { if (clickable) { _clickableElements.Add(e); } else { _clickableElements.Remove(e); } }; _game = game; InitializeComponent(); _mulliganNotificationBehavior = new OverlayElementBehavior(MulliganNotificationPanel) { GetRight = () => 0, GetBottom = () => Height * 0.04, GetScaling = () => AutoScaling, AnchorSide = Side.Bottom, EntranceAnimation = AnimationType.Slide, ExitAnimation = AnimationType.Slide, }; _heroNotificationBehavior = new OverlayElementBehavior(HeroNotificationPanel) { GetRight = () => 0, GetBottom = () => Height * 0.04, GetScaling = () => AutoScaling, AnchorSide = Side.Bottom, HideCallback = () => { ShowBgsTopBar(); }, EntranceAnimation = AnimationType.Slide, ExitAnimation = AnimationType.Slide, }; _bgsTopBarBehavior = new OverlayElementBehavior(BgsTopBar) { GetRight = () => 0, GetTop = () => 0, GetScaling = () => AutoScaling, AnchorSide = Side.Top, EntranceAnimation = AnimationType.Slide, ExitAnimation = AnimationType.Slide, }; _bgsBobsBuddyBehavior = new OverlayElementBehavior(BobsBuddyDisplay) { GetLeft = () => Width / 2 - BobsBuddyDisplay.ActualWidth * AutoScaling / 2, GetTop = () => 0, GetScaling = () => AutoScaling, AnchorSide = Side.Top, EntranceAnimation = AnimationType.Slide, ExitAnimation = AnimationType.Slide, }; _bgsPastOpponentBoardBehavior = new OverlayElementBehavior(PastOpponentBoardDisplay) { GetLeft = () => Width / 2 - PastOpponentBoardDisplay.ActualWidth * AutoScaling / 2, GetTop = () => 0, GetScaling = () => AutoScaling, AnchorSide = Side.Top, EntranceAnimation = AnimationType.Instant, ExitAnimation = AnimationType.Instant, }; _experienceCounterBehavior = new OverlayElementBehavior(ExperienceCounter) { GetRight = () => Height * .35, GetTop = () => Height * .9652, AnchorSide = Side.Bottom, GetScaling = () => AutoScaling, }; if (Config.Instance.ExtraFeatures && Config.Instance.ForceMouseHook) { HookMouse(); } ShowInTaskbar = Config.Instance.ShowInTaskbar; if (Config.Instance.VisibleOverlay) { Background = (SolidColorBrush) new BrushConverter().ConvertFrom("#4C0000FF"); } _offsetX = Config.Instance.OffsetX; _offsetY = Config.Instance.OffsetY; _customWidth = Config.Instance.CustomWidth; _customHeight = Config.Instance.CustomHeight; if (Config.Instance.ShowBatteryLife) { EnableBatteryMonitor(); } InitializeCollections(); GridMain.Visibility = Hidden; if (User32.GetHearthstoneWindow() != IntPtr.Zero) { UpdatePosition(); } Update(true); UpdateScaling(); UpdatePlayerLayout(); UpdateOpponentLayout(); GridMain.Visibility = Visible; }