Beispiel #1
0
        /// <summary>
        /// Resets the Slot of the calling user
        /// </summary>
        /// <param name="service"></param>
        internal void UnsetPlayerState(SimulationService service)
        {
            ClientInfo client;

            if (clients.TryGetValue(service, out client))
            {
                Slot slot = null;
                lock (simulationLock)
                {
                    // Find Slot
                    for (int i = 0; i < slots.Length; i++)
                    {
                        // Reset old slot
                        if (slots[i].Profile == client.UserProfile)
                        {
                            slot            = slots[i];
                            slot.PlayerInfo = false;
                            slot.Profile    = null;
                            slot.ReadyState = false;
                            break;
                        }
                    }
                }

                // Send Info about the current Slot
                if (slot != null)
                {
                    SendPlayerChanged(slot);
                }
            }
            else
            {
                throw new InvalidOperationException("Client not registered");
            }
        }
        /// <summary>
        /// Resets the Slot of the calling user
        /// </summary>
        /// <param name="service"></param>
        internal void UnsetPlayerState(SimulationService service)
        {
            ClientInfo client;
            if (clients.TryGetValue(service, out client))
            {
                Slot slot = null;
                lock (simulationLock)
                {
                    // Find Slot
                    for (int i = 0; i < slots.Length; i++)
                    {
                        // Reset old slot
                        if (slots[i].Profile == client.UserProfile)
                        {
                            slot = slots[i];
                            slot.PlayerInfo = false;
                            slot.Profile = null;
                            slot.ReadyState = false;
                            break;
                        }
                    }
                }

                // Send Info about the current Slot
                if (slot != null)
                    SendPlayerChanged(slot);
            }
            else
            {
                throw new InvalidOperationException("Client not registered");
            }
        }