コード例 #1
0
    public void UpdateShow(int runeid, ItemTemplate rune)
    {
        if (rune == null)
        {
            return;
        }
        mRuneGUID = UI_RuneMange._instance.rune[runeid].GetItemGuid();

        runeName.text = GameUtils.getString(rune.getName());
        //runeIcon.overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + rune.getIcon());
        //runeIcon.transform.localScale = new Vector3(0.8f,0.8f,0f);
        //runeIcon.SetNativeSize();

        mIconItem.SetIcon(common.defaultPath + rune.getIcon());
        mIconItem.SetStarsNum(rune.getRune_quality());
        mIconItem.SetRuneType(rune.getRune_type());
        //int starCount = rune.getRune_quality();
        //for (int n = 0; n < mStarList.Count; n++)
        //{
        //    if (n == starCount - 1)
        //    {
        //        mStarList[n].SetActive(true);
        //    }
        //    else
        //    {
        //        mStarList[n].SetActive(false);
        //    }
        //}

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

        mIconItem.SetIsSpecial(RuneModule.IsSpecialRune(rune));

        //GameUtils.DestroyChildsObj(mAttriList);
        ItemEquip data = (ItemEquip)ObjectSelf.GetInstance().CommonItemContainer.FindItem(EM_BAG_HASHTABLE_TYPE.EM_BAG_HASHTABLE_TYPE_EQUIP, mRuneGUID);

        //runeLevel.text = "+" + data.GetStrenghLevel();
        mIconItem.SetLevel(data.GetStrenghLevel());

        //装备人名字
        ObjectCard oc = ObjectSelf.GetInstance().HeroContainerBag.GetItemUser(data);

        if (oc == null)
        {
            userName.gameObject.SetActive(false);
        }
        else
        {
            HeroTemplate heroT = DataTemplate.GetInstance().GetHeroTemplateById(oc.GetHeroData().TableID);
            if (heroT != null)
            {
                userName.text = GameUtils.getString(heroT.getTitleID()) + "    " + GameUtils.getString("hero_rune_content7");
            }
            userName.gameObject.SetActive(true);
        }

        //是否满级;
        bool isFullLv = DataTemplate.GetInstance().IsRuneStrenthFullLevel(rune, data.GetStrenghLevel());

        GameUtils.SetBtnSpriteGrayState(intensifyBtn, isFullLv);
        showAtt.Clear();
        //--------基础属性;
        RuneData runeData = data.GetRuneData();
        bool     titleDone1 = false;
        int      split = 0;
        int      k = 0, p = 0;

        foreach (int id in runeData.BaseAttributeID)
        {
            if (id == -1)
            {
                continue;
            }

            if (!titleDone1)
            {
                k++;
                titleDone1 = true;
                CreateTitle(mAttriList, GameUtils.getString("hero_rune_content8"), k - 1);
            }
        }
        foreach (int id in runeData.BaseAttributeID)
        {
            if (id == -1)
            {
                continue;
            }
            BaseruneattributeTemplate bt = DataTemplate.GetInstance().GetBaseruneattributeTemplate(id);
            p++;
            if (bt.getNumshow() != 0)
            {
                CreateBaseAttriObj(mAttriList, GameUtils.getString(bt.getAttriDes()), "+" + bt.getAttriValue().ToString(), p - 1);
            }
        }
        //创建特殊服务的特效效果属性
        foreach (int id in runeData.BaseAttributeID)
        {
            if (id == -1)
            {
                continue;
            }
            BaseruneattributeTemplate bt = DataTemplate.GetInstance().GetBaseruneattributeTemplate(id);
            if (bt.getNumshow() == 0)
            {
                CreateDetailTxts(mAttriList, GameUtils.getString(bt.getAttriDes()));
            }
        }

        //--------附加属性;
        int  count      = DataTemplate.GetInstance().GetRuneMaxRedefineTimes(rune);
        bool titleDone2 = false;
        int  i      = 0;
        bool isGray = false;
        int  b      = 0;

        foreach (int id in runeData.AppendAttribute)
        {
            i++;

            isGray = i * 3 > data.GetStrenghLevel();

            if (id == -1)
            {
                if (i <= count)
                {
                    if (!titleDone2)
                    {
                        k++;
                        titleDone2 = true;
                        CreateTitle(mAttriList, GameUtils.getString("hero_rune_content9"), k - 1);
                    }
                    b++;
                    //未知属性,未鉴定;
                    CreateAddAttriObj(mAttriList, GameUtils.getString("rune_content2"), "", GameUtils.getString("rune_content3"), isGray, b - 1);
                }

                continue;
            }

            if (!titleDone2)
            {
                k++;
                titleDone2 = true;
                CreateTitle(mAttriList, GameUtils.getString("hero_rune_content9"), k - 1);
            }
            b++;
            AddruneattributeTemplate bt = DataTemplate.GetInstance().GetAddruneattributeTemplate(id);
            bool   isPercent            = bt.getIspercentage() > 0;
            string val = isPercent ? ((float)bt.getAttriValue() / (float)10f + "%") : bt.getAttriValue().ToString();
            CreateAddAttriObj(mAttriList, GameUtils.getString(bt.getAttriDes1()), GameUtils.getString(bt.getAttriDes2()), bt.getSymbol() + val, isGray, b - 1);
        }
        for (int m = 0; m < showAtt.Count; m++)
        {
            showAtt[m].SetActive(true);
        }

        //是否鉴定满级;
        GameUtils.SetBtnSpriteGrayState(authenticateBtn, data.GetDefineTimes() >= count);
    }
コード例 #2
0
    protected void UpdateData(RuneAttriShowType type = RuneAttriShowType.All)
    {
        //Debug.LogError("RuneDetailCommon Update data");

        SetObjAllUseless();
        RuneData runeData = ItemEquipInfo.GetRuneData();

        bool titleDone1 = false;

        foreach (int id in runeData.BaseAttributeID)
        {
            if (id == -1)
            {
                continue;
            }

            int fullLv = DataTemplate.GetInstance().GetRuneStrenthMaxLevel(ItemEquipInfo.GetItemRowData());

            if (ItemEquipInfo.GetStrenghLevel() + mStrenLvAdder > fullLv)
            {
                return;
            }

            if (!titleDone1)
            {
                titleDone1 = true;
                //CreateTitle(mAttriList, GameUtils.getString("hero_rune_content8"));
                RuneDetailTitle title = GetOrCreateRuneDetailObj(RuneDetailObjType.Title, layoutTrans) as RuneDetailTitle;
                title.SetTxt(GameUtils.getString("hero_rune_content8"));
                title.SetActive(true);
            }

            BaseruneattributeTemplate bt = DataTemplate.GetInstance().GetBaseruneattributeTemplate(id + mStrenLvAdder);
            if (bt.getNumshow() == 0 && type != RuneAttriShowType.BaseAttriOnly)
            {
                //CreateDetailTxts(mAttriList, GameUtils.getString(bt.getAttriDes()));
                RuneDetailContent content = GetOrCreateRuneDetailObj(RuneDetailObjType.Content, layoutTrans) as RuneDetailContent;
                content.SetTxt(GameUtils.getString(bt.getAttriDes()));
                content.SetActive(true);
            }
            else
            {
                //CreateBaseAttriObj(mAttriList, GameUtils.getString(bt.getAttriDes()), "+" + bt.getAttriValue().ToString());
                RuneDetailTwoAttri twoAttri = GetOrCreateRuneDetailObj(RuneDetailObjType.TwoAttri, layoutTrans) as RuneDetailTwoAttri;
                twoAttri.SetLeftTxt(GameUtils.getString(bt.getAttriDes()));
                twoAttri.SetRightTxt("+" + bt.getAttriValue().ToString());
                twoAttri.SetActive(true);
            }
        }

        if (type == RuneAttriShowType.All)
        {
            //--------附加属性;
            int  count      = DataTemplate.GetInstance().GetRuneMaxRedefineTimes(ItemEquipInfo.GetItemRowData());
            bool titleDone2 = false;
            int  i          = 0;
            bool isGray     = false;

            foreach (int id in runeData.AppendAttribute)
            {
                i++;

                isGray = i * 3 > ItemEquipInfo.GetStrenghLevel() + mStrenLvAdder;

                if (id == -1)
                {
                    if (i <= count)
                    {
                        if (!titleDone2)
                        {
                            titleDone2 = true;
                            //CreateTitle(mAttriList, GameUtils.getString("hero_rune_content9"));
                            RuneDetailTitle title = GetOrCreateRuneDetailObj(RuneDetailObjType.Title, layoutTrans) as RuneDetailTitle;
                            title.SetTxt(GameUtils.getString("hero_rune_content9"));
                            title.SetActive(true);
                        }
                        //未知属性,未鉴定;
                        //CreateAddAttriObj(mAttriList, GameUtils.getString("rune_content2"), "", GameUtils.getString("rune_content3"), isGray);
                        RuneDetailThreeAtrri threeAttri = GetOrCreateRuneDetailObj(RuneDetailObjType.ThreAttri, layoutTrans) as RuneDetailThreeAtrri;
                        threeAttri.SetLeftTxt(GameUtils.getString("rune_content2"), isGray);
                        threeAttri.SetMidTxt("", isGray);
                        threeAttri.SetRightTxt(GameUtils.getString("rune_content3"), isGray);
                        threeAttri.SetActive(true);
                    }

                    continue;
                }

                if (!titleDone2)
                {
                    titleDone2 = true;
                    //CreateTitle(mAttriList, GameUtils.getString("hero_rune_content9"));
                    RuneDetailTitle title = GetOrCreateRuneDetailObj(RuneDetailObjType.Title, layoutTrans) as RuneDetailTitle;
                    title.SetTxt(GameUtils.getString("hero_rune_content9"));
                    title.SetActive(true);
                }

                AddruneattributeTemplate bt = DataTemplate.GetInstance().GetAddruneattributeTemplate(id);
                bool   isPercent            = bt.getIspercentage() > 0;
                string val = isPercent ? ((float)bt.getAttriValue() / (float)10f + "%") : bt.getAttriValue().ToString();
                //CreateAddAttriObj(mAttriList, GameUtils.getString(bt.getAttriDes1()), GameUtils.getString(bt.getAttriDes2()), bt.getSymbol() + val, isGray);
                RuneDetailThreeAtrri threeAttri1 = GetOrCreateRuneDetailObj(RuneDetailObjType.ThreAttri, layoutTrans) as RuneDetailThreeAtrri;
                threeAttri1.SetLeftTxt(GameUtils.getString(bt.getAttriDes1()), isGray);
                threeAttri1.SetMidTxt(GameUtils.getString(bt.getAttriDes2()), isGray);
                threeAttri1.SetRightTxt(bt.getSymbol() + val, isGray);
                threeAttri1.SetActive(true);
            }
        }
    }