Example #1
0
    public void onClickTabSlot(UIHeroInventoryTab t, GameIDData data)
    {
        if (UIReinforceBarPanel.isReinforceMode)
        {
            if (t.data == null)
            {
                return;
            }
            reinforcePanel.onClick(t);
        }
        else if (UIComposePanel.isComposeMode)
        {
            if (t.data == null)
            {
                return;
            }
            composePanel.onClick(t);
        }
        else
        {
            selectedSlot = null;
            _selectedTab = t;

            itemDetailPopup.show(data, RuneInfoPopup.Type.Normal, false);
        }
    }
Example #2
0
    public void onClickSlot(UIHeroInventorySlot s, GameIDData data)
    {
        if (UIReinforceBarPanel.isReinforceMode)
        {
            if (s.data == null)
            {
                return;
            }

            reinforcePanel.onClick(s);
        }
        else if (UIComposePanel.isComposeMode)
        {
            if (s.data == null)
            {
                return;
            }
            composePanel.onClick(s);
        }
        else if (UIMultiSellPanel.isMultiSell)
        {
            if (s.data == null)
            {
                return;
            }
            sellPanel.onClick(s);
        }
        else
        {
            selectedSlot = s;
            _selectedTab = null;

            itemDetailPopup.show(data, RuneInfoPopup.Type.Normal, true);
        }
    }
Example #3
0
    public void onClick(UIHeroInventorySlot invenSlot)
    {
        switch (onClick(invenSlot.index, invenSlot.data))
        {
        case 1: invenSlot.select = true; break;

        case -1: invenSlot.select = false; break;
        }

        refresh();
    }
Example #4
0
    public void OnSelectedSlot(UIHeroInventorySlot curSlot)
    {
        if (selectedSlot != null)
        {
            selectedSlot.OnDeSelected();
        }

        selectedSlot = curSlot;
        selectedSlot.OnSelected();

        heroManager.OpenItemDetail(selectedSlot.userItem);
    }
Example #5
0
    public void RefreshSlot()
    {
        for (int i = 0; i < _slots.Count; i++)
        {
            UIHeroInventorySlot slot = _slots[i];
            NGUITools.Destroy(slot.gameObject);
        }
        _slots.Clear();

        InitSlot();
        //slot.Refresh();
        //if (slot.userItem.Count <= 0 || GameManager.GameUser.UserItems.FirstOrDefault(p => p.Id == slot.userItem.Id) == null
        //    || slot.userItem.RoleUId != 0
        //    )
        //{
        //    NGUITools.Destroy(slot.gameObject);
        //    _slots.Remove(slot);
        //    uiInventory.root.Reposition();
        //    i--;
        //}
    }
Example #6
0
    void resetSelectSlot(GameIDData d, bool isInventorySlot)
    {
        if (d == null)
        {
            return;
        }

        if (isInventorySlot)
        {
            if (selectedSlot == null)
            {
                UIHeroInventorySlot[] ss = invenList.GetComponentsInChildren <UIHeroInventorySlot>();
                foreach (UIHeroInventorySlot ts in ss)
                {
                    if (ts.data != null && d.serverId == ts.data.serverId)
                    {
                        selectedSlot = ts;
                        break;
                    }
                }
            }
        }
        else
        {
            if (_selectedTab == null)
            {
                for (int i = 0; i < slotCategory.Length; ++i)
                {
                    if (slotCategory[i].data.serverId == d.serverId)
                    {
                        _selectedTab = slotCategory[i];
                        break;
                    }
                }
            }
        }
    }
Example #7
0
    private void InitSlot()
    {
        _slots = new List <UIHeroInventorySlot>();
        List <UserItem> userItems = GameManager.GameUser.UserItems.Where(p => p.RoleUId == 0 && p.Count > 0).ToList();//.OrderByDescending(p => p.GameItem.Kind).ThenByDescending(p => p.Grade).ToList();
        int             index     = 0;

        foreach (UserItem userItem in userItems)
        {
            GameObject go = NGUITools.AddChild(uiInventory.root.gameObject, uiInventory.prefab);
            go.name = index.ToString();
            UIHeroInventorySlot slot = go.GetComponent <UIHeroInventorySlot>();
            slot.SetItem(userItem, this);
            _slots.Add(slot);
            if (heroManager.InventoryActiveTab == UIHeroNewManager.InvetoryTab.All || heroManager.InventoryActiveTab == UIHeroNewManager.InvetoryTab.None)
            {
                go.SetActive(true);
            }
            else
            {
                switch (heroManager.InventoryActiveTab)
                {
                case UIHeroNewManager.InvetoryTab.Ring:
                    if (userItem.GameItem.Kind == (int)ItemKind.Ring)
                    {
                        go.SetActive(true);
                    }
                    break;

                case UIHeroNewManager.InvetoryTab.Medal:
                    if (userItem.GameItem.Kind == (int)ItemKind.Medal)
                    {
                        go.SetActive(true);
                    }
                    break;

                case UIHeroNewManager.InvetoryTab.Armor:
                    if (userItem.GameItem.Kind == (int)ItemKind.Armor)
                    {
                        go.SetActive(true);
                    }
                    break;

                case UIHeroNewManager.InvetoryTab.EXP:
                    if (userItem.GameItem.Kind == (int)ItemKind.Consume)
                    {
                        go.SetActive(true);
                    }
                    break;

                case UIHeroNewManager.InvetoryTab.Support:
                    if (userItem.GameItem.Kind == (int)ItemKind.Support)
                    {
                        go.SetActive(true);
                    }
                    break;
                }
            }

            index++;
            //yield return null;
        }

        uiInventory.root.Reposition();
        // uiInventory.root.Reposition();
        //uiInventory.scrollView.ResetPosition();
    }