Exemplo n.º 1
0
        /// <summary>
        /// called by rooms when a player finishes connecting
        /// </summary>
        internal void FinishedRoomSwitch()
        {
#if DEBUG
            Debug.Log($"Finished switching {this}");
#endif
            //update our actual room
            _currentRoom     = _switchingToRoom;
            _switchingToRoom = Guid.Empty;
            Room.MovePlayerCount(Server, _oldRoom, _currentRoom);
            _oldRoom = Guid.Empty;
            //and synchronize data
            SynchNetData();

            try
            {
                FinishedSwitchingRooms.Raise(Server.GetRoom(_currentRoom));
            }
            catch (Exception e)
            {
                Debug.LogException(e);
            }

            if (Interlocked.Exchange(ref _changingRooms, 0) != 1)
            {
                Debug.LogError($"Player {this} was marked as having finished switching rooms, but they were not actually in the process of doing so. This should never happen");
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// called by rooms when a player finishes connecting
        /// </summary>
        internal void FinishedRoomSwitch()
        {
#if DEBUG
            Debug.Log($"Finished switching {this}");
#endif
            //update our actual room
            _currentRoom     = _switchingToRoom;
            _switchingToRoom = Guid.Empty;
            Room.MovePlayerCount(Server, _oldRoom, _currentRoom);
            _oldRoom = Guid.Empty;
            //and synchronize data
            SynchNetData();
            FinishedSwitchingRooms?.Invoke(Server.GetRoom(_currentRoom));
        }