Beispiel #1
0
        public override void Execute()
        {
            //TODO: Update game data
            GameStateUpdateMessage updateMessage;
            GameManagerAppWorker   tempWorker = ((GameManagerAppWorker)myConversation.commFacility.myAppWorker);

            foreach (IPEndPoint userEndPoint in tempWorker.GameInfo.UserEndPoints.Values)
            {
                for (short i = 0; i < 4; i++)
                {
                    updateMessage = new GameStateUpdateMessage(myConversation.FirstEnvelope.message.convId, tempWorker.GameInfo.GameId, i, tempWorker.GameInfo.PlayerPoints, tempWorker.GameInfo.PlayerCardAmounts, tempWorker.GameInfo.BoardLayout, tempWorker.GameInfo.PlayerWithLR, tempWorker.GameInfo.LastMove);
                    tempWorker.GameInfo.UserEndPoints.TryGetValue((int)i, out ep);
                    envelopes[i] = new Envelope(updateMessage, ep);
                }
            }
            receivedEnvelopes = SendAndReceiveMultMessage(envelopes);
            if (HaveReceivedFromAll(receivedEnvelopes) && receivedAcks(receivedEnvelopes))
            {
                myConversation.SetState(((EndTurnConversation)myConversation).GetWaitForAcks());
            }
            else
            {
                Logger.Error("Failed to receive the correct ack from all users");
            }
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            GameManagerAppWorker appWorker = new GameManagerAppWorker(args);

            appWorker.Start();
        }
Beispiel #3
0
 public TempState(GameManagerAppWorker appWorker)
     : base(appWorker)
 {
 }
 public StartUpState(GameManagerAppWorker appWorker, string[] args)
     : base(appWorker)
 {
     this.args = args;
 }