private void HandleUpgradePartnerStageResult(JsonMessage lobbyMsg) { JsonData jsonData = lobbyMsg.m_JsonData; ArkCrossEngineMessage.Msg_LC_UpgradeParnerStageResult protoData = lobbyMsg.m_ProtoData as ArkCrossEngineMessage.Msg_LC_UpgradeParnerStageResult; if (null != protoData) { if ((int)PartnerMsgResultEnum.SUCCESS == protoData.m_ResultCode) { RoleInfo role = LobbyClient.Instance.CurrentRole; PartnerInfo partner = role.PartnerStateInfo.GetPartnerInfoById(protoData.m_PartnerId); if (null == partner) { return; } PartnerConfig partnerConfig = PartnerConfigProvider.Instance.GetDataById(protoData.m_PartnerId); PartnerStageUpConfig psuConfig = PartnerStageUpConfigProvider.Instance.GetDataById(partner.CurSkillStage); if (null != partnerConfig && null != psuConfig) { role.ReduceItemData(partnerConfig.StageUpItemId, 0, psuConfig.ItemCost); role.Money -= psuConfig.GoldCost; } UserInfo user = WorldSystem.Instance.GetPlayerSelf(); if (null != user) { user.ParterChanged = true; } if (null != role) { role.PartnerStateInfo.SetPartnerStage(protoData.m_PartnerId, protoData.m_CurStage); } } GfxSystem.PublishGfxEvent("ge_partner_upgrade_skill_result", "ui", protoData.m_ResultCode); } }
private static bool CheckPartnerCanUpgrade(int partnerId) { RoleInfo role_info = LobbyClient.Instance.CurrentRole; PartnerInfo partnerInfo = role_info.PartnerStateInfo.GetPartnerInfoById(partnerId); if (partnerInfo != null && partnerInfo.CurSkillStage < 4) {//未满级 int ownItemNum = GetItemDataInfoById(partnerInfo.StageUpItemId).ItemNum; PartnerStageUpConfig stageUpCfg = PartnerStageUpConfigProvider.Instance.GetDataById(partnerInfo.CurSkillStage); int itemNeedNum = 0; if (stageUpCfg != null) { itemNeedNum = stageUpCfg.ItemCost; if (ownItemNum >= itemNeedNum) { return(true); } } } return(false); }
//设置升阶信息 public void SetLiftSkillInfo(PartnerConfig partnerCfg, int stage, int itemId) { if (partnerCfg == null) { return; } List <string> iconList = new List <string>(); if (iconList == null) { return; } iconList.Add(partnerCfg.Icon0); iconList.Add(partnerCfg.Icon1); iconList.Add(partnerCfg.Icon2); iconList.Add(partnerCfg.Icon3); List <string> DescList = new List <string>(); if (DescList == null) { return; } DescList.Add(partnerCfg.StageDescription0); DescList.Add(partnerCfg.StageDescription1); DescList.Add(partnerCfg.StageDescription2); DescList.Add(partnerCfg.StageDescription3); UIAtlas atlas = null; UnityEngine.GameObject goAtlas = CrossObjectHelper.TryCastObject <UnityEngine.GameObject>(ResourceSystem.GetSharedResource(partnerCfg.AtlasPath)); if (goAtlas != null) { atlas = goAtlas.GetComponent <UIAtlas>(); } for (int index = 0; index < c_SkillNumMax; ++index) { if (spLift[index] != null && index < iconList.Count) { spLift[index].spriteName = iconList[index]; spLift[index].atlas = atlas; } //设置技能图标 if (lblLifts[index] != null && index < DescList.Count) { lblLifts[index].text = DescList[index]; } if (stage >= index + 1) { spLift[index].color = LightColor; } else { spLift[index].color = AshColor; } //设置进阶箭头 if (index < spArrow.Length && spArrow[index] != null) { if (stage > index + 1) { spArrow[index].spriteName = "sheng-ji-jian-tou1"; } else { spArrow[index].spriteName = "sheng-ji-jian-tou2"; } } if (stage >= index + 1) { lblLifts[index].color = SectionColor; } else { lblLifts[index].color = AshColor; } } m_PartnerSkillLiftUpItemId = itemId; DFMItemIconUtils.Instance.SetItemInfo(ItemIconType.Partner_Skill, goSkillLift, itemId); if (stage < 4) { //if (textureLiftGoods != null) NGUITools.SetActive(textureLiftGoods.gameObject, true); if (lblLiftItemNum != null) { NGUITools.SetActive(lblLiftItemNum.gameObject, true); } if (btnLiftUp != null) { NGUITools.SetActive(btnLiftUp.gameObject, true); } int itemNeedNum = 0; ItemConfig itemCfg = ItemConfigProvider.Instance.GetDataById(itemId); if (itemCfg != null) { PartnerStageUpConfig stageUpCfg = PartnerStageUpConfigProvider.Instance.GetDataById(stage); if (stageUpCfg != null) { itemNeedNum = stageUpCfg.ItemCost; } int ownItemNum = GetItemNum(itemId); if (lblLiftItemNum != null) { lblLiftItemNum.text = ownItemNum + "/" + itemNeedNum; } if (itemProgressBar != null && itemNeedNum != 0) { itemProgressBar.value = ownItemNum / (float)itemNeedNum; } bool enable = (ownItemNum >= itemNeedNum); EnableButton(btnLiftUp, enable); } } else { string CHN = StrDictionaryProvider.Instance.GetDictString(359); if (lblLiftItemName != null) { lblLiftItemName.text = CHN; } if (itemProgressBar != null) { itemProgressBar.value = 1; } if (btnLiftUp != null) { NGUITools.SetActive(btnLiftUp.gameObject, false); } //if (textureLiftGoods != null) NGUITools.SetActive(textureLiftGoods.gameObject, false); if (lblLiftItemNum != null) { NGUITools.SetActive(lblLiftItemNum.gameObject, false); } } }