示例#1
0
文件: Helpers.cs 项目: kevin-ye/KOS
 public Lock GetLock(string lockIdentifier)
 {
     if (locks.ContainsKey(lockIdentifier))
     {
         return locks[lockIdentifier];
     }
     var lockObject = new Lock(lockIdentifier);
     locks.Add(lockIdentifier, lockObject);
     newLocks.Add(lockObject);
     return lockObject;
 }
示例#2
0
        private void UnlockIdentifier(Lock lockObject)
        {
            if (lockObject.IsInitialized())
            {
                if (lockObject.IsSystemLock())
                {
                    // disable this FlyByWire parameter
                    AddOpcode(new OpcodePush(lockObject.Identifier));
                    AddOpcode(new OpcodePush(false));
                    AddOpcode(new OpcodeCall("toggleflybywire()"));

                    // remove update trigger
                    string triggerIdentifier = "lock-" + lockObject.Identifier;
                    if (_context.Triggers.Contains(triggerIdentifier))
                    {
                        Trigger triggerObject = _context.Triggers.GetTrigger(triggerIdentifier);
                        AddOpcode(new OpcodePush(null)).DestinationLabel = triggerObject.GetFunctionLabel();
                        AddOpcode(new OpcodeRemoveTrigger());
                    }
                }

                // unlock variable
                AddOpcode(new OpcodePush(lockObject.PointerIdentifier));
                AddOpcode(new OpcodePush(null)).DestinationLabel = lockObject.DefaultLabel;
                AddOpcode(new OpcodeStore());
            }
        }
示例#3
0
文件: Helpers.cs 项目: WazWaz/KOS
 public Lock GetLock(string lockIdentifier)
 {
     if (_locks.ContainsKey(lockIdentifier))
     {
         return _locks[lockIdentifier];
     }
     else
     {
         Lock lockObject = new Lock(lockIdentifier);
         _locks.Add(lockIdentifier, lockObject);
         _newLocks.Add(lockObject);
         return lockObject;
     }
 }