示例#1
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();
            }
        }
示例#2
0
        /// <summary>
        /// Removes given lock from storage
        /// </summary>
        public void RemoveLock(LockDefinition lockDefinition)
        {
            switch (lockDefinition.Type)
            {
            case LockType.AsteroidComet:
                lock (_asteroidCometSyncLock)
                {
                    AsteroidCometLock = null;
                }
                break;

            case LockType.Kerbal:
                KerbalLocks.TryRemove(lockDefinition.KerbalName, out _);
                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;

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

            default:
                throw new ArgumentOutOfRangeException();
            }
        }