public void SetAvailableReinforcements(IBatchOperationHandle batchOperationHandle, Guid sessionId, string userId, string currentEtag, uint reinforcements) { DummySession foundSession = SessionRepository.SessionMap[sessionId]; DummyBatchOperationHandle batchOperation = batchOperationHandle as DummyBatchOperationHandle; if (foundSession != null) { DummyNationData foundPlayer = foundSession.Players.Find(player => player.UserId == userId); if (foundPlayer != null) { batchOperation.QueuedOperations.Add(() => { foundPlayer.AvailableReinforcements = reinforcements; }); } else { throw new InvalidOperationException("Called MarkPlayerCompletedPhase with a non-existent user id"); } } else { throw new InvalidOperationException("Called JoinSession with a non-existent GUID"); } }
public void SetCardOwner(IBatchOperationHandle batchOperationHandle, Guid sessionId, Guid regionId, String userId, String currentEtag) { DummySession foundSession = SessionRepository.SessionMap[sessionId]; if (foundSession != null) { DummyNationData foundPlayer = foundSession.Players.Find(player => player.UserId == userId); if (foundPlayer != null) { SetCardOwnerInternal(batchOperationHandle, sessionId, regionId, userId, currentEtag); } else { throw new InvalidOperationException("Called SetCardOwner with a non-existent user id"); } } else { throw new InvalidOperationException("Called SetCardOwner with a non-existent session id"); } }
public Task MarkPlayerCompletedPhase(Guid sessionId, String userId, Guid phaseId) { DummySession foundSession = SessionRepository.SessionMap[sessionId]; if (foundSession != null) { DummyNationData foundPlayer = foundSession.Players.Find(player => player.UserId == userId); if (foundPlayer != null) { foundPlayer.CompletedPhase = phaseId; return(Task.FromResult(false)); } else { throw new InvalidOperationException("Called MarkPlayerCompletedPhase with a non-existent user id"); } } else { throw new InvalidOperationException("Called JoinSession with a non-existent GUID"); } }