Пример #1
0
        /// <summary>
        /// Release all the locks (update and control) of a vessel
        /// </summary>
        public void ReleaseAllVesselLocks(IEnumerable <string> crewNames, Guid vesselId, int msDelay = 0)
        {
            TaskFactory.StartNew(() =>
            {
                if (msDelay > 0)
                {
                    Thread.Sleep(msDelay);
                }


                if (LockQuery.UnloadedUpdateLockBelongsToPlayer(vesselId, SettingsSystem.CurrentSettings.PlayerName))
                {
                    ReleaseLock(new LockDefinition(LockType.UnloadedUpdate, SettingsSystem.CurrentSettings.PlayerName, vesselId));
                }
                if (LockQuery.UpdateLockBelongsToPlayer(vesselId, SettingsSystem.CurrentSettings.PlayerName))
                {
                    ReleaseLock(new LockDefinition(LockType.Update, SettingsSystem.CurrentSettings.PlayerName, vesselId));
                }
                if (LockQuery.ControlLockBelongsToPlayer(vesselId, SettingsSystem.CurrentSettings.PlayerName))
                {
                    ReleaseLock(new LockDefinition(LockType.Control, SettingsSystem.CurrentSettings.PlayerName, vesselId));
                }
                foreach (var kerbal in crewNames)
                {
                    if (LockQuery.KerbalLockBelongsToPlayer(kerbal, SettingsSystem.CurrentSettings.PlayerName))
                    {
                        ReleaseLock(new LockDefinition(LockType.Kerbal, SettingsSystem.CurrentSettings.PlayerName, kerbal));
                    }
                }
            });
        }
Пример #2
0
        private void ReleaseAllVesselLocksImpl(IEnumerable <string> crewNames, Guid vesselId)
        {
            if (LockQuery.UnloadedUpdateLockBelongsToPlayer(vesselId, SettingsSystem.CurrentSettings.PlayerName))
            {
                ReleaseLock(new LockDefinition(LockType.UnloadedUpdate, SettingsSystem.CurrentSettings.PlayerName, vesselId));
            }
            if (LockQuery.UpdateLockBelongsToPlayer(vesselId, SettingsSystem.CurrentSettings.PlayerName))
            {
                ReleaseLock(new LockDefinition(LockType.Update, SettingsSystem.CurrentSettings.PlayerName, vesselId));
            }
            if (LockQuery.ControlLockBelongsToPlayer(vesselId, SettingsSystem.CurrentSettings.PlayerName))
            {
                ReleaseLock(new LockDefinition(LockType.Control, SettingsSystem.CurrentSettings.PlayerName, vesselId));
            }

            if (crewNames != null)
            {
                foreach (var kerbal in crewNames)
                {
                    if (LockQuery.KerbalLockBelongsToPlayer(kerbal, SettingsSystem.CurrentSettings.PlayerName))
                    {
                        ReleaseLock(new LockDefinition(LockType.Kerbal, SettingsSystem.CurrentSettings.PlayerName, kerbal));
                    }
                }
            }
        }
Пример #3
0
 /// <summary>
 /// Aquire the update lock on the given vessel
 /// </summary>
 public void AcquireUpdateLock(Guid vesselId, bool force = false)
 {
     if (!LockQuery.UpdateLockBelongsToPlayer(vesselId, SettingsSystem.CurrentSettings.PlayerName))
     {
         AcquireLock(new LockDefinition(LockType.Update, SettingsSystem.CurrentSettings.PlayerName, vesselId), force);
     }
 }
Пример #4
0
 /// <summary>
 /// Release all the locks (update and control) of a vessel
 /// </summary>
 public void ReleaseAllVesselLocks(Guid vesselId)
 {
     if (LockQuery.UpdateLockBelongsToPlayer(vesselId, SettingsSystem.CurrentSettings.PlayerName))
     {
         ReleaseLock(new LockDefinition(LockType.Update, SettingsSystem.CurrentSettings.PlayerName, vesselId));
     }
     if (LockQuery.ControlLockBelongsToPlayer(vesselId, SettingsSystem.CurrentSettings.PlayerName))
     {
         ReleaseLock(new LockDefinition(LockType.Control, SettingsSystem.CurrentSettings.PlayerName, vesselId));
     }
 }
Пример #5
0
        /// <summary>
        /// Release all the locks (update and control) of a vessel
        /// </summary>
        public void ReleaseAllVesselLocks(Guid vesselId, int msDelay = 0)
        {
            TaskFactory.StartNew(() =>
            {
                if (msDelay > 0)
                {
                    Thread.Sleep(msDelay);
                }

                if (LockQuery.UnloadedUpdateLockBelongsToPlayer(vesselId, SettingsSystem.CurrentSettings.PlayerName))
                {
                    ReleaseLock(new LockDefinition(LockType.UnloadedUpdate, SettingsSystem.CurrentSettings.PlayerName, vesselId));
                }
                if (LockQuery.UpdateLockBelongsToPlayer(vesselId, SettingsSystem.CurrentSettings.PlayerName))
                {
                    ReleaseLock(new LockDefinition(LockType.Update, SettingsSystem.CurrentSettings.PlayerName, vesselId));
                }
                if (LockQuery.ControlLockBelongsToPlayer(vesselId, SettingsSystem.CurrentSettings.PlayerName))
                {
                    ReleaseLock(new LockDefinition(LockType.Control, SettingsSystem.CurrentSettings.PlayerName, vesselId));
                }
            });
        }