Esempio n. 1
0
    private void CreateItems(List <ItemPair> rList)
    {
        if (rList == null || rList.Count == 0)
        {
            return;
        }

        for (var i = 0; i < rList.Count; i++)
        {
            var item = rList[i];
            if (item.count <= 0)
            {
                continue;
            }
            var itemInfo = PropItemInfo.Get((ushort)item.itemId);
            if (!itemInfo || !itemInfo.IsValidVocation(modulePlayer.proto))
            {
                continue;
            }

            var t = itemRoot.AddNewChild(itemTemplete);
            t.SafeSetActive(true);
            itemCache.Add(t);

            Util.SetItemInfoSimple(t, itemInfo);
            Util.SetText(t.GetComponent <Text>("numberdi/count"), item.count.ToString());
        }
    }
Esempio n. 2
0
    private void CreateItems(List <PItem2> rList)
    {
        if (rList == null || rList.Count == 0)
        {
            return;
        }

        ClearItemCache();
        Sort(rList);
        for (var i = 0; i < rList.Count; i++)
        {
            var item = rList[i];
            if (item.num <= 0)
            {
                continue;
            }
            var itemInfo = PropItemInfo.Get(item.itemTypeId);
            if (!itemInfo || !itemInfo.IsValidVocation(modulePlayer.proto))
            {
                continue;
            }

            var t = itemRoot.AddNewChild(itemTemplete);
            t.SafeSetActive(true);
            itemCache.Add(t);
            Util.SetItemInfo(t, itemInfo, item.level, (int)item.num, true, item.star);
        }
    }
Esempio n. 3
0
 private void Sort(List <PItem2> rList)
 {
     rList.Sort((l, r) =>
                1000 * ((PropItemInfo.Get(r.itemTypeId) != null ? PropItemInfo.Get(r.itemTypeId).quality  : 0).CompareTo(PropItemInfo.Get(l.itemTypeId) != null ? PropItemInfo.Get(l.itemTypeId).quality : 0)) +
                100 * ((PropItemInfo.Get(l.itemTypeId) != null ? PropItemInfo.Get(l.itemTypeId).itemType  : 0).CompareTo(PropItemInfo.Get(r.itemTypeId) != null ? PropItemInfo.Get(r.itemTypeId).itemType  : 0)) +
                10 * ((PropItemInfo.Get(l.itemTypeId) != null ? PropItemInfo.Get(l.itemTypeId).subType : 0).CompareTo(PropItemInfo.Get(r.itemTypeId) != null ? PropItemInfo.Get(r.itemTypeId).subType : 0)) +
                l.itemTypeId.CompareTo(r.itemTypeId));
 }
Esempio n. 4
0
    private void Refresh(ushort itemTypeId, bool drop, PItem item = null, int haveNum = -1, bool showStar = false)
    {
        m_petSkill?.gameObject.SetActive(false);

        var info = PropItemInfo.Get(itemTypeId);

        if (info == null)
        {
            return;
        }

        int count = (int)Module_Player.instance.GetCount(itemTypeId);

        if (item != null)
        {
            count = Module_Cangku.instance.GetItemCount(item.itemId);
        }
        if (haveNum != -1)
        {
            count = haveNum;
        }

        Util.SetItemInfo(wupin, info, 0, count);
        var ct = wupin.GetComponent <Text>("numberdi/count");

        ct.gameObject.SetActive(count > 0);
        Util.SetText(ct, ConfigText.GetDefalutString(204, 30), count);

        var TextInfo = ConfigManager.Get <ConfigText>(info.desc);

        tip_text.text = TextInfo ? TextInfo.text[0].Replace("\\n", "\n") : string.Empty;

        m_rTime.transform.parent.gameObject.SetActive(false);

        dropBtn.gameObject.SetActive(false);
        var dropOpen = Module_Guide.instance.HasFinishGuide(GeneralConfigInfo.defaultConfig.dropOpenID);

        if (drop && dropOpen)
        {
            Module_Global.instance.m_dropList = Module_Global.instance.GetDropJump(itemTypeId);
            dropBtn.gameObject.SetActive(Module_Global.instance.m_dropList != null && Module_Global.instance.m_dropList.Count > 0);
            dropBtn.onClick.RemoveAllListeners();
            if (showStar)
            {
                dropBtn.onClick.AddListener(NormalJumpClick);
            }
            else
            {
                dropBtn.onClick.AddListener(JumpClick);
            }
        }

        cancle_btn.onClick.RemoveAllListeners();
        cancle_btn.onClick.AddListener(() => { Destroy(this); });
    }