Ejemplo n.º 1
0
    void OnStrengthBtnClick()
    {
        ItemTemplate itemT      = ItemEquipInfo.GetItemRowData();
        int          strengthLv = ItemEquipInfo.GetStrenghLevel();
        bool         isFullLv   = DataTemplate.GetInstance().IsRuneStrenthFullLevel(itemT, strengthLv);

        //已满级;
        if (isFullLv)
        {
            InterfaceControler.GetInst().AddMsgBox(GameUtils.getString("hero_rune_tip2"), transform);
            return;
        }

        //费用是否足够;
        RunecostTemplate rt = DataTemplate.GetInstance().GetRuneCostTemplate(itemT.getRune_strengthenId(), strengthLv + 1);

        if (rt.getAttriType1() != -1)
        {
            long count = 0;
            if (ObjectSelf.GetInstance().TryGetResourceCountById(rt.getAttriType1(), ref count))
            {
                if (count < rt.getAttriValue1())
                {
                    InterfaceControler.GetInst().AddMsgBox(GameUtils.getString("hero_rune_tip1"), transform);
                    return;
                }
            }
            else
            {
                LogManager.LogError("错误的资源id:" + rt.getAttriType1());
            }
        }
        if (rt.getAttriType2() != -1)
        {
            long count = 0;
            if (ObjectSelf.GetInstance().TryGetResourceCountById(rt.getAttriType2(), ref count))
            {
                if (count < rt.getAttriValue2())
                {
                    InterfaceControler.GetInst().AddMsgBox(GameUtils.getString("hero_rune_tip5"), transform);
                    return;
                }
            }
            else
            {
                LogManager.LogError("错误的资源id:" + rt.getAttriType2());
            }
        }

        //成功后逻辑;
        CRefineEquip msg = new CRefineEquip();

        msg.equipkey = (int)(mRuneGUID.GUID_value);
        IOControler.GetInstance().SendProtocol(msg);

        mStrenthBtn[0].GetComponent <Button>().enabled = false;
        mStrenthBtn[1].GetComponent <Button>().enabled = false;
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 根据属性库id;等级获取RunecostTemplate
    /// </summary>
    /// <param name="bagId"></param>
    /// <param name="level"></param>
    /// <returns></returns>
    public RunecostTemplate GetRuneCostTemplate(int bagId, int level)
    {
        foreach (int i in m_RunecostTable.GetDataKeys())
        {
            RunecostTemplate rt = ( RunecostTemplate )m_RunecostTable.getTableData(i);

            if (rt == null)
            {
                continue;
            }

            if (rt.getBagId() == bagId && rt.getLevel() == level)
            {
                return(rt);
            }
        }

        return(null);
    }
Ejemplo n.º 3
0
    public int GetRuneStrenthMaxLevel(ItemTemplate itemT)
    {
        if (itemT == null)
        {
            return(-1);
        }

        int bagId  = itemT.getRune_strengthenId();
        int result = 0;

        foreach (int i in m_RunecostTable.GetDataKeys())
        {
            RunecostTemplate rt = ( RunecostTemplate )m_RunecostTable.getTableData(i);
            if (rt.getBagId() == bagId)
            {
                result++;
            }
        }

        return(result);
    }
Ejemplo n.º 4
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();
        }
    }
Ejemplo n.º 5
0
    void UpdateUI()
    {
        mStrenthObj.SetActive(false);

        //刷新右上角消耗显示;
        long count1 = 0;

        ObjectSelf.GetInstance().TryGetResourceCountById(1400000002, ref count1);
        mCostTxt1.text = count1.ToString();

        ItemTemplate itemT      = ItemEquipInfo.GetItemRowData();
        int          strengthLv = ItemEquipInfo.GetStrenghLevel();

        //是否是特殊符文;
        EM_RUNE_TYPE runeType = (EM_RUNE_TYPE)itemT.getRune_type();
        bool         isUnique = runeType == EM_RUNE_TYPE.EM_RUNE_TYPE_SPECIAL || runeType == EM_RUNE_TYPE.EM_RUNE_TYPE_SPECIAL_UNIQUE;

        mStrenthBtn[0].gameObject.SetActive(!isUnique);
        mStrenthBtn[1].gameObject.SetActive(isUnique);
        mCloseBtn[0].gameObject.SetActive(!isUnique);
        mCloseBtn[1].gameObject.SetActive(isUnique);


        //判断符文是否满级了;
        bool isFullLv = DataTemplate.GetInstance().IsRuneStrenthFullLevel(itemT, strengthLv);

        mRuneObj[0].SetActive(!isFullLv);
        mRuneObj[1].SetActive(!isFullLv);
        mRuneObj[2].SetActive(isFullLv);

        if (isFullLv)
        {
            //mStrenthRuneItem[i].SetIsSpecial(isUnique);
            RuneItemCommonData ricd = new RuneItemCommonData();
            ricd.IsShowMaxEffect = true;
            ricd.ItemT           = itemT;
            ricd.RuneLevel       = strengthLv;
            ricd.EquipedHeroName = RuneModule.GetItemEuipHeroName(ItemEquipInfo);
            mItemCommons[2].SetRuneItemData(ricd, RuneItemCommon.RuneItemShowType.IconWithRightName);
        }
        else
        {
            RuneItemCommonData ricd = new RuneItemCommonData();
            ricd.IsShowMaxEffect = true;
            ricd.ItemT           = itemT;
            ricd.RuneLevel       = strengthLv;
            ricd.EquipedHeroName = RuneModule.GetItemEuipHeroName(ItemEquipInfo);
            mItemCommons[0].SetRuneItemData(ricd, RuneItemCommon.RuneItemShowType.IconWithRightName);

            RuneItemCommonData ricd1 = new RuneItemCommonData();
            ricd1.IsShowMaxEffect = true;
            ricd1.ItemT           = itemT;
            ricd1.RuneLevel       = strengthLv + 1;
            ricd1.EquipedHeroName = RuneModule.GetItemEuipHeroName(ItemEquipInfo);
            mItemCommons[1].SetRuneItemData(ricd1, RuneItemCommon.RuneItemShowType.IconWithRightName);
        }

        mCostObj[0].SetActive(!isFullLv);
        mCostObj[1].SetActive(!isFullLv);

        GameUtils.SetBtnSpriteGrayState(mStrenthBtn[0], isFullLv);
        GameUtils.SetBtnSpriteGrayState(mStrenthBtn[1], isFullLv);

        mStrenthFullObj1.SetActive(isFullLv);
        mStrenthFullObj2.SetActive(isFullLv);

        if (isFullLv)
        {
        }
        else // 没满级判断资源消耗;
        {
            if (isUnique)
            {
                mStrenthTitleTxt.text = GameUtils.getString("rune_title2");

                //消耗资源处刷新;
                RunecostTemplate rt = DataTemplate.GetInstance().GetRuneCostTemplate(itemT.getRune_strengthenId(), strengthLv + 1);

                if (rt.getAttriType1() == 1400000002)//是金币;
                {
                    long countTmp = 0;
                    ObjectSelf.GetInstance().TryGetResourceCountById(rt.getAttriType1(), ref countTmp);
                    mCost2Txt1.text = countTmp.ToString();
                    ObjectSelf.GetInstance().TryGetResourceCountById(rt.getAttriType2(), ref countTmp);
                    mCost2Txt2.text = countTmp.ToString();

                    TEXT_COLOR tc = countTmp >= rt.getAttriValue2() ? TEXT_COLOR.WHITE : TEXT_COLOR.RED;
                    mCostItemCountTxt.text = GameUtils.StringWithColor(rt.getAttriValue2().ToString(), tc);
                    tc = ObjectSelf.GetInstance().Money >= rt.getAttriValue1() ? TEXT_COLOR.WHITE : TEXT_COLOR.RED;
                    mCostGoldTxt[1].text = GameUtils.StringWithColor(rt.getAttriValue1().ToString(), tc);
                }
                else//不是金币;
                {
                    long countTmp = 0;
                    ObjectSelf.GetInstance().TryGetResourceCountById(rt.getAttriType2(), ref countTmp);
                    mCost2Txt1.text = countTmp.ToString();
                    ObjectSelf.GetInstance().TryGetResourceCountById(rt.getAttriType1(), ref countTmp);
                    mCost2Txt2.text = countTmp.ToString();

                    TEXT_COLOR tc = countTmp >= rt.getAttriValue1() ? TEXT_COLOR.WHITE : TEXT_COLOR.RED;
                    mCostItemCountTxt.text = GameUtils.StringWithColor(rt.getAttriValue1().ToString(), tc);
                    tc = ObjectSelf.GetInstance().Money >= rt.getAttriValue2() ? TEXT_COLOR.WHITE : TEXT_COLOR.RED;
                    mCostGoldTxt[1].text = GameUtils.StringWithColor(rt.getAttriValue2().ToString(), tc);
                }

                mNorCostItemImg.sprite  = GameUtils.GetSpriteByResourceType(rt.getAttriType1());
                mSpecCostItemImg.sprite = GameUtils.GetSpriteByResourceType(rt.getAttriType2());

                mCostGoldImg.sprite = GameUtils.GetSpriteByResourceType(rt.getAttriType1());
                mCost2Img1.sprite   = GameUtils.GetSpriteByResourceType(rt.getAttriType1());
                mCost2Img2.sprite   = GameUtils.GetSpriteByResourceType(rt.getAttriType2());

                mCostObj1.SetActive(false);
                mCostObj2.SetActive(true);
            }
            else
            {
                mStrenthTitleTxt.text = GameUtils.getString("rune_title1");

                RunecostTemplate rt = DataTemplate.GetInstance().GetRuneCostTemplate(itemT.getRune_strengthenId(), strengthLv + 1);

                if (rt.getAttriType1() == 1400000002)//是金币;
                {
                    TEXT_COLOR tc = ObjectSelf.GetInstance().Money >= rt.getAttriValue1() ? TEXT_COLOR.WHITE : TEXT_COLOR.RED;
                    mCostGoldTxt[0].text = GameUtils.StringWithColor(rt.getAttriValue1().ToString(), tc);
                }
                else//不是金币;
                {
                    TEXT_COLOR tc = ObjectSelf.GetInstance().Money >= rt.getAttriValue2() ? TEXT_COLOR.WHITE : TEXT_COLOR.RED;
                    mCostGoldTxt[0].text = GameUtils.StringWithColor(rt.getAttriValue2().ToString(), tc);
                }

                mCostObj1.SetActive(true);
                mCostObj2.SetActive(false);
            }
        }

        mStrenthBtn[0].GetComponent <Button>().enabled = true;
        mStrenthBtn[1].GetComponent <Button>().enabled = true;

        //RuneData runeData = ItemEquipInfo.GetRuneData();
        ////基础属性;
        //bool titleDone1 = false;
        //foreach (int id in runeData.BaseAttributeID)
        //{
        //    if (id == -1)
        //        continue;

        //    if (!titleDone1)
        //    {
        //        titleDone1 = true;
        //        if (isFullLv)
        //        {
        //            CreateTitle(mDetailTransPos[2], GameUtils.getString("hero_rune_content8"));
        //        }
        //        else
        //        {
        //            CreateTitle(mDetailTransPos[0], GameUtils.getString("hero_rune_content8"));
        //            CreateTitle(mDetailTransPos[1], GameUtils.getString("hero_rune_content8"));
        //        }
        //    }

        //    BaseruneattributeTemplate bt1 = DataTemplate.GetInstance().GetBaseruneattributeTemplate(id);
        //    if (isFullLv)
        //    {
        //        if (bt1.getNumshow() == 0)
        //        {
        //            //CreateTitle(mAttriList[2], GameUtils.getString(bt1.getAttriDes()));
        //            CreateDetailTxts(mDetailTransPos[2], GameUtils.getString(bt1.getAttriDes()));
        //        }
        //        else
        //        {
        //            CreateBaseAttriObj(mDetailTransPos[2], GameUtils.getString(bt1.getAttriDes()), "+" + bt1.getAttriValue().ToString());
        //        }
        //        //CreateBaseAttriObj(mAttriList[2], GameUtils.GetAttriName(bt1.getAttriType()), "+" + bt1.getAttriValue().ToString());
        //    }
        //    else
        //    {
        //        if (bt1.getNumshow() == 0)
        //        {
        //            //CreateTitle(mAttriList[0], GameUtils.getString(bt1.getAttriDes()));
        //            CreateDetailTxts(mDetailTransPos[0], GameUtils.getString(bt1.getAttriDes()));
        //        }
        //        else
        //        {
        //            CreateBaseAttriObj(mDetailTransPos[0], GameUtils.getString(bt1.getAttriDes()), "+" + bt1.getAttriValue().ToString());
        //        }
        //        //CreateBaseAttriObj(mAttriList[0], GameUtils.GetAttriName(bt1.getAttriType()), "+" + bt1.getAttriValue().ToString());
        //        BaseruneattributeTemplate bt2 = DataTemplate.GetInstance().GetBaseruneattributeTemplate(id + 1);
        //        if (bt2.getNumshow() == 0)
        //        {
        //            //CreateTitle(mAttriList[1], GameUtils.getString(bt2.getAttriDes()));
        //            CreateDetailTxts(mDetailTransPos[1], GameUtils.getString(bt2.getAttriDes()));
        //        }
        //        else
        //        {
        //            CreateBaseAttriObj(mDetailTransPos[1], GameUtils.getString(bt2.getAttriDes()), "+" + bt2.getAttriValue().ToString());
        //        }
        //        //CreateBaseAttriObj(mAttriList[1], GameUtils.GetAttriName(bt2.getAttriType()), "+" + bt2.getAttriValue().ToString());
        //    }
        //}

        ////附加属性;
        //bool titleDone2 = false;
        //int count = DataTemplate.GetInstance().GetRuneMaxRedefineTimes(itemT);
        //int m = 0;
        //bool curIsGray = false, nextIsGray = false;

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

        //    curIsGray = m * 3 > strengthLv;
        //    nextIsGray = m * 3 > strengthLv + 1;

        //    if (id == -1)
        //    {
        //        if (m <= count)
        //        {
        //            if (!titleDone2)
        //            {
        //                titleDone2 = true;

        //                if (isFullLv)
        //                {
        //                    CreateTitle(mDetailTransPos[2], GameUtils.getString("hero_rune_content9"));
        //                }
        //                else
        //                {
        //                    CreateTitle(mDetailTransPos[0], GameUtils.getString("hero_rune_content9"));
        //                    CreateTitle(mDetailTransPos[1], GameUtils.getString("hero_rune_content9"));
        //                }
        //            }

        //            //位置属性,未鉴定;
        //            if (isFullLv)
        //            {
        //                CreateAddAttriObj(mDetailTransPos[2], GameUtils.getString("rune_content2"), "", GameUtils.getString("rune_content3"), curIsGray);
        //            }
        //            else
        //            {
        //                CreateAddAttriObj(mDetailTransPos[0], GameUtils.getString("rune_content2"), "", GameUtils.getString("rune_content3"), curIsGray);
        //                CreateAddAttriObj(mDetailTransPos[1], GameUtils.getString("rune_content2"), "", GameUtils.getString("rune_content3"), nextIsGray);
        //            }
        //        }

        //        continue;
        //    }

        //    if (!titleDone2)
        //    {
        //        titleDone2 = true;
        //        if (isFullLv)
        //        {
        //            CreateTitle(mDetailTransPos[2], GameUtils.getString("hero_rune_content9"));
        //        }
        //        else
        //        {
        //            CreateTitle(mDetailTransPos[0], GameUtils.getString("hero_rune_content9"));
        //            CreateTitle(mDetailTransPos[1], GameUtils.getString("hero_rune_content9"));
        //        }
        //    }

        //    AddruneattributeTemplate bt = DataTemplate.GetInstance().GetAddruneattributeTemplate(id);
        //    bool isPercent = bt.getIspercentage() > 0;
        //    string val = isPercent ? ((float)bt.getAttriValue() / (float)10f + "%") : bt.getAttriValue().ToString();
        //    if (isFullLv)
        //    {
        //        CreateAddAttriObj(mDetailTransPos[2], GameUtils.getString(bt.getAttriDes1()), GameUtils.getString(bt.getAttriDes2()), bt.getSymbol() + val, curIsGray);
        //    }
        //    else
        //    {
        //        CreateAddAttriObj(mDetailTransPos[0], GameUtils.getString(bt.getAttriDes1()), GameUtils.getString(bt.getAttriDes2()), bt.getSymbol() + val, curIsGray);
        //        CreateAddAttriObj(mDetailTransPos[1], GameUtils.getString(bt.getAttriDes1()), GameUtils.getString(bt.getAttriDes2()), bt.getSymbol() + val, nextIsGray);
        //    }
        //}
    }