Exemple #1
0
    public void Init(WEB_SHOP_UI_PRICETYPE._enWebListName kPayType, GachaCardItem.enCardGrade type, CItem item, DATA_ITEM_NEW ItemTableData)
    {
        _enCardType = enCardType.Item;

        _CreatureCardParent.SetActive(false);

        _ItemCardParent.SetActive(false);
        _PvpItemCardParent.SetActive(false);
        _RaidItemCardParent.SetActive(false);

        GameObject parent = null;

        if (kPayType == WEB_SHOP_UI_PRICETYPE._enWebListName.Medal)
        {
            parent = _PvpItemCardParent;
            _PvpItemIcon.Init(ItemTableData, item);
        }
        else if (kPayType == WEB_SHOP_UI_PRICETYPE._enWebListName.Shard)
        {
            parent = _RaidItemCardParent;
            _RaidItemIcon.Init(ItemTableData, item);
        }
        else
        {
            parent = _ItemCardParent;
            _ItemIcon.Init(ItemTableData, item);
        }

        parent.SetActive(true);
        Transform[] childrens = parent.GetComponentsInChildren <Transform>(true);
        if (childrens != null)
        {
            for (int i = 0; i < childrens.Length; ++i)
            {
                childrens[i].gameObject.SetActive(true);
            }
        }
    }
    //===================================================================================
    //
    // Variable
    //
    //===================================================================================


    //===================================================================================
    //
    // Default Method
    //
    //===================================================================================

    //===================================================================================
    //
    // Method
    //
    //===================================================================================
    public void InitItem(CItem item)
    {
        _wealthIcon.gameObject.SetActive(false);
        _creatureIcon.gameObject.SetActive(false);
        _itemIcon.gameObject.SetActive(false);

        GameObject itemGameObject = null;

        DATA_ITEM_NEW ItemTable = CDATA_ITEM_NEW.Get(item.m_ItemID);

        if (ItemTable.m_enItemType == DATA_ITEM_TYPE_NEW._enItemStatusType.ITEMTYPE_MONEY)
        {
            itemGameObject = _wealthIcon.gameObject;
            _wealthIcon.Init(ItemTable);
            _wealthCountLabel.text = item.m_ItemLot.ToString();
        }
        else
        {
            itemGameObject = _itemIcon.gameObject;
            _itemIcon.Init(ItemTable);
        }

        foreach (Transform tr in itemGameObject.GetComponentsInChildren <Transform>(true))
        {
            tr.gameObject.SetActive(true);
        }

        //_wealthParent.SetActive(false);
        //_creatureParent.SetActive(false);

        //foreach (Transform tr in _itemParent.GetComponentsInChildren<Transform>(true))
        //{
        //    tr.gameObject.SetActive(true);
        //}

        //DATA_ITEM_NEW ItemTable = CDATA_ITEM_NEW.Get(item.m_ItemID);
        //_itemSprite.sprite2D = UIResourceMgr.CreateSprite(BUNDLELIST.TEXTURE_ICON_ITEMICON, ItemTable.m_szIconName);
        //_itemGradeSprite.spriteName = string.Format("{0}{1}", "inventory_slot0", ItemTable.m_iGrade);

        //_IconNameLabel.text = StringTableManager.GetData(ItemTable.iItemName);
    }
Exemple #3
0
    private void CreateItemIcon(List <PvPItemInfo> items)
    {
        ClearItemIcon();

        for (int i = 0; i < items.Count; i++)
        {
            PvPItemInfo info = items[i];

            CItem citem = new CItem();
            citem.m_ItemID  = info.ItemID;
            citem.m_ItemKey = info.ItemKey;

            citem.m_ItemOptions = new _vItemOptions();

            for (int k = 0; k < info.options.Count; k++)
            {
                PvPItemOptionInfo optioninfo = info.options[k];

                CItemOption citemoption = new CItemOption();
                citemoption.m_OptionNo      = optioninfo.optionNo;
                citemoption.m_OptionID      = optioninfo.optionID;
                citemoption.m_OptionCreator = optioninfo.optionCreator;
                citemoption.m_OptionInt     = optioninfo.optionInt;
                citemoption.m_OptionBigint  = optioninfo.optionBigint;

                citem.m_ItemOptions.Add(citemoption);
            }

            DATA_ITEM_NEW itemTable = CDATA_ITEM_NEW.Get(info.ItemID);

            Transform parent = null;

            if (itemTable.m_enItemSubType == DATA_ITEM_SUB_TYPE_NEW._enItemStatusSubType.ITEMTYPE_EI_WEAPON)
            {
                parent = _itemIconTransforms[(int)enCreatureItemType.ITEMCREATUETYPE_WEAPON];
            }
            else if (itemTable.m_enItemSubType == DATA_ITEM_SUB_TYPE_NEW._enItemStatusSubType.ITEMTYPE_EI_ARMOR)
            {
                parent = _itemIconTransforms[(int)enCreatureItemType.ITEMCREATUETYPE_ARMOR];
            }
            else if (itemTable.m_enItemSubType == DATA_ITEM_SUB_TYPE_NEW._enItemStatusSubType.ITEMTYPE_EI_ACCESSORY)
            {
                parent = _itemIconTransforms[(int)enCreatureItemType.ITEMCREATUETYPE_ACC1];
            }
            else if (itemTable.m_enItemSubType == DATA_ITEM_SUB_TYPE_NEW._enItemStatusSubType.ITEMTYPE_EI_ACCESSORY_2)
            {
                parent = _itemIconTransforms[(int)enCreatureItemType.ITEMCREATUETYPE_ACC2];
            }

            ItemBaseIcon icon = UIResourceMgr.CreatePrefab <ItemBaseIcon>(BUNDLELIST.PREFABS_UI_COMMON, parent, "ItemBaseIcon");

            UIPanel iconPanel = icon.GetComponent <UIPanel>();
            if (iconPanel != null)
            {
                if (_panel != null)
                {
                    UtilFunc.SetPanelDepth(iconPanel, _panel.depth + 10);
                }
                else
                {
                    UtilFunc.SetPanelDepth(iconPanel, 410);
                }
            }

            TweenScale tweenscale = icon.GetComponent <TweenScale>();
            if (tweenscale != null)
            {
                DestroyImmediate(tweenscale);
            }

            uint ItemForce = info.ItemForce;

            ItemSlot slot = new ItemSlot(citem);
            slot.SetUpgradeLevel((int)ItemForce);

            icon.Init(itemTable, slot);
            icon.SetForceCount((int)ItemForce);
            icon.ActiveGoldBuffIcon(false);

            _itemIconList.Add(icon);
        }
    }