/// <summary> /// 关闭tips统一接口 /// </summary> /// <param name="id"></param> public void CloseTipsById(uint id) { PGoods goods = Singleton <GoodsMode> .Instance.GetPGoodsById(id); if (goods.goodsId > GoodsMode.Instance.GoodsId) { GoodsTips.Instance.CloseView(); } else { SysEquipVo vo = BaseDataMgr.instance.GetDataById <SysEquipVo>(goods.goodsId); if (vo == null) { Log.info(this, "没有找到Vo"); return; } else if (vo.type == GoodsConst.PET_EQUIP) { PetEquipTips.Instance.CloseView(); } else if (vo.type == GoodsConst.ROLE_EQUIP) { EquipTips.Instance.CloseView(); } } }
/// <summary> /// 获取宝石充灵的经验:PGoods.energy 是包含自身的能力值的,要减去自身的能力值 /// </summary> /// <param name="uid"></param> /// <returns></returns> public int GetSmeltMerge(uint uid) { PGoods goods = GetPGoodsById(uid); SysItemVo vo = BaseDataMgr.instance.GetDataById <SysItemVo>(goods.goodsId); return(goods.energy - Int32.Parse(StringUtils.SplitVoString(vo.other)[0])); }
/// <summary> /// 玩家的物品Tips /// </summary> /// <param name="id">唯一Id</param> /// <param name="leftClick">按钮响应函数,如果为null 则隐藏</param> /// <param name="rightClick">按钮响应函数,如果为null 则隐藏</param> /// <param name="leftText">按钮文本</param> /// <param name="rightText">按钮文本</param> /// <param name="tipsType">Tips的具体样式</param> public void OpenTipsById(uint id, UIWidgetContainer.ClickDelegate leftClick, UIWidgetContainer.ClickDelegate rightClick, string leftText, string rightText, TipsType tipsType = TipsType.DEFAULT_TYPE) { PGoods goods = Singleton <GoodsMode> .Instance.GetPGoodsById(id); if (goods.goodsId > GoodsMode.Instance.GoodsId) { Singleton <GoodsTips> .Instance.OpenViewById(id, leftText, rightText, leftClick, rightClick, tipsType); } else { SysEquipVo vo = BaseDataMgr.instance.GetDataById <SysEquipVo>(goods.goodsId); if (vo == null) { Log.info(this, "没有找到Vo"); return; } else if (vo.type == GoodsConst.PET_EQUIP) { Singleton <PetEquipTips> .Instance.OpenViewById(id, leftText, rightText, leftClick, rightClick); } else if (vo.type == GoodsConst.ROLE_EQUIP) { Singleton <EquipTips> .Instance.OpenViewById(id, leftText, rightText, leftClick, rightClick, null, tipsType); } } }
/// <summary> /// 获取继承费用 /// </summary> /// <param name="goods"></param> /// <returns></returns> public int GetInheritCost(PGoods goods) { SysEquipVo vo = BaseDataMgr.instance.GetDataById <SysEquipVo>(goods.goodsId); int lvl = int.Parse(StringUtils.SplitVoString(vo.lvl)[0]); return((int)Mathf.Ceil(Mathf.Pow((float)lvl, 2f) / 2 + Mathf.Pow((vo.color + 4), 4))); }
public SysRefineVo GetRefineVo(uint uid) { PGoods currentGoods = GetPGoodsById(uid); SysRefineVo sv = BaseDataMgr.instance.GetDataById <SysRefineVo>((currentGoods.equip[0].refine)); return(sv); }
/// <summary> /// 是否超过玩家等级 /// </summary> /// <param name="uid"></param> /// <returns></returns> public bool IsStrenOverLvl(uint uid) { PGoods currentGoods = GetPGoodsById(uid); int stren = currentGoods.equip[0].stren; return(stren >= MeVo.instance.Level); }
public void LeftViewClick(uint uid) { if (idList.Contains(uid)) { return; } foreach (ItemContainer ic in itemList) { if (ic.Id == 0) { idList.Add(uid); PGoods goods = Singleton <GoodsMode> .Instance.GetPGoodsById(uid); SysEquipVo vo = BaseDataMgr.instance.GetDataById <SysEquipVo>(uid); Singleton <ItemManager> .Instance.InitItem(ic, goods.goodsId, 0); ic.FindInChild <UISprite>("tips").SetActive(true); ic.Id = uid; refineStone += Singleton <GoodsMode> .Instance.GetDestroyCount(uid); refineNum.text = "x " + refineStone; break; } } }
public readonly uint ADD_ICON = 2; //加号 /// <summary> /// 确保goodsId是存在的,0表示锁的icon ,1表示空白 /// </summary> /// <param name="item"></param> /// <param name="goodsId"></param> /// <param name="type"></param> public void InitItemByUId(GameObject item, uint uid, ItemType type) { int color = 1; //默认为 1 string spriteName = string.Empty; UIAtlas atlas = null; PGoods goods = GoodsMode.Instance.GetPGoodsById(uid); if (goods == null) { Log.info(this, "背包没有找到改唯一id的物品"); return; } uint goodsId = goods.goodsId; if (goodsId > 100000) //物品道具 { SysItemVo vo = BaseDataMgr.instance.GetDataById <SysItemVo>(goodsId); color = vo.color; spriteName = string.Empty + vo.icon; //atlas = Singleton<AtlasManager>.Instance.GetAtlas("SmeltIcon"); //后续可以根据物品类型Id来分流 //string spriteName = string.Empty + vo.icon; //if (atlas.GetSprite(spriteName) == null) { if (vo.type == GoodsConst.SMELT_GOODS) { atlas = Singleton <AtlasManager> .Instance.GetAtlas("GemIcon"); } else { atlas = Singleton <AtlasManager> .Instance.GetAtlas("PropIcon"); } if (atlas == null || atlas.GetSprite(spriteName) == null) //没有图片 变成 设置为 问号图片 { spriteName = "100000"; } } item.SetChildActive("color", false); InitSpriteHelp(item, "icon", atlas, spriteName); InitSpriteHelp(item, "background", "common", "pz_" + color); } else //装备 { SysEquipVo vo = BaseDataMgr.instance.GetDataById <SysEquipVo>(goodsId); color = vo.color; spriteName = string.Empty + vo.icon; atlas = Singleton <AtlasManager> .Instance.GetAtlas("EquipIcon"); if (atlas.GetSprite(spriteName) == null) //没有图片 变成 设置为 问号图片 { InitSpriteHelp(item, "icon", "PropIcon", "100000"); } else { InitSpriteHelp(item, "icon", "EquipIcon", spriteName); } InitSpriteHelp(item, "background", "EquipIcon", "pz_" + color); item.SetChildActive("color", false); } }
/// <summary> /// 是否强化至最高等级 /// </summary> /// <param name="uid"></param> /// <returns></returns> public bool IsStrenTop(uint uid) { PGoods currentGoods = GetPGoodsById(uid); SysEquipVo vo = BaseDataMgr.instance.GetDataById <SysEquipVo>(currentGoods.goodsId); int stren = currentGoods.equip[0].stren; return(stren >= vo.max_stren); }
public int CalculateFightPoint(PGoods goods) { //物品为空,或者不是装备,直接返回 0 if (goods == null || goods.goodsId > GoodsId) { return(0); } List <PSuitAttr> attrList = new List <PSuitAttr>(); attrList = goods.GetAttrTotalValue(); float fightpoint = 0; foreach (PSuitAttr attr in attrList) { switch (attr.id) { case GoodsConst.ATTR_ID_HP: //生命 fightpoint += (float)attr.attr * 0.2f; break; case GoodsConst.ATTR_ID_MP: //魔法 fightpoint += (float)attr.attr * 0.1f; break; case GoodsConst.ATTR_ID_ATT_DEF_M: //魔防 case GoodsConst.ATTR_ID_ATT_DEF_P: //物防 case GoodsConst.ATTR_ID_DODGE: //闪避 case GoodsConst.ATTR_ID_HIT: //命中 fightpoint += (float)attr.attr * 0.5f; break; case GoodsConst.ATTR_ID_CRIT_RATIO: //暴伤 fightpoint += (float)attr.attr * 0.7f; break; case GoodsConst.ATTR_ID_LUCK: //幸运 fightpoint += (float)attr.attr * 0.8f; break; case GoodsConst.ATTR_ID_HURT_RE: //减伤 fightpoint += (float)attr.attr; break; case GoodsConst.ATTR_ID_ATT_P_MIN: //最小物攻 case GoodsConst.ATTR_ID_ATT_P_MAX: //最大物攻 case GoodsConst.ATTR_ID_ATT_M_MIN: //最小魔防 case GoodsConst.ATTR_ID_ATT_M_MAX: //最大魔防 case GoodsConst.ATTR_ID_ATT_MAX: //最大攻击 case GoodsConst.ATTR_ID_CRIT: //暴击 case GoodsConst.ATTR_ID_FLEX: //韧性 fightpoint += (float)attr.attr * 0.6f; break; } } return(Mathf.RoundToInt(fightpoint)); }
//获得装备分级精炼石的数量 public int GetDestroyCount(PGoods goods) { SysEquipVo vo = BaseDataMgr.instance.GetDataById <SysEquipVo>(goods.goodsId); int lvl = int.Parse(StringUtils.SplitVoString(vo.lvl)[0]); int refine = goods.equip[0].refine; int stren = goods.equip[0].stren; float aa = Mathf.Pow((float)(refine / 2), 2.3f); return((int)(Mathf.Ceil(lvl / 50f + Mathf.Pow((vo.color / 3f), 4f) + stren / 5f + aa))); }
//装备是否满足职业类型 public static bool IsJobCanEquip(this PGoods goods) { SysEquipVo vo = BaseDataMgr.instance.GetDataById <SysEquipVo>(goods.goodsId); if (vo != null && (vo.job == 0 || vo.job == MeVo.instance.job)) { return(true); } return(false); }
/// <summary> /// 获取背包宝石的总经验值 + goods.energy ; 10 级宝石返回自身值 /// </summary> /// <param name="uid">唯一Id</param> /// <returns></returns> public int GetSmeltExp(uint uid) { PGoods goods = GetPGoodsById(uid); if (IsTopSmelt(goods.goodsId)) { return(GetSmeltNextExp(goods.goodsId)); } return(goods.energy);// - Int32.Parse(StringUtils.SplitVoString(vo.other)[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(); }
/// <summary> /// 获取强化费用 /// </summary> /// <param name="uid"></param> /// <returns></returns> public SysStrenthVo GetStrenCost(uint uid) { PGoods currentGoods = GetPGoodsById(uid); if (currentGoods.equip.Count > 0) { SysStrenthVo sv = BaseDataMgr.instance.GetDataById <SysStrenthVo>((byte)(currentGoods.equip[0].stren + (byte)1)); return(sv); } return(null); }
//单击左边装备,显示 Tips 界面 private void ShowLeftTips(GameObject go) { ItemContainer ic = go.GetComponent <ItemContainer>(); if (ic.Id != 0) { currentGoods = GoodsMode.Instance.GetOtherPGoods(ic.Id); OpenTips(); AddTweenPositionComponent(centerPos, leftPos); } }
private void OnUseClick(GameObject obj) { PGoods goods = Singleton <GoodsMode> .Instance.GetPGoodsByGoodsId(choseItemId); if (goods != null && goods.count > 0) { Singleton <PetControl> .Instance.UsePetExpItem(currentPPet.id, goods.id, 1); } else { MessageManager.Show("物品数量不足!"); } }
public void OpenPlayerEquipViewByPGoods(PGoods other, string leftText, string rightText, UIWidgetContainer.ClickDelegate mLeftOnClick = null, UIWidgetContainer.ClickDelegate mRightOnClick = null, UIWidgetContainer.ClickDelegate closeOnClick = null, TipsType tipsType = TipsType.DEFAULT_TYPE) { showOtherPlayerEquip = true; this.id = other.id; goods = other; this.mLeftOnClick = mLeftOnClick; this.mRightOnClick = mRightOnClick; this.mCloseOnClick = closeOnClick; this.leftBtnLabel = leftText; this.rightBtnLabel = rightText; this.tipsType = tipsType; OpenView(); }
public void OpenPlayerEquipTipsByGoods(PGoods goods) { SysEquipVo vo = BaseDataMgr.instance.GetDataById <SysEquipVo>(goods.goodsId); if (vo == null) { Log.info(this, "没有找到Vo"); return; } else if (vo.type == GoodsConst.ROLE_EQUIP) { Singleton <EquipTips> .Instance.OpenPlayerEquipViewByPGoods(goods, "", "", null, null, null); } }
public void OpenViewById(uint id, string leftText, string rightText, UIWidgetContainer.ClickDelegate mLeftOnClick = null, UIWidgetContainer.ClickDelegate mRightOnClick = null, UIWidgetContainer.ClickDelegate closeOnClick = null, TipsType tipsType = TipsType.DEFAULT_TYPE) { this.id = id; goods = Singleton <GoodsMode> .Instance.GetPGoodsById(id); this.mLeftOnClick = mLeftOnClick; this.mRightOnClick = mRightOnClick; this.mCloseOnClick = closeOnClick; this.leftBtnLabel = leftText; this.rightBtnLabel = rightText; this.tipsType = tipsType; OpenView(); }
public void OpenViewByGoodsId(uint goodsId, string leftText, string rightText, UIWidgetContainer.ClickDelegate mLeftOnClick = null, UIWidgetContainer.ClickDelegate mRightOnClick = null, UIWidgetContainer.ClickDelegate closeOnClick = null, TipsType tipsType = TipsType.DEFAULT_TYPE) { this.id = goodsId; goods = new PGoods(); goods.goodsId = goodsId; this.mLeftOnClick = mLeftOnClick; this.mRightOnClick = mRightOnClick; this.mCloseOnClick = closeOnClick; this.leftBtnLabel = leftText; this.rightBtnLabel = rightText; this.tipsType = tipsType; OpenView(); }
public void OpenViewByGoodsId(uint goodsId, string leftText, string rightText, UIWidgetContainer.ClickDelegate mLeftclickDelegate, UIWidgetContainer.ClickDelegate mRightclickDelegate, TipsType tipsType) { this.id = id; goods = new PGoods(); goods.goodsId = goodsId; this.tipsType = tipsType; this.mLeftclickDelegate = mLeftclickDelegate; //this.mMiddleclickDelegate = mMiddleclickDelegate; this.mRightclickDelegate = mRightclickDelegate; this.leftBtnLabel = leftText; this.rightBtnLabel = rightText; OpenView(); }
//单击左边装备,显示 Tips 界面 private void ShowLeftTips(GameObject go) { ItemContainer ic = go.GetComponent <ItemContainer>(); if (ic.Id != 0) { currentGoods = GoodsMode.Instance.GetPGoodsById(ic.Id); repos = 2; vp_Timer.In(0.26f, delegate() { Singleton <TipsManager> .Instance.OpenTipsById(currentGoods.id, ForgeEquipment, UnWearEquipment, LanguageManager.GetWord("Goods.Forge"), LanguageManager.GetWord("Goods.TakeOff"), TipsType.DEFAULT_TYPE); }, 1, leftClickHandle); } }
//根据 id排序 方便比对 public int CompareByIdFunc(PGoods left, PGoods right) { if (left.id > right.id) { return(1); } else if (left.id < right.id) { return(-1); } else { return(0); } }
/// <summary> /// 是否显示可装备的箭头提示 /// </summary> /// <param name="id">唯一Id</param> /// <returns></returns> public bool IsShowEquipTips(uint id) { PGoods goods = GetPGoodsById(id); if (goods != null && goods.goodsId < GoodsId) //装备 { SysEquipVo vo = goods.GetPGoodsVo <SysEquipVo>(); int fightPoint = GoodsMode.Instance.CalculateFightPoint(goods); //本装备的战斗力 int fightPoint1 = GoodsMode.Instance.GetFightPointByPos(vo.pos); //装备栏对应位置的战斗力 if (fightPoint > fightPoint1 && goods.IsJobCanEquip() && vo.GetLvl() <= MeVo.instance.Level) //战斗力 是否可装备(角色类型),等级 { return(true); } } return(false); }
public int HoleId; //当前宝石的空位置 //装备镶嵌宝石点击事件 private void SmeltBtnClick(GameObject go) { ItemContainer ic = go.GetComponent <ItemContainer>(); for (int i = 0; i < 5; i++) { if (itemList[i].Equals(ic)) { HoleId = i + 1; break; } } if (ic.Id != 0) //已经镶嵌,可以充能 { //SelectSmelt(); if (currentItem && ic != currentItem) { currentItem.SetHighLightState(false); } if (ic != currentItem) { idList.Clear(); SelectSmelt(); } currentItem = ic; //currenId = ic.Id; PGoods goods = GoodsMode.Instance.GetPGoodsById(uid); int index = HoleId - 1; PGemInHole gem = goods.equip[0].gemList[index]; currenId = gem.gemId; this.energyFull = GoodsMode.Instance.GetSmeltNextExp(gem.gemId); if (GoodsMode.Instance.IsTopSmelt(gem.gemId)) { this.energy = this.energyFull; } else { this.energy = gem.energy - GoodsMode.Instance.GetSmeltInitExp(gem.gemId); } UpdateMergeSlider(); } _guideIndex = 0; GuideMergeStoneItemContainer = smeltList[0]; }
public int GetStarRemain(uint id) { //获得星签剩余数量 uint goodsId = (uint)lotteryData[id].StarId; PGoods goods = Singleton <GoodsMode> .Instance.GetPGoodsByGoodsId(goodsId); if (null != goods) { lotteryData[id].StarRemain = goods.count; } else { lotteryData[id].StarRemain = 0; } return(lotteryData[id].StarRemain); }
public void OpenViewById(uint id, string leftText, string rightText, UIWidgetContainer.ClickDelegate mLeftclickDelegate, UIWidgetContainer.ClickDelegate mRightclickDelegate, TipsType tipsType) { this.id = id; goods = Singleton <GoodsMode> .Instance.GetPGoodsById(id); this.tipsType = tipsType; this.mLeftclickDelegate = mLeftclickDelegate; //this.mMiddleclickDelegate = mMiddleclickDelegate; this.mRightclickDelegate = mRightclickDelegate; this.leftBtnLabel = leftText; this.rightBtnLabel = rightText; OpenView(); //miaoShuList[1].text = vo. //jiBenSX.text = vo. }
//单击右边背包物品,显示 Tips 界面 private void ShowRightTips(GameObject go) { ItemContainer ic = go.GetComponent <ItemContainer>(); if (ic.Id != 0) { UIWidgetContainer.ClickDelegate leftDelegate = null, rightDelegate = null; string leftText = null, rightText = null; currentGoods = GoodsMode.Instance.GetPGoodsById(ic.Id); if (currentGoods.goodsId > GoodsMode.Instance.GoodsId) { SysItemVo vo = BaseDataMgr.instance.GetDataById <SysItemVo>(currentGoods.goodsId); if (vo.can_use == true) //可使用 { leftText = LanguageManager.GetWord("Goods.QuickUse"); rightText = LanguageManager.GetWord("Goods.Use"); leftDelegate = QuickUseOnClick; rightDelegate = UseGoodsOnClick; } else { } } else //装备 { repos = 1; SysEquipVo equip = BaseDataMgr.instance.GetDataById <SysEquipVo>(currentGoods.goodsId); if (equip.type == GoodsConst.ROLE_EQUIP) { leftText = LanguageManager.GetWord("Goods.Forge"); rightText = LanguageManager.GetWord("Goods.PutOn"); leftDelegate = ForgeEquipment1; rightDelegate = WearEquipment; } else if (equip.type == GoodsConst.PET_EQUIP) { } } vp_Timer.In(0.26f, delegate() { Singleton <TipsManager> .Instance.OpenTipsById(currentGoods.id, leftDelegate, rightDelegate, leftText, rightText, TipsType.DEFAULT_TYPE); }, 1, rightClickHandle); } }
/// <summary> /// 计算装备战斗力 /// </summary> /// <param name="uid"></param> /// <param name="isGoodsId">是否是物品id 为 true uid表示物品id, 为 false uid 表示装备唯一id</param> /// <returns></returns> public int CalculateFightPoint(uint uid, bool isGoods = false) { if (!isGoods) { PGoods goods = new PGoods(); goods.goodsId = uid; return(CalculateFightPoint(goods)); } else { PGoods goods = this.GetPGoodsById(uid); if (goods != null) { return(CalculateFightPoint(goods)); } } return(0); }