示例#1
0
        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");
            }
        }
示例#2
0
        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");
            }
        }
示例#3
0
        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");
            }
        }