예제 #1
0
        public static MessagePlayerAction Parse(string s)
        {
            var message = new MessagePlayerAction(PopInt(ref s), PopInt(ref s), PopInt(ref s), Pop <PlayerAction>(ref s));

            switch (message.Action)
            {
            case PlayerAction.SelectAlongLine: message.Inner = MessageSelectAlongLine.Parse(s); break;

            case PlayerAction.SelectInBox: message.Inner = MessageSelectInBox.Parse(s); break;

            case PlayerAction.AttackMove: message.Inner = MessageAttackMove.Parse(s); break;

            case PlayerAction.PlaceBuilding: message.Inner = MessagePlaceBuilding.Parse(s); break;

            case PlayerAction.CastSpell: message.Inner = MessageCastSpell.Parse(s); break;

            case PlayerAction.ChatMessage: message.Inner = MessageChat.Parse(s); break;
            }

            return(message);
        }
예제 #2
0
        public static Message Parse(string s)
        {
            var Type    = Pop <MessageType>(ref s);
            var message = new Message(Type);

            switch (message.Type)
            {
            case MessageType.PlayerAction: message.Inner = MessagePlayerAction.Parse(s); break;

            case MessageType.PlayerActionAck: message.Inner = MessagePlayerActionAck.Parse(s); break;

            case MessageType.Bookend: message.Inner = MessageBookend.Parse(s); break;

            case MessageType.GameState: message.Inner = MessageGameState.Parse(s); break;

            case MessageType.StartingStep: message.Inner = MessageStartingStep.Parse(s); break;

            case MessageType.Hash: message.Inner = MessageHash.Parse(s); break;

            case MessageType.StringHash: message.Inner = MessageStringHash.Parse(s); break;
            }

            return(message);
        }