예제 #1
0
    private void CheakIdleRune()
    {
        var runeList = m_ObjectSelf.CommonItemContainer.GetItemList(EM_BAG_HASHTABLE_TYPE.EM_BAG_HASHTABLE_TYPE_EQUIP);

        m_HaveIdleRune        = false;
        m_HaveIdleSpecialRune = false;
        for (int i = 0; i < runeList.Count; i++)
        {
            if (runeList[i].GetItemType() == (int)EM_ITEM_TYPE.EM_ITEM_TYPE_RUNE)
            {
                ItemEquip rune = runeList[i] as ItemEquip;
                if (rune != null && !rune.IsEquip())
                {
                    if (rune.GetItemRowData().getRune_type() < (int)EM_SORT_RUNE_ITEM.EM_SORT_RUNE_ITEM_SPECIAL)
                    {
                        m_HaveIdleRune = true;
                    }
                    else if (rune.GetItemRowData().getRune_type() == (int)EM_SORT_RUNE_ITEM.EM_SORT_RUNE_ITEM_SPECIAL)
                    {
                        m_HaveIdleSpecialRune = true;
                    }
                }
                if (m_HaveIdleRune && m_HaveIdleSpecialRune)
                {
                    break;
                }
            }
        }
    }
예제 #2
0
    void SortRune()
    {
        List <BaseItem> norRuneList   = new List <BaseItem>();
        List <BaseItem> equipRuneList = new List <BaseItem>();

        // 筛选是否已经装备
        for (int i = 0; i < _curRuneList.Count; ++i)
        {
            int       tableID = _curRuneList[i].item.GetItemTableID();
            ItemEquip equip   = (ItemEquip)ObjectSelf.GetInstance().CommonItemContainer.FindItem(EM_BAG_HASHTABLE_TYPE.EM_BAG_HASHTABLE_TYPE_EQUIP, _curRuneList[i].item.GetItemGuid());

            if (equip.IsEquip())
            {
                equipRuneList.Add(_curRuneList[i].item);
            }
            else
            {
                norRuneList.Add(_curRuneList[i].item);
            }
        }

        // 进行排序
        SortItem(ref norRuneList);
        SortItem(ref equipRuneList);

        // 重新读取数据
        _curRuneList.Clear();
        for (int i = 0; i < norRuneList.Count; ++i)
        {
            ItemTemplate item = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(norRuneList[i].GetItemTableID());
            RuneTempData rune = new RuneTempData();
            rune.item     = norRuneList[i];
            rune.isSelect = false;
            _curRuneList.Add(rune);
        }

        for (int i = 0; i < equipRuneList.Count; ++i)
        {
            ItemTemplate item = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(equipRuneList[i].GetItemTableID());
            RuneTempData rune = new RuneTempData();
            rune.item     = equipRuneList[i];
            rune.isSelect = false;
            _curRuneList.Add(rune);
        }
    }
예제 #3
0
    public void ShowInfo()
    {
        // 获得数据
        _rune = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(tableID);
        _data = (ItemEquip)ObjectSelf.GetInstance().CommonItemContainer.FindItem(EM_BAG_HASHTABLE_TYPE.EM_BAG_HASHTABLE_TYPE_EQUIP, guid);

        //_icon.sprite = UIResourceMgr.LoadSprite(common.defaultPath + _rune.getIcon());
        //_icon.SetNativeSize();

        iconItem.SetIcon(common.defaultPath + _rune.getIcon());
        iconItem.SetRuneType(_rune.getRune_type());
        //iconItem.SetIsSpecial(_rune.getRune_type() == 5 || _rune.getRune_type() == 6);
        iconItem.SetIsSpecial(RuneModule.IsSpecialRune(_rune));

        // 是否已装备
        if (_data.IsEquip())
        {
            _equip.SetActive(true);
        }
        else
        {
            _equip.SetActive(false);
        }

        // 名称
        _name.text = GameUtils.getString(_rune.getName());

        // 符文等级
        _level.text = "+" + _data.GetStrenghLevel().ToString();

        // 符文基础值
        smelt = _rune.getRune_smelt();
        //_smeltText.text = smelt.ToString();

        // 符文星级
        int level = _rune.getRune_quality();

        for (int i = 5; i < 10; i++)
        {
            _starLevel.transform.GetChild(i).gameObject.SetActive(i < level + 5);
        }

        // 是否被选中
        _border.SetActive(false);

        // 金币 返回的物品
        int strengid    = _rune.getRune_strengthenId();
        int strenglevel = _data.GetStrenghLevel();
        int unqelID     = 0;

        money = 0;
        smelt = 0;
        if (strenglevel == 0)
        {
            money           = 0;
            smelt           = _rune.getRune_smelt();
            _smeltText.text = smelt.ToString();
        }

        if (strenglevel != 0)
        {
            smelt    = _rune.getRune_smelt();
            unqelID  = strengid * 100;
            unqelID += strenglevel;

            //
            RunecostTemplate runecost = (RunecostTemplate)DataTemplate.GetInstance().m_RunecostTable.getTableData(unqelID);
            if (runecost.getReturnType1() == 1400000002)
            {
                money += runecost.getReturnValue1();
            }
            else if (runecost.getReturnType1() == 1400000004)
            {
                smelt += runecost.getReturnValue1();
            }

            if (runecost.getReturnType2() == 1400000002)
            {
                money += runecost.getReturnValue2();
            }
            else if (runecost.getReturnType2() == 1400000004)
            {
                smelt += runecost.getReturnValue2();
            }
            _smeltText.text = smelt.ToString();
        }
    }
예제 #4
0
    public void RuneShow()
    {
        //Debug.Log(tableID);

        if (itemState == ItemSate.Empty)
        {
            for (int i = 0; i < Parent.childCount; i++)
            {
                Parent.GetChild(i);
                if (i == 0)
                {
                    Parent.GetChild(i).gameObject.SetActive(true);
                }
                else
                {
                    Parent.GetChild(i).gameObject.SetActive(false);
                }
            }
            mySelfBtn.onClick.RemoveListener(new UnityEngine.Events.UnityAction(OnMyselfClick));
            return;
        }
        else if (itemState == ItemSate.Lock)
        {
            for (int i = 0; i < Parent.childCount; i++)
            {
                Parent.GetChild(i);
                if (i == 0 || i == 1)
                {
                    Parent.GetChild(i).gameObject.SetActive(true);
                }
                else
                {
                    Parent.GetChild(i).gameObject.SetActive(false);
                }
            }
            mySelfBtn.onClick.RemoveListener(new UnityEngine.Events.UnityAction(OnMyselfClick));
            return;
        }
        else if (itemState == ItemSate.FillDate)
        {
            Parent.FindChild("lock").gameObject.SetActive(false);
            Parent.FindChild("Border").gameObject.SetActive(false);
            maxLevel.SetActive(true);
            bg.SetActive(true);
            specBg.SetActive(true);
            mIcon.gameObject.SetActive(true);
            mName.gameObject.SetActive(true);
            Parent.FindChild("Level").gameObject.SetActive(true);
            Parent.FindChild("Equip").gameObject.SetActive(false);
            Parent.FindChild("Pos").gameObject.SetActive(true);
            Parent.FindChild("stars").gameObject.SetActive(true);
            mySelfBtn.onClick.RemoveAllListeners();
            mySelfBtn.onClick.AddListener(new UnityEngine.Events.UnityAction(OnMyselfClick));
        }
        if (tableID == null)
        {
            return;
        }
        else
        {
            rune = (ItemTemplate)DataTemplate.GetInstance().m_ItemTable.getTableData(tableID);
            //Debug.Log(rune.getIcon());
            mIcon.overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + rune.getIcon());
            // mIcon.SetNativeSize();
            mIcon.transform.localScale = new Vector3(0.8f, 0.8f, 0f);
            mName.text = GameUtils.getString(rune.getName());
            int starCount = rune.getRune_quality();

            bool isSpec = RuneModule.IsSpecialRune(rune);
            bg.SetActive(!isSpec);
            specBg.SetActive(isSpec);

            for (int i = 0; i < starCount; i++)
            {
                mStarList[i].SetActive(true);
            }

            for (int i = 1; i <= 4; i++)
            {
                mTypes[i - 1].gameObject.SetActive(i == rune.getRune_type());
            }

            for (int i = starCount; i < mStarList.Count; i++)
            {
                mStarList[i].SetActive(false);
            }
            m_CurItem = (ItemEquip)ObjectSelf.GetInstance().CommonItemContainer.FindItem(EM_BAG_HASHTABLE_TYPE.EM_BAG_HASHTABLE_TYPE_EQUIP, UI_RuneMange._instance.rune[id].GetItemGuid());
            bool isEquiped = m_CurItem.IsEquip();//ObjectSelf.GetInstance().HeroContainerBag.IsItemEquiped(data);
            mEquip.SetActive(isEquiped);
            mLevel.text = "+" + m_CurItem.GetStrenghLevel();

            //已满级
            int          strengthLv = m_CurItem.GetStrenghLevel();
            ItemTemplate itemT      = m_CurItem.GetItemRowData();
            bool         isFullLv   = DataTemplate.GetInstance().IsRuneStrenthFullLevel(itemT, strengthLv);
            if (isFullLv)
            {
                maxLevel.SetActive(true);
            }
            else
            {
                maxLevel.SetActive(false);
            }
            //设置符文满级特效颜色
            RawImage rawImage = maxLevel.GetComponent <RawImage>();
            switch (itemT.getRune_type())
            {
            case 1:     //蓝色
                rawImage.color = Color.blue;
                break;

            case 2:     //紫色
                rawImage.color = new Color(153 / 255f, 51 / 255f, 250 / 255f);
                break;

            case 3:     //绿色
                rawImage.color = Color.green;
                break;

            case 4:      //红色
                rawImage.color = Color.red;
                break;

            case 5:      //橙色
                rawImage.color = new Color(255 / 255f, 128 / 255f, 0 / 255f);
                break;

            default:
                break;
            }
            m_Tip.SetActive(ObjectSelf.GetInstance().CommonItemContainer.IsNewGetItem(m_CurItem.GetItemGuid()));
        }
    }