protected override void ProcessReply(Reply reply) { if (reply.Success) ((Player)Process).UmbrellaRaised = true; else ((Player)Process).Umbrella = null; }
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); } }
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); }
protected override void ProcessReply(Reply reply) { if (reply.Success) { Process.CleanupSession(); Process.MyProcessInfo.Status = ProcessInfo.StatusCode.Terminating; } }
protected override void ProcessReply(Reply reply) { if (reply.Success) { Process.CleanupSession(); Process.MyProcessInfo.Status = ProcessInfo.StatusCode.Registered; } }
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; } }
protected override void ProcessReply(Reply reply) { NextIdReply idReply = reply as NextIdReply; if (idReply.Success) { ((BalloonStore)Process).NextId = idReply.NextId; ((BalloonStore)Process).NumIds = idReply.NumberOfIds; } }
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; } }
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; } }
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."); } }
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(); } }
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); } }
private void Receive(Reply reply) { logger.Debug("Received Logout Reply"); ProcessInfo = null; }
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; }
protected override void ProcessReply(Reply reply) { Process.BeginShutdown(); }