Inheritance: MonoBehaviour
 // アプリケーション終了時の後片付け。
 void OnApplicationQuit()
 {
     instance_ = null;
     // [iPhone]
     #if UNITY_IPHONE
     if (Application.platform == RuntimePlatform.IPhonePlayer) {
         _OverlayWindowUninstall();
     }
     #endif
 }
Example #2
0
        protected override void Dispose(bool isDisposing)
        {
            if (_isDisposed)
            {
                return;
            }

            if (isDisposing)
            {
                _tickEngine.PreTick -= OnPreTick;
                _tickEngine.Tick    -= OnTick;

                ClearScreen();
                OverlayWindow?.Dispose();
            }

            base.Dispose();
            _isDisposed = true;
        }
 protected bool AdjustSurface()
 {
     InvalidSize = (Width <= 0 || Height <= 0);
     if (InvalidSize == true)
     {
         return(false);
     }
     if (_window == null)
     {
         _window = new OverlayWindow(Left, Top, Width, Height)
         {
             IsTopmost = true,
             IsVisible = true
         };
         _graphics = new Graphics
         {
             MeasureFPS = false,
             Width      = _window.Width,
             Height     = _window.Height,
             PerPrimitiveAntiAliasing  = true,
             TextAntiAliasing          = true,
             UseMultiThreadedFactories = false,
             VSync        = false,
             WindowHandle = IntPtr.Zero
         };
         _window.CreateWindow();
         _graphics.WindowHandle = _window.Handle;
         _graphics.Setup();
     }
     else
     {
         if (Left != _window.X || Top != _window.Y)
         {
             _window.Move(Left, Top);
         }
         if (Width != _window.Width || Height != _window.Height)
         {
             _window.Resize(Width, Height);
             _graphics.Resize(Width, Height);
         }
     }
     return(true);
 }
Example #4
0
        public override void Initialize(IWindow targetWindow)
        {
            // Set target window by calling the base method
            base.Initialize(targetWindow);

            OverlayWindow = new OverlayWindow(targetWindow)
            {
                Height        = TargetWindow.Height,
                Width         = TargetWindow.Width,
                ShowInTaskbar = false,
                Topmost       = true
            };
            // OverlayWindow.Deactivated += OverlayWindow_Deactivated;

            // Set up update interval and register events for the tick engine.
            _tickEngine.Interval = TimeSpan.FromMilliseconds(1000 / 60);
            _tickEngine.PreTick += OnPreTick;
            _tickEngine.Tick    += OnTick;
        }
Example #5
0
    public EntityHUD.HealthMeterTag ConnectHealthMeter(Entity ent, string meterId)
    {
        this.Setup();
        HealthMeterBase healthMeterForId = this._data.GetHealthMeterForId(meterId);
        Killable        entityComponent  = ent.GetEntityComponent <Killable>();

        if (healthMeterForId != null && entityComponent != null)
        {
            HealthMeterBase pooledWindow = OverlayWindow.GetPooledWindow <HealthMeterBase>(healthMeterForId);
            EntityHUD.ConnectedHealthMeter connectedHealthMeter = new EntityHUD.ConnectedHealthMeter(ent, entityComponent, pooledWindow);
            this.healthMeters.Add(connectedHealthMeter);
            if (this.ShouldHideStuff())
            {
                connectedHealthMeter.Hide();
            }
            return(new EntityHUD.HealthMeterTag(this, connectedHealthMeter));
        }
        return(null);
    }
Example #6
0
 public CommandCenter(MainWindowModel mainModel)
 {
     commandList    = new List <string>();
     this.mainModel = mainModel;
     commands.Add("config", args => AppConfig.ConfigToString());
     commands.Add("set-config", args =>
     {
         AppConfig.SetConfig(args[1], args[2]);
         return($"New config sets");
     });
     commands.Add("log-error", args =>
     {
         Logger.Log(LogLevel.Error, args[1]);
         return($"log");
     });
     commands.Add("log-warn", args =>
     {
         Logger.Log(LogLevel.Warn, args[1]);
         return($"log");
     });
     commands.Add("log-info", args =>
     {
         Logger.Log(LogLevel.Info, args[1]);
         return($"log");
     });
     commands.Add("logboth", args =>
     {
         AppConfig.SetConfig("LogType", "Both");
         return("Log to both console and file");
     });
     commands.Add("show", args => {
         var overlay = new OverlayWindow(mainModel);
         overlay.Show();
         overlay.DataContext = mainModel;
         WindowHelper.SetTopMostTransparent(overlay);
         return("Overlay on");
     });
     commands.Add("test", args => {
         TestData();
         return("testing");
     });
 }
Example #7
0
        public OSD(int left, int top, int right, int bottom)
        {
            overlayWindow = new OverlayWindow(left, top, right, bottom)
            {
                IsTopmost = true,
                IsVisible = true
            };

            graphics = new Graphics
            {
                MeasureFPS = false,
                Height     = overlayWindow.Height,
                Width      = overlayWindow.Width,
                PerPrimitiveAntiAliasing  = true,
                TextAntiAliasing          = true,
                UseMultiThreadedFactories = false,
                VSync        = true,
                WindowHandle = IntPtr.Zero
            };
        }
Example #8
0
 protected override bool DoShow(MenuScreen <PauseMenu> previous)
 {
     if (base.Owner._mapWindow.CanShow(base.Owner.currEnt))
     {
         MapWindow pooledWindow = OverlayWindow.GetPooledWindow <MapWindow>(base.Owner._mapWindow);
         pooledWindow.Show(base.Owner.currEnt, null, new EntityOverlayWindow.OnDoneFunc(this.ClickedBack), null);
         GuiSelectionHandler component = base.Owner.GetComponent <GuiSelectionHandler>();
         if (component != null)
         {
             component.enabled = false;
         }
         base.Owner.mapWindow = pooledWindow;
     }
     else
     {
         Debug.LogWarning("No map for " + Utility.GetCurrentSceneName());
         base.SwitchToBack();
     }
     return(false);
 }
 private void ShowOverlayWindow()
 {
     _overlayWindow = OverlayWindow.Show(DockControl);
     SetStartMousePosition(_overlayWindow, _overlayWindow.PointFromScreen(_startMousePoint));
     foreach (FloatingWindow floatingWindow in DockControl.FloatingWindows)
     {
         NativeFloatingWindow nativeWindow = NativeFloatingWindow.GetNativeFloatingWindow(floatingWindow);
         Point pointFromScreen             = _startMousePoint;
         try
         {
             pointFromScreen = nativeWindow.PointFromScreen(_startMousePoint);
         }
         catch (Exception e)
         {
             Debug.WriteLine(@"pointFromScreen: " + pointFromScreen);
             Debug.WriteLine(e);
         }
         SetStartMousePosition(nativeWindow, pointFromScreen);
     }
 }
Example #10
0
        public void _Init_()
        {
            mem     = CheatData.mem;
            created = true;
            GetWindowRect(handle, out rect);
            WHwindow = new OverlayWindow(rect.left, rect.top, rect.right, rect.bottom);
            //  WHwindow = new OverlayWindow();
            //WHwindow.MoveWindow( rect.right-rect.top, rect.bottom);
            var rendererOptions = new Direct2DRendererOptions()
            {
                AntiAliasing = true,
                Hwnd         = WHwindow.WindowHandle,
                MeasureFps   = true,
                VSync        = false
            };

            gfx = new Direct2DRenderer(rendererOptions);
            tr  = new Thread(Loop);
            tr.Start();
        }
Example #11
0
 public Visuals()
 {
     _window = new OverlayWindow(Main.ScreenRect.left, Main.ScreenRect.top, Main.ScreenSize.Width, Main.ScreenSize.Height)
     {
         IsTopmost = true,
         IsVisible = true
     };
     _window.SizeChanged += _window_SizeChanged;
     _graphics            = new GameOverlay.Drawing.Graphics()
     {
         MeasureFPS = true,
         Height     = _window.Height,
         PerPrimitiveAntiAliasing  = true,
         TextAntiAliasing          = true,
         UseMultiThreadedFactories = false,
         VSync        = true,
         Width        = _window.Width,
         WindowHandle = IntPtr.Zero
     };
 }
Example #12
0
 /// <summary>
 /// CreateWindowState and show the overlay window if it is not already created.
 /// </summary>
 public void Launch()
 {
     if (mOverlayWindow == null)
     {
         mOverlayActive = true;
         mOverlayWindow = new OverlayWindow(this);
         Show();
         mOverlayWindow.FormClosed += new FormClosedEventHandler(mOverlayWindow_FormClosed);
         mOverlayWindow.AlwaysOnTop = mConfig.AlwaysOnTop;
         if (mOverlayFullscreen)
         {
             mOverlayWindow.Fullscreen = true;
         }
         if (OverlayLaunched != null)
         {
             OverlayLaunched(this, null);
         }
         //mOverlayWindow.ForceRedraw();
     }
 }
Example #13
0
        public void ClickThrough()
        {
            var window = new OverlayWindow();

            window.ClickThrough = true;
            window.ClickThrough = false;
            window.ClickThrough = true;
            window.ClickThrough = false;

            window.SourceInitialized += (s, e) =>
            {
                window.ClickThrough = true;
                window.ClickThrough = false;
                window.ClickThrough = true;
                window.ClickThrough = false;

                window.Close();
            };

            window.Show();
        }
Example #14
0
        public void AltF4Cancel()
        {
            var window = new OverlayWindow();

            window.AltF4Cancel = true;
            window.AltF4Cancel = false;
            window.AltF4Cancel = true;
            window.AltF4Cancel = false;

            window.SourceInitialized += (s, e) =>
            {
                window.AltF4Cancel = true;
                window.AltF4Cancel = false;
                window.AltF4Cancel = true;
                window.AltF4Cancel = false;

                window.Close();
            };

            window.Show();
        }
Example #15
0
        public GameMasterOverlay()
        {
            _window = new OverlayWindow(0, 0, Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height)
            {
                IsTopmost = true,
                IsVisible = true
            };

            _window.SizeChanged += _window_SizeChanged;

            _graphics = new Graphics
            {
                Height = _window.Height,
                PerPrimitiveAntiAliasing  = true,
                TextAntiAliasing          = true,
                UseMultiThreadedFactories = false,
                VSync        = true,
                Width        = _window.Width,
                WindowHandle = IntPtr.Zero
            };
        }
Example #16
0
        // Clear objects
        public override void Dispose()
        {
            if (_isDisposed)
            {
                return;
            }

            if (IsEnabled)
            {
                Disable();
            }

            OverlayWindow.Hide();
            OverlayWindow.Close();
            OverlayWindow = null;

            _tickEngine.Stop();

            base.Dispose();
            _isDisposed = true;
        }
Example #17
0
        void SetUp()
        {
            var _grid = new Grid
            {
                VerticalAlignment   = System.Windows.VerticalAlignment.Stretch,
                HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch,
                Width  = OverlayWindow.Width,
                Height = OverlayWindow.Height
            };

            _label = new Label
            {
                FontSize            = 28,
                Foreground          = Brushes.Red,
                Background          = (Brush)App.Current.FindResource("OverlayLabelBG"),
                Content             = App.Current.FindResource("m_AlertWindow"),
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center,
            };
            _grid.Children.Add(_label);
            OverlayWindow.Add(_grid);
        }
Example #18
0
        public GraphicWindow(int w, int h)
        {
            window = new OverlayWindow(0, 0, w, h)
            {
                IsTopmost = true,
                IsVisible = true
            };
            window.CreateWindow();

            graphics = new GraphicsEx
            {
                MeasureFPS = false,
                PerPrimitiveAntiAliasing  = false,
                TextAntiAliasing          = false,
                UseMultiThreadedFactories = true,
                VSync        = true,
                Width        = window.Width,
                Height       = window.Height,
                WindowHandle = window.Handle
            };
            graphics.Setup();
        }
Example #19
0
        private void HealthDraw(OverlayWindow w, Graphics g, int xOffset, int yOffset)
        {
            float fontSize = 26f;

            // Draw health.
            if (Program.gameMemory.PlayerCurrentHealth > 1200 || Program.gameMemory.PlayerCurrentHealth < 0) // Dead?
            {
                g.DrawText(consolasBold, fontSize, redBrush, xOffset, yOffset, "DEAD");
            }
            else if (Program.gameMemory.PlayerCurrentHealth >= 801) // Fine (Green)
            {
                g.DrawText(consolasBold, fontSize, greenBrush, xOffset, yOffset, Program.gameMemory.PlayerCurrentHealth.ToString());
            }
            else if (Program.gameMemory.PlayerCurrentHealth <= 800 && Program.gameMemory.PlayerCurrentHealth >= 361) // Caution (Yellow)
            {
                g.DrawText(consolasBold, fontSize, yellowBrush, xOffset, yOffset, Program.gameMemory.PlayerCurrentHealth.ToString());
            }
            else if (Program.gameMemory.PlayerCurrentHealth <= 360) // Danger (Red)
            {
                g.DrawText(consolasBold, fontSize, redBrush, xOffset, yOffset, Program.gameMemory.PlayerCurrentHealth.ToString());
            }
        }
Example #20
0
        public DXOverlay(IntPtr windowHook)
        {
            this.windowHook = windowHook;

            // it is important to set the window to visible (and topmost) if you want to see it!
            _window = new OverlayWindow()
            {
                IsVisible = true,
                IsTopmost = true
            };

            // initialize a new Graphics object
            // set everything before you call _graphics.Setup()
            _graphics = new Graphics()
            {
                MeasureFPS = false,
                PerPrimitiveAntiAliasing  = false,
                TextAntiAliasing          = true,
                UseMultiThreadedFactories = false,
                VSync = false
            };
        }
Example #21
0
        void OnPreTick(object sender, EventArgs eventArgs)
        {
            // Only want to set them up once.
            if (!_isSetup)
            {
                SetUp();
                _isSetup = true;
            }

            var activated = TargetWindow.IsActivated;
            var visible   = OverlayWindow.IsVisible;

            // Ensure window is shown or hidden correctly prior to updating
            //if (!activated && visible)
            //{
            //    OverlayWindow.Hide();
            //}
            //else
            if (activated && !visible)
            {
                OverlayWindow.Show();
            }
        }
        private void InitializeOverlay()
        {
            DEVMODE devMode = default;

            devMode.dmSize = (short)Marshal.SizeOf <DEVMODE>();
            NativeWrappers.EnumDisplaySettings(null, -1, ref devMode);

            _window = new OverlayWindow(0, 0, devMode.dmPelsWidth, devMode.dmPelsHeight)
            {
                IsTopmost = true,
                IsVisible = true
            };

            _graphics = new Graphics()
            {
                MeasureFPS = false,
                PerPrimitiveAntiAliasing  = false,
                TextAntiAliasing          = true,
                UseMultiThreadedFactories = false,
                VSync = false
            };

            _isOverlayInitialized = true;
        }
Example #23
0
        private void StatisticsDraw(OverlayWindow w, Graphics g, int xOffset, int yOffset)
        {
            // Additional information and stats.
            // Adjustments for displaying text properly.
            int heightGap = 15;
            int i         = -1;

            // IGT Display.
            g.DrawText(consolasBold, 20f, whiteBrush, xOffset + 0, yOffset + (heightGap * ++i), string.Format("{0}", Program.gameMemory.IGTFormattedString));
            yOffset += 5;

            if (Program.programSpecialOptions.Flags.HasFlag(ProgramFlags.Debug))
            {
                ++i;
                g.DrawText(consolasBold, 16f, greyBrush, xOffset + 0, yOffset + (heightGap * ++i), "Raw IGT");
                g.DrawText(consolasBold, 16f, greyBrush, xOffset + 0, yOffset + (heightGap * ++i), "A:" + Program.gameMemory.IGTRunningTimer.ToString("00000000000000000000"));
                g.DrawText(consolasBold, 16f, greyBrush, xOffset + 0, yOffset + (heightGap * ++i), "C:" + Program.gameMemory.IGTCutsceneTimer.ToString("00000000000000000000"));
                g.DrawText(consolasBold, 16f, greyBrush, xOffset + 0, yOffset + (heightGap * ++i), "M:" + Program.gameMemory.IGTMenuTimer.ToString("00000000000000000000"));
                g.DrawText(consolasBold, 16f, greyBrush, xOffset + 0, yOffset + (heightGap * ++i), "P:" + Program.gameMemory.IGTPausedTimer.ToString("00000000000000000000"));
                ++i;
            }

            g.DrawText(consolasBold, 16f, greyBrush, xOffset + 0, yOffset + (heightGap * ++i), string.Format("DA Rank: {0}", Program.gameMemory.Rank));
            g.DrawText(consolasBold, 16f, greyBrush, xOffset + 0, yOffset + (heightGap * ++i), string.Format("DA Score: {0}", Program.gameMemory.RankScore));

            g.DrawText(consolasBold, 16f, redBrush, xOffset + 0, yOffset + (heightGap * ++i), "Enemy HP");
            yOffset += 6;
            foreach (EnemyHP enemyHP in Program.gameMemory.EnemyHealth.Where(a => a.IsAlive).OrderBy(a => a.Percentage).ThenByDescending(a => a.CurrentHP))
            {
                int x = xOffset + 0;
                int y = yOffset + (heightGap * ++i);

                DrawProgressBarDirectX(w, g, backBrush, foreBrush, x, y, 158, heightGap, enemyHP.Percentage * 100f, 100f);
                g.DrawText(consolasBold, 12f, redBrush, x + 5, y, string.Format("{0} {1:P1}", enemyHP.CurrentHP, enemyHP.Percentage));
            }
        }
Example #24
0
        public LeagueOverlay()
        {
            leagueProc = Process.GetProcessesByName("LeagueClientUx")[0];
            IntPtr ptr  = leagueProc.MainWindowHandle;
            Rect   rect = new Rect();

            GetWindowRect(ptr, ref rect);
            // it is important to set the window to visible (and topmost) if you want to see it!
            _window = new OverlayWindow(0, 0, rect.Right - rect.Left, rect.Bottom - rect.Top)
            {
                IsTopmost = true,
                IsVisible = true,
                Title     = "LeagueOverlay"
            };


            _window.X = rect.Left;
            _window.Y = rect.Top;

            // handle this event to resize your Graphics surface
            _window.SizeChanged += _window_SizeChanged;

            // initialize a new Graphics object
            // set everything before you call _graphics.Setup()
            _graphics = new Graphics
            {
                MeasureFPS = true,
                Height     = _window.Height,
                PerPrimitiveAntiAliasing  = true,
                TextAntiAliasing          = true,
                UseMultiThreadedFactories = false,
                VSync        = true,
                Width        = _window.Width,
                WindowHandle = IntPtr.Zero
            };
        }
Example #25
0
        /// <summary> タイムラインコントロールビューを開きます。
        /// </summary>
        /// <param name="pTimelineC"> タイムラインコンポーネント </param>
        /// <param name="pOverlayViewC"> オーバーレイ表示コンポーネント </param>
        private void openOverlayControlView(CommonDataModel pCommonDM, TimelineComponent pTimelineC, OverlayViewComponent pOverlayViewC)
        {
            OverlayWindow window = new OverlayWindow();

            window.Topmost    = true;
            window.ResizeMode = System.Windows.ResizeMode.NoResize;
            pOverlayViewC.OverlayDataModel.OverlayWindowData.WindowHeight = 30;
            pOverlayViewC.OverlayDataModel.OverlayWindowData.WindowWidth  = 170;

            var vm = window.DataContext as OverlayWindowViewModel;

            if (vm != null)
            {
                vm.TimelineComponent    = pTimelineC;
                vm.OverlayViewComponent = pOverlayViewC;
            }

            if (pOverlayViewC.CommonDataModel.AppStatusData.AppMode != AppMode.Desing)
            {
                window.Show();
            }

            // ViewのIntPtrを採取
            IntPtr intPtr = new WindowInteropHelper(window).Handle;

            pOverlayViewC.OverlayDataModel.OverlayWindowData.WindowIntPtr = intPtr;
            if (!pCommonDM.AppCommonData.ViewIntPtrList.Contains(intPtr))
            {
                pCommonDM.AppCommonData.ViewIntPtrList.Add(intPtr);
            }

            if (pOverlayViewC.OverlayDataModel.OverlayWindowData.WindowLock)
            {
                WindowsServices.SetWindowExTransparent(pOverlayViewC.OverlayDataModel.OverlayWindowData.WindowIntPtr);
            }
        }
 public override void Dispose()
 {
     OverlayWindow.Dispose();
     base.Dispose();
 }
Example #27
0
        static void Main(string[] args)
        {
            // Read settings
            DataContractJsonSerializer Settings = new DataContractJsonSerializer(typeof(Settings[]));

            Settings[] settings    = null;
            Settings   auto_config = new Settings(320, 320, "game", true, Keys.MButton, Keys.Insert, Keys.Home, Keys.NumPad9, 0.1f, true, false);

            using (FileStream fs = new FileStream("config.json", FileMode.OpenOrCreate))
            {
                if (fs.Length == 0)
                {
                    Settings.WriteObject(fs, new Settings[1] {
                        auto_config
                    });
                    MessageBox.Show($"Created auto-config, change whatever settings you want and restart.");
                    return;
                }
                else
                {
                    settings = (Settings[])Settings.ReadObject(fs);
                }
            }

            //Vars
            size.X = settings[0].SizeX;
            size.Y = settings[0].SizeY;
            string game              = settings[0].Game;
            bool   SimpleRCS         = settings[0].SimpleRCS;
            Keys   ShootKey          = settings[0].ShootKey;
            Keys   TrainModeKey      = settings[0].TrainModeKey;
            Keys   ScreenshotKey     = settings[0].ScreenshotKey;
            Keys   ScreenshotModeKey = settings[0].ScreenshotModeKey;
            float  SmoothAim         = settings[0].SmoothAim;
            bool   Information       = settings[0].Information;
            bool   Head              = settings[0].Head;

            int i = 0;
            int selectedObject = 0;
            int shooting       = 0;

            string[]      objects = null;
            OverlayWindow _window;

            GameOverlay.Drawing.Graphics _graphics;
            bool trainingMode = false;

            screenshotMode = false;

            YoloWrapper yoloWrapper = null;

            //Check compatibility
            if (Process.GetProcessesByName(game).Count() == 0)
            {
                MessageBox.Show($"You have not launched {game}...");
                Process.GetCurrentProcess().Kill();
            }

            if (File.Exists($"trainfiles/{game}.cfg") && File.Exists($"trainfiles/{game}.weights") && File.Exists($"trainfiles/{game}.names"))
            {
                yoloWrapper = new YoloWrapper($"trainfiles/{game}.cfg", $"trainfiles/{game}.weights", $"trainfiles/{game}.names");
                Console.Clear();
                if (yoloWrapper.EnvironmentReport.CudaExists == false)
                {
                    Console.WriteLine("Install CUDA 10");
                    Process.GetCurrentProcess().Kill();
                }
                if (yoloWrapper.EnvironmentReport.CudnnExists == false)
                {
                    Console.WriteLine("Cudnn doesn't exist");
                    Process.GetCurrentProcess().Kill();
                }
                if (yoloWrapper.EnvironmentReport.MicrosoftVisualCPlusPlus2017RedistributableExists == false)
                {
                    Console.WriteLine("Install Microsoft Visual C++ 2017 Redistributable");
                    Process.GetCurrentProcess().Kill();
                }
                if (yoloWrapper.DetectionSystem.ToString() != "GPU")
                {
                    MessageBox.Show("No GPU card detected. Exiting...");
                    Process.GetCurrentProcess().Kill();
                }
                objects = File.ReadAllLines($"trainfiles/{game}.names");
            }
            else
            {
                trainingMode = true;
                MessageBox.Show($"Looks like you have not configured settings for {game}... Let's train the Neural Network! :)\n Preparing files for training....");

                Console.Write("How many objects will the NN be analyzing and training on? Write each object's name via the separator ',' without spaces (EX: 1,2): ");
                objects = Console.ReadLine().Split(',');
            }


            PrepareFiles(game);
            Random random = new Random();

            //Make transparent window for drawing
            _window = new OverlayWindow(0, 0, size.X, size.Y)
            {
                IsTopmost = true,
                IsVisible = true
            };

            _graphics = new GameOverlay.Drawing.Graphics()
            {
                MeasureFPS = true,
                Height     = _window.Height,
                PerPrimitiveAntiAliasing  = true,
                TextAntiAliasing          = true,
                UseMultiThreadedFactories = false,
                VSync        = true,
                Width        = _window.Width,
                WindowHandle = IntPtr.Zero
            };

            _window.CreateWindow();

            _graphics.WindowHandle = _window.Handle;
            _graphics.Setup();


            GameOverlay.Drawing.Graphics gfx = _graphics;

            System.Drawing.Rectangle trainBox = new System.Drawing.Rectangle(0, 0, size.X / 2, size.Y / 2);

            while (true)
            {
                coordinates = Cursor.Position;

                if (screenshotMode)
                {
                    bitmap = new Bitmap(CaptureWindow(game, true), size.X, size.Y);
                }
                else
                {
                    bitmap = new Bitmap(CaptureWindow(game, false), size.X, size.Y);
                }

                trainBox.X = size.X / 2 - trainBox.Width / 2;
                trainBox.Y = size.Y / 2 - trainBox.Height / 2;

                if (User32.GetAsyncKeyState(TrainModeKey) == -32767)
                {
                    if (yoloWrapper != null)
                    {
                        objects      = File.ReadAllLines($"trainfiles/{game}.names");
                        trainingMode = trainingMode == true ? false : true;
                    }
                }

                if (User32.GetAsyncKeyState(ScreenshotModeKey) == -32767)
                {
                    if (yoloWrapper != null)
                    {
                        objects        = File.ReadAllLines($"trainfiles/{game}.names");
                        screenshotMode = screenshotMode == true ? false : true;
                    }
                }

                _window.X = coordinates.X - size.X / 2;
                _window.Y = coordinates.Y - size.Y / 2;
                gfx.BeginScene();
                gfx.ClearScene();

                gfx.DrawRectangle(_graphics.CreateSolidBrush(GameOverlay.Drawing.Color.Green), 0, 0, size.X, size.Y, 2);

                if (trainingMode)
                {
                    int rand = random.Next(5000, 999999);

                    if (User32.GetAsyncKeyState(Keys.Left) != 0)
                    {
                        if (trainBox.Width <= 0)
                        {
                            continue;
                        }
                        else
                        {
                            trainBox.Width -= 1;
                        }
                    }

                    if (User32.GetAsyncKeyState(Keys.Down) != 0)
                    {
                        if (trainBox.Height >= size.Y)
                        {
                            continue;
                        }
                        else
                        {
                            trainBox.Height += 1;
                        }
                    }

                    if (User32.GetAsyncKeyState(Keys.Right) != 0)
                    {
                        if (trainBox.Width >= size.X)
                        {
                            continue;
                        }
                        else
                        {
                            trainBox.Width += 1;
                        }
                    }

                    if (User32.GetAsyncKeyState(Keys.Up) != 0)
                    {
                        if (trainBox.Height <= 0)
                        {
                            continue;
                        }
                        else
                        {
                            trainBox.Height -= 1;
                        }
                    }

                    float relative_center_x = (float)(trainBox.X + trainBox.Width / 2) / size.X;
                    float relative_center_y = (float)(trainBox.Y + trainBox.Height / 2) / size.Y;
                    float relative_width    = (float)trainBox.Width / size.X;
                    float relative_height   = (float)trainBox.Height / size.Y;
                    gfx.DrawTextWithBackground(_graphics.CreateFont("Arial", 14), _graphics.CreateSolidBrush(GameOverlay.Drawing.Color.Red), _graphics.CreateSolidBrush(0, 0, 0), new GameOverlay.Drawing.Point(0, 0), "Training mode. Object: " + objects[selectedObject] + Environment.NewLine + "ScreenshotMode: " + (screenshotMode == true ? "following" : "centered"));
                    gfx.DrawRectangle(_graphics.CreateSolidBrush(GameOverlay.Drawing.Color.Blue), GameOverlay.Drawing.Rectangle.Create(trainBox.X, trainBox.Y, trainBox.Width, trainBox.Height), 1);
                    gfx.DrawRectangle(_graphics.CreateSolidBrush(GameOverlay.Drawing.Color.Red), GameOverlay.Drawing.Rectangle.Create(trainBox.X + Convert.ToInt32(trainBox.Width / 2.9), trainBox.Y, Convert.ToInt32(trainBox.Width / 3), trainBox.Height / 7), 2);

                    if (User32.GetAsyncKeyState(Keys.PageUp) == -32767)
                    {
                        selectedObject = selectedObject + 1 == objects.Count() ? 0 : selectedObject + 1;
                    }

                    if (User32.GetAsyncKeyState(Keys.PageDown) == -32767)
                    {
                        selectedObject = selectedObject == 0 ? objects.Count() - 1 : selectedObject - 1;
                    }

                    if (User32.GetAsyncKeyState(ScreenshotKey) == -32767)
                    {
                        bitmap.Save($"darknet/data/img/{game}{i.ToString()}{rand}.png", System.Drawing.Imaging.ImageFormat.Png);
                        File.WriteAllText($"darknet/data/img/{game}{i.ToString()}{rand}.txt", string.Format("{0} {1} {2} {3} {4}", selectedObject, relative_center_x, relative_center_y, relative_width, relative_height).Replace(",", "."));
                        i++;
                        Console.Beep();
                    }

                    if (User32.GetAsyncKeyState(Keys.Back) == -32767)
                    {
                        bitmap.Save($"darknet/data/img/{game}{i.ToString()}{rand}.png", System.Drawing.Imaging.ImageFormat.Png);
                        File.WriteAllText($"darknet/data/img/{game}{i.ToString()}{rand}.txt", "");
                        i++;
                        Console.Beep();
                    }

                    if (User32.GetAsyncKeyState(Keys.End) == -32767)
                    {
                        Console.WriteLine("Okay, we have the pictures for training. Let's train the Neural Network....");
                        File.WriteAllText($"darknet/{game}.cfg", File.ReadAllText($"darknet/{game}.cfg").Replace("NUMBER", objects.Count().ToString()).Replace("FILTERNUM", ((objects.Count() + 5) * 3).ToString()));
                        File.WriteAllText($"darknet/{game}.cfg", File.ReadAllText($"darknet/{game}.cfg").Replace("batch=1", "batch=64").Replace("subdivisions=1", "subdivisions=8"));
                        File.WriteAllText($"darknet/data/{game}.data", File.ReadAllText($"darknet/data/{game}.data").Replace("NUMBER", objects.Count().ToString()).Replace("GAME", game));
                        File.WriteAllText($"darknet/{game}.cmd", File.ReadAllText($"darknet/{game}.cmd").Replace("GAME", game));
                        File.WriteAllText($"darknet/{game}_trainmore.cmd", File.ReadAllText($"darknet/{game}_trainmore.cmd").Replace("GAME", game));
                        File.WriteAllText($"darknet/data/{game}.names", string.Join("\n", objects));
                        // DirectoryInfo d = ;//Assuming Test is your Folder
                        FileInfo[] Files     = new DirectoryInfo(Application.StartupPath + @"\darknet\data\img").GetFiles($"{game}*.png"); //Getting Text files
                        string     PathOfImg = "";
                        foreach (FileInfo file in Files)
                        {
                            PathOfImg += $"data/img/{file.Name}\r\n";
                        }

                        File.WriteAllText($"darknet/data/{game}.txt", PathOfImg);

                        Process.GetProcessesByName(game)[0].Kill();
                        if (File.Exists($"trainfiles/{game}.weights"))
                        {
                            File.Copy($"trainfiles/{game}.weights", $"darknet/{game}.weights", true);
                            Process.Start("cmd", @"/C cd " + Application.StartupPath + $"/darknet/ & {game}_trainmore.cmd");
                        }
                        else
                        {
                            Process.Start("cmd", @"/C cd " + Application.StartupPath + $"/darknet/ & {game}.cmd");
                        }

                        Console.WriteLine("When you have finished training the NN, write \"done\" in this console.");

                        while (true)
                        {
                            if (Console.ReadLine() == "done")
                            {
                                File.Copy($"darknet/data/backup/{game}_last.weights", $"trainfiles/{game}.weights", true);
                                File.Copy($"darknet/data/{game}.names", $"trainfiles/{game}.names", true);
                                File.Copy($"darknet/{game}.cfg", $"trainfiles/{game}.cfg", true);
                                File.WriteAllText($"trainfiles/{game}.cfg", File.ReadAllText($"trainfiles/{game}.cfg").Replace("batch=64", "batch=1").Replace("subdivisions=8", "subdivisions=1"));
                                yoloWrapper  = new YoloWrapper($"trainfiles/{game}.cfg", $"trainfiles/{game}.weights", $"trainfiles/{game}.names");
                                trainingMode = false;
                                break;
                            }
                            else
                            {
                                Console.WriteLine("When you have finished training the NN, write \"done\" in this console.");
                            }
                        }
                        Console.WriteLine("Okay! Training has finished. Let's check detection in the game!");
                    }
                }
                else
                {
                    if (User32.GetAsyncKeyState(Keys.PageUp) == -32767)
                    {
                        selectedObject = selectedObject + 1 == objects.Count() ? 0 : selectedObject + 1;
                    }

                    if (User32.GetAsyncKeyState(Keys.Up) == -32767)
                    {
                        SmoothAim = SmoothAim >= 1 ? SmoothAim : SmoothAim + 0.05f;
                    }

                    if (User32.GetAsyncKeyState(Keys.Down) == -32767)
                    {
                        SmoothAim = SmoothAim <= 0 ? SmoothAim : SmoothAim - 0.05f;
                    }

                    if (User32.GetAsyncKeyState(Keys.Delete) == -32767)
                    {
                        Head = Head == true ? false : true;
                    }

                    if (User32.GetAsyncKeyState(Keys.Home) == -32767)
                    {
                        shooting  = 0;
                        SimpleRCS = SimpleRCS == true ? false : true;
                    }

                    if (User32.GetAsyncKeyState(Keys.PageDown) == -32767)
                    {
                        selectedObject = selectedObject == 0 ? objects.Count() - 1 : selectedObject - 1;
                    }
                    gfx.DrawText(_graphics.CreateFont("Arial", 10), _graphics.CreateSolidBrush(GameOverlay.Drawing.Color.Red), new GameOverlay.Drawing.Point(0, 0), $"Object {objects[selectedObject]}; SmoothAim {Math.Round(SmoothAim, 2)}; Head {Head}; SimpleRCS {SimpleRCS}");

                    using (MemoryStream ms = new MemoryStream())
                    {
                        bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                        IEnumerable <Alturos.Yolo.Model.YoloItem> items = yoloWrapper.Detect(ms.ToArray());
                        if (SimpleRCS)
                        {
                            if (User32.GetAsyncKeyState(ShootKey) == 0)
                            {
                                shooting = 0;
                            }
                        }

                        if (items.Count() > 0)
                        {
                            foreach (var item in items)
                            {
                                if (item.Confidence > (double)0.4)
                                {
                                    GameOverlay.Drawing.Rectangle head = GameOverlay.Drawing.Rectangle.Create(item.X + Convert.ToInt32(item.Width / 2.9), item.Y, Convert.ToInt32(item.Width / 3), item.Height / 7);
                                    GameOverlay.Drawing.Rectangle body = GameOverlay.Drawing.Rectangle.Create(item.X + Convert.ToInt32(item.Width / 6), item.Y + item.Height / 6, Convert.ToInt32(item.Width / 1.5f), item.Height / 3);

                                    if (Information)
                                    {
                                        if (Head)
                                        {
                                            gfx.DrawTextWithBackground(_graphics.CreateFont("Arial", 12), _graphics.CreateSolidBrush(GameOverlay.Drawing.Color.Red), _graphics.CreateSolidBrush(0, 0, 0), new GameOverlay.Drawing.Point(item.X + item.Width, item.Y + item.Width), $"{item.Type} {DistanceBetweenCross(head.Left + head.Width / 2, head.Top + head.Height / 2)}");
                                        }
                                        else
                                        {
                                            gfx.DrawTextWithBackground(_graphics.CreateFont("Arial", 12), _graphics.CreateSolidBrush(GameOverlay.Drawing.Color.Red), _graphics.CreateSolidBrush(0, 0, 0), new GameOverlay.Drawing.Point(item.X + item.Width, item.Y + item.Width), $"{item.Type} {DistanceBetweenCross(body.Left + body.Width / 2, body.Top + body.Height / 2)}");
                                        }
                                    }

                                    if (item.Type == objects[selectedObject])
                                    {
                                        gfx.DrawRectangle(_graphics.CreateSolidBrush(GameOverlay.Drawing.Color.Red), GameOverlay.Drawing.Rectangle.Create(item.X, item.Y, item.Width, item.Height), 2);

                                        if (Head)
                                        {
                                            gfx.DrawRectangle(_graphics.CreateSolidBrush(GameOverlay.Drawing.Color.Blue), head, 2);
                                            gfx.DrawCrosshair(_graphics.CreateSolidBrush(GameOverlay.Drawing.Color.Blue), head.Left + head.Width / 2, head.Top + head.Height / 2 + Convert.ToInt32(1 * shooting), 2, 2, CrosshairStyle.Cross);
                                            gfx.DrawLine(_graphics.CreateSolidBrush(GameOverlay.Drawing.Color.Blue), size.X / 2, size.Y / 2, head.Left + head.Width / 2, head.Top + head.Height / 2 + Convert.ToInt32(1 * shooting), 2);
                                        }
                                        else
                                        {
                                            gfx.DrawRectangle(_graphics.CreateSolidBrush(GameOverlay.Drawing.Color.Blue), body, 2);
                                            gfx.DrawCrosshair(_graphics.CreateSolidBrush(GameOverlay.Drawing.Color.Blue), body.Left + body.Width / 2, body.Top + body.Height / 2 + Convert.ToInt32(1 * shooting), 2, 2, CrosshairStyle.Cross);
                                            gfx.DrawLine(_graphics.CreateSolidBrush(GameOverlay.Drawing.Color.Blue), size.X / 2, size.Y / 2, body.Left + body.Width / 2, body.Top + body.Height / 2 + Convert.ToInt32(1 * shooting), 2);
                                        }

                                        if (User32.GetAsyncKeyState(ShootKey) != 0)
                                        {
                                            if (Head)
                                            {
                                                Alturos.Yolo.Model.YoloItem nearestEnemy = items.Where(x => x.Type == objects[selectedObject]).OrderByDescending(x => DistanceBetweenCross(x.X + Convert.ToInt32(x.Width / 2.9) + (x.Width / 3) / 2, x.Y + (x.Height / 7) / 2)).Last();

                                                GameOverlay.Drawing.Rectangle nearestEnemyHead = GameOverlay.Drawing.Rectangle.Create(nearestEnemy.X + Convert.ToInt32(nearestEnemy.Width / 2.9), nearestEnemy.Y, Convert.ToInt32(nearestEnemy.Width / 3), nearestEnemy.Height / 7 + (float)2 * shooting);

                                                if (SmoothAim <= 0)
                                                {
                                                    User32.mouse_event(0x01, Convert.ToInt32(((nearestEnemyHead.Left - size.X / 2) + (nearestEnemyHead.Width / 2))), Convert.ToInt32((nearestEnemyHead.Top - size.Y / 2 + nearestEnemyHead.Height / 7 + 1 * shooting)), 0, (UIntPtr)0);
                                                    User32.mouse_event(0x02, 0, 0, 0, (UIntPtr)0);
                                                    User32.mouse_event(0x04, 0, 0, 0, (UIntPtr)0);
                                                }
                                                else
                                                {
                                                    if (size.X / 2 < nearestEnemyHead.Left | size.X / 2 > nearestEnemyHead.Right
                                                        | size.Y / 2 < nearestEnemyHead.Top | size.Y / 2 > nearestEnemyHead.Bottom)
                                                    {
                                                        User32.mouse_event(0x01, Convert.ToInt32(((nearestEnemyHead.Left - size.X / 2) + (nearestEnemyHead.Width / 2)) * SmoothAim), Convert.ToInt32((nearestEnemyHead.Top - size.Y / 2 + nearestEnemyHead.Height / 7 + 1 * shooting) * SmoothAim), 0, (UIntPtr)0);
                                                    }
                                                    else
                                                    {
                                                        User32.mouse_event(0x02, 0, 0, 0, (UIntPtr)0);
                                                        User32.mouse_event(0x04, 0, 0, 0, (UIntPtr)0);
                                                        if (SimpleRCS)
                                                        {
                                                            shooting += 2;
                                                        }
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                Alturos.Yolo.Model.YoloItem nearestEnemy = items.Where(x => x.Type == objects[selectedObject]).OrderByDescending(x => DistanceBetweenCross(x.X + Convert.ToInt32(x.Width / 6) + (x.Width / 1.5f) / 2, x.Y + x.Height / 6 + (x.Height / 3) / 2)).Last();

                                                GameOverlay.Drawing.Rectangle nearestEnemyBody = GameOverlay.Drawing.Rectangle.Create(nearestEnemy.X + Convert.ToInt32(nearestEnemy.Width / 6), nearestEnemy.Y + nearestEnemy.Height / 6 + (float)2 * shooting, Convert.ToInt32(nearestEnemy.Width / 1.5f), nearestEnemy.Height / 3 + (float)2 * shooting);
                                                if (SmoothAim <= 0)
                                                {
                                                    User32.mouse_event(0x01, Convert.ToInt32(((nearestEnemyBody.Left - size.X / 2) + (nearestEnemyBody.Width / 2))), Convert.ToInt32((nearestEnemyBody.Top - size.Y / 2 + nearestEnemyBody.Height / 7 + 1 * shooting)), 0, (UIntPtr)0);
                                                    User32.mouse_event(0x02, 0, 0, 0, (UIntPtr)0);
                                                    User32.mouse_event(0x04, 0, 0, 0, (UIntPtr)0);
                                                }
                                                else
                                                {
                                                    if (size.X / 2 < nearestEnemyBody.Left | size.X / 2 > nearestEnemyBody.Right
                                                        | size.Y / 2 < nearestEnemyBody.Top | size.Y / 2 > nearestEnemyBody.Bottom)
                                                    {
                                                        User32.mouse_event(0x01, Convert.ToInt32(((nearestEnemyBody.Left - size.X / 2) + (nearestEnemyBody.Width / 2)) * SmoothAim), Convert.ToInt32((nearestEnemyBody.Top - size.Y / 2 + nearestEnemyBody.Height / 7 + 1 * shooting) * SmoothAim), 0, (UIntPtr)0);
                                                    }
                                                    else
                                                    {
                                                        User32.mouse_event(0x02, 0, 0, 0, (UIntPtr)0);
                                                        User32.mouse_event(0x04, 0, 0, 0, (UIntPtr)0);
                                                        if (SimpleRCS)
                                                        {
                                                            shooting += 2;
                                                        }
                                                    }
                                                }
                                            }
                                            //System.Threading.Thread.Sleep(120);
                                        }
                                    }
                                    else
                                    {
                                        gfx.DrawRectangle(_graphics.CreateSolidBrush(GameOverlay.Drawing.Color.Green), GameOverlay.Drawing.Rectangle.Create(item.X, item.Y, item.Width, item.Height), 2);
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (SimpleRCS)
                            {
                                shooting = 0;
                            }
                        }
                    }
                }
                gfx.FillRectangle(_graphics.CreateSolidBrush(GameOverlay.Drawing.Color.Blue), GameOverlay.Drawing.Rectangle.Create(size.X / 2, size.Y / 2, 4, 4));

                gfx.EndScene();
            }
        }
Example #28
0
 public void ActivateWindow(OverlayWindow window)
 {
     window.Active = true;
 }
Example #29
0
 void DestroyOverlayWindow()
 {
     if (_overlayWindow != null)
     {
         _overlayWindow.Close();
         _overlayWindow = null;
     }
 }
Example #30
0
 void CreateOverlayWindow()
 {
     if (_overlayWindow == null)
     {
         _overlayWindow = new OverlayWindow(this);
     }
     Rect rectWindow = new Rect(this.PointToScreenDPIWithoutFlowDirection(new Point()), this.TransformActualSizeToAncestor());
     _overlayWindow.Left = rectWindow.Left;
     _overlayWindow.Top = rectWindow.Top;
     _overlayWindow.Width = rectWindow.Width;
     _overlayWindow.Height = rectWindow.Height;
 }
Example #31
0
        private void Nampham()
        {
            rect.left   = 0;    //
            rect.right  = 1366; //
            rect.top    = 21;   //
            rect.bottom = 726;  //
            int Width           = rect.right - rect.left;
            int Height          = rect.bottom - rect.top;
            int Width2          = 1382; //
            int Height2         = 744;  //
            var overlay         = new OverlayWindow(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top);
            var rendererOptions = new Direct2DRendererOptions()
            {
                AntiAliasing = false,
                Hwnd         = overlay.WindowHandle,
                MeasureFps   = true,
                VSync        = true
            };

            var     d2d         = new Direct2DRenderer(rendererOptions);
            var     trains      = d2d.CreateBrush(0, 0, 0, 0);
            var     blackBrush  = d2d.CreateBrush(0, 0, 0, 255);
            var     redBrush    = d2d.CreateBrush(242, 14, 14, 255);
            var     greenBrush  = d2d.CreateBrush(33, 208, 43, 255);
            var     whiteBrush  = d2d.CreateBrush(255, 255, 255, 200);
            var     blueBrush   = d2d.CreateBrush(0, 0, 255, 255);
            var     grenBrush   = d2d.CreateBrush(33, 208, 43, 180);
            var     greenBrush2 = d2d.CreateBrush(0, 188, 0, 255);
            var     font        = d2d.CreateFont("Tahoma", 8, true);
            var     bigfont     = d2d.CreateFont("Tahoma", 14, true);
            Vector2 center      = new Vector2();

            while (true)
            {
                center.X = Width / 2;
                center.Y = (Height / 2) + 20;
                d2d.BeginScene();
                d2d.ClearScene(trains);
                if (Showbone)
                {
                    var m_pWorld = Mem.ReadMemory <int>(Mem.BaseAddress + Offsets.PyGame + 0x410);
                    List <LUPPI.NP.Word> modal = new List <NP.Word>();
                    var m_pSceneContext        = Mem.ReadMemory <int>(m_pWorld + 0x8);
                    var cameraBase             = Mem.ReadMemory <int>(m_pSceneContext + 0x4);
                    var viewMatrix             = Mem.ReadMatrix <float>(cameraBase + 0xC4, 16);
                    var pSkeletonList          = Mem.ReadMemory <int>(m_pWorld + 0x290);
                    int visibleCount           = Mem.ReadMemory <int>(m_pWorld + 0x278);
                    int coutene = 0;
                    for (int i = 0; i < visibleCount; i++)
                    {
                        int r_pModel    = Mem.ReadMemory <int>(pSkeletonList + i);
                        int m_pAnimator = Mem.ReadMemory <int>(r_pModel + 0x328);
                        if (m_pAnimator > 1)
                        {
                            var intt = Mem.ReadMemory <int>(m_pAnimator + 0x528);
                            //var bon = Mem.ReadMemory<int>(m_pAnimator + 0x970);
                            var name = Mem.ReadString(intt, 35);
                            //float[] b = Mem.ReadMatrix<float>(r_pModel + 0x3B0, 16);
                            if (name.Contains("_male"))
                            {
                                coutene += 1;
                                modal.Add(new NP.Word()
                                {
                                    baseAdd = m_pAnimator, baseModal = r_pModel, isMen = true
                                });
                            }
                            else if (name.Contains("_female"))
                            {
                                coutene += 1;
                                modal.Add(new NP.Word()
                                {
                                    baseAdd = m_pAnimator, baseModal = r_pModel, isMen = false
                                });
                            }
                        }
                    }
                    d2d.DrawTextWithBackground("ENERMY : " + (coutene - 1) + " 💩", 10, 400, bigfont, redBrush, whiteBrush);
                    for (int i = 0; i < modal.Count; i++)
                    {
                        if (i == 0)//LOCALPLAYER POS
                        {
                            var m_Position1 = modal[i].pos;
                            MyPosition.X = m_Position1[12];
                            MyPosition.Y = m_Position1[13];
                            MyPosition.Z = m_Position1[14];
                        }
                        //string name = modal[i].TypeName;
                        //if (name.Contains("dataosha_male") || name.Contains("dataosha_female"))
                        {
                            var     m_Position = modal[i].pos;
                            Vector3 position;
                            position.X = m_Position[12];
                            position.Y = m_Position[13];
                            position.Z = m_Position[14];
                            var p = 0;
                            for (int j = 0; j < 0xE80; j += 0x40)
                            {
                                var ab         = Mem.ReadMemory <int>(modal[i].baseAdd + 0x970);
                                var boneMatrix = Mem.ReadMatrix <float>(ab + j, 16);
                                var bone4      = new LUPPI.NP.Matrix(boneMatrix);
                                var bone24     = new LUPPI.NP.Matrix(m_Position);
                                var result     = LUPPI.NP.Matrix.Multiply(bone4, bone24);
                                var vec3a      = new Vector3(result.M41, result.M42, result.M43);
                                Maths.WorldToScreen3(vec3a, viewMatrix, out var testeee, Width, Height);
                                d2d.DrawText(p.ToString(), testeee.X, testeee.Y, font, whiteBrush);
                                p++;
                            }
                            Maths.WorldToScreen(position, out var testee2, Width, Height);
                            int    khoangCach = Helper.GetDistance(MyPosition, position, 20);
                            string tea        = "[" + khoangCach + "m]";
                            if (khoangCach < 150)
                            {
                                d2d.DrawText(tea, testee2.X - tea.Length, testee2.Y, font, greenBrush2);
                            }
                            else
                            {
                                d2d.DrawText(tea, testee2.X - tea.Length, testee2.Y, font, whiteBrush);
                            }
                        }
                    }
                }
                if (isBoxEsp)
                {
                    Vector2 vector3;
                    LocalPlayer = Mem.ReadMemory <int>(Mem.BaseAddress + Offsets.LocalPlayer);
                    Mem.ReadMemory <int>(Mem.BaseAddress + 0x22);
                    MyPosition = GetEncryptedPosition(LocalPlayer);
                    List <Entity> ls = ReadAllEntity();
                    d2d.DrawTextWithBackground("ENERMY : " + enemyCount.ToString() + " 💩", 10, 400, bigfont, redBrush, whiteBrush);
                    d2d.DrawTextWithBackground("AIM LEG: " + aimLeg.ToString(), 10, 370, bigfont, redBrush, whiteBrush);
                    for (int i = 0; i < ls.Count; i++)
                    {
                        //ls[i].Coordinates.Y += 15f;
                        ls[i].Coordinates = ls[i].GetEncryptedPosition();
                        if (Maths.WorldToScreen(ls[i].Coordinates, out vector3, Width2, Height2))
                        {
                            int   khoangCach = Helper.GetDistance(MyPosition, ls[i].Coordinates, 10);
                            var   widthhp    = 0f;
                            var   widthhp2   = 0f;
                            float numaim     = 2f;
                            if (ls[i].isPlayer && ls[i].hp > 0)
                            {
                                float heiadd = 0f;
                                bool  flag3  = ls[i].pose == Pose.Standing;
                                if (flag3)
                                {
                                    heiadd += 18.5f;
                                }
                                bool flag4 = ls[i].pose == Pose.Prone;
                                if (flag4)
                                {
                                    heiadd += 12.5f;
                                    numaim  = 1.6f;
                                }
                                bool flag5 = ls[i].pose == Pose.Crouching;
                                if (flag5)
                                {
                                    heiadd += 4f;
                                    numaim  = 1.1f;
                                }
                                Vector2 line1, line2, line3, line4, line5, line6, line7, line8;
                                if (isBoxEsp)
                                {
                                    var a1  = ls[i].Coordinates.X;
                                    var a2  = ls[i].Coordinates.Y;
                                    var a3  = ls[i].Coordinates.Z;
                                    var v7  = a1 - 5.5f;
                                    var v8  = a2 - 2.5f;
                                    var v9  = a3 - 5.5f;
                                    var v10 = a1 + 5.5f;
                                    var v12 = a3 + 5.5f;
                                    if (Maths.WorldToScreen(new Vector3(v7, v8, v9), out line1, Width, Height))
                                    {
                                        var v4  = a2 + heiadd;
                                        var v11 = a2 + heiadd;
                                        var v13 = v4;
                                        var v14 = v4;
                                        if (Maths.WorldToScreen(new Vector3(v10, v4, v12), out line2, Width, Height))
                                        {
                                            if (Maths.WorldToScreen(new Vector3(v10, v8, v9), out line3, Width, Height))
                                            {
                                                if (Maths.WorldToScreen(new Vector3(v7, v11, v9), out line4, Width, Height))
                                                {
                                                    if (Maths.WorldToScreen(new Vector3(v7, v8, v12), out line5, Width, Height))
                                                    {
                                                        if (Maths.WorldToScreen(new Vector3(v7, v13, v12), out line6, Width, Height))
                                                        {
                                                            if (Maths.WorldToScreen(new Vector3(v10, v8, v12), out line7, Width, Height))
                                                            {
                                                                if (Maths.WorldToScreen(new Vector3(v10, v14, v9), out line8, Width, Height))
                                                                {
                                                                    d2d.DrawLine(line1.X, line1.Y, line4.X, line4.Y, 1, whiteBrush);
                                                                    d2d.DrawLine(line3.X, line3.Y, line8.X, line8.Y, 1, whiteBrush);
                                                                    d2d.DrawLine(line7.X, line7.Y, line2.X, line2.Y, 1, whiteBrush);
                                                                    d2d.DrawLine(line5.X, line5.Y, line6.X, line6.Y, 1, whiteBrush);

                                                                    //Chan
                                                                    d2d.DrawLine(line1.X, line1.Y, line3.X, line3.Y, 1, whiteBrush);
                                                                    d2d.DrawLine(line3.X, line3.Y, line7.X, line7.Y, 1, whiteBrush);
                                                                    d2d.DrawLine(line7.X, line7.Y, line5.X, line5.Y, 1, whiteBrush);
                                                                    d2d.DrawLine(line5.X, line5.Y, line1.X, line1.Y, 1, whiteBrush);

                                                                    //Dau
                                                                    d2d.DrawLine(line4.X, line4.Y, line8.X, line8.Y, 1, whiteBrush);
                                                                    d2d.DrawLine(line8.X, line8.Y, line2.X, line2.Y, 1, whiteBrush);
                                                                    d2d.DrawLine(line2.X, line2.Y, line6.X, line6.Y, 1, whiteBrush);
                                                                    d2d.DrawLine(line6.X, line6.Y, line4.X, line4.Y, 1, whiteBrush);

                                                                    widthhp  = (float)Helper.GetDistance2(line4, line2, 1);
                                                                    widthhp2 = (float)Helper.GetDistance2(line6, line8, 1);
                                                                    if (widthhp < widthhp2)
                                                                    {
                                                                        widthhp = widthhp2;
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                                var     dy = ls[i].Coordinates.X;
                                var     dy_4 = ls[i].Coordinates.Y;
                                var     v46 = ls[i].Coordinates.Z;
                                var     v27 = dy_4 + 27.0f;
                                Vector2 aimpoint, aimpoint2;
                                if (Maths.WorldToScreen(new Vector3(dy, v27, v46), out aimpoint, Width, Height))
                                {
                                    string tea = ls[i].PlayerName + " [" + khoangCach + " m]";
                                    if (khoangCach < 150)
                                    {
                                        d2d.DrawText(tea, aimpoint.X - tea.Length * 2, aimpoint.Y - 10, font, redBrush);
                                    }
                                    else
                                    {
                                        d2d.DrawText(tea, aimpoint.X - tea.Length * 2, aimpoint.Y - 10, font, whiteBrush);
                                    }

                                    //Player HP
                                    if (ls[i].hp == 100)
                                    {
                                        d2d.DrawVerticalBar(ls[i].hp, aimpoint.X - widthhp / 2, aimpoint.Y - 15f, widthhp, 1, 3, greenBrush2, blackBrush);
                                    }
                                    else
                                    {
                                        d2d.DrawVerticalBar(ls[i].hp, aimpoint.X - widthhp / 2, aimpoint.Y - 15f, widthhp, 1, 3, redBrush, blackBrush);
                                    }
                                }

                                if (Maths.WorldToScreen(new Vector3(dy, v27, v46), out aimpoint, Width, Height2))
                                {
                                    var v41 = dy_4 + heiadd;
                                    if (Maths.WorldToScreen(new Vector3(dy, v41, v46), out aimpoint2, Width, Height2))
                                    {
                                        if ((Maths.InsideCircle((int)center.X, (int)center.Y, 80, (int)aimpoint2.X, (int)aimpoint2.Y)))
                                        {
                                            if (Keyboard.IsKeyDown(Keys.LShiftKey))
                                            {
                                                Cursor.Position = new Point((int)(aimpoint2.X), (int)(aimpoint2.Y));
                                                if (Keyboard.IsKeyDown(Keys.LButton))
                                                {
                                                    Cursor.Position = new Point((int)(aimpoint2.X), (int)(aimpoint2.Y + ls[i].Pitch));
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            if (ls[i].isItem)
                            {
                                if (ls[i].dropID == 1001 || ls[i].dropID == 1002 || ls[i].dropID == 1007 || ls[i].dropID == 1026)
                                {
                                    d2d.DrawText2("[GUN]", vector3.X, vector3.Y, font, whiteBrush, greenBrush2);
                                }
                                else if (ls[i].dropID == 1273 || ls[i].dropID == 1274 || ls[i].dropID == 1275)
                                {
                                    d2d.DrawText2("[SCOPE]", vector3.X, vector3.Y, font, whiteBrush, greenBrush2);
                                }
                                else if (khoangCach < 100)
                                {
                                    //d2d.DrawText("[I]", vector3.X, vector3.Y, font, whiteBrush);
                                }
                            }
                            if (ls[i].isItemDie && khoangCach < 100)
                            {
                                d2d.DrawText2("[DIE]", vector3.X, vector3.Y, font, whiteBrush, greenBrush2);
                            }
                        }
                    }
                }

                d2d.EndScene();
                //Thread.Sleep(1);
            }
        }
		public MainWindow(GameV2 game)
		{
		    _game = game;

			InitializeComponent();
			Trace.Listeners.Add(new TextBoxTraceListener(Options.OptionsTrackerLogging.TextBoxLog));


			Helper.MainWindow = this;
			//Config.Load();
			EnableMenuItems(false);


			try
			{
				if(File.Exists("HDTUpdate_new.exe"))
				{
					if(File.Exists("HDTUpdate.exe"))
						File.Delete("HDTUpdate.exe");
					File.Move("HDTUpdate_new.exe", "HDTUpdate.exe");
				}
			}
			catch(Exception e)
			{
				Logger.WriteLine("Error updating updater\n" + e);
			}
			try
			{
				//updater used pre v0.9.6
				if(File.Exists("Updater.exe"))
					File.Delete("Updater.exe");
			}
			catch(Exception e)
			{
				Logger.WriteLine("Error deleting Updater.exe\n" + e);
			}


			HsLogReaderV2.Create();

			var configVersion = string.IsNullOrEmpty(Config.Instance.CreatedByVersion) ? null : new Version(Config.Instance.CreatedByVersion);

			var currentVersion = Helper.GetCurrentVersion();
			var versionString = string.Empty;
			if(currentVersion != null)
			{
				versionString = string.Format("{0}.{1}.{2}", currentVersion.Major, currentVersion.Minor, currentVersion.Build);
				Help.TxtblockVersion.Text = "Version: " + versionString;

				// Assign current version to the config instance so that it will be saved when the config
				// is rewritten to disk, thereby telling us what version of the application created it
				Config.Instance.CreatedByVersion = currentVersion.ToString();
			}

			ConvertLegacyConfig(currentVersion, configVersion);

			if(Config.Instance.SelectedTags.Count == 0)
				Config.Instance.SelectedTags.Add("All");

			_foundHsDirectory = FindHearthstoneDir();

			if(_foundHsDirectory)
				_updatedLogConfig = UpdateLogConfigFile();

			//hearthstone, loads db etc - needs to be loaded before playerdecks, since cards are only saved as ids now
			_game.Reset();

			if(!Directory.Exists(Config.Instance.DataDir))
				Config.Instance.Reset("DataDirPath");

			SetupDeckListFile();
			DeckList.Load();

			// Don't load active deck if it's archived
			if(DeckList.Instance.ActiveDeck != null && DeckList.Instance.ActiveDeck.Archived)
				DeckList.Instance.ActiveDeck = null;

			UpdateDeckList(DeckList.Instance.ActiveDeck);

			SetupDefaultDeckStatsFile();
			DefaultDeckStats.Load();


			SetupDeckStatsFile();
			DeckStatsList.Load();

			_notifyIcon = new NotifyIcon
			{
				Icon = new Icon(@"Images/HearthstoneDeckTracker16.ico"),
				Visible = true,
				ContextMenu = new ContextMenu(),
				Text = "Hearthstone Deck Tracker v" + versionString
			};

			MenuItem startHearthstonMenuItem = new MenuItem("Start Launcher/Hearthstone", (sender, args) => StartHearthstoneAsync());
			startHearthstonMenuItem.Name = "startHearthstone";
			_notifyIcon.ContextMenu.MenuItems.Add(startHearthstonMenuItem);

			MenuItem useNoDeckMenuItem = new MenuItem("Use no deck", (sender, args) => UseNoDeckContextMenu());
			useNoDeckMenuItem.Name = "useNoDeck";
			_notifyIcon.ContextMenu.MenuItems.Add(useNoDeckMenuItem);

			MenuItem autoSelectDeckMenuItem = new MenuItem("Autoselect deck", (sender, args) => AutoDeckDetectionContextMenu());
			autoSelectDeckMenuItem.Name = "autoSelectDeck";
			_notifyIcon.ContextMenu.MenuItems.Add(autoSelectDeckMenuItem);

			MenuItem classCardsFirstMenuItem = new MenuItem("Class cards first", (sender, args) => SortClassCardsFirstContextMenu());
			classCardsFirstMenuItem.Name = "classCardsFirst";
			_notifyIcon.ContextMenu.MenuItems.Add(classCardsFirstMenuItem);

			_notifyIcon.ContextMenu.MenuItems.Add("Show", (sender, args) => ActivateWindow());
			_notifyIcon.ContextMenu.MenuItems.Add("Exit", (sender, args) => Close());
			_notifyIcon.MouseClick += (sender, args) =>
			{
				if(args.Button == MouseButtons.Left)
					ActivateWindow();
			};

			//create overlay
			Overlay = new OverlayWindow(_game) {Topmost = true};

			PlayerWindow = new PlayerWindow(_game,Config.Instance, _game.IsUsingPremade ? _game.PlayerDeck : _game.PlayerDrawn);
			OpponentWindow = new OpponentWindow(_game, Config.Instance, _game.OpponentCards);
			TimerWindow = new TimerWindow(Config.Instance);
			StatsWindow = new StatsWindow();

			if(Config.Instance.PlayerWindowOnStart)
				PlayerWindow.Show();
			if(Config.Instance.OpponentWindowOnStart)
				OpponentWindow.Show();
			if(Config.Instance.TimerWindowOnStartup)
				TimerWindow.Show();

			LoadConfig();
			if(!Config.Instance.NetDeckClipboardCheck.HasValue)
			{
				var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
				                        @"Google\Chrome\User Data\Default\Extensions\lpdbiakcpmcppnpchohihcbdnojlgeel");

				if(Directory.Exists(path))
				{
					Config.Instance.NetDeckClipboardCheck = true;
					Config.Save();
				}
			}

			if(!Config.Instance.RemovedNoteUrls)
				RemoveNoteUrls();
			if(!Config.Instance.ResolvedDeckStatsIssue)
				ResolveDeckStatsIssue();

			TurnTimer.Create(90);

			SortFilterDecksFlyout.HideStuffToCreateNewTag();
			TagControlEdit.OperationSwitch.Visibility = Visibility.Collapsed;
			TagControlEdit.GroupBoxSortingAllConstructed.Visibility = Visibility.Collapsed;
			TagControlEdit.GroupBoxSortingArena.Visibility = Visibility.Collapsed;

			FlyoutNotes.ClosingFinished += (sender, args) => DeckNotesEditor.SaveDeck();


			UpdateDbListView();

			_doUpdate = _foundHsDirectory;

			SelectDeck(DeckList.Instance.ActiveDeck, true);

			if(_foundHsDirectory)
				HsLogReaderV2.Instance.Start(_game);

			Helper.SortCardCollection(ListViewDeck.Items, Config.Instance.CardSortingClassFirst);
			DeckPickerList.PropertyChanged += DeckPickerList_PropertyChanged;
			DeckPickerList.UpdateDecks();
			DeckPickerList.UpdateArchivedClassVisibility();

			CopyReplayFiles();

			LoadHearthStats();

			UpdateOverlayAsync();
			UpdateAsync();

			BackupManager.Run();

			_initialized = true;

			PluginManager.Instance.LoadPlugins();
			Options.OptionsTrackerPlugins.Load();
			PluginManager.Instance.StartUpdateAsync();
		}
Example #33
0
		public MainWindow()
		{
			// Set working directory to path of executable
			Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);

			InitializeComponent();

			EnableMenuItems(false);

			try
			{
				if(File.Exists("Updater_new.exe"))
				{
					if(File.Exists("Updater.exe"))
						File.Delete("Updater.exe");
					File.Move("Updater_new.exe", "Updater.exe");
				}
			}
			catch
			{
				Logger.WriteLine("Error updating updater");
			}

			Helper.MainWindow = this;
			_configPath = Config.Load();
			HsLogReader.Create();

			var configVersion = string.IsNullOrEmpty(Config.Instance.CreatedByVersion)
				                    ? null
				                    : new Version(Config.Instance.CreatedByVersion);

			Version currentVersion;
			if(Config.Instance.CheckForUpdates)
			{
				currentVersion = Helper.CheckForUpdates(out NewVersion);
				_lastUpdateCheck = DateTime.Now;
			}
			else
				currentVersion = Helper.GetCurrentVersion();

			var versionString = string.Empty;
			if(currentVersion != null)
			{
				versionString = string.Format("{0}.{1}.{2}", currentVersion.Major, currentVersion.Minor, currentVersion.Build);
				Help.TxtblockVersion.Text = "Version: " + versionString;

				// Assign current version to the config instance so that it will be saved when the config
				// is rewritten to disk, thereby telling us what version of the application created it
				Config.Instance.CreatedByVersion = currentVersion.ToString();
			}

			ConvertLegacyConfig(currentVersion, configVersion);

			if(Config.Instance.SelectedTags.Count == 0)
				Config.Instance.SelectedTags.Add("All");

			if(Config.Instance.GenerateLog)
			{
				Directory.CreateDirectory("Logs");
				var listener = new TextWriterTraceListener(Config.Instance.LogFilePath);
				Trace.Listeners.Add(listener);
				Trace.AutoFlush = true;
			}

			_foundHsDirectory = FindHearthstoneDir();

			if(_foundHsDirectory)
				_updatedLogConfig = UpdateLogConfigFile();

			//hearthstone, loads db etc - needs to be loaded before playerdecks, since cards are only saved as ids now
			Game.Reset();

			_decksPath = Config.Instance.HomeDir + "PlayerDecks.xml";
			SetupDeckListFile();
			try
			{
				DeckList = XmlManager<Decks>.Load(_decksPath);
			}
			catch(Exception e)
			{
				MessageBox.Show(
					e.Message + "\n\n" + e.InnerException +
					"\n\n If you don't know how to fix this, please delete " + _decksPath +
					" (this will cause you to lose your decks).",
					"Error loading PlayerDecks.xml");
				Application.Current.Shutdown();
			}

			foreach(var deck in DeckList.DecksList)
				DeckPickerList.AddDeck(deck);

			SetupDeckStatsFile();
			DeckStatsList.Load();

			_notifyIcon = new NotifyIcon {Icon = new Icon(@"Images/HearthstoneDeckTracker.ico"), Visible = true, ContextMenu = new ContextMenu(), Text = "Hearthstone Deck Tracker v" + versionString};
			_notifyIcon.ContextMenu.MenuItems.Add("Show", (sender, args) => ActivateWindow());
			_notifyIcon.ContextMenu.MenuItems.Add("Exit", (sender, args) => Close());
			_notifyIcon.MouseClick += (sender, args) => { if(args.Button == MouseButtons.Left) ActivateWindow(); };

			//create overlay
			Overlay = new OverlayWindow {Topmost = true};

			PlayerWindow = new PlayerWindow(Config.Instance, Game.IsUsingPremade ? Game.PlayerDeck : Game.PlayerDrawn);
			OpponentWindow = new OpponentWindow(Config.Instance, Game.OpponentCards);
			TimerWindow = new TimerWindow(Config.Instance);
			StatsWindow = new StatsWindow();

			if(Config.Instance.PlayerWindowOnStart)
				PlayerWindow.Show();
			if(Config.Instance.OpponentWindowOnStart)
				OpponentWindow.Show();
			if(Config.Instance.TimerWindowOnStartup)
				TimerWindow.Show();
			if(!DeckList.AllTags.Contains("All"))
			{
				DeckList.AllTags.Add("All");
				WriteDecks();
			}
			if(!DeckList.AllTags.Contains("Arena"))
			{
				DeckList.AllTags.Add("Arena");
				WriteDecks();
			}
			if(!DeckList.AllTags.Contains("Constructed"))
			{
				DeckList.AllTags.Add("Constructed");
				WriteDecks();
			}

			Options.ComboboxAccent.ItemsSource = ThemeManager.Accents;
			Options.ComboboxTheme.ItemsSource = ThemeManager.AppThemes;
			Options.ComboboxLanguages.ItemsSource = Helper.LanguageDict.Keys;

			Options.ComboboxKeyPressGameStart.ItemsSource = EventKeys;
			Options.ComboboxKeyPressGameEnd.ItemsSource = EventKeys;

			LoadConfig();

			FillElementSorters();

			//this has to happen before reader starts
			var lastDeck = DeckList.DecksList.FirstOrDefault(d => d.Name == Config.Instance.LastDeck);
			DeckPickerList.SelectDeck(lastDeck);

			TurnTimer.Create(90);

			SortFilterDecksFlyout.HideStuffToCreateNewTag();
			TagControlEdit.OperationSwitch.Visibility = Visibility.Collapsed;
			TagControlEdit.PnlSortDecks.Visibility = Visibility.Collapsed;


			UpdateDbListView();

			_doUpdate = _foundHsDirectory;
			UpdateOverlayAsync();

			_initialized = true;
			Options.MainWindowInitialized();

			DeckPickerList.UpdateList();
			if(lastDeck != null)
			{
				DeckPickerList.SelectDeck(lastDeck);
				UpdateDeckList(lastDeck);
				UseDeck(lastDeck);
			}

			if(_foundHsDirectory)
				HsLogReader.Instance.Start();

			Helper.SortCardCollection(ListViewDeck.Items, Config.Instance.CardSortingClassFirst);
			DeckPickerList.SortDecks();
		}
Example #34
0
 private void DirectXOverlay_Paint(OverlayWindow w, Graphics g)
 {
     StatisticsDraw(w, g, 5, 50);
     HealthDraw(w, g, 5, 25);
     InventoryDraw(w, g, 200, 25);
 }
Example #35
0
    /// <summary>
    /// Opens windows to orient the robot
    /// </summary>
    public void ShowOrient()
    {
        List <string> titles = new List <string> ();

        titles.Add("Left");
        titles.Add("Right");
        titles.Add("Forward");
        titles.Add("Back");
        titles.Add("Save Orientation");
        titles.Add("Close");
        titles.Add("Default");

        List <Rect> rects = new List <Rect> ();

        rects.Add(new Rect(40, 200, 105, 35));
        rects.Add(new Rect(245, 200, 105, 35));
        rects.Add(new Rect(147, 155, 105, 35));
        rects.Add(new Rect(147, 245, 105, 35));
        rects.Add(new Rect(110, 95, 190, 35));
        rects.Add(new Rect(270, 50, 90, 35));
        rects.Add(new Rect(50, 50, 90, 35));

        oWindow = new TextWindow("Orient Robot", new Rect((Screen.width / 2) - 150, (Screen.height / 2) - 125, 400, 300),
                                 new string[0], new Rect[0], titles.ToArray(), rects.ToArray());
        //The directional buttons lift the robot to avoid collison with objects, rotates it, and saves the applied rotation to a vector3
        gui.AddWindow("Orient Robot", oWindow, (object o) => {
            mainNode.transform.position = new Vector3(mainNode.transform.position.x, 1, mainNode.transform.position.z);
            switch ((int)o)
            {
            case 0:
                mainNode.transform.position = new Vector3(mainNode.transform.position.x, 1, mainNode.transform.position.z);
                mainNode.transform.Rotate(new Vector3(0, 0, 45));
                break;

            case 1:
                mainNode.transform.position = new Vector3(mainNode.transform.position.x, 1, mainNode.transform.position.z);
                mainNode.transform.Rotate(new Vector3(0, 0, -45));
                break;

            case 2:
                mainNode.transform.position = new Vector3(mainNode.transform.position.x, 1, mainNode.transform.position.z);
                mainNode.transform.Rotate(new Vector3(45, 0, 0));
                break;

            case 3:
                mainNode.transform.position = new Vector3(mainNode.transform.position.x, 1, mainNode.transform.position.z);
                mainNode.transform.Rotate(new Vector3(-45, 0, 0));
                break;

            case 4:
                rotation = mainNode.transform.rotation;
                Debug.Log(rotation);
                break;

            case 5:
                oWindow.Active = false;
                break;

            case 6:
                rotation = Quaternion.identity;
                mainNode.transform.rotation = rotation;
                break;
            }
        });
    }
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Create dock manager.
        /// </summary>
        public DockManager()
        {
            InitializeComponent();

            DragPaneServices.Register(this);

            _overlayWindow = new OverlayWindow(this);
        }