Example #1
0
        public bool Connect(string roomId)
        {
            if (LoggedIn)
            {
                client.Multiplayer.CreateJoinRoom(
                    roomId,
                    "Everybodyedits190",
                    true,
                    null,
                    null,
                    delegate(PlayerIOClient.Connection tempConnection)
                    {
                        connection = tempConnection;
                        connection.Send("init");
                        connection.AddOnDisconnect(new DisconnectEventHandler(onDisconnect));
                        connection.AddOnMessage(new MessageReceivedEventHandler(onMessage));

                        chatSayer = new ChatSayer(this);

                        subBotHandler.onConnect();

                        SafeInvoke.Invoke(mainForm, new Action(() => { mainForm.onConnectFinished(true); }));

                    },
                    delegate(PlayerIOError tempError)
                    {
                        SafeInvoke.Invoke(mainForm, new Action(() => { mainForm.onConnectFinished(false); }));
                        MessageBox.Show(tempError.ToString());
                    });
                return true;
            }
            return false;
        }