Example #1
0
 public void Dispose()
 {
     if (autoSavedManager != null)
     {
         autoSavedManager.Abort();
     }
     if (AutoInstManager != null &&
         AutoInstManager.IsAlive)
     {
         AutoInstManager.Abort();
     }
     MainRoutine.Dispose();
     MainRoutine = null;
     foreach (var subRoutine in SubRoutines)
     {
         subRoutine.Dispose();
     }
     SubRoutines.Clear();
     MMonitorManager.Dispose();
     MTVModel.Dispose();
     MMonitorManager = null;
     //MTVModel = null;
     PManager = null;
     UManager = null;
     LibFuncBlock.Dispose();
     LibFuncBlock = null;
     foreach (var funcBlock in FuncBlocks)
     {
         funcBlock.Dispose();
     }
     FuncBlocks.Clear();
 }
Example #2
0
        private void MainBotLoop()
        {
            var main = new MainRoutine(GameState);

            ScreenReader.DetectSide(GameState);
            main.Root.Start(GameState);

            while (true)
            {
                if (!MainWindow.IsPaused)
                {
                    counterCallsPerSecond++;
                    try
                    {
                        var tack = main.Root.Tick(GameState);
                        if (tack != RunStatus.Running)
                        {
                            main.Root.Stop(GameState);

                            main.Root.Start(GameState);
                        }
                        Thread.Sleep(50);
                    }
                    catch (Exception e)
                    {
                    }
                }
                else
                {
                    Thread.Sleep(1000);
                }
            }
        }
        public MainWindow()
        {
            var       main = new MainRoutine(null);
            TreeDebug td   = new TreeDebug();

            td.AnalyzeComposite(main.Root, null);
            td.ShowDialog();
            InitializeComponent();
            Instance     = this;
            keyboardHook = new KeyboardHook();
            keyboardHook.RegisterHotKey(0, Keys.F1);
            keyboardHook.KeyPressed += KeyboardHook_KeyPressed;
            IsPaused = false;
            var myTimer = new Timer();

            myTimer.Elapsed += DisplayTimeEvent;
            myTimer.Interval = 1000; // 1000 ms is one second
            myTimer.Start();
            ControlInput.SetupHeroesWindow();
        }