コード例 #1
0
ファイル: Room.cs プロジェクト: jabbo/Jabbo
        public void removeUser(ConnectedUser userToRemove)
        {
            if (!containsUser(userToRemove._UserID))
            {
                return;
            }

            _Users.Remove(userToRemove._UserID);

            foreach (ConnectedUser usr in _Users.Values)
            {
                RemoveAvatarPacket toremove = new RemoveAvatarPacket();
                toremove.I = userToRemove._UserID;
                string stringtoremove = JsonConvert.SerializeObject(toremove);
                usr.sendData("058" + stringtoremove + "#");
            }

            if (!(userToRemove._Room_X == doorstep_x && userToRemove._Room_Y == doorstep_y))
            {
                try { _sqUnit[userToRemove._Room_X, userToRemove._Room_Y] = false; } catch { }
            }

            userToRemove._Room_X = 0;
            userToRemove._Room_Y = 0;
            userToRemove._Room_X_Target = 0;
            userToRemove._Room_Y_Target = 0;
            userToRemove._HasRights = false;
            userToRemove._Drink = "";
            userToRemove._Brb = 0;
            userToRemove._Room_Sit = "";

            if ((countUsers()) == 0)
            {
                _Users.Clear();
                _Bots.Clear();
                RoomManager.removeRoom(RoomID);
            }
        }
コード例 #2
0
ファイル: Room.cs プロジェクト: jabbo/Jabbo
        public void removeBot(int botID)
        {
            if (!containsBot(botID))
                return;

            RoomBot botToRemove = (RoomBot)_Bots[botID];
            _Bots.Remove(botID);

            int avatarID = botID - botID * 2;

            foreach (ConnectedUser usr in _Users.Values)
            {
                RemoveAvatarPacket toremove = new RemoveAvatarPacket();
                toremove.I = botToRemove._MyAvatarID;
                string stringtoremove = JsonConvert.SerializeObject(toremove);
                usr.sendData("058" + stringtoremove + "#");
            }

            if (((botToRemove._MyX + 1).ToString()) + "_" + ((botToRemove._MyY + 1).ToString()) != door)
            {
                _sqUnit[botToRemove._MyX, botToRemove._MyY] = false;
            }

            if ((countUsers()) == 0)
            {
                _Users.Clear();
                _Bots.Clear();
                RoomManager.removeRoom(RoomID);
            }
        }