//void OnReturnToDivergencePointAnswer(NetworkMessage netMsg) //{ // ReturnToDivergencePointAnswerMessage msg = netMsg.ReadMessage<ReturnToDivergencePointAnswerMessage>(); // algorithmRespect.ReturnToDivergencePointAnswer.Value = msg.answer; //} void SendDirective(Directive directive) { DirectiveMessage msg = new DirectiveMessage(); msg.directive = directive; client.Send(msg.GetMsgType(), msg); }
void StartServer() { if (server == null) { server = new NetworkServerSimple(); server.RegisterHandler(MsgType.Connect, OnConnect); server.RegisterHandler(MsgType.Disconnect, OnDisconnect); server.RegisterHandler(DirectiveMessage.GetCustomMsgType(), OnDirective); server.RegisterHandler(RequestForGameInformationMessage.GetCustomMsgType(), OnRequestForGameInformation); server.RegisterHandler(ReturnToDivergencePointRequestMessage.GetCustomMsgType(), OnReturnToDivergencePointRequest); server.Listen(serverPort); } }
void OnDirective(NetworkMessage netMsg) { DirectiveMessage msg = netMsg.ReadMessage <DirectiveMessage>(); directive.CurrentDirective.Set(msg.directive, notify: true); }