Exemplo n.º 1
0
    public static void SetShowRuneDate(ItemTemplate itemT)
    {
        if (itemT == null)
        {
            LogManager.LogError("Open UI_RuneInfo error, ItemTemplate is null");
            return;
        }

        ItemEquip data = new ItemEquip();

        //data.SetItemGuid(110);
        data.SetItemTableID(itemT.getId());
        int[] runeID = new int[GlobalMembers.MAX_RUNE_BASE_ATTRIBUTE_COUNT];
        if (itemT.getRune_baseAttri1() != -1)
        {
            runeID[0] = itemT.getRune_baseAttri1() * 100;
        }
        else
        {
            runeID[0] = -1;
        }
        if (itemT.getRune_baseAttri2() != -1)
        {
            runeID[1] = itemT.getRune_baseAttri2() * 100;
        }
        else
        {
            runeID[1] = -1;
        }
        if (itemT.getRune_baseAttri3() != -1)
        {
            runeID[2] = itemT.getRune_baseAttri3() * 100;
        }
        else
        {
            runeID[2] = -1;
        }
        int[] runAddID = new int[GlobalMembers.MAX_RUNE_APPEND_ATTRIBUTE_COUNT];
        for (int i = 0; i < GlobalMembers.MAX_RUNE_APPEND_ATTRIBUTE_COUNT; i++)
        {
            runAddID[i] = -1;
        }
        data.GetRuneData().SetBaseAttributeID(runeID);
        data.GetRuneData().SetAppendAtttibute(runAddID);
        data.SetEquipState(false);
        //UI_RuneInfo.SetShowRuneGUID(data.GetItemGuid());
        SetShowRuneDate(data);
    }
Exemplo n.º 2
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);
    }