Example #1
0
        public Peggle(ChatWebsocket cws, MainForm form)
        {
            this.cws  = cws;
            this.form = form;
            if (FindTarget("popcapgame1"))               //Process name or window title
            {
                chatCommands = new Dictionary <string, Action>
                {
                    { "left", () => MoveLeft() },                     // Add chat command "left" to call the MoveLeft() function defined below
                    { "light left", () => MoveLittleLeft() },

                    { "right", () => MoveRight() },
                    { "light right", () => MoveLittleRight() },

                    { "up", () => MoveUp() },
                    { "down", () => MoveDown() },

                    { "shoot", () => Shoot() }
                };

                this.cws = cws;
                log("Loaded commands: " + String.Join(", ", chatCommands.Keys.ToArray()));
                log("Chat commands are active.");
                this.cws.NewMessage += HandleMessage;
            }
        }
Example #2
0
        private async void chatConnectionButton_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(Properties.Settings.Default.client_id))
            {
                MessageBox.Show("Please set your client ID in the settings tab");
                return;
            }
            cws             = new ChatWebsocket();
            cws.NewMessage += LogResponse;
            await cws.Connect();

            if (cws.GetStatus())
            {
                chatConnectionButton.Text = "Connected";
            }
            else
            {
                chatConnectionButton.Text = "Error connecting";
            }
        }