Cakewalk.Server.Zones.ZoneManager.RequestZoneTransfer C# (CSharp) Метод

RequestZoneTransfer() публичный Метод

Tries to move a user in to a new zone.
public RequestZoneTransfer ( ServerEntity entity, int newZoneID ) : bool
entity ServerEntity
newZoneID int
Результат bool
        public bool RequestZoneTransfer(ServerEntity entity, int newZoneID)
        {
            //Check the zone exists
            if (m_zones.ContainsKey(newZoneID))
            {
                Zone newZone = m_zones[newZoneID];

                //See if the user is already in a zone
                if (m_userZones.ContainsKey(entity))
                {
                    //Remove them from their current zone
                    Zone currentZone = m_userZones[entity];
                    currentZone.RemoveEntity(entity);
                }
                else
                {
                    //Add them to the zone index
                    m_userZones.Add(entity, newZone);
                }

                //Move them in to their new zone
                m_userZones[entity] = newZone;
                newZone.AddEntity(entity);

                return true;
            }

            return false;
        }