コード例 #1
0
        public override void OnMessage(RoomConnection sender, Message m)
        {
            switch (m.Type)
            {
            case "init":
                new Task(() =>
                {
                    //Console.WriteLine(sender.Room);
                    //sender.Connection.Send("say", @"Hi, everybody! Yes, I am annoying.");
                    //System.Threading.Thread.Sleep(25);
                    sender.Connection.Send("say", @"Play Cheese Edits: https://www.mediafire.com/?9114ak36c52wqe6");
                    System.Threading.Thread.Sleep(100);
                    sender.Connection.Disconnect();
                    this.connections.Remove(sender.Room);
                }).Start();
                break;

            case "add":
                if (!players.Contains(m.GetString(1).ToLower()))
                {
                    players.Add(m.GetString(1).ToLower());
                }
                break;
            }
        }
コード例 #2
0
 public virtual void OnDisconnect(RoomConnection sender, string reason)
 {
     Console.WriteLine("{0} kicked by reason {1}", sender.Room, reason);
     connections.Remove(sender.Room);
 }
コード例 #3
0
 public abstract void OnMessage(RoomConnection sender, Message m);
コード例 #4
0
 public virtual void OnConnected(RoomConnection sender)
 {
 }
コード例 #5
0
 public virtual void OnConnectFailed(RoomConnection sender)
 {
     connections.Remove(sender.Room);
 }