コード例 #1
0
        public void RequestSimulationLock(string guid, SimulationLockType lockType, LockRequestCompleted whenCompleted)
        {
            SimulationOwnershipRequest ownershipRequest = new SimulationOwnershipRequest(muliplayerSession.Reservation.PlayerId, guid, lockType);

            packetSender.Send(ownershipRequest);
            completeFunctionsByGuid[guid] = whenCompleted;
        }
コード例 #2
0
        public void ReceivedSimulationLockResponse(string guid, bool lockAquired, SimulationLockType lockType)
        {
            Log.Info("Received lock response, guid: " + guid + " " + lockAquired + " " + lockType);

            if (lockAquired)
            {
                SimulateGuid(guid, lockType);
            }

            LockRequestCompleted requestCompleted = null;

            if (completeFunctionsByGuid.TryGetValue(guid, out requestCompleted) && requestCompleted != null)
            {
                completeFunctionsByGuid.Remove(guid);
                requestCompleted(guid, lockAquired);
            }
            else
            {
                Log.Warn("Did not have an outstanding simulation request for " + guid + " maybe there were multiple outstanding requests?");
            }
        }
コード例 #3
0
 public LockRequest(NitroxId id, SimulationLockType lockType, LockRequestCompleted onComplete, T context) : base(id, lockType)
 {
     this.onComplete = onComplete;
     this.context    = context;
 }