Example #1
0
        private void Game_OnWndProc(WndEventArgs args)
        {
            if (Game.IsChatOpen || args.WParam != this.key)
            {
                return;
            }

            if (args.Msg == WM_KEYDOWN || args.Msg == WM_SYSKEYDOWN)
            {
                if (!this.keyDown)
                {
                    this.keyDown  = true;
                    this.startPos = Game.MouseScreenPosition - CircleSize / 2;
                }
            }
            else if (args.Msg == WM_KEYUP || args.Msg == WM_SYSKEYUP)
            {
                if (this.selectedAction != null)
                {
                    GameDispatcher.BeginInvoke(
                        () =>
                    {
                        this.selectedAction.Execute();
                        this.selectedAction = null;
                    });
                }
                this.keyDown = false;
            }
        }
Example #2
0
        private static async void UpdateOnLoad()
        {
            while (!loaderTask.IsCancellationRequested)
            {
                try
                {
                    await Task.Delay(250, loaderTask.Token);

                    if (OnLoad == null)
                    {
                        continue;
                    }

                    if (!IngameTrigger.Value)
                    {
                        continue;
                    }

                    var subscribers = OnLoad.GetInvocationList();

                    foreach (var subscriber in subscribers.Where(s => !NotifiedSubscribers.Contains(s)))
                    {
                        NotifiedSubscribers.Add(subscriber);

                        GameDispatcher.BeginInvoke(() => { subscriber.DynamicInvoke(Type, EventArgs.Empty); });
                    }
                }
                catch (TaskCanceledException)
                {
                    Console.WriteLine("Stopped LoaderTask");
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }
        }