コード例 #1
0
        public override IMessage Process(IGameMaster gameMaster)
        {
            if (PlayerGuid == default(Guid))
            {
                //Console.WriteLine("Unsigned request");
                return(null);
            }

            var optionalSenderId = gameMaster.Authorize(PlayerGuid);

            if (!optionalSenderId.HasValue)
            {
                //Console.WriteLine("Unrecognized player");
                return(null);
            }

            var senderId = optionalSenderId.Value;

            //Console.WriteLine($"Player {senderId} request to {WithPlayerId}");

            if (!gameMaster.PlayerIdExists(WithPlayerId))
            {
                return(new RejectKnowledgeExchangeMessage(senderId, WithPlayerId, null, true));
            }
            gameMaster.EvaluateAction(GetActionInfo());
            return(null);
        }
コード例 #2
0
        public override IMessage Process(IGameMaster gameMaster)
        {
            var result = gameMaster.EvaluateAction(GetActionInfo());

            return(DataMessage.FromBoardDataOverridingTimestamps(result.data, result.isGameFinished));
        }