public void RequestSimulationLock(string guid, SimulationLockType lockType, LockRequestCompleted whenCompleted) { SimulationOwnershipRequest ownershipRequest = new SimulationOwnershipRequest(muliplayerSession.Reservation.PlayerId, guid, lockType); packetSender.Send(ownershipRequest); completeFunctionsByGuid[guid] = whenCompleted; }
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?"); } }
public LockRequest(NitroxId id, SimulationLockType lockType, LockRequestCompleted onComplete, T context) : base(id, lockType) { this.onComplete = onComplete; this.context = context; }