コード例 #1
0
    public void SendMeetPlayer(string id)
    {
        FlatBufferBuilder fbb = new FlatBufferBuilder(1024);

        var _id = fbb.CreateString(id);

        PlayerInfo.StartPlayerInfo(fbb);
        PlayerInfo.AddId(fbb, _id);
        var playerInfoOffset = PlayerInfo.EndPlayerInfo(fbb);

        MeetCommand.StartMeetCommand(fbb);
        MeetCommand.AddOtherPlayer(fbb, playerInfoOffset);
        var meetCommandOffset = MeetCommand.EndMeetCommand(fbb);

        MessageRoot.StartMessageRoot(fbb);
        MessageRoot.AddDataType(fbb, Data.MeetCommand);
        MessageRoot.AddData(fbb, meetCommandOffset.Value);
        var msgRootOffset = MessageRoot.EndMessageRoot(fbb);

        MessageRoot.FinishMessageRootBuffer(fbb, msgRootOffset);

        byte[] buf = fbb.SizedByteArray();

        _writer.BaseStream.Write(buf, 0, buf.Length);
        _writer.Flush();
    }