/// <summary> /// 保护属性状态变化 /// </summary> /// <param name="attrId"></param> private void OnCompoundProtectStatusChanged(uint attrId) { Equip data = Data; if (null == data) { return; } GameCmd.PairNumber attrPair = GetAttrPairByAttrId(attrId); if (null == attrPair) { if (m_lst_checkProtectAttr.Contains(attrId)) { m_lst_checkProtectAttr.Remove(attrId); } return; } if (m_lst_checkProtectAttr.Contains(attrId)) { m_lst_checkProtectAttr.Remove(attrId); } else { m_lst_checkProtectAttr.Add(attrId); } UpdateCompoundZF(Data); }
/// <summary> /// 属性提升成功 /// </summary> /// <param name="ret"></param> private void OnPromoteComplete(bool success) { bool clearRs = true; GameCmd.PairNumber selectAttrPair = GetEquipAttrByIndex((int)m_em_selectEquipAttrIndex); if (null != selectAttrPair) { //筛选满足条件符石 uint selectAttrGrade = emgr.GetAttrGrade(selectAttrPair); if (m_uint_selectRSBaseId != 0) { RuneStone rs = DataManager.Manager <ItemManager>() .GetTempBaseItemByBaseID <RuneStone>(m_uint_selectRSBaseId, ItemDefine.ItemDataType.RuneStone); int holdNum = imgr.GetItemNumByBaseId(m_uint_selectRSBaseId); clearRs = rs.Grade < selectAttrGrade || holdNum <= 0; } } ResetProccess(clearIndex: false, clearSelectRsId: clearRs); string tips = "恭喜,提升属性成功"; if (!success) { tips = "很遗憾,属性提升失败"; } UpdateProccess(Data); TipsManager.Instance.ShowTips(tips); }
/// <summary> /// 获取单个概率 /// </summary> /// <param name="attrPair"></param> /// <returns></returns> /// <summary> /// 获取属性id对应的属性 /// </summary> /// <param name="attrId"></param> /// <returns></returns> private GameCmd.PairNumber GetAttrPairByAttrId(uint attrId) { Equip data = Data; if (null == data) { return(null); } GameCmd.PairNumber attrPair = new GameCmd.PairNumber(); attrPair.id = attrId; List <GameCmd.PairNumber> addtiveAttr = data.GetAdditiveAttr(); bool match = false; for (int i = 0; i < addtiveAttr.Count; i++) { if (addtiveAttr[i].id == attrPair.id) { match = true; attrPair.value = addtiveAttr[i].value; break; } } return(match ? attrPair : null); }
private void DoRemove() { string tips = ""; bool success = true; if (!emgr.IsItemHaveAdditiveAttrOrGemHole(selectEquipId)) { success = false; tips = "当前装备没有附加属性,无法进行消除操作"; } else if (!IsSelectEquipAttr()) { success = false; tips = "请先勾选要消除的附加属性"; } else if (m_uint_selectRSBaseId == 0) { success = false; tips = "请选择符石"; } else if (imgr.GetItemNumByBaseId(m_uint_selectRSBaseId) == 0) { success = false; tips = "符石数量不足"; } if (!success) { TipsManager.Instance.ShowTips(tips); return; } GameCmd.PairNumber pair = GetEquipAttrByIndex((int)m_em_selectEquipAttrIndex); emgr.EquipPropertyRemove(selectEquipId, m_uint_selectRSBaseId, ((null != pair) ? pair.id : 0)); }
/// <summary> /// 根据键值对创建本地属性数据 /// </summary> /// <param name="effectId"></param> /// <returns></returns> public static LocalAttrData Create(GameCmd.PairNumber attr) { if (null == attr) { return(null); } return(new LocalAttrData(attr)); }
/// <summary> /// 设置格子 /// </summary> /// <param name="attr">属性</param> /// <param name="totalProtectAttrNum">保护属性总条数</param> /// <param name="selectNum">选择数量</param> /// <param name="callback"></param> public void SetGridView(GameCmd.PairNumber attr, bool select, int fillNum = 0, int needNum = 0 , Action <uint> callback = null) { ResetInfoGrid(); RuneStone rs = null; uint runeStoneBaseId = 0; AttrId = attr.id; EquipManager emgr = DataManager.Manager <EquipManager>(); if (emgr.TryGetRuneStoneIdByEffectId(emgr.TransformAttrToEffectId(attr), out runeStoneBaseId)) { rs = DataManager.Manager <ItemManager>().GetTempBaseItemByBaseID <RuneStone>(runeStoneBaseId, ItemDefine.ItemDataType.RuneStone); } else { Engine.Utility.Log.Error("TryGetRuneStoneIdByEffectId failed attr pair = [id,{0}]-[value,{1}]", attr.id, attr.value); } m_uint_rsId = rs.BaseId; if (null != this.attrDes) { this.attrDes.text = emgr.GetAttrDes(attr); } if (null != this.m_labPortectDes) { this.m_labPortectDes.text = string.Format("消耗符石档次:{0}档", rs.Grade); } if (null != m_toggle) { m_toggle.value = select; } SetIcon(true, rs.Icon); SetBorder(true, rs.BorderIcon); int holdNum = (int)DataManager.Manager <ItemManager>().GetItemNumByBaseId(runeStoneBaseId); SetRuneStoneMask(true, (uint)rs.Grade); if (select && fillNum < needNum) { SetNotEnoughGet(true); } if (null != m_labNum) { if (select) { this.m_labNum.text = ItemDefine.BuilderStringByHoldAndNeedNum((uint)fillNum, (uint)needNum); } else { this.m_labNum.text = holdNum.ToString(); } } if (this.changeCallback != callback) { this.changeCallback = callback; } }
private void SetOpenData() { if (null == compoundSelectData) { return; } SetTransformState(true); ResetInfoGrid(); BaseItem baseItem = DataManager.Manager <ItemManager>().GetTempBaseItemByBaseID <BaseItem>(compoundSelectData.BaseID); int attrNum = (null != compoundSelectData.Attrs) ? compoundSelectData.Attrs.Count : 0; SetIcon(true, baseItem.Icon); SetBorder(true, ItemDefine.GetItemBorderIcon((uint)attrNum)); if (compoundSelectData.IsBind) { SetBindMask(true); } if (null != m_TransDatas) { AttrTransData temData = null; GameCmd.PairNumber pair = null; EquipManager emgr = DataManager.Manager <EquipManager>(); for (int i = 0, max = m_TransDatas.Length; i < max; i++) { temData = m_TransDatas[i]; if (temData.Root == null) { continue; } if (null != compoundSelectData.Attrs && compoundSelectData.Attrs.Count > i) { if (!temData.Root.gameObject.activeSelf) { temData.Root.gameObject.SetActive(true); } pair = compoundSelectData.Attrs[i]; if (null != temData.Grade) { temData.Grade.text = emgr.GetAttrGrade(compoundSelectData.Attrs[i]).ToString(); } if (null != temData.Des) { temData.Des.text = emgr.GetAttrDes(compoundSelectData.Attrs[i]); } } else if (temData.Root.gameObject.activeSelf) { temData.Root.gameObject.SetActive(false); } } } SetSelect(m_bSelect); }
private void ShowUI() { Equip equip = DataManager.Manager <ItemManager>().GetBaseItemByQwThisId <Equip>(qwThisID); if (null == equip) { return; } if (null != m_infoGrid) { m_infoGrid.Reset(); m_infoGrid.SetIcon(true, equip.Icon); m_infoGrid.SetBorder(true, equip.BorderIcon); if (equip.IsBind) { m_infoGrid.SetLockMask(true); } //m_infoGrid.RegisterUIEventDelegate((eventType, gridData, param) => //{ // if (eventType == UIEventType.Click) // { // TipsManager.Instance.ShowItemTips(equip); // } //}); } if (null != m_label_EquipName) { m_label_EquipName.text = equip.Name; } GameCmd.PairNumber pair = null; UICompoundAttrGrid tempGrid = null; int gridCount = mlstGrids.Count; EquipManager emgr = DataManager.Manager <EquipManager>(); List <GameCmd.PairNumber> additiveAttrs = equip.GetAdditiveAttr(); for (int i = 0; i < gridCount; i++) { tempGrid = mlstGrids[i]; if (null != additiveAttrs && additiveAttrs.Count > i) { if (!tempGrid.Visible) { tempGrid.SetVisible(true); } pair = additiveAttrs[i]; tempGrid.SetData(emgr.GetAttrGrade(additiveAttrs[i]), emgr.GetAttrDes(additiveAttrs[i])); } else if (tempGrid.Visible) { tempGrid.SetVisible(false); } } }
/// <summary> /// 保护属性需要的符石数量 /// </summary> /// <param name="attrPair"></param> /// <returns></returns> private int GetAttrProtectNeedRSNum(GameCmd.PairNumber attrPair) { float prop = GetSingleRSProp(attrPair); if (prop <= Mathf.Epsilon) { return(0); } int num = Mathf.CeilToInt(1 / prop); return(num); }
/// <summary> /// 更新消除 /// </summary> internal void UpdateRemove() { bool isSelectRS = (m_uint_selectRSBaseId != 0); RuneStone rs = DataManager.Manager <ItemManager>() .GetTempBaseItemByBaseID <RuneStone>(m_uint_selectRSBaseId, ItemDefine.ItemDataType.RuneStone); uint num = (isSelectRS) ? (uint)imgr.GetItemNumByBaseId(m_uint_selectRSBaseId) : 0; if (null != m_processRsGrowShow) { m_processRsGrowShow.SetGridData(m_uint_selectRSBaseId, needUnload: true); } int attrCount = GetEquipAttrCount(false); if (attrCount > 0) { EquipDefine.LocalAttrData attr = null; GameCmd.PairNumber attrPair = null; ColorType cType = ColorType.JZRY_Txt_Black; bool choose = false; for (ForgingProccessPropertyIndex i = ForgingProccessPropertyIndex.One; i < (ForgingProccessPropertyIndex)attrCount; i++) { choose = IsSelectEquipAttr() && (m_em_selectEquipAttrIndex == i); cType = (choose) ? ColorType.JZRY_Txt_Red : ColorType.JZRY_Txt_Black; attrPair = GetEquipAttrByIndex((int)i, true); if (m_dic_propCurGrids.ContainsKey(i) && !m_dic_propCurGrids[i].Visible) { m_dic_propCurGrids[i].SetVisible(true); attr = EquipDefine.LocalAttrData.Create(attrPair); m_dic_propCurGrids[i].SetGridView(ColorManager.GetColorString(cType, attr.AttrDes), attr.IsMaxGrade, true , attr.Grade); } if (m_dic_propCBs.ContainsKey(i) && !m_dic_propCBs[i].gameObject.activeSelf) { m_dic_propCBs[i].gameObject.SetActive(true); m_dic_propCBs[i].Set(choose); } bool showTips = emgr.IsItemHaveAdditiveAttrOrGemHole(selectEquipId); if (null != m_label_ProccessTips && m_label_ProccessTips.gameObject.activeSelf != showTips) { m_label_ProccessTips.gameObject.SetActive(showTips); if (showTips) { m_label_ProccessTips.text = "勾选属性消除后消失"; } } } } }
private void UpdateActivateRemove(Muhon data) { if (null == data) { return; } bool isActive = (data.AdditionAttrCount != 0) ? true : false; if (null != m_label_ActiveRemoveName) { m_label_ActiveRemoveName.text = data.Name; } //刷新圣魂升级信息 if (null != m_activeRemoveGrow) { m_activeRemoveGrow.SetGridData(data.QWThisID); } if (null != m_grid_ActivePropertyRoot && m_grid_ActivePropertyRoot.gameObject.activeSelf != isActive) { m_grid_ActivePropertyRoot.gameObject.SetActive(isActive); } if (isActive) { CheckActiveRemovePropertySelect(); List <GameCmd.PairNumber> attrPairs = data.GetAdditiveAttr(); GameCmd.PairNumber pair = null; UIMuhonPropertySelectGrid tempGrid = null; int gridCount = mlstMuhonPropertySelects.Count; for (int i = 0; i < gridCount; i++) { tempGrid = mlstMuhonPropertySelects[i]; if (null != attrPairs && attrPairs.Count > i) { if (!tempGrid.Visible) { tempGrid.SetVisible(true); } pair = attrPairs[i]; tempGrid.SetGridView(pair.id, emgr.GetAttrDes(pair), emgr.GetAttrGrade(pair), mlstSelectRemoveAttrs.Contains(pair.id)); } else if (tempGrid.Visible) { tempGrid.SetVisible(false); } } } //设置辅助 SetActivateRemoveAssist(); UpdateActiveRemoveState(data, isActive); }
void UpdateMainEquipAttr(bool canCompound) { Equip equip = Data; if (null != m_trans_CompoundMainAttrRoot) { if (m_trans_CompoundMainAttrRoot.gameObject.activeSelf != canCompound) { m_trans_CompoundMainAttrRoot.gameObject.SetActive(canCompound); } if (canCompound) { List <GameCmd.PairNumber> pairs = equip.GetAdditiveAttr(); AttrTransData tempTransData = null; GameCmd.PairNumber pair = null; for (int i = 0, max = m_compoundAttrTransData.Length; i < max; i++) { tempTransData = m_compoundAttrTransData[i]; if (null == tempTransData.Root) { continue; } if (null != pairs && pairs.Count > i) { if (!tempTransData.Root.gameObject.activeSelf) { tempTransData.Root.gameObject.SetActive(true); } pair = pairs[i]; if (null != tempTransData.Grade) { tempTransData.Grade.text = emgr.GetAttrGrade(pair).ToString(); } if (null != tempTransData.Des) { tempTransData.Des.text = emgr.GetAttrDes(pair); } } else if (tempTransData.Root.gameObject.activeSelf) { tempTransData.Root.gameObject.SetActive(false); } } } } }
private void UpdateUI() { Muhon itemData = DataManager.Manager <ItemManager>().GetBaseItemByQwThisId <Muhon>(blendMuhonId); if (null == itemData) { Engine.Utility.Log.Error("MuhonBlendCompletePanel UpdateUI faield get itemData null"); return; } EquipManager emgr = DataManager.Manager <EquipManager>(); if (null != m_showGrid) { m_showGrid.SetGridData(blendMuhonId); } if (null != m_label_EquipName) { m_label_EquipName.text = itemData.Name; } //更新属性信息 List <GameCmd.PairNumber> attrPairs = itemData.GetAdditiveAttr(); GameCmd.PairNumber pair = null; UIProperyGradeGrid tempGrid = null; int gridCount = mlstGrids.Count; for (int i = 0; i < gridCount; i++) { tempGrid = mlstGrids[i]; if (null != attrPairs && attrPairs.Count > i) { if (!tempGrid.Visible) { tempGrid.SetVisible(true); } pair = attrPairs[i]; tempGrid.SetGridView(emgr.GetAttrDes(pair), emgr.GetAttrGrade(pair), emgr.IsAttrGradeMax(pair)); } else if (tempGrid.Visible) { tempGrid.SetVisible(false); } } }
/// <summary> /// 获取附加属性 /// </summary> /// <returns></returns> public List <GameCmd.PairNumber> GetAdditiveAttr() { List <GameCmd.PairNumber> result = new List <GameCmd.PairNumber>(); if (null != serverData && null != serverData.numbers) { for (int i = 0; i < ServerData.numbers.Count; i++) { GameCmd.PairNumber pair = ServerData.numbers[i]; if (!ItemDefine.IsAdditiveAttr(pair.id)) { continue; } result.Add(pair); } } return(result); }
/// <summary> /// 更新提取 /// </summary> internal void UpdateFetch() { RuneStone rs = DataManager.Manager <ItemManager>() .GetTempBaseItemByBaseID <RuneStone>(emgr.InactiveRuneStoneBaseId, ItemDefine.ItemDataType.RuneStone); uint num = (uint)imgr.GetItemNumByBaseId(emgr.InactiveRuneStoneBaseId); if (null != m_processRsGrowShow) { m_processRsGrowShow.SetGridData(rs.BaseId); } int attrCount = GetEquipAttrCount(true); if (attrCount > 0) { EquipDefine.LocalAttrData attr = null; GameCmd.PairNumber attrPair = null; for (ForgingProccessPropertyIndex i = ForgingProccessPropertyIndex.One ; i < (ForgingProccessPropertyIndex)attrCount; i++) { attrPair = GetEquipAttrByIndex((int)i, true); if (m_dic_propCurGrids.ContainsKey(i) && !m_dic_propCurGrids[i].Visible) { m_dic_propCurGrids[i].SetVisible(true); attr = EquipDefine.LocalAttrData.Create(attrPair); m_dic_propCurGrids[i].SetGridView(ColorManager.GetColorString(ColorType.JZRY_Txt_Black, attr.AttrDes), attr.IsMaxGrade, true , attr.Grade); } } bool showTips = emgr.IsItemHaveAdditiveAttrOrGemHole(selectEquipId); if (null != m_label_ProccessTips && m_label_ProccessTips.gameObject.activeSelf != showTips) { m_label_ProccessTips.gameObject.SetActive(showTips); if (showTips) { m_label_ProccessTips.text = "提取后此装备消失"; } } } }
/// <summary> /// 刷新加工消费 /// </summary> private void UpdateProccessCost() { if (null != m_trans_ProccessCost) { uint proccessCost = 0; if (IsProccessMode(ForgingProccessMode.Fetch)) { proccessCost = emgr.RuneStoneActivationCost; } else { GameCmd.PairNumber selectAttrPair = GetEquipAttrByIndex((int)m_em_selectEquipAttrIndex); if (null != selectAttrPair) { uint matchRunestoneID = emgr.GetMatchAttrRuneStone(selectAttrPair); RuneStone rs = imgr.GetTempBaseItemByBaseID <RuneStone>(matchRunestoneID, ItemDefine.ItemDataType.RuneStone); if (IsProccessMode(ForgingProccessMode.Remove)) { proccessCost = (null != rs) ? rs.RemoveCost : 0; } else if (IsProccessMode(ForgingProccessMode.Promote)) { proccessCost = (null != rs) ? rs.PromoteCost : 0; } } } UICurrencyGrid currencyGrid = m_trans_ProccessCost.GetComponent <UICurrencyGrid>(); if (null == currencyGrid) { currencyGrid = m_trans_ProccessCost.gameObject.AddComponent <UICurrencyGrid>(); } currencyGrid.SetGridData(new UICurrencyGrid.UICurrencyGridData( MallDefine.GetCurrencyIconNameByType(GameCmd.MoneyType.MoneyType_Gold), proccessCost)); } }
private void ShowResult() { GameCmd.stEquipComposeItemWorkUserCmd_CS compoundData = emgr.CompoundData; if (null == compoundData.index_info || compoundData.index_info.Count != cardArray.Length) { return; } table.EquipComposeDataBase equipComposeDB = DataManager.Manager <ItemManager>().GetLocalDataBase <table.EquipComposeDataBase>(compoundData.new_item); if (null == equipComposeDB) { return; } m_assistID = equipComposeDB.assistId; m_assistNeedNum = equipComposeDB.assistNum; List <EquipManager.CompoudSelectAttrData> cardDatas = new List <EquipManager.CompoudSelectAttrData>(); int replaceCoinNum = (int)DataManager.Manager <MallManager>().GetDQPriceByItem(m_assistID); List <GameCmd.PairNumber> attrs = null; bool isBind = false; GameCmd.PropIndexInfo tempIndexInfo = null; EquipManager.CompoudSelectAttrData tempSelectAttrData = null;; GameCmd.PairNumber tempPair = null; GameCmd.PropIndexInfo.PropPair tempPropPair = null; for (int i = 0, max = compoundData.index_info.Count; i < max; i++) { isBind = false; tempIndexInfo = compoundData.index_info[i]; tempSelectAttrData = new EquipManager.CompoudSelectAttrData(); tempSelectAttrData.Index = tempIndexInfo.index; tempSelectAttrData.BaseID = compoundData.new_item; attrs = null; if (null != tempIndexInfo.value) { attrs = new List <GameCmd.PairNumber>(); for (int j = 0, maxJ = tempIndexInfo.value.Count; j < maxJ; j++) { tempPropPair = tempIndexInfo.value[j]; if (tempPropPair.key == (uint)GameCmd.eItemAttribute.Item_Attribute_FightPower) { continue; } if (tempPropPair.key == (uint)GameCmd.eItemAttribute.Item_Attribute_Bind) { if (ItemDefine.IsBind(tempPropPair.value)) { isBind = true; } continue; } tempPair = new GameCmd.PairNumber() { id = tempPropPair.key, value = tempPropPair.value, }; attrs.Add(tempPair); } } tempSelectAttrData.CostItemID = equipComposeDB.assistId; tempSelectAttrData.CostItemNum = (int)equipComposeDB.assistNum; tempSelectAttrData.ReplaceCostMoneyType = GameCmd.MoneyType.MoneyType_Coin; tempSelectAttrData.ReplaceCostMoneyNum = replaceCoinNum; tempSelectAttrData.Attrs = attrs; tempSelectAttrData.IsBind = isBind; cardDatas.Add(tempSelectAttrData); } bool isOpen = false; bool freeGet = (emgr.CompoundSelectIndex == 0); bool select = false; UICompoundSelectAttrGrid tempGrid = null; for (int i = 0, max = cardArray.Length; i < max; i++) { select = false; isOpen = false; tempGrid = cardArray[i]; if (null == tempGrid) { continue; } tempSelectAttrData = cardDatas[i]; if (!freeGet) { isOpen = emgr.IsEquipCompoundResultOpen(tempSelectAttrData.Index); if (isOpen) { select = (emgr.CompoundSelectIndex == tempSelectAttrData.Index); } } tempGrid.SetData(isOpen, data: tempSelectAttrData, select: select, freeGet: freeGet); } UpdateAssistData(); }
void ShowPetUI() { int labelNum = 6; UILabel[] labels = new UILabel[labelNum]; for (int i = 1; i <= 6; i++) { labels[i - 1] = m_trans_skilllabels.Find("Label" + i.ToString()).GetComponent <UILabel>(); labels[i - 1].enabled = false; } for (int i = 1; i <= 6; i++) { labels[i - 1] = m_trans_talentlabels.Find("Label" + i.ToString()).GetComponent <UILabel>(); labels[i - 1].enabled = false; } for (int i = 0; i < m_itemServer.numbers.Count; i++) { GameCmd.PairNumber pn = m_itemServer.numbers[i]; GameCmd.eItemAttribute bute = (GameCmd.eItemAttribute)pn.id; switch (bute) { case GameCmd.eItemAttribute.Item_Attribute_Pet_Lv: m_label_level.text = string.Format("{0}{1}", pn.value.ToString(), CommonData.GetLocalString("级")); break; case GameCmd.eItemAttribute.Item_Attribute_Pet_Life: { m_label_petLift.gameObject.SetActive(true); string showStr = string.Format("{0} {1}", CommonData.GetLocalString("寿命:"), pn.value.ToString()); m_label_petLift.text = ColorManager.GetColorString(252, 230, 188, 255, showStr); } break; case GameCmd.eItemAttribute.Item_Attribute_Pet_Base_Id: { PetDataBase db = GameTableManager.Instance.GetTableItem <PetDataBase>(pn.value); if (db != null) { m_label_Label_2.text = CommonData.GetLocalString("携带等级") + " " + db.carryLevel; m_label_name.text = db.petName; // DataManager.Manager<UIManager>().SetSpriteDynamicIcon(m_sprite_icon, db.icon, true); UIManager.GetTextureAsyn(db.icon, ref m_curIconAsynSeed, () => { if (null != m__icon) { m__icon.mainTexture = null; } }, m__icon); if (null != m_sprite_qulity) { UIManager.GetQualityAtlasAsyn(db.petQuality, ref m_curBordernAsynSeed, () => { if (null != m_sprite_qulity) { m_sprite_qulity.atlas = null; } }, m_sprite_qulity); } m_label_Label_3.text = string.Format("{0}{1}", CommonData.GetLocalString("类型:"), db.attackType); } } break; case GameCmd.eItemAttribute.Item_Attribute_Pet_Grade: { string st = DataManager.Manager <PetDataManager>().GetGrowStatus((int)pn.value); string showStr = string.Format("{0} {1}", CommonData.GetLocalString("成长状态"), st); m_label_petGradeValue.text = ColorManager.GetColorString(252, 230, 188, 255, showStr); } break; case GameCmd.eItemAttribute.Item_Attribute_Pet_Yh_Lv: { uint petYhLv = pn.value; string showStr = string.Format("{0} {1}{2}", CommonData.GetLocalString("修为"), petYhLv, CommonData.GetLocalString("级")); m_label_petYhLv.text = ColorManager.GetColorString(252, 230, 188, 255, showStr); } break; case GameCmd.eItemAttribute.Item_Attribute_Pet_Character: { uint petCharacter = pn.value; string cha = DataManager.Manager <PetDataManager>().GetPetCharacterStr((int)petCharacter); string showStr = string.Format("{0} {1}", CommonData.GetLocalString("性格:"), cha); m_label_petCharacter.text = ColorManager.GetColorString(252, 230, 188, 255, showStr); } break; case GameCmd.eItemAttribute.Item_Attribute_Pet_By_Lv: { uint variableLevel = pn.value; string cha = DataManager.Manager <PetDataManager>().GetJieBianString((int)variableLevel, false); string showStr = string.Format("{0} {1}", CommonData.GetLocalString("劫变:"), cha); m_label_variableLevel.text = ColorManager.GetColorString(252, 230, 188, 255, showStr); } break; case GameCmd.eItemAttribute.Item_Attribute_Pet_Inherit_time: { uint InheritingNumber = pn.value; string showStr = string.Format("{0} {1}", CommonData.GetLocalString("传承次数:"), InheritingNumber); m_label_InheritingNumber.text = ColorManager.GetColorString(252, 230, 188, 255, showStr); } break; } if (bute >= GameCmd.eItemAttribute.Item_Attribute_Pet_Cur_Talent_Zhili && bute <= GameCmd.eItemAttribute.Item_Attribute_Pet_Cur_Talent_Jingshen) { int index = bute - GameCmd.eItemAttribute.Item_Attribute_Pet_Cur_Talent_Zhili; UILabel label = telentLabels[index]; string showStr = ""; if (bute == GameCmd.eItemAttribute.Item_Attribute_Pet_Cur_Talent_Zhili) { showStr = CommonData.GetLocalString("智力天赋"); } else if (bute == GameCmd.eItemAttribute.Item_Attribute_Pet_Cur_Talent_Minjie) { showStr = CommonData.GetLocalString("敏捷天赋"); } else if (bute == GameCmd.eItemAttribute.Item_Attribute_Pet_Cur_Talent_Tizhi) { showStr = CommonData.GetLocalString("体质天赋"); } else if (bute == GameCmd.eItemAttribute.Item_Attribute_Pet_Cur_Talent_Liliang) { showStr = CommonData.GetLocalString("力量天赋"); } else if (bute == GameCmd.eItemAttribute.Item_Attribute_Pet_Cur_Talent_Jingshen) { showStr = CommonData.GetLocalString("精神天赋"); } string labelStr = string.Format("{0} {1}", showStr, pn.value); label.text = labelStr; label.enabled = true; label.depth = 4 + index; } if (bute >= GameCmd.eItemAttribute.Item_Attribute_Pet_Skill_List1_Id && bute <= GameCmd.eItemAttribute.Item_Attribute_Pet_Skill_List6_Id) { int index = bute - GameCmd.eItemAttribute.Item_Attribute_Pet_Skill_List1_Id; UILabel label = skillLabels[index]; if (pn.value != 0) { SkillDatabase db = GameTableManager.Instance.GetTableItem <SkillDatabase>(pn.value, 1); if (db != null) { label.text = string.Format("{0} ", db.strName);// db.strName; label.enabled = true; label.depth = 4 + i; } } else { label.enabled = false; } } if (bute >= GameCmd.eItemAttribute.Item_Attribute_Pet_Skill_List1_Lv && bute <= GameCmd.eItemAttribute.Item_Attribute_Pet_Skill_List6_Lv) { int index = bute - GameCmd.eItemAttribute.Item_Attribute_Pet_Skill_List1_Lv; UILabel label = skillLabels[index]; if (pn.value != 0) { string msg = string.Format("{0} lv.{1}", label.text, pn.value); label.text = msg; } } } }
private void OnRideUI(uint baseId, uint level, UILabel[] labels) { m_label_petGradeValue.text = string.Format("速度加成: {0}%", RideData.GetSpeedById_Level(baseId, (int)level)); m_label_petLift.text = ""; m_label_petCharacter.text = ""; m_label_variableLevel.text = ""; m_label_InheritingNumber.text = ""; for (int i = 0; i < skillLabels.Length; i++) { skillLabels[i].enabled = false; } uint ride_life = 0; for (int i = 0; i < m_itemServer.numbers.Count; i++) { GameCmd.PairNumber pn = m_itemServer.numbers[i]; GameCmd.eItemAttribute bute = (GameCmd.eItemAttribute)pn.id; switch (bute) { case GameCmd.eItemAttribute.Item_Attribute_Ride_Level: break; case GameCmd.eItemAttribute.Item_Attribute_Ride_Life: ride_life = pn.value; break; case GameCmd.eItemAttribute.Item_Attribute_Ride_Skill: table.RideSkillData skilldata = GameTableManager.Instance.GetTableItem <table.RideSkillData>(baseId, (int)level); if (skilldata != null) { for (int n = 0; n < skilldata.skillArray.Count; n++) { labels[n].enabled = true; table.RideSkillDes rideSkillDes = GameTableManager.Instance.GetTableItem <table.RideSkillDes>(skilldata.skillArray[n]); if (rideSkillDes != null) { labels[n].text = rideSkillDes.skillName; } } } break; case GameCmd.eItemAttribute.Item_Attribute_Ride_Base_Id: table.RideDataBase ridedata = GameTableManager.Instance.GetTableItem <table.RideDataBase>(pn.value); if (ridedata != null) { m_label_name.text = ridedata.name; //DataManager.Manager<UIManager>().SetSpriteDynamicIcon(m_sprite_icon, ridedata.icon, true); UIManager.GetTextureAsyn(ridedata.icon, ref m_curIconAsynSeed, () => { if (null != m__icon) { m__icon.mainTexture = null; } }, m__icon); if (null != m_sprite_qulity) { UIManager.GetQualityAtlasAsyn(ridedata.quality, ref m_curBordernAsynSeed, () => { if (null != m_sprite_qulity) { m_sprite_qulity.atlas = null; } }, m_sprite_qulity); } m_label_Label_2.text = string.Format("品质: {0}", DataManager.Manager <RideManager>().GetRideQualityStr(ridedata.quality)); } break; default: break; } } m_label_petYhLv.text = string.Format("寿命: {0}", ride_life); }
/// <summary> /// /// </summary> /// <param name="none"></param> /// <param name="qwThisId"></param> /// <param name="index"></param> public void SetGridViewData(bool none, uint qwThisId = 0) { ResetInfoGrid(); this.m_uint_qwThisId = qwThisId; if (null != m_ts_none && m_ts_none.gameObject.activeSelf != none) { m_ts_none.gameObject.SetActive(none); } if (null != m_ts_infos && m_ts_infos.gameObject.activeSelf == none) { m_ts_infos.gameObject.SetActive(!none); } if (!none) { ResetInfoGrid(); Equip equip = DataManager.Manager <ItemManager>().GetBaseItemByQwThisId <Equip>(qwThisId); if (null != equip) { SetBorder(true, equip.BorderIcon); SetIcon(true, equip.Icon); SetBindMask(equip.IsBind); } if (null != m_lab_name) { m_lab_name.text = equip.Name; } if (null != m_TransDatas) { EquipManager emgr = DataManager.Manager <EquipManager>(); GameCmd.PairNumber pair = null; AttrTransData tempTransData = null; List <GameCmd.PairNumber> pairs = equip.GetAdditiveAttr(); for (int i = 0, max = m_TransDatas.Length; i < max; i++) { tempTransData = m_TransDatas[i]; if (null == tempTransData.Root) { continue; } if (null != pairs && pairs.Count > i) { if (!tempTransData.Root.gameObject.activeSelf) { tempTransData.Root.gameObject.SetActive(true); } pair = pairs[i]; if (null != tempTransData.Grade) { tempTransData.Grade.text = emgr.GetAttrGrade(pair).ToString(); } if (null != tempTransData.Des) { tempTransData.Des.text = emgr.GetAttrDes(pair); } } else if (tempTransData.Root.gameObject.activeSelf) { tempTransData.Root.gameObject.SetActive(false); } } } } }
private void UpdateBlend(Muhon data) { if (null == data) { return; } Muhon blendData = (blendSelectMuhonId != 0) ? imgr.GetBaseItemByQwThisId <Muhon>(blendSelectMuhonId) : null; //刷新圣魂升级信息 if (null != m_blendCurGrow) { m_blendCurGrow.SetGridData(data.QWThisID); } if (null != m_blendNextGrow) { m_blendNextGrow.SetGridData((null != blendData) ? blendData.QWThisID : 0); } bool choose = (blendSelectMuhonId != 0 && imgr.ExistItem(blendSelectMuhonId)) ? true : false; int attrOpenNum = (data.StartLevel == 0) ? 1 : (int)data.StartLevel; //<id,是否为原属性> Dictionary <uint, bool> retainAdditiveAttrDic = new Dictionary <uint, bool>(); //Cur Additive Attr Dictionary <uint, GameCmd.PairNumber> curAddtiveAttrsDic = new Dictionary <uint, GameCmd.PairNumber>(); foreach (GameCmd.PairNumber pair in data.GetAdditiveAttr()) { curAddtiveAttrsDic.Add(pair.id, pair); } //Blend Additive Attr Dictionary <uint, GameCmd.PairNumber> blendAddtiveAttrsDic = new Dictionary <uint, GameCmd.PairNumber>(); if (null != blendData) { foreach (GameCmd.PairNumber pair in blendData.GetAdditiveAttr()) { blendAddtiveAttrsDic.Add(pair.id, pair); } } if (null != m_btn_BlendUnload && m_btn_BlendUnload.gameObject.activeSelf != choose) { m_btn_BlendUnload.gameObject.SetActive(choose); } if (choose) { bool inCur = true; foreach (GameCmd.PairNumber pairCur in curAddtiveAttrsDic.Values) { if (retainAdditiveAttrDic.Count >= attrOpenNum) { continue; } inCur = true; if (blendAddtiveAttrsDic.ContainsKey(pairCur.id) && blendAddtiveAttrsDic[pairCur.id].value > pairCur.value) { inCur = false; } retainAdditiveAttrDic.Add(pairCur.id, inCur); } foreach (GameCmd.PairNumber pairBlend in blendAddtiveAttrsDic.Values) { if (retainAdditiveAttrDic.Count >= attrOpenNum) { continue; } if (!retainAdditiveAttrDic.ContainsKey(pairBlend.id)) { retainAdditiveAttrDic.Add(pairBlend.id, false); } } } List <GameCmd.PairNumber> curTempAttrList = new List <GameCmd.PairNumber>(curAddtiveAttrsDic.Values); List <GameCmd.PairNumber> blendTempAttrList = new List <GameCmd.PairNumber>(blendAddtiveAttrsDic.Values); string attrDes; bool chooseAttr = false; uint attrGrade = 0; UIMuhonPropertyGrid muhonGrid = null; GameCmd.PairNumber pairNum = null; int index = 0; for (EquipDefine.AttrIndex i = EquipDefine.AttrIndex.First; i <= EquipDefine.AttrIndex.Fifth; i++) { index = (int)i - 1; //填充当前圣魂属性 if (m_dic_currentAttrs.TryGetValue(i, out muhonGrid)) { if ((index + 1) <= attrOpenNum) { if (curTempAttrList.Count > index) { pairNum = curTempAttrList[index]; attrDes = emgr.GetAttrDes(pairNum); chooseAttr = (retainAdditiveAttrDic.ContainsKey(pairNum.id) && retainAdditiveAttrDic[pairNum.id]) ? true : false; attrGrade = emgr.GetAttrGrade(pairNum); muhonGrid.SetGridView(true, false, txt: attrDes, needMask: choose, grade: attrGrade, check: chooseAttr); } else { muhonGrid.SetGridView(true); } } else { muhonGrid.SetGridView(false, lockDes: tmgr.GetMuhonAttrLockDes(i)); } } //填充融合圣魂属性 if (m_dic_blendAtrs.TryGetValue(i, out muhonGrid)) { if ((index + 1) <= attrOpenNum) { if (blendTempAttrList.Count > index) { pairNum = blendTempAttrList[index]; attrDes = emgr.GetAttrDes(pairNum); chooseAttr = (retainAdditiveAttrDic.ContainsKey(pairNum.id) && !retainAdditiveAttrDic[pairNum.id]) ? true : false; attrGrade = emgr.GetAttrGrade(pairNum); muhonGrid.SetGridView(true, false, txt: attrDes, needMask: choose, grade: attrGrade, check: chooseAttr); } else { muhonGrid.SetGridView(true); } } else { muhonGrid.SetGridView(false, lockDes: tmgr.GetMuhonAttrLockDes(i)); } } } //显示Tips if (null != m_trans_BlendTips && m_trans_BlendTips.gameObject.activeSelf != choose) { m_trans_BlendTips.gameObject.SetActive(choose); } //辅助 SetBlendAssist(); }
private void ParseTableData() { table.GridStrengthenSuitDataBase gt = TableData; if (null != gt) { //套装 m_lstSuitProp = new List <GameCmd.PairNumber>(); GameCmd.PairNumber pair = null; if (gt.phyAttack != 0) { //物攻 pair = new GameCmd.PairNumber() { id = (uint)GameCmd.eItemAttribute.Item_Attribute_Pdam, value = gt.phyAttack, }; m_lstSuitProp.Add(pair); } if (gt.magicAttack != 0) { //法攻 pair = new GameCmd.PairNumber() { id = (uint)GameCmd.eItemAttribute.Item_Attribute_Mdam, value = gt.magicAttack, }; m_lstSuitProp.Add(pair); } if (gt.phyDef != 0) { //物防 pair = new GameCmd.PairNumber() { id = (uint)GameCmd.eItemAttribute.Item_Attribute_Pdef, value = gt.phyDef, }; m_lstSuitProp.Add(pair); } if (gt.magicDef != 0) { //法防 pair = new GameCmd.PairNumber() { id = (uint)GameCmd.eItemAttribute.Item_Attribute_Mdef, value = gt.magicDef, }; m_lstSuitProp.Add(pair); } if (gt.hp != 0) { //生命值 pair = new GameCmd.PairNumber() { id = (uint)GameCmd.eItemAttribute.Item_Attribute_HPMax, value = gt.hp, }; m_lstSuitProp.Add(pair); } if (gt.magic != 0) { //法术值 pair = new GameCmd.PairNumber() { id = (uint)GameCmd.eItemAttribute.Item_Attribute_MPMax, value = gt.magic, }; m_lstSuitProp.Add(pair); } } }
/// <summary> /// 更新提升 /// </summary> internal void UpdatePromote() { bool isSelectRS = (m_uint_selectRSBaseId != 0); RuneStone rs = DataManager.Manager <ItemManager>() .GetTempBaseItemByBaseID <RuneStone>(m_uint_selectRSBaseId, ItemDefine.ItemDataType.RuneStone); uint num = (isSelectRS) ? (uint)imgr.GetItemNumByBaseId(m_uint_selectRSBaseId) : 0; if (null != m_processRsGrowShow) { m_processRsGrowShow.SetGridData(m_uint_selectRSBaseId, needUnload: true); } int attrCount = GetEquipAttrCount(); if (attrCount > 0) { EquipDefine.LocalAttrData attr = null; EquipDefine.LocalAttrData nextAttr = null; GameCmd.PairNumber attrPair = null; ColorType cType = ColorType.JZRY_Txt_Black; bool choose = false; Vector3 tempPos = Vector3.zero; for (ForgingProccessPropertyIndex i = ForgingProccessPropertyIndex.One; i < (ForgingProccessPropertyIndex)attrCount; i++) { cType = ColorType.JZRY_Txt_Black; choose = IsSelectEquipAttr() && (m_em_selectEquipAttrIndex == i); attrPair = GetEquipAttrByIndex((int)i); attr = EquipDefine.LocalAttrData.Create(attrPair); if (m_dic_propCurGrids.ContainsKey(i)) { m_dic_propCurGrids[i].SetVisible(true); m_dic_propCurGrids[i].SetGridView(ColorManager.GetColorString(cType, attr.AttrDes), attr.IsMaxGrade, true , attr.Grade); } if (m_dic_propNextGrids.ContainsKey(i)) { cType = (choose) ? ColorType.JZRY_Green : ColorType.JZRY_Txt_Black; m_dic_propNextGrids[i].SetVisible(true); if (attr.IsMaxGrade) { m_dic_propNextGrids[i].SetGridView("", false, false); m_dic_propNextGrids[i].SetProperty("已提升至最大等级"); } else { nextAttr = EquipDefine.LocalAttrData.Create((null != attr) ? attr.NextEffectId : 0); if (null != nextAttr) { m_dic_propNextGrids[i].SetGridView( ColorManager.GetColorString(cType, nextAttr.AttrDes), nextAttr.IsMaxGrade, true, nextAttr.Grade); } else { Engine.Utility.Log.Error("Forgingpanel_proccess UpdatePromote nextAttr null"); } } if (null != m_trans_ArrowPromote && choose && isSelectRS) { if (!m_trans_ArrowPromote.gameObject.activeSelf) { m_trans_ArrowPromote.gameObject.SetActive(true); } tempPos = m_trans_ArrowPromote.position; tempPos.y = m_dic_propCurGrids[i].CacheTransform.position.y; m_trans_ArrowPromote.transform.position = tempPos; if (null != m_label_ArrowPromoteTxt) { uint differ = (null != attr && null != rs) ? (rs.Grade - attr.Grade) : 0; m_label_ArrowPromoteTxt.text = string.Format("成功率{0}%", emgr.GetPropertyPromoteProp(differ)); } } } if (m_dic_propCBs.ContainsKey(i) && !m_dic_propCBs[i].gameObject.activeSelf) { m_dic_propCBs[i].gameObject.SetActive(true); m_dic_propCBs[i].Set(choose); } } } }
private LocalAttrData(GameCmd.PairNumber attr) { this.attr = attr; }
/// <summary> /// 点击属性提升符石选择 /// </summary> private void OnSelectProcessRuneStone() { if (!IsSelectEquipAttr() || DataManager.Manager <UIPanelManager>().IsShowPanel(PanelID.ItemChoosePanel)) { TipsManager.Instance.ShowTips("请勾选需要提升的属性"); return; } GameCmd.PairNumber selectAttrPair = GetEquipAttrByIndex((int)m_em_selectEquipAttrIndex); if (null == selectAttrPair) { Engine.Utility.Log.Error("Get AttrPair faield,promoteid:{0}", 0); return; } uint selectAttrGrade = emgr.GetAttrGrade(selectAttrPair); bool filterEqual = IsProccessMode(ForgingProccessMode.Promote); //筛选满足条件符石 List <uint> baseIdList = emgr.GetMatchProperyRunestone(selectAttrPair, filterEqual); UILabel desLabel = null; Action <UILabel> desLabAction = (des) => { desLabel = des; if (null != desLabel) { if (filterEqual) { desLabel.text = m_tmgr.GetLocalText(LocalTextType.Local_TXT_Rune_1); } else { desLabel.text = m_tmgr.GetLocalText(LocalTextType.Local_TXT_Rune_2); } } }; uint tempSelectGemRuneStoneId = 0; UIRSInfoSelectGrid selectGemRuneStoneGrid = null; UIEventDelegate eventDlg = (eventTye, grid, param) => { if (eventTye == UIEventType.Click) { UIRSInfoSelectGrid tempGrid = grid as UIRSInfoSelectGrid; RuneStone tempRs = DataManager.Manager <ItemManager>() .GetTempBaseItemByBaseID <RuneStone>(tempGrid.BaseId, ItemDefine.ItemDataType.RuneStone); if (tempSelectGemRuneStoneId == tempGrid.BaseId) { tempSelectGemRuneStoneId = 0; tempGrid.SetHightLight(false); } else if (tempGrid.BaseId != 0) { bool enable = (!filterEqual) ? (tempRs.Grade >= selectAttrGrade) : (tempRs.Grade > selectAttrGrade); if (enable) { tempSelectGemRuneStoneId = tempGrid.BaseId; if (null != selectGemRuneStoneGrid) { selectGemRuneStoneGrid.SetHightLight(false); } tempGrid.SetHightLight(true); selectGemRuneStoneGrid = tempGrid; } else if (filterEqual) { TipsManager.Instance.ShowTips(LocalTextType.Rune_Promote1); } else { TipsManager.Instance.ShowTips(LocalTextType.Rune_Eliminate1); } } } }; ItemChoosePanel.ItemChooseShowData showData = new ItemChoosePanel.ItemChooseShowData() { createNum = baseIdList.Count, title = "选择符石", nullTips = "您未拥有该类符石", cloneTemp = m_trans_UIRSInfoSelectGrid.gameObject, onChooseCallback = () => { if (tempSelectGemRuneStoneId != m_uint_selectRSBaseId) { m_uint_selectRSBaseId = tempSelectGemRuneStoneId; UpdateProccess(Data); } }, gridCreateCallback = (obj, index) => { if (index >= baseIdList.Count) { Engine.Utility.Log.Error("OnSelectPromoteRuneStone error,index out of range"); } else { table.ItemDataBase tempItemDataBase = imgr.GetLocalDataBase <table.ItemDataBase>(baseIdList[index]); table.RunestoneDataBase tempRuneStoneDataBase = imgr.GetLocalDataBase <table.RunestoneDataBase>(baseIdList[index]); if (null == tempItemDataBase || null == tempRuneStoneDataBase) { Engine.Utility.Log.Error("OnSelectPromoteRuneStone error,get itemdatabase or tempItemDataBase null baseid:{0}", baseIdList[index]); } else { UIRSInfoSelectGrid gemRuneStoneGrid = obj.GetComponent <UIRSInfoSelectGrid>(); if (null == gemRuneStoneGrid) { gemRuneStoneGrid = obj.AddComponent <UIRSInfoSelectGrid>(); } gemRuneStoneGrid.RegisterUIEventDelegate(eventDlg); RuneStone rs = DataManager.Manager <ItemManager>() .GetTempBaseItemByBaseID <RuneStone>(baseIdList[index], ItemDefine.ItemDataType.RuneStone); bool select = (baseIdList[index] == m_uint_selectRSBaseId); bool enable = (!filterEqual) ? (rs.Grade >= selectAttrGrade) : (rs.Grade > selectAttrGrade); gemRuneStoneGrid.SetGridViewData(baseIdList[index], select, enable); if (select) { selectGemRuneStoneGrid = gemRuneStoneGrid; tempSelectGemRuneStoneId = baseIdList[index]; } } } }, desPassCallback = desLabAction, }; DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.ItemChoosePanel, data: showData); }
/// <summary> /// 计算保护数据 /// </summary> private void CalculateProtectData() { m_dicPrtAttData.Clear(); GameCmd.PairNumber pair = null; int rsNeed = 0; Dictionary <uint, int> holdRsNum = new Dictionary <uint, int>(); Dictionary <uint, int> simiRsCount = new Dictionary <uint, int>(); uint rsId = 0; for (int i = 0, max = m_lst_checkProtectAttr.Count; i < max; i++) { pair = GetAttrPairByAttrId(m_lst_checkProtectAttr[i]); if (!emgr.TryGetRuneStoneIdByEffectId(emgr.TransformAttrToEffectId(pair), out rsId)) { continue; } if (!simiRsCount.ContainsKey(rsId)) { simiRsCount.Add(rsId, 1); } else { simiRsCount[rsId] += 1; } } bool isLast = false; int fillNum = 0; for (int i = 0, max = m_lst_checkProtectAttr.Count; i < max; i++) { pair = GetAttrPairByAttrId(m_lst_checkProtectAttr[i]); if (!emgr.TryGetRuneStoneIdByEffectId(emgr.TransformAttrToEffectId(pair), out rsId)) { m_dicPrtAttData.Add(pair.id, new ProtectAttrData() { AttrPair = pair, FillNum = 0, NeedNum = 0, }); continue; } if (!holdRsNum.ContainsKey(rsId)) { holdRsNum.Add(rsId, imgr.GetItemNumByBaseId(rsId)); } isLast = simiRsCount[rsId] == 1; rsNeed = GetAttrProtectNeedRSNum(pair); if (isLast) { fillNum = holdRsNum[rsId]; } else { fillNum = (holdRsNum[rsId] >= rsNeed) ? rsNeed : holdRsNum[rsId]; } holdRsNum[rsId] -= fillNum; m_dicPrtAttData.Add(pair.id, new ProtectAttrData() { AttrPair = pair, FillNum = fillNum, NeedNum = rsNeed, }); } }
/// <summary> /// 单个符石保护概率 /// </summary> /// <returns></returns> private float GetSingleRSProp(GameCmd.PairNumber attrPair) { return(emgr.GetZFAttrUintProtectProb(attrPair, m_lst_checkProtectAttr.Count) / 100f); }