From 5026bdd0c3df032101ad639f1455d51ecb67243f Mon Sep 17 00:00:00 2001 From: jiaoyangna <3046463818@qq.com> Date: Thu, 5 Nov 2020 16:02:49 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=9A=AE=E8=82=A4=E3=80=91=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../~Lua/Modules/Hero/HeroManager.lua | 38 ++++++++++++ .../Popup/RewardItemSingleShowPopup.lua | 16 +++-- .../~Lua/Modules/RoleInfo/RoleInfoPanel.lua | 9 ++- .../~Lua/Modules/RoleInfo/RoleSkinPanel.lua | 60 ++++++++++--------- 4 files changed, 87 insertions(+), 36 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/Hero/HeroManager.lua b/Assets/ManagedResources/~Lua/Modules/Hero/HeroManager.lua index 73a9e0d4bf..028727d1d7 100644 --- a/Assets/ManagedResources/~Lua/Modules/Hero/HeroManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Hero/HeroManager.lua @@ -297,6 +297,43 @@ function this.GetHeroDataByHeroSIdAndMinSortId(_heroSId) end return heroData end + +--获取该静态id 没有穿皮肤的 sortid最小的英雄信息 +function this.GetHeroDataByHeroSIdAndMinSortIdAndSkinId(_heroSId,_skinId) + local heroData = {} + + local formationList = FormationManager.GetAllFormationHeroId() + for i, v in pairs(formationList) do + if heroDatas[i] then + local curData = heroDatas[i] + if curData.id == _heroSId and curData.skinId ~= _skinId then + if heroData and heroData.id then + if curData.sortId < heroData.sortId then + heroData = curData + end + else + heroData = curData + end + end + end + end + if heroData and heroData.id then + return heroData + end + for i, v in pairs(heroDatas) do + if v.id == _heroSId and v.skinId ~= _skinId then + if heroData and heroData.id then + if v.sortId < heroData.sortId then + heroData = v + end + else + heroData = v + end + end + end + LogPink("heroData.dynamicId:"..heroData.dynamicId) + return heroData +end --获取所有英雄信息(分解 回溯用 ) function this.GetAllHeroDataMsinusUpWar(_sortTypeId,type) --0全部 1-6属性 7-9 3、4、5星 local heros = {} @@ -3301,6 +3338,7 @@ end function this.ChangeDownSkinId(heroSId,skinId) for k,v in pairs(heroDatas) do if v.id == heroSId and v.skinId == skinId then + NetManager.ChangeHeroSkin(v.dynamicId,0,function() end) v.skinId = 0 v.skinConfig = heroConfig[v.id] v.live = GetResourcePath(v.skinConfig.Live) diff --git a/Assets/ManagedResources/~Lua/Modules/Popup/RewardItemSingleShowPopup.lua b/Assets/ManagedResources/~Lua/Modules/Popup/RewardItemSingleShowPopup.lua index bfd7ce429c..eb28325b6e 100644 --- a/Assets/ManagedResources/~Lua/Modules/Popup/RewardItemSingleShowPopup.lua +++ b/Assets/ManagedResources/~Lua/Modules/Popup/RewardItemSingleShowPopup.lua @@ -94,15 +94,21 @@ function RewardItemSingleShowPopup:BindEvent() end) Util.AddClick(this.btnJump, function() if itemConfigData.ItemType == ItemType.Skin then - local skinId = ConfigManager.GetConfigData(ConfigName.HeroSkin,itemSid).Type - if HeroSkinManager.IsExist(skinId) then + local skinConfig = ConfigManager.GetConfigData(ConfigName.HeroSkin,itemSid) + if HeroSkinManager.IsExist(skinConfig.Type) then PopupTipPanel.ShowTip("已解锁该皮肤,请在皮肤有效期之后再解锁") else local curResolveAllItemList = {} table.insert(curResolveAllItemList,{itemId = itemSid,itemNum = 1}) NetManager.UseAndPriceItemRequest(0,curResolveAllItemList,function (drop) - PopupTipPanel.ShowTip("已成功解锁该皮肤,请去神将界面穿戴") self:ClosePanel() + if HeroManager.GetCurHeroIsHaveBySid(skinConfig.HeroId) then + MsgPanel.ShowTwo(string.format("成功解锁皮肤%s,是否前往更换?",skinConfig.ReadingName),function() end,function() + local herodata = HeroManager.GetHeroDataByHeroSIdAndMinSortIdAndSkinId(skinConfig.HeroId,skinConfig.Type) + LogGreen("herodata.dynamicId:"..tostring(herodata.dynamicId)) + UIManager.OpenPanel(UIName.RoleInfoPanel,herodata, HeroManager.GetAllHeroDatas(),true,4) + end,"取消","确定","",false,"") + end end) end elseif itemConfigData then @@ -227,13 +233,13 @@ function RewardItemSingleShowPopup:OnShow() for i = 1, #jumpSortData do if jumpSortData[i].id > 0 then if not RECHARGEABLE then--(是否开启充值) - if this.isRewardItemPop == true or itemConfigData.Id == 61 or itemConfigData.Id == 19 then + if this.isRewardItemPop == true or itemConfigData.Id == 61 or itemConfigData.Id == 19 or itemConfigData.ItemType == 17 then SubUIManager.Open(SubUIConfig.JumpView, this.equipProGrid.transform, jumpSortData[i].id,false) else SubUIManager.Open(SubUIConfig.JumpView, this.equipProGrid.transform, jumpSortData[i].id,true) end else - if this.isRewardItemPop == true then + if this.isRewardItemPop == true or itemConfigData.ItemType == 17 then SubUIManager.Open(SubUIConfig.JumpView, this.equipProGrid.transform, jumpSortData[i].id,false) else SubUIManager.Open(SubUIConfig.JumpView, this.equipProGrid.transform, jumpSortData[i].id,true) diff --git a/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleInfoPanel.lua b/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleInfoPanel.lua index e7eb68b916..08638cce58 100644 --- a/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleInfoPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleInfoPanel.lua @@ -208,8 +208,13 @@ function RoleInfoPanel:RemoveListener() end --界面打开时调用(用于子类重写) -function RoleInfoPanel:OnOpen(_curHeroData, _heroDatas,_isUpZhen) +function RoleInfoPanel:OnOpen(_curHeroData, _heroDatas,_isUpZhen,_index) curHeroData, heroDatas,isUpZhen = _curHeroData, _heroDatas,_isUpZhen + if _index and _index > 0 then + _CurPageIndex = _index + else + _CurPageIndex = 1 + end end -- 打开,重新打开时回调 @@ -219,7 +224,7 @@ function RoleInfoPanel:OnShow() isClickLeftOrRightBtn = true this.upLvEffect:SetActive(false) for i = 1, #heroDatas do - if curHeroData == heroDatas[i] then + if curHeroData.dynamicId == heroDatas[i].dynamicId then index = i end end diff --git a/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleSkinPanel.lua b/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleSkinPanel.lua index a58958dd66..676dab4c02 100644 --- a/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleSkinPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleSkinPanel.lua @@ -89,44 +89,46 @@ function RoleSkinPanel:SetSingleData(go,data) porpertys[go][1].gameObject:SetActive(true) Util.GetGameObject(porpertys[go][1],"info"):GetComponent("Text").text = "获取途径" Util.AddOnceClick(porpertys[go][1].gameObject,function() + UIManager.OpenPanel(UIName.RewardItemSingleShowPopup, data.Id,function() end) end) lock.gameObject:SetActive(true) end if data.Type == curHeroData.skinId or (curHeroData.skinId == 0 and data.IsDefault == 1) then self.Select.transform:SetParent(Util.GetGameObject(go,"skinState").transform) self.Select:GetComponent("RectTransform").localPosition = Vector3.zero - elseif HeroSkinManager.IsExist(data.Type) or data.IsDefault == 1 then - local changeSkinId = data.IsDefault == 1 and 0 or data.Type - Util.AddOnceClick(go.gameObject,function() - NetManager.ChangeHeroSkin(curHeroData.dynamicId,changeSkinId,function() - poolManager:UnLoadLive(curHeroData.live, parent.curLiveObj) - HeroManager.ChangeSkinId(curHeroData.dynamicId,changeSkinId) - curHeroData = HeroManager.GetSingleHeroData(curHeroData.dynamicId) - curLiveName = curHeroData.Live - parent.curLiveObj = HeroManager.LoadHerolive(curHeroData,parent.curObj) - PopupTipPanel.ShowTip("已更换皮肤!") - isUnLoadLive = false - this:OnShow(0,parent,curHeroData) - end) - end) - else - Util.AddOnceClick(go.gameObject,function() - poolManager:UnLoadLive(curHeroData.live, parent.curLiveObj) - curLiveName = GetResourcePath(data.Live) - parent.curLiveObj = poolManager:LoadLive(GetResourcePath(data.Live), parent.curObj.transform, - Vector3.one * data.Scale, Vector3.New(data.Position[1], data.Position[2], 0)) - PopupTipPanel.ShowTip("未获得此皮肤!") - isUnLoadLive = true - end) end + Util.AddOnceClick(go.gameObject,function() + local skinId = data.IsDefault == 1 and 0 or data.Type + this:BtnAction(skinId,data) + end) end + +function RoleSkinPanel:BtnAction(skinId,data) + if skinId == curHeroData.skinId then + return + end + if HeroSkinManager.IsExist(skinId) or skinId == 0 then + NetManager.ChangeHeroSkin(curHeroData.dynamicId,skinId,function() + poolManager:UnLoadLive(curHeroData.live, parent.curLiveObj) + HeroManager.ChangeSkinId(curHeroData.dynamicId,skinId) + local tempdata = HeroManager.GetSingleHeroData(curHeroData.dynamicId) + curLiveName = tempdata.Live + parent.curLiveObj = HeroManager.LoadHerolive(tempdata,parent.curObj) + PopupTipPanel.ShowTip("已更换皮肤!") + this:OnShow(0,parent,tempdata) + end) + else + poolManager:UnLoadLive(curHeroData.live, parent.curLiveObj) + curLiveName = GetResourcePath(data.Live) + parent.curLiveObj = poolManager:LoadLive(GetResourcePath(data.Live), parent.curObj.transform, + Vector3.one * data.Scale, Vector3.New(data.Position[1], data.Position[2], 0)) + PopupTipPanel.ShowTip("未获得此皮肤!") + end + +end + function RoleSkinPanel:OnHide() - this.gameObject:SetActive(false) - -- if isUnLoadLive then - -- poolManager:UnLoadLive(curLiveName, parent.curLiveObj) - -- parent.curLiveObj = HeroManager.LoadHerolive(curHeroData,parent.curObj) - -- isUnLoadLive = false - -- end + this.gameObject:SetActive(false) end function RoleSkinPanel:OnClose()