ByteBuffer.WriteLong C# (CSharp) Method

WriteLong() public method

public WriteLong ( long v ) : void
v long
return void
    public void WriteLong(long v)
    {
        mBinaryWriter.Write(v);
    }

Usage Example

        /// <summary>
        /// Send when player has succesfully connected to room
        /// </summary>
        public static void Send_RoomList(long connectionId, RoomInstance[] rooms)
        {
            //New packet
            ByteBuffer buffer = new ByteBuffer();

            //Add packet id
            buffer.WriteLong((long)ServerPacketId.RoomList);
            //Add room list length
            buffer.WriteInteger(rooms.Length);

            //add rooms
            foreach (var room in rooms)
            {
                //add room id
                buffer.WriteLong(room.RoomId);
                //add max players in room
                buffer.WriteInteger(room.MaxPlayers);
                //add deck size
                buffer.WriteInteger(room.DeckSize);
                //add players count
                buffer.WriteInteger(room.ConnectedPlayersN);
                //add player names and avatars
                foreach (var name in room.GetPlayerNicknames())
                {
                    buffer.WriteStringUnicode(name); //using unicode there because player names support all languages
                }
            }

            //Send packet
            SendDataTo(connectionId, buffer.ToArray());
        }
All Usage Examples Of ByteBuffer::WriteLong