public static void HandleMessage(ClientStructure client, IClientMessageBase message)
        {
            var data = message.Data as KerbalBaseMsgData;

            switch (data?.KerbalMessageType)
            {
            case KerbalMessageType.Request:
                KerbalSystem.HandleKerbalsRequest(client);
                //We don't use this message anymore so we can recycle it
                message.Recycle();
                break;

            case KerbalMessageType.Proto:
                KerbalSystem.HandleKerbalProto(client, (KerbalProtoMsgData)data);
                break;

            case KerbalMessageType.Remove:
                KerbalSystem.HandleKerbalRemove(client, (KerbalRemoveMsgData)data);

                break;

            default:
                throw new NotImplementedException("Kerbal type not implemented");
            }
        }
Exemple #2
0
        public override void HandleMessage(ClientStructure client, IMessageData messageData)
        {
            var message = messageData as KerbalBaseMsgData;

            switch (message?.KerbalMessageType)
            {
            case KerbalMessageType.Request:
                KerbalSystem.HandleKerbalsRequest(client);
                break;

            case KerbalMessageType.Proto:
                KerbalSystem.HandleKerbalProto(client, (KerbalProtoMsgData)message);
                break;

            case KerbalMessageType.Remove:
                KerbalSystem.HandleKerbalRemove(client, (KerbalRemoveMsgData)message);

                break;

            default:
                throw new NotImplementedException("Kerbal type not implemented");
            }
        }