コード例 #1
0
        /// <summary>
        /// Removes given lock from storage
        /// </summary>
        public void RemoveLock(LockDefinition lockDefinition)
        {
            switch (lockDefinition.Type)
            {
            case LockType.Asteroid:
                lock (_asteroidSyncLock)
                {
                    AsteroidLock = null;
                }
                break;

            case LockType.UnloadedUpdate:
                UnloadedUpdateLocks.TryRemove(lockDefinition.VesselId, out _);
                break;

            case LockType.Update:
                UpdateLocks.TryRemove(lockDefinition.VesselId, out _);
                break;

            case LockType.Control:
                ControlLocks.TryRemove(lockDefinition.VesselId, out _);
                break;

            case LockType.Spectator:
                SpectatorLocks.TryRemove(lockDefinition.PlayerName, out _);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
コード例 #2
0
        /// <summary>
        /// Removes given lock from storage
        /// </summary>
        public void RemoveLock(LockType lockType, string playerName, Guid vesselId, string kerbalName)
        {
            switch (lockType)
            {
            case LockType.Asteroid:
                lock (_asteroidSyncLock)
                {
                    AsteroidLock = null;
                }
                break;

            case LockType.Kerbal:
                KerbalLocks.TryRemove(kerbalName, out _);
                break;

            case LockType.UnloadedUpdate:
                UnloadedUpdateLocks.TryRemove(vesselId, out _);
                break;

            case LockType.Update:
                UpdateLocks.TryRemove(vesselId, out _);
                break;

            case LockType.Control:
                ControlLocks.TryRemove(vesselId, out _);
                break;

            case LockType.Spectator:
                SpectatorLocks.TryRemove(playerName, out _);
                break;

            case LockType.Contract:
                lock (_contractSyncLock)
                {
                    ContractLock = null;
                }
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }