Exemplo n.º 1
0
 public static void Stop()
 {
     if (_timer.Enabled)
     {
         _timer.Stop();
         _timer.Enabled = false;
     }
     Finished?.Invoke();
     Finished      = null;
     _userSettings = null;
     _keybinds     = null;
     MouseEmulation.UIAssistantAPI.ViewAPI.RemoveTargetingReticle();
 }
Exemplo n.º 2
0
        public static void Start()
        {
            var api      = MouseEmulation.UIAssistantAPI;
            var handlers = api.KeyboardAPI.CreateHookHandlers();

            handlers.KeyDown += Handlers_KeyDown;
            api.KeyboardAPI.Hook(handlers);
            Finished       += () => api.KeyboardAPI.Unhook(handlers);
            _timer          = new Timer();
            _timer.Interval = 100d / 6d;
            _timer.Elapsed += Timer_Elapsed;
            _timer.Start();
            _userSettings  = MouseEmulation.UIAssistantAPI.UIAssistantSettings;
            _mouseSettings = MouseEmulation.Settings;
            _keybinds      = api.KeyboardAPI.CreateKeybindManager();
            _keybinds.Add(_userSettings.Quit, () => { Stop(); MouseEmulation.UIAssistantAPI.PluginManager.Exit(); });
            _keybinds.Add(_userSettings.Back, () => { Stop(); MouseEmulation.UIAssistantAPI.PluginManager.Undo(); });
            _keybinds.Add(_userSettings.Usage, () =>
            {
                if (_usagePanel == null)
                {
                    MouseEmulation.UIAssistantAPI.ViewAPI.UIDispatcher.Invoke(() =>
                    {
                        _usagePanel = new Usage();
                        MouseEmulation.UIAssistantAPI.ViewAPI.AddPanel(_usagePanel);
                        Finished += RemoveUsagePanel;
                    });
                }
                else
                {
                    RemoveUsagePanel();
                    Finished -= RemoveUsagePanel;
                }
            });
            MouseEmulation.UIAssistantAPI.ViewAPI.AddTargetingReticle();
        }
Exemplo n.º 3
0
 public KeyInputContext(IHookHandlers handlers, IKeybindManager keybinds)
 {
     HookHandlers = handlers;
     Keybinds     = keybinds;
 }