ByteBuffer.ReadShort C# (CSharp) Method

ReadShort() public method

public ReadShort ( ) : ushort
return ushort
    public ushort ReadShort()
    {
        return (ushort)mBinaryReader.ReadInt16();
    }

Usage Example

Example #1
0
        override public void Setup_AfterAdd(ByteBuffer buffer, int beginPos)
        {
            base.Setup_AfterAdd(buffer, beginPos);

            if (!buffer.Seek(beginPos, 6))
            {
                return;
            }

            if ((ObjectType)buffer.ReadByte() != packageItem.objectType)
            {
                return;
            }

            string str;
            int    itemCount = buffer.ReadShort();

            _items  = new string[itemCount];
            _values = new string[itemCount];
            for (int i = 0; i < itemCount; i++)
            {
                int nextPos = buffer.ReadShort();
                nextPos += buffer.position;

                _items[i]  = buffer.ReadS();
                _values[i] = buffer.ReadS();
                str        = buffer.ReadS();
                if (str != null)
                {
                    if (_icons == null)
                    {
                        _icons = new string[itemCount];
                    }
                    _icons[i] = str;
                }

                buffer.position = nextPos;
            }

            str = buffer.ReadS();
            if (str != null)
            {
                this.text      = str;
                _selectedIndex = Array.IndexOf(_items, str);
            }
            else if (_items.Length > 0)
            {
                _selectedIndex = 0;
                this.text      = _items[0];
            }
            else
            {
                _selectedIndex = -1;
            }

            str = buffer.ReadS();
            if (str != null)
            {
                this.icon = str;
            }

            if (buffer.ReadBool())
            {
                this.titleColor = buffer.ReadColor();
            }
            int iv = buffer.ReadInt();

            if (iv > 0)
            {
                visibleItemCount = iv;
            }
            _popupDirection = (PopupDirection)buffer.ReadByte();

            iv = buffer.ReadShort();
            if (iv >= 0)
            {
                _selectionController = parent.GetControllerAt(iv);
            }
        }
All Usage Examples Of ByteBuffer::ReadShort