Example #1
0
        public ObiasRoom OpenSupportRoom(ObiasClient c)
        {
            Random    rnd        = new Random();
            int       RoomNumber = 3;
            ObiasRoom r          = new ObiasRoom("Support", RoomNumber);

            r.join(c);
            r.join(Support[rnd.Next(0, Support.Count)]);
            return(r);
        }
Example #2
0
        private void command(String cmd)
        {
            String[] args = cmd.Split(" ");
            switch (args[0].ToLower())
            {
            case "join":
                if (loggedIn)
                {
                    if (args.Length >= 2)
                    {
                        msg("Joined room " + args[1]);
                    }
                    else
                    {
                        msg("No room given");
                    }
                }
                else
                {
                    msg("you musst logged in");
                }
                break;

            case "login":
                if (args.Length == 2)
                {
                    Username = args[1];
                    live.User.Add(Username, this);
                    msg("Logged as " + Username);
                    loggedIn = true;
                }
                break;

            case "loginassupport":
                if (args.Length == 2)
                {
                    Username = args[1];
                    live.Support.Add(this);
                    msg("Logged as " + Username);
                    loggedIn = true;
                }
                break;

            case "send":
                if (!isInRoom)
                {
                    if (args.Length >= 3)
                    {
                        if (live.User.ContainsKey(args[1]))
                        {
                            String msg = "- ";
                            for (int i = 2; i < args.Length; i++)
                            {
                                msg = msg + args[i] + " ";
                            }
                            live.User[args[1]].msg(Username + ": " + msg);
                        }
                        else
                        {
                            this.msg("User Existiert nicht");
                        }
                    }
                }
                else if (args.Length >= 2 && isInRoom)
                {
                    String msg = " ";
                    for (int i = 1; i < args.Length; i++)
                    {
                        msg = msg + args[i] + " ";
                    }
                    room.msg(this, msg);
                }
                break;

            case "opensupport":
                if (args.Length == 1)
                {
                    if (loggedIn)
                    {
                        ObiasRoom room = live.OpenSupportRoom(this);
                        isInRoom  = true;
                        this.room = room;
                    }
                }
                break;
            }
        }