protected override void ProcessReply(Reply reply)
 {
     if (reply.Success)
         ((Player)Process).UmbrellaRaised = true;
     else
         ((Player)Process).Umbrella = null;
 }
Esempio n. 2
0
        public void Reply_TestEverything()
        {
            Reply r1 = new Reply();
            Assert.IsFalse(r1.Success);
            Assert.IsNull(r1.Note);

            Reply r2 = new Reply()
            {
                Success = true,
                Note = "Testing"
            };

            Assert.IsTrue(r2.Success);
            Assert.AreEqual("Testing", r2.Note);

            byte[] bytes = r2.Encode();
            string tmp = Encoding.ASCII.GetString(bytes);

            Message m2 = Message.Decode(bytes);
            Reply r3 = m2 as Reply;
            Assert.IsNotNull(r3);
            Assert.AreNotSame(r2, r3);
            Assert.IsTrue(r3.Success);
            Assert.AreEqual(r2.Note, r3.Note);
        }
 protected override void ProcessReply(Reply reply)
 {
     if (reply.Success)
     {
         ((Player)Process).GameData.ChangeHitPoints(1);
     }
 }
Esempio n. 4
0
 protected override void ProcessReply(Reply reply)
 {
     BalloonReply balloon = reply as BalloonReply;
     if (balloon.Success)
         ((Player)Process).Balloons.Enqueue(balloon.Balloon);
     else
         ((Player)Process).Pennies.Push(penny);
 }
Esempio n. 5
0
 protected override void ProcessReply(Reply reply)
 {
     if (reply.Success)
     {
         Process.CleanupSession();
         Process.MyProcessInfo.Status = ProcessInfo.StatusCode.Terminating;
     }
 }
Esempio n. 6
0
 protected override void ProcessReply(Reply reply)
 {
     if (reply.Success)
     {
         Process.CleanupSession();
         Process.MyProcessInfo.Status = ProcessInfo.StatusCode.Registered;
     }
 }
Esempio n. 7
0
 protected override void ProcessReply(Reply reply)
 {
     if(reply.Success)
     {
         GameListReply listReply = reply as GameListReply;
         ((Player)Process).PotentialGames = listReply.GameInfo.ToList();
         Process.MyProcessInfo.Status = ProcessInfo.StatusCode.JoiningGame;
     }
 }
Esempio n. 8
0
        protected override void ProcessReply(Reply reply)
        {
            NextIdReply idReply = reply as NextIdReply;

            if (idReply.Success)
            {
                ((BalloonStore)Process).NextId = idReply.NextId;
                ((BalloonStore)Process).NumIds = idReply.NumberOfIds;
            }
        }
Esempio n. 9
0
        protected override void ProcessReply(Reply reply)
        {
            LoginReply loginReply = reply as LoginReply;

            if (loginReply.Success)
            {
                Process.ProxyEndPoint = loginReply.ProxyEndPoint;
                ((Player)Process).PennyBankEndPoint = loginReply.PennyBankEndPoint;
                ((Player)Process).PennyBankPublicKey = loginReply.PennyBankPublicKey;
                Process.MyProcessInfo = loginReply.ProcessInfo;
                MessageNumber.LocalProcessId = loginReply.ProcessInfo.ProcessId;
            }
        }
Esempio n. 10
0
        protected override void ProcessReply(Reply reply)
        {
            if (reply.Success)
            {
                JoinGameReply joinReply = reply as JoinGameReply;

                ((BalloonStore)Process).Game = new GameInfo()
                {
                    GameId = ((BalloonStore)Process).Options.GameId,
                    GameManagerId = ((BalloonStore)Process).Options.GameManagerId,
                    Status = GameInfo.StatusCode.Available
                };
                Process.MyProcessInfo.Status = ProcessInfo.StatusCode.JoinedGame;
            }
        }
Esempio n. 11
0
        public void doWork()
        {
            Thread.Sleep(3000);
            IPEndPoint loginTarget = getEndpont(ConfigurationManager.AppSettings["registryIP"], ConfigurationManager.AppSettings["registryPort"]);

            bool running = true;
            while (running)
            {
                Program.socket.Connect(loginTarget);
                var receivedData = Program.socket.Receive(ref loginTarget);
                Message aRMessage = Message.Decode(receivedData);
                AliveRequest myAR = aRMessage as AliveRequest;
                Reply alive = new Reply
                {
                    Success = true
                };
                byte[] aReply = alive.Encode();
                Program.socket.Send(aReply, aReply.Length);
                Console.WriteLine("Responded to Alive.");
            }
        }
Esempio n. 12
0
        protected override void ProcessReply(Reply reply)
        {
            LoginReply loginReply = reply as LoginReply;

            if (loginReply.Success)
            {
                Process.ProxyEndPoint = loginReply.ProxyEndPoint;
                ((BalloonStore)Process).PennyBankEndPoint = loginReply.PennyBankEndPoint;
                ((BalloonStore)Process).PennyBankPublicKey = loginReply.PennyBankPublicKey;
                Process.MyProcessInfo = loginReply.ProcessInfo;
                MessageNumber.LocalProcessId = loginReply.ProcessInfo.ProcessId;


                RequestReply conv = CommSubsystem.ConversationFactory.CreateFromConversationType<NextIdConversation>();
                conv.TargetEndPoint = Process.RegistryEndPoint;

                conv.Execute();

                ((BalloonStore)Process).CreateBalloons();
            }
        }
Esempio n. 13
0
        protected override void ProcessReply(Reply reply)
        {
            if (reply.Success)
            {
                JoinGameReply joinReply = reply as JoinGameReply;

                ((Player)Process).GameData = new GameProcessData()
                {
                    HasUmbrellaRaised = false,
                    HitPoints = 0,
                    LifePoints = joinReply.InitialLifePoints,
                    Type = ProcessInfo.ProcessType.Player,
                    ProcessId = joinReply.MsgId.Pid,
                };
                ((Player)Process).Game = ((Player)Process).PotentialGames[0];
                Process.MyProcessInfo.Status = ProcessInfo.StatusCode.JoinedGame;
                ((Player)Process).PotentialGames.Clear();
            }
            else
            {
                ((Player)Process).PotentialGames.RemoveAt(0);
            }
        }
Esempio n. 14
0
 private void Receive(Reply reply)
 {
     logger.Debug("Received Logout Reply");
     ProcessInfo = null;
 }
Esempio n. 15
0
 public void Receive(AliveRequest request)
 {
     logger.Debug("Received Alive Request");
     Reply reply = new Reply()
     {
         Success = true,
         Note = "I'm alive!"
     };
     logger.Debug("Sending Alive Reply");
     Messager.Send(reply, RegistryEndPoint);
 }
 protected override void ProcessReply(Reply reply)
 {
     Parent.ValidatedByPennyBank = reply.Success;
 }
Esempio n. 17
0
 protected override void ProcessReply(Reply reply)
 {
     Process.BeginShutdown();
 }