protected override void HandleAfterOpenView() { SysEquipVo vo = BaseDataMgr.instance.GetDataById <SysEquipVo>(goodsId); int count = GoodsMode.Instance.GetCountByGoodsId(goodsId); ItemManager.Instance.InitItem(item, goodsId, 0); nameLabel.text = vo.name; descLabel.text = vo.desc; numLabel.text = VoUtils.LanguagerFormat("PetEquipTips.NumTips", count); lvlLabel.text = LanguageManager.GetWord("PetEquipTips.LvlTips") + vo.GetLvl(); List <string> attrString = vo.GetPetAttrList(); UILabel label; for (int i = 0; i < 5; i++) //加成属性 { label = attrList[i]; if (i < attrString.Count) { label.text = attrString[i]; label.SetActive(true); } else { label.text = string.Empty; label.SetActive(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]; 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(); }
/// <summary> /// 返回后端推送的物品的数据结构 /// </summary> /// <param name="goodsId">物品Id</param> /// <returns></returns> public PGoods GetPGoodsByGoodsId(uint goodsId) { List <PGoods> tempList = GetPGoodsByType(VoUtils.GetGoodsType(goodsId)); foreach (PGoods goods in tempList) { if (goods.goodsId == goodsId) { return(goods); } } return(null); }
//更新我的伤害信息 private void MyHurt() { uint hur = Singleton <BossMode> .Instance.hurt; float tot = (float)Singleton <BossMode> .Instance.fullHp; if (tot != 0) { myHurt.text = VoUtils.LanguagerFormat("Boss.MyHurt", hur + "(" + string.Format("{0:P1}", hur / tot) + ")"); } else { myHurt.text = VoUtils.LanguagerFormat("Boss.MyHurt", "(0.0 %)");; } }
/// <summary> /// 返回背包物品数量 /// </summary> /// <param name="goodsId"></param> /// <returns></returns> public int GetCountByGoodsId(uint goodsId) { int num = 0; List <PGoods> tempList = GetPGoodsByType(VoUtils.GetGoodsType(goodsId)); foreach (PGoods goods in tempList) { if (goods.goodsId == goodsId) { num += goods.count; } } return(num); }
private void GuWuTips(GameObject go) { if (go.Equals(btn_bj.gameObject)) { guWuType = BossMode.CritGuwuId; } else { guWuType = BossMode.AttackGuwuId; } int cost = StringUtils.GetStringToInt(BossMode.Instance.GuWuCostList[guWuType - 1].diam)[0]; ConfirmMgr.Instance.ShowOkAlert(VoUtils.LanguagerFormat("Boss.GuWuCost", cost), string.Empty, GuWuOnClick, LanguageManager.GetWord("Boss.GuWu")); }
private void UpdateMedalInfo() { int medalId = MedalMode.Instance.UpgradeId; medalLevel.text = "Lv." + medalId; if (MedalMode.Instance.IsMaxLevel()) { medalId = MedalMode.MaxMedalLvel; } else { medalId = medalId + 1; } SysMedalVo medalVo = BaseDataMgr.instance.GetDataById <SysMedalVo>((uint)medalId); List <int> attrList = medalVo.GetAddAttrs(); GameObject tempItem; for (int i = 0; i < 8; i++) { tempItem = attrItemList[i]; NGUITools.FindInChild <UILabel>(tempItem, "value").text = "+" + MeVo.instance.GetAttrValueById(attrList[2 * i]); NGUITools.FindInChild <UILabel>(tempItem, "name").text = VoUtils.GetRoleAttr(attrList[2 * i]); NGUITools.FindInChild <UILabel>(tempItem, "add").text = "+" + attrList[2 * i + 1]; } if (MedalMode.Instance.IsMaxLevel()) { repuCost.text = "声望:" + string.Format(ColorConst.YELLOW_FORMAT, 0); goldCost.text = "金币:" + string.Format(ColorConst.YELLOW_FORMAT, 0); } else { string colorString = ColorConst.YELLOW_FORMAT; if (!MedalMode.Instance.CanMedalUp(medalId)) //不能升级 { colorString = ColorConst.RED_FORMAT; } repuCost.text = "声望:" + string.Format(colorString, medalVo.repu); goldCost.text = "金币:" + string.Format(colorString, medalVo.gold); } }
// 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(); }
public void LeftViewClick(uint uid) { PGoods goods = Singleton <GoodsMode> .Instance.GetPGoodsById(uid); SysEquipVo vo = BaseDataMgr.instance.GetDataById <SysEquipVo>(goods.goodsId); if (EquipLeftView.Instance.Repos == GoodsMode.Instance.EQUIP_REPOS) { currentEquip.Id = uid; Singleton <ItemManager> .Instance.InitItem(currentEquip, goods.goodsId, 0); this.pos = goods.pos; currentRefine = goods.equip[0].refine; currentStren = goods.equip[0].stren; List <PSuitAttr> suitAttr = goods.equip[0].suitList; string suitStr; UILabel label; for (int i = 0; i < 5; i++) { label = currentSuitList[i]; if (i >= suitAttr.Count) { label.SetActive(false); } else { suitStr = VoUtils.RoleAttrFormat1(suitAttr[i].id, string.Empty + suitAttr[i].attr); label.text = suitStr; label.SetActive(true); } } currentEquip.FindInChild <UILabel>("stren").text = "强化等级:+" + currentStren; currentEquip.FindInChild <UISprite>("tips").SetActive(true); currectSelect = true; label = currentEquip.FindInChild <UILabel>("name");//.text = vo.name; label.text = vo.name; ColorUtils.SetEqNameColor(label, vo.color); currentEquip.FindInChild <UILabel>("refine").text = "精炼等级:" + currentRefine; currentEquip.FindInChild <UILabel>("title").text = string.Empty; currentId = uid; costValue.text = string.Empty + Singleton <GoodsMode> .Instance.GetInheritCost(goods); //if(!nextSelect ) EquipLeftView.Instance.ReposChange(GoodsMode.Instance.GOODS_REPOS, this.pos); currentEquip.isEnabled = true; } else if (EquipLeftView.Instance.Repos == GoodsMode.Instance.GOODS_REPOS) { nextEquip.Id = uid; Singleton <ItemManager> .Instance.InitItem(nextEquip, goods.goodsId, 0); int tempStren = goods.equip[0].stren; int tempRefine = goods.equip[0].refine; List <PSuitAttr> suitAttr = goods.equip[0].suitList; string suitStr; UILabel label; for (int i = 0; i < 5; i++) { label = nextSuitList[i]; if (i >= suitAttr.Count) { label.SetActive(false); } else { suitStr = VoUtils.RoleAttrFormat1(suitAttr[i].id, string.Empty + suitAttr[i].attr); label.text = suitStr; label.SetActive(true); } } if (tempStren < currentStren) { tempStren = currentStren; } if (tempRefine < currentRefine) { tempRefine = currentRefine; } nextEquip.FindInChild <UILabel>("stren").text = "强化等级:+" + tempStren; nextEquip.FindInChild <UISprite>("tips").SetActive(true); nextSelect = true; label = nextEquip.FindInChild <UILabel>("name"); label.text = vo.name; ColorUtils.SetEqNameColor(label, vo.color); nextEquip.FindInChild <UILabel>("refine").text = "精炼等级:" + tempRefine; nextEquip.FindInChild <UILabel>("title").text = string.Empty; nextId = uid; nextEquip.isEnabled = true; } }
public void LeftViewClick(uint uid) { this.uid = uid; this.repos = Singleton <EquipLeftView> .Instance.Repos; PGoods currentGoods = Singleton <GoodsMode> .Instance.GetPGoodsById(uid); SysRefineVo sv = BaseDataMgr.instance.GetDataById <SysRefineVo>((uint)(currentGoods.equip[0].refine)); if (sv != null) { costValue.text = string.Empty + sv.money; refineCost = int.Parse(sv.goods); //refineStone.text = sv.goods;//精炼石数量 } UpdateRefineCost(); ItemManager.Instance.InitItem(equipIcon, currentGoods.goodsId, 0); int stren = 0; //if(currentGoods.equip.Count != 0) stren = currentGoods.equip[0].stren; int refine = currentGoods.equip[0].refine; refineLvl.text = refine + "/15"; //equipStren.text = "+" + stren ; //item2.FindInChild<UILabel>("label").text = "+" + (stren + 1); SysEquipVo vo = BaseDataMgr.instance.GetDataById <SysEquipVo>(currentGoods.goodsId); //先枚举强化属性显示 equipName.text = vo.name + " " + string.Format(ColorConst.YELLOW_FORMAT, "+" + stren); 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)))); } //Log.info(this, Singleton<EquipMode>.Instance.GetEquipStrenType(vo, vo.stren_type) + " " + vo.stren_type); for (int i = 0; i < 3; i++) { if (i < strenType.Length) { int addValue = int.Parse(strs[i * 2 + 1]); int strenValue = int.Parse(strs[i * 2]) + addValue * stren; if (sv.value == 0) { attrList[i].text = VoUtils.RoleAttrFormat1(int.Parse(strenType[i]), string.Empty + strenValue); } else { attrList[i].text = VoUtils.RoleAttrFormat1(int.Parse(strenType[i]), strenValue + string.Format(ColorConst.GREEN_FORMAT, " +" + Mathf.RoundToInt(strenValue * sv.GetRefineRate()) + "( " + string.Format("{0:0%}", sv.GetRefineRate()) + " )")); } } else { attrList[i].text = string.Empty; } } for (int i = 0; i < 15; i++) { if (refine > i) { refineStar[i].spriteName = "xingxing1"; } else { refineStar[i].spriteName = "kongxing"; } } }
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); } }