public void Copy(ItemInfo item_info)
 {
     item_idx    = item_info.item_idx;
     char_idx    = item_info.char_idx;
     type        = item_info.type;
     bag_type    = item_info.bag_type;
     ui_pos      = item_info.ui_pos;
     number      = item_info.number;
     create_time = item_info.create_time;
     bin_content = item_info.bin_content;
 }
Exemple #2
0
 public virtual void Serialize(ItemInfo item_info)
 {
     m_item_idx = item_info.item_idx;
     m_char_idx = item_info.char_idx;
     //m_main_type = item_info.type;
     m_sub_type    = item_info.type;
     m_bag_type    = item_info.bag_type;
     m_ui_pos      = item_info.ui_pos;
     m_number      = item_info.number;
     m_create_time = item_info.create_time;
 }
 public void Read(ByteArray by)
 {
     item_idx    = by.ReadLong();
     char_idx    = by.ReadLong();
     type        = (eItemSubType)by.ReadUInt();
     bag_type    = (eBagType)by.ReadUShort();
     ui_pos      = by.ReadUInt();
     number      = by.ReadUInt();
     create_time = by.ReadLong();
     bin_content.Read(by);
 }
Exemple #4
0
    public void SendChangePlaceItem(eBagType bagType, int place, eBagType toBag, int toPlace, int count)
    {
        GSPacketIn pkg = new GSPacketIn((byte)ePackageType.CHANGE_PLACE_ITEM);

        pkg.WriteByte((byte)bagType);
        pkg.WriteInt(place);
        pkg.WriteByte((byte)toBag);
        pkg.WriteInt(toPlace);
        pkg.WriteInt(count);
        this.SendTCP(pkg);
    }
Exemple #5
0
        /// <summary>
        /// 获取背包
        /// </summary>
        public BagBase GetBag(eBagType type)
        {
            switch (type)
            {
            case eBagType.Equip: return(this.GetEquipBag());

            case eBagType.Store: return(this.GetStoreBag());

            case eBagType.Weapon: return(this.GetWeaponBag());

            case eBagType.Main:
            default:
                return(this.GetDefaultBag());
            }
        }
    public bool ShowBag(eBagType bagType, int itemOffset = 0)
    {
        foreach (BagSlotController bsc in bagSlots)
        {
            bsc.UnloadDisplay();
        }
        List <ItemInfo> items = gameController.connector.localBags[(int)bagType];

        if (items == null)
        {
            return(false);
        }
        Debug.Log("SHOWBAG " + (eBagType)bagType);
        localBag = items;
        StartCoroutine(LoadBagSlot(items, gameController.connector.localPlayerInfo.sex, "BagSlot", itemOffset));
        return(true);
    }
    public void HollowMoveToBagItem(eBagType bagType, int itemId)
    {
        const float ItemIconWidth = 80;
        const int   ItemColumn    = 5;
        var         bag           = PlayerDataManager.Instance.GetBag((int)bagType);

        if (null == bag)
        {
            Logger.Debug("PlayerDataManager.Instance.GetBag((int)bagType)");
            return;
        }

        var idx = -1;

        for (var i = 0; i < bag.Items.Count; i++)
        {
            var item = bag.Items[i];
            if (null == item || itemId != item.ItemId)
            {
                continue;
            }

            idx = i;
            break;
        }

        if (-1 == idx)
        {
            Logger.Debug("Can't find item[{0}]", itemId);
            return;
        }
        var   offset  = DataModel.PointerPos - DataModel.HollowPos;
        var   temp    = DataModel.HollowPos;
        var   offsetX = idx % ItemColumn * ItemIconWidth;
        float offsetY = 5;

        temp.x += offsetX;
        //temp.y -= offsetY;
        DataModel.HollowPos = temp;

        DataModel.PointerPos = DataModel.HollowPos + offset;
    }
        private void HollowLogoMoveToBagProp(eBagType bagType, int itemId)
        {
            const float _ItemIconWidth = 80;
            const int   _ItemColumn    = 5;
            var         _bag           = PlayerDataManager.Instance.GetBag((int)bagType);

            if (null == _bag)
            {
                Logger.Debug("PlayerDataManager.Instance.GetBag((int)bagType)");
                return;
            }

            var _idx = -1;

            for (var i = 0; i < _bag.Items.Count; i++)
            {
                var _item = _bag.Items[i];
                if (null == _item || itemId != _item.ItemId)
                {
                    continue;
                }

                _idx = i;
                break;
            }

            if (-1 == _idx)
            {
                Logger.Debug("Can't find item[{0}]", itemId);
                return;
            }
            var   _offset  = m_DataModel.PointerPos - m_DataModel.HollowPos;
            var   _temp    = m_DataModel.HollowPos;
            var   _offsetX = _idx % _ItemColumn * _ItemIconWidth;
            float _offsetY = 5;

            _temp.x += _offsetX;
            //temp.y -= offsetY;
            m_DataModel.HollowPos = _temp;

            m_DataModel.PointerPos = m_DataModel.HollowPos + _offset;
        }
 public void SendChangePlaceItem(eBagType bagType, int place, eBagType toBag, int toPlace, int count)
 {
     connector.SendChangePlaceItem(bagType, place, toBag, toPlace, count);
 }