Example #1
0
        public void LeftViewClick(uint uid)
        {
            PGoods goods = Singleton <GoodsMode> .Instance.GetPGoodsById(uid);

            SysEquipVo vo    = BaseDataMgr.instance.GetDataById <SysEquipVo>(goods.goodsId);
            PEquip     equip = goods.equip[0];

            ClearItemData();
            inlayTips.text = VoUtils.GetInlayTips(vo.GetGemType());
            this.uid       = uid;
            ItemContainer ic;
            PGemInHole    gem;

            for (int i = 0; i < 5; i++)  //默认全部开启
            {
                ic = itemList[i];

                if (i < equip.gemList.Count) //已经开启,而且已经镶嵌
                {
                    gem   = equip.gemList[i];
                    ic.Id = gem.gemId;
                    Singleton <ItemManager> .Instance.InitItem(ic, gem.gemId, 0);

                    ic.FindInChild <UISprite>("tips").SetActive(true);
                    if (GoodsMode.Instance.IsTopSmelt(gem.gemId))
                    {
                        ic.FindInChild <UISlider>("sld_jy").value = 1f;
                    }
                    else
                    {
                        int nextEng = GoodsMode.Instance.GetSmeltNextExp((uint)gem.gemId);
                        int curEng  = gem.energy - GoodsMode.Instance.GetSmeltInitExp(gem.gemId);
                        if (nextEng == 0)
                        {
                            ic.FindInChild <UISlider>("sld_jy").value = 0f;
                        }
                        else
                        {
                            ic.FindInChild <UISlider>("sld_jy").value = curEng / (float)nextEng;
                        }
                    }
                    ic.isEnabled = true;
                }
                else
                {
                    Singleton <ItemManager> .Instance.InitItem(ic, ItemManager.Instance.EMPTY_ICON, 0);

                    ic.FindInChild <UISprite>("tips").SetActive(false);
                    ic.FindInChild <UISlider>("sld_jy").value = 0f;
                    ic.Id        = 0;
                    ic.isEnabled = false;
                }
            }
            SelectSmelt();
        }
Example #2
0
        // 126 ,190 ,227
        protected override void HandleAfterOpenView()
        {
            if (showOtherPlayerEquip)
            {
                SetViewForOtherPlayer();
            }

            SysEquipVo vo = BaseDataMgr.instance.GetDataById <SysEquipVo>(goods.goodsId);

            fightpoint.text = string.Empty + GoodsMode.Instance.CalculateFightPoint(goods);
            Singleton <ItemManager> .Instance.InitItem(goodsIcon, goods.goodsId, 0);

            List <PSuitAttr> suitAttr = new List <PSuitAttr>();

            if (vo != null)            //装备描
            {
                itemName.text = ColorUtils.GetEquipColor(vo.color, vo.name);
                jobLabel.text = LanguageManager.GetWord("Role.TipsJob" + vo.job);
                string lvl    = StringUtils.SplitVoString(vo.lvl)[0];
                int    refine = (goods.equip.Count == 0)? 0 : (int)(goods.equip[0].refine);
                int    stren  = (goods.equip.Count == 0) ? 0 : (int)(goods.equip[0].stren);
                suitAttr = goods.equip.Count == 0?null: goods.equip[0].suitList;
                goodsIcon.FindInChild <UILabel>("stren").text = "+" + stren;

                UILabel label;
                string  suitStr = null;
                for (int i = 0; i < 5; i++)
                {
                    label = fjList[i];
                    if (suitAttr != null && i < suitAttr.Count)
                    {
                        suitStr = string.Format(LanguageManager.GetWord("Language.Format1"),
                                                LanguageManager.GetWord("Role.Attr" + suitAttr[i].id), suitAttr[i].attr) +
                                  VoUtils.LanguagerFormat("EquipTips.SuitStar", suitAttr[i].pos);
                        label.text = ColorUtils.GetEquipColor(3, suitStr);   //已经开启使用蓝色
                    }
                    else
                    {
                        suitStr    = VoUtils.GetColorTips(i + 1);
                        label.text = ColorUtils.GetEquipColor(i + 2, suitStr);
                    }
                }
                for (int i = 0; i < 15; i++)
                {
                    if (refine <= i)
                    {
                        refineList[i].spriteName = "kongxing";
                    }
                    else
                    {
                        refineList[i].spriteName = "xingxing1";
                    }
                }

                string[]      strenType = StringUtils.SplitVoString(vo.stren_type);
                List <string> strs      = new List <string>();
                foreach (string s in strenType)
                {
                    strs.AddRange(StringUtils.GetValueListFromString(vo.GetEquipStrenType(int.Parse(s))));
                }
                int         type;
                SysRefineVo refineVo;
                //基础属性计算
                for (int i = 0; i < 2; i++)
                {
                    if (i < strenType.Length)
                    {
                        type = int.Parse(strenType[i]);

                        int addValue   = int.Parse(strs[i * 2 + 1]);
                        int strenValue = int.Parse(strs[i * 2]) + addValue * stren;
                        refineVo = BaseDataMgr.instance.GetDataById <SysRefineVo>((uint)refine);

                        float  rate      = refineVo.GetRefineRate();
                        int    addValue1 = Mathf.RoundToInt(strenValue * rate);
                        string format    = LanguageManager.GetWord("Language.Format4");
                        string key       = VoUtils.GetRoleAttr(type); //属性文本
                        if (addValue1 == 0)                           //没有精炼加成值
                        {
                            format = LanguageManager.GetWord("Language.Format1");
                            if (type != 10 && type != 8)   //不是物攻和魔攻
                            {
                                jcList[i].text = string.Format(format, key, strenValue);
                            }
                            else
                            {
                                string minValue = vo.GetEquipStrenType(type - 1);
                                jcList[i].text = string.Format(format, string.Format(ColorConst.EQUIP_BLUE_FORMAT, key), minValue + "-" + strenValue);
                            }
                        }
                        else
                        {
                            if (type != 10 && type != 8)
                            {
                                jcList[i].text = string.Format(format, string.Format(ColorConst.EQUIP_BLUE_FORMAT, key), strenValue, string.Format(ColorConst.GREEN_FORMAT, "+" + addValue1 + "( " +
                                                                                                                                                   string.Format("{0:0%}", rate) + " )"));
                            }
                            else
                            {
                                string minValue = vo.GetEquipStrenType(type - 1);
                                jcList[i].text = string.Format(format, string.Format(ColorConst.EQUIP_BLUE_FORMAT, key), minValue + "-" + strenValue, string.Format(ColorConst.GREEN_FORMAT, "+" + addValue1 + "( " +
                                                                                                                                                                    string.Format("{0:0%}", rate) + " )"));
                            }
                        }
                    }
                    else
                    {
                        jcList[i].text = string.Empty;
                    }
                }
                int repos = Singleton <GoodsMode> .Instance.GetReposById(goods.id);

                string lvlString = MeVo.instance.Level < vo.GetLvl() ? string.Format(ColorConst.RED_FORMAT, lvl):lvl + string.Empty;
                if (repos == GoodsMode.Instance.GOODS_REPOS)
                {
                    itemLevel.text = "等级: " + lvlString + " (未装备)";
                }
                else if (repos == GoodsMode.Instance.EQUIP_REPOS)
                {
                    itemLevel.text = "等级: " + lvlString + " (已装备)";
                }
                else
                {
                    itemLevel.text = "等级: " + lvlString;
                }

                PEquip            equip = (goods.equip.Count == 0) ? new PEquip() : goods.equip[0];
                int               count = equip.gemList.Count;
                UIWidgetContainer ic;
                PGemInHole        gem;
                SysItemVo         smeltVo;
                for (int i = 0; i < 5; i++)               //宝石镶嵌信息
                {
                    ic = smeltList[i];
                    UILabel label1 = ic.FindInChild <UILabel>("label");
                    if (i < count)               //已经镶嵌
                    {
                        gem = equip.gemList[i];
                        ItemManager.Instance.InitItem(ic, gem.gemId, 0);
                        smeltVo      = BaseDataMgr.instance.GetDataById <SysItemVo>(gem.gemId);
                        label1.text  = VoUtils.GetRoleAttr(smeltVo.subtype) + ": +" + smeltVo.value;
                        label1.color = Color.green;
                    }
                    else
                    {
                        List <PGoods> goodsList = GoodsMode.Instance.GetSmeltGemListByGoodsId(this.goods.goodsId);
                        if (goodsList.Count != 0)
                        {
                            ItemManager.Instance.InitItem(ic, ItemManager.Instance.ADD_ICON, 0);

                            label1.text = "可镶嵌";
                        }
                        else
                        {
                            ItemManager.Instance.InitItem(ic, ItemManager.Instance.EMPTY_ICON, 0);
                            label1.text = "未镶嵌";
                        }
                        label1.color = new Color(169 / 255f, 169 / 255f, 169 / 255f);
                    }
                }
            }

            //按钮回调和位置调整
            btn_right.FindInChild <UILabel>("label").text = rightBtnLabel; //文本显示
            btn_left.FindInChild <UILabel>("label").text  = leftBtnLabel;
            btn_left.clickDelegate = mLeftOnClick;                         //响应事件指定
            bool isCenter = false;

            if (mLeftOnClick == null)
            {
                btn_left.SetActive(false);
                isCenter = true;
            }
            else
            {
                btn_left.SetActive(true);
                if (tipsType != TipsType.DELEGATENOCLOSE)
                {
                    btn_left.clickDelegate += CloseView;
                }
            }
            btn_right.clickDelegate = mRightOnClick;

            if (mRightOnClick == null)
            {
                btn_right.SetActive(false);
                isCenter = true;
            }
            else
            {
                btn_right.SetActive(true);
                if (tipsType != TipsType.DELEGATENOCLOSE)
                {
                    btn_right.clickDelegate += CloseView;
                }
            }
            if (isCenter)          //调整位置
            {
                btn_left.transform.localPosition = new Vector3(-3f, -238f, 0f);
                btn_left.FindInChild <UISprite>("background").width = 280;
                btn_left.FindInChild <UISprite>("highlight").width  = 298;
                btn_right.transform.localPosition = new Vector3(-3f, -238f, 0f);
                btn_right.FindInChild <UISprite>("background").width = 280;
                btn_right.FindInChild <UISprite>("highlight").width  = 298;
            }
            else
            {
                btn_left.transform.localPosition = new Vector3(-98.5f, -238f, 0f);
                btn_left.FindInChild <UISprite>("background").width = 167;
                btn_left.FindInChild <UISprite>("highlight").width  = 179;
                btn_right.transform.localPosition = new Vector3(78.5f, -238f, 0f);
                btn_right.FindInChild <UISprite>("background").width = 167;
                btn_right.FindInChild <UISprite>("highlight").width  = 179;
            }
            if (mOpenHandle != null)
            {
                mOpenHandle();
            }
            setEquipTipsPlayReverse();
        }
Example #3
0
    /// <summary>
    /// 返回装备的最终加成值
    /// </summary>
    /// <param name="goods"></param>
    /// <returns></returns>
    public static List <PSuitAttr> GetAttrTotalValue(this PGoods goods)
    {
        List <PSuitAttr> suitAttr = new List <PSuitAttr>();
        SysEquipVo       vo       = BaseDataMgr.instance.GetDataById <SysEquipVo>(goods.goodsId);

        if (vo != null)
        {
            for (int i = 5; i < 23; i++)   //遍历 5 - 22 的属性值
            {
                List <int> attr = vo.GetEquipAttrValue(i);
                if (attr.Count > 0)  //取出第一个值,第二值是加成值
                {
                    AddSuitAttrValue(suitAttr, i, attr[0]);
                }
            }
            int refine = (goods.equip.Count == 0) ? 0 : (int)(goods.equip[0].refine);
            int stren  = (goods.equip.Count == 0) ? 0 : (int)(goods.equip[0].stren);
            //附加属性
            if (goods.equip.Count != 0)
            {
                foreach (var pSuitAttr in goods.equip[0].suitList)
                {
                    AddSuitAttrValue(suitAttr, pSuitAttr.id, pSuitAttr.attr);
                }
            }
            string[]   strenType = StringUtils.SplitVoString(vo.stren_type);
            List <int> strs      = new List <int>();
            foreach (string s in strenType)
            {
                strs.AddRange(vo.GetEquipAttrValue(int.Parse(s)));
            }
            int         type;
            SysRefineVo refineVo;
            //强化,精炼 加成值
            for (int i = 0; i < 2; i++)
            {
                if (i < strenType.Length)
                {
                    type = int.Parse(strenType[i]);

                    int addValue   = strs[i * 2 + 1];
                    int strenValue = strs[i * 2] + addValue * stren;  //强化加成值
                    refineVo = BaseDataMgr.instance.GetDataById <SysRefineVo>((uint)refine);

                    float rate        = refineVo.GetRefineRate();
                    int   refineValue = Mathf.RoundToInt(strenValue * rate); //精炼加成值
                    AddSuitAttrValue(suitAttr, type, refineValue + addValue * stren);
                }
            }
            //宝石镶嵌
            PEquip     equip = (goods.equip.Count == 0) ? new PEquip() : goods.equip[0];
            int        count = equip.gemList.Count;
            PGemInHole gem;
            SysItemVo  smeltVo;
            for (int i = 0; i < 5; i++) //宝石镶嵌信息
            {
                if (i < count)          //已经镶嵌
                {
                    gem     = equip.gemList[i];
                    smeltVo = BaseDataMgr.instance.GetDataById <SysItemVo>(gem.gemId);
                    AddSuitAttrValue(suitAttr, smeltVo.subtype, smeltVo.value);
                }
            }
        }
        return(suitAttr);
    }
Example #4
0
        private bool isInlaySmelt = false;//装备是否已镶嵌宝石
        public void LeftViewClick(uint uid)
        {
            PGoods goods = Singleton <GoodsMode> .Instance.GetPGoodsById(uid);

            SysEquipVo vo    = BaseDataMgr.instance.GetDataById <SysEquipVo>(goods.goodsId);
            PEquip     equip = goods.equip[0];

            PGemInHole gem;
            SysItemVo  itemVo;

            ClearItemData();
            mergeTips.text = VoUtils.GetMergeTips(vo.GetGemType());
            this.uid       = uid;
            ItemContainer ic;

            for (int i = 0; i < 5; i++)
            {
                ic = itemList[i];
                Singleton <ItemManager> .Instance.InitItem(ic, 0, 0);

                if (i < equip.gemList.Count) //已经开启,而且已经镶嵌
                {
                    isInlaySmelt = true;
                    gem          = equip.gemList[i];
                    Singleton <ItemManager> .Instance.InitItem(ic, gem.gemId, 0);

                    ic.isEnabled  = true;
                    ic.buttonType = Button.ButtonType.HoldHighlight;
                    ic.Id         = gem.gemId;
                    ic.FindInChild <UISprite>("tips").SetActive(false);
                    if (GoodsMode.Instance.IsTopSmelt(gem.gemId)) //顶级宝石
                    {
                        ic.FindInChild <UISlider>("sld_jy").value = 1f;
                    }
                    else
                    {
                        itemVo = BaseDataMgr.instance.GetDataById <SysItemVo>((uint)gem.gemId);
                        int nextEng = GoodsMode.Instance.GetSmeltNextExp((uint)itemVo.id);
                        int curEng  = gem.energy - GoodsMode.Instance.GetSmeltInitExp(gem.gemId);
                        if (nextEng == 0)
                        {
                            ic.FindInChild <UISlider>("sld_jy").value = 0f;
                        }
                        else
                        {
                            ic.FindInChild <UISlider>("sld_jy").value = curEng / (float)nextEng;
                        }
                    }
                }
                else
                {
                    Singleton <ItemManager> .Instance.InitItem(ic, ItemManager.Instance.EMPTY_ICON, 0);

                    ic.FindInChild <UISprite>("tips").SetActive(false);
                    ic.FindInChild <UISlider>("sld_jy").value = 0f;
                    ic.isEnabled = false;
                    ic.Id        = 0;
                }
            }
            if (!isInlaySmelt)  //没有镶嵌宝石 显示提示信息
            {
                bottomSprite.SetActive(false);
                if (grid.gameObject.activeInHierarchy)
                {
                    grid.SetActive(false);
                }
                if (!tips.gameObject.activeInHierarchy)
                {
                    tips.SetActive(true);
                }
                MergeButton.SetActive(false);
                sprite2.text                    = "装备还未镶嵌宝石";
                sprite2.gradientTop             = new Color(112 / 225f, 112 / 255f, 112 / 255f);
                sprite2.gradientBottom          = Color.white;
                sprite2.color                   = Color.white;
                sprite2.transform.localPosition = Vector3.zero;
                sprite1.SetActive(false);
            }
            else   //有镶嵌宝石
            {
                bottomSprite.SetActive(false);
                if (grid.gameObject.activeInHierarchy)
                {
                    grid.SetActive(false);
                }
                if (!tips.gameObject.activeInHierarchy)
                {
                    tips.SetActive(true);
                }
                MergeButton.SetActive(false);
                sprite2.text                    = "请选择已镶嵌宝石";
                sprite2.gradientTop             = new Color(45 / 255f, 109 / 255f, 144 / 255f);
                sprite2.gradientBottom          = Color.white;
                sprite2.color                   = new Color(167 / 255f, 238 / 255f, 254 / 255f);
                sprite2.transform.localPosition = Vector3.zero;
                sprite1.SetActive(false);
            }
        }