示例#1
0
    public static byte[] SimpleMessage(int messageId)
    {
        var builder = new FlatBufferBuilder(4);

        FMessage.StartFMessage(builder);
        switch (messageId)
        {
        case 0:
            FMessage.AddMessageType(builder, FMessageType.StartGame);
            break;

        case 1:
        default:
            FMessage.AddMessageType(builder, FMessageType.LeaveRoom);
            break;
        }
        var messageObj = FMessage.EndFMessage(builder);

        builder.Finish(messageObj.Value);

        return(builder.SizedByteArray());
    }