From ed1d27394eec88513fa5a25c1ae01a4bdb9a8b68 Mon Sep 17 00:00:00 2001 From: wangzhenxing <1545929779@qq.com> Date: Tue, 2 Apr 2024 15:24:35 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=B9=E8=AE=AD=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../~Lua/Modules/Net/NetManager.lua | 15 +- .../RoleInfo/SpecailTrainingInfoPopup.lua | 168 +++++++++++------- .../RoleInfo/TrainingItemListPanel.lua | 66 +++---- 3 files changed, 140 insertions(+), 109 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua b/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua index cf2422f4e7..c3899de739 100644 --- a/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua @@ -7713,14 +7713,15 @@ function NetManager.TrainingUnlockSkillRequest(_heroid,_unlockId,pockemensId,mag end end if pockemensId then - - for i = 1, #pockemensId do - data.pokemonIds:append(tostring(pockemensId[i])) - end - - + for i = 1, #pockemensId do + data.pokemonIds:append(tostring(pockemensId[i])) + end + end + if magicSoldierIds then + for i = 1, #magicSoldierIds do + data.magicSoldierIds:append(tostring(magicSoldierIds[i])) + end end - --data.incarnationCards= incarnationCards if item then if item.itemtype==56 then diff --git a/Assets/ManagedResources/~Lua/Modules/RoleInfo/SpecailTrainingInfoPopup.lua b/Assets/ManagedResources/~Lua/Modules/RoleInfo/SpecailTrainingInfoPopup.lua index d5656daf96..7267fbc4e6 100644 --- a/Assets/ManagedResources/~Lua/Modules/RoleInfo/SpecailTrainingInfoPopup.lua +++ b/Assets/ManagedResources/~Lua/Modules/RoleInfo/SpecailTrainingInfoPopup.lua @@ -74,9 +74,13 @@ function SpecailTrainingInfoPopup:OnShow() HeroManager.GetHeroTrainingAddPro(self._curHerodata.dynamicId) self.ScrollView:SetData(self.showList, function(index, go) self:SetSingleData(index,go,self.showList[index]) + LayoutRebuilder.ForceRebuildLayoutImmediate(go.transform) end) - ForceRebuildLayout(self.GameObject.transform) + --ForceRebuildLayout(self.GameObject.transform) + UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(self.GameObject.transform) + UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(self.GameObject.transform) self.ScrollView:SetIndex(1) + LayoutRebuilder.ForceRebuildLayoutImmediate(self.GameObject.transform) end -- --_data=TrainingConfig @@ -165,7 +169,7 @@ function SpecailTrainingInfoPopup:SetSingleData(index,_go,_data) local Button = Util.GetGameObject( singleAttList[i][1],"Button") Util.AddOnceClick(Button,function() if not CheckFunctionOpen(FUNCTION_OPEN_TYPE.TrainBuild) then - PopupTipPanel.ShowTip("功能未开启") + PopupTipPanel.ShowTip("特训建筑功能未开启") return end if (ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.TrainBuild)) then @@ -241,7 +245,7 @@ function SpecailTrainingInfoPopup:SetSingleData(index,_go,_data) Util.GetGameObject( singleAttList[i][1],"Progress/Image"):GetComponent("RectTransform").sizeDelta = Vector3.New(360*size,25,0) Util.GetGameObject( singleAttList[i][1],"Progress/Text"):GetComponent("Text").text = string.format("%s/%s",curExp,trainExp) -- ForceRebuildLayout( singleAttList[i][1].transform) - + LayoutRebuilder.ForceRebuildLayoutImmediate(singleAttList[i][1].transform) singleAttList[i][1]:SetActive(true) end local activeIsOpen=false @@ -294,8 +298,7 @@ function SpecailTrainingInfoPopup:SetSingleData(index,_go,_data) PopupTipPanel.ShowTip(Language[12268]) return end - if tData.Level<=curLevel then - + if tData.Level<=curLevel then if #selectSkillUnlockItems1==0 or #selectSkillUnlockItems2==0 then PopupTipPanel.ShowTip(Language[10054]) @@ -303,18 +306,26 @@ function SpecailTrainingInfoPopup:SetSingleData(index,_go,_data) end local item={} local pokemenons={} - + local godWeapon={} + --local noHeroList={} if selectSkillUnlockItems1[1].type==3 then for i=1,#selectSkillUnlockItems1 do local t=selectSkillUnlockItems1[i] local pockemen={} pokemenons[i]=selectSkillUnlockItems1[i].dynamicId end - + --noHeroList=pokemenons + elseif selectSkillUnlockItems1[1].type==4 then + for i=1,#selectSkillUnlockItems1 do + local t=selectSkillUnlockItems1[i] + local pockemen={} + godWeapon[i]=selectSkillUnlockItems1[i].dynamicId + end + --noHeroList=godWeapon else - item.id=selectSkillUnlockItems1[1].itemData.id - item.itemNum=1 - item.itemtype=selectSkillUnlockItems1[1].itemData.itemType + item.id=selectSkillUnlockItems1[1].itemData.id + item.itemNum=1 + item.itemtype=selectSkillUnlockItems1[1].itemData.itemType end local TrainingUnlockSkillHeroItem={} for i=1,#selectSkillUnlockItems2 do @@ -332,46 +343,56 @@ function SpecailTrainingInfoPopup:SetSingleData(index,_go,_data) local magicSoldierIds={} magicSoldierIds[1]="" - NetManager.TrainingUnlockSkillRequest( self._curHerodata.dynamicId,tData.Id,pokemenons,nil,TrainingUnlockSkillHeroItem,item,function (msg) - UIManager.OpenPanel(UIName.RewardItemPopup, msg.drop, 1) - if #TrainingUnlockSkillHeroItem>0 then - local t={} - for i=1 ,#TrainingUnlockSkillHeroItem do - t[i]=TrainingUnlockSkillHeroItem[i].id - end - HeroManager.DeleteHeroDatas(t) - end - - if pokemenons and #pokemenons>0 then - PokemonManager.RemovePokemonData(pokemenons) - end - if self.OpenType==1 then - if CheckListIsContainValue1(self._curHerodata.HeroTraining.unlockIds,tData.Id) then - Chose:SetActive(false) - tip2:SetActive(true) - else - Chose:SetActive(true) - tip2:SetActive(false) - end - else + --LogError("111111111111111111111111111111111111111111111111111111111111111111111111111 noHeroList=="..#noHeroList.." TrainingUnlockSkillHeroItem=="..#TrainingUnlockSkillHeroItem) + NetManager.TrainingUnlockSkillRequest( self._curHerodata.dynamicId,tData.Id,pokemenons,godWeapon,TrainingUnlockSkillHeroItem,item,function (msg) + UIManager.OpenPanel(UIName.RewardItemPopup, msg.drop, 1) + if #TrainingUnlockSkillHeroItem>0 then + local t={} + for i=1 ,#TrainingUnlockSkillHeroItem do + t[i]=TrainingUnlockSkillHeroItem[i].id + end + HeroManager.DeleteHeroDatas(t) + end + selectSkillUnlockItems1={} + selectSkillUnlockItems2={} + if pokemenons and #pokemenons>0 then + PokemonManager.RemovePokemonData(pokemenons) + end + if godWeapon and #godWeapon>0 then + --PokemonManager.RemovePokemonData(pokemenons) + GodWeaponManager.RemoveWeaponData(godWeapon) + end + if self.OpenType==1 then if CheckListIsContainValue1(self._curHerodata.HeroTraining.unlockIds,tData.Id) then Chose:SetActive(false) tip2:SetActive(true) - localContent:SetActive(true) - skillBtn:SetActive(true) else Chose:SetActive(true) tip2:SetActive(false) - localContent:SetActive(false) - skillBtn:SetActive(false) - end - end - self.ScrollView:SetData(self.showList, function(index, go) - self:SetSingleData(index,go,self.showList[index]) + end + else + if CheckListIsContainValue1(self._curHerodata.HeroTraining.unlockIds,tData.Id) then + Chose:SetActive(false) + tip2:SetActive(true) + localContent:SetActive(true) + skillBtn:SetActive(true) + else + Chose:SetActive(true) + tip2:SetActive(false) + localContent:SetActive(false) + skillBtn:SetActive(false) + end + end + self.ScrollView:SetData(self.showList, function(index, go) + self:SetSingleData(index,go,self.showList[index]) + end) + --ForceRebuildLayout(_go.transform) + UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(_go.transform) + UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(_go.transform) + --ForceRebuildLayout(self.GameObject.transform) + UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(self.GameObject.transform) + UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(self.GameObject.transform) end) - ForceRebuildLayout(_go.transform) - ForceRebuildLayout(self.GameObject.transform) - end) end end ) @@ -406,6 +427,8 @@ function SpecailTrainingInfoPopup:SetSingleData(index,_go,_data) tmpData[i].type=1---Item 栏位 if tData.NeedItem1[i][1]== 21 then tmpData[i].type=3 + elseif tData.NeedItem1[i][1]== 53 then + tmpData[i].type=4 end if tData.NeedItem1[i][1]== 56 then tmpData[i].Name= ItemBaseTypeName[tData.NeedItem1[i][2]] @@ -436,14 +459,13 @@ function SpecailTrainingInfoPopup:SetSingleData(index,_go,_data) local itemIcon= Util.GetGameObject(singleSkillList[i],"hero/icon"):GetComponent("Image") if curData.type==1 then Util.GetGameObject(singleSkillList[i],"Name"):GetComponent("Text").text=GetQuantityStrByquality(curData.data[3])..curData.Name - itemIcon.sprite=self.spLoader:LoadSprite("r_characterbg_blue") - + itemIcon.sprite=self.spLoader:LoadSprite("UI_hz_beibao_duigoudi") elseif curData.type==2 then Util.GetGameObject(singleSkillList[i],"Name"):GetComponent("Text").text=NumToChinese[curData.heroGroupData[1]].."星"..curData.Name - itemIcon.sprite=self.spLoader:LoadSprite("r_hero_jinjie-touxiang2") + itemIcon.sprite=self.spLoader:LoadSprite("UI_hz_zhonghe05_70") else Util.GetGameObject(singleSkillList[i],"Name"):GetComponent("Text").text=GetQuantityStrByquality(curData.data[3])..curData.Name - itemIcon.sprite=self.spLoader:LoadSprite("r_characterbg_blue") + itemIcon.sprite=self.spLoader:LoadSprite("UI_hz_beibao_duigoudi") end local needNum= Util.GetGameObject(singleSkillList[i],"hero/lvbg/CountText"):GetComponent("Text") local neednum=1 @@ -480,7 +502,7 @@ function SpecailTrainingInfoPopup:SetSingleData(index,_go,_data) selectSkillUnlockItems1[i]=selectItems[i] end else - itemIcon.sprite=self.spLoader:LoadSprite("r_characterbg_blue") + itemIcon.sprite=self.spLoader:LoadSprite("UI_hz_beibao_duigoudi") add:SetActive(true) needNum.text="0".."/"..neednum end @@ -488,21 +510,22 @@ function SpecailTrainingInfoPopup:SetSingleData(index,_go,_data) selectSkillUnlockItems2={} if #selectHeroOrItems>0 then - if selectHeroOrItems[1].type==1 then - itemIcon.sprite=self.spLoader:LoadSprite(selectHeroOrItems[1].icon) - - else - local itemConfig = ConfigManager.TryGetConfigData(ConfigName.ItemConfig,selectHeroOrItems[1].id) - if not itemConfig then return end - -- icon.sprite = self.spLoader:LoadSprite(GetResourcePath(itemConfig.ResourceID)) - itemIcon.sprite=self.spLoader:LoadSprite(GetResourcePath(itemConfig.ResourceID)) + if selectHeroOrItems[1].type==1 then + itemIcon.sprite=self.spLoader:LoadSprite(selectHeroOrItems[1].icon) needNum.text=#selectHeroOrItems.."/"..neednum - end - for i=1 ,#selectHeroOrItems do - selectSkillUnlockItems2[i]=selectHeroOrItems[i] - end - add:SetActive(false) - else + else + local itemConfig = ConfigManager.TryGetConfigData(ConfigName.ItemConfig,selectHeroOrItems[1].id) + if not itemConfig then return end + + -- icon.sprite = self.spLoader:LoadSprite(GetResourcePath(itemConfig.ResourceID)) + itemIcon.sprite=self.spLoader:LoadSprite(GetResourcePath(itemConfig.ResourceID)) + needNum.text=#selectHeroOrItems.."/"..neednum + end + for i=1 ,#selectHeroOrItems do + selectSkillUnlockItems2[i]=selectHeroOrItems[i] + end + add:SetActive(false) + else itemIcon.sprite=self.spLoader:LoadSprite("r_hero_jinjie-touxiang2") add:SetActive(true) needNum.text="0".."/"..neednum @@ -529,6 +552,23 @@ function SpecailTrainingInfoPopup:SetSingleData(index,_go,_data) itemIcon.sprite=self.spLoader:LoadSprite("UI_hz_zhonghe05_70") add:SetActive(true) needNum.text="0".."/"..neednum + end + elseif curData.type==4 then + selectSkillUnlockItems1={} + if #selectItems>0 then + LogError("selectItems======================"..#selectItems.." selectItems[1].type==="..selectItems[1].type.."selectItems[1].id=="..selectItems[1].id) + local itemConfig = ConfigManager.TryGetConfigData(ConfigName.ItemConfig,selectItems[1].id) + if not itemConfig then return end + itemIcon.sprite=self.spLoader:LoadSprite(GetResourcePath(itemConfig.ResourceID)) + needNum.text=#selectItems.."/"..neednum + for i=1 ,#selectItems do + selectSkillUnlockItems1[i]=selectItems[i] + end + add:SetActive(false) + else + itemIcon.sprite=self.spLoader:LoadSprite("UI_hz_zhonghe05_70") + add:SetActive(true) + needNum.text="0".."/"..neednum end end @@ -543,8 +583,8 @@ function SpecailTrainingInfoPopup:SetSingleData(index,_go,_data) SkillContent:SetActive(false) end - ForceRebuildLayout(_go.transform) - ForceRebuildLayout(self.GameObject.transform) + --ForceRebuildLayout(_go.transform) + LayoutRebuilder.ForceRebuildLayoutImmediate(_go.transform) _go:SetActive(true) end function SpecailTrainingInfoPopup:SetSingleData2(index,_go,_data) diff --git a/Assets/ManagedResources/~Lua/Modules/RoleInfo/TrainingItemListPanel.lua b/Assets/ManagedResources/~Lua/Modules/RoleInfo/TrainingItemListPanel.lua index 86e11b6713..f701f79a40 100644 --- a/Assets/ManagedResources/~Lua/Modules/RoleInfo/TrainingItemListPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/RoleInfo/TrainingItemListPanel.lua @@ -141,7 +141,29 @@ function TrainingItemListPanel:OnOpen(_curData,_func,NeedNum,selectItems1,select -- heroOrItemDataList[i]=itemDatas[i] end - + elseif _curData.type == 4 then + local pokemonList = GodWeaponManager.GetNoUpZhenWeapons() + local index=0 + for i=1,#pokemonList do + local v={} + v.dynamicId=pokemonList[i].dynamicId + v.pokemonData=pokemonList[i] + v.type=4 + v.index = i--用于祭品选择界面 查看是否选中 + v.star=pokemonList[i].star + v.lv=pokemonList[i].lv + local config=pokemonList[i].config + v.ischip=0 + v.icon= GetResourcePath(config.Icon) + --LogError("v.id========================================="..v.id) + v.id=pokemonList[i].id + v.quality=config.Quality + v.name=config.Name + v.returnCoin=config.CoinReturn + v.frame=GetHeroQuantityImageByquality(config.Quality) + v.num=1 + table.insert(heroOrItemDataList,v) + end else local titemDatas={} if _curData.NeedHeroOther ~=0 then @@ -344,13 +366,7 @@ function this.OnShowSingleCardData(go,heroData)--isSelect 1选择 2 没选择 end end end - -- local meshs1=starGrid:GetComponentsInChildren(typeof(UnityEngine.ParticleSystem)) - -- for key, value in pairs(meshs1:ToTable()) do - -- local mat=value:GetComponent(typeof(UnityEngine.Renderer)) - -- if mat.material.shader.name=="UI Particles/Additive" then - -- mat.material.shader=poolManager:LoadAsset("UI-Particle-Add_1",poolManager.AssetType.Other) - -- end - -- end + Util.SetParticleSortLayer(starGrid,this.sortingOrder + 1) Util.AddOnceClick(cardBtn, function() local isSelect = false @@ -385,7 +401,7 @@ function this.OnShowSingleCardData(go,heroData)--isSelect 1选择 2 没选择 end, 0.5) end - elseif curData.type==3 then + elseif curData.type==3 or curData.type==4 then local choosed = Util.GetGameObject(go.transform, "choosed") choosed:SetActive(false) -- if curSelectHeroList[heroData.dynamicId] then @@ -429,36 +445,10 @@ function this.OnShowSingleCardData(go,heroData)--isSelect 1选择 2 没选择 starSize = Vector2.New(1,-13) end SetHeroStars(this.spLoader, starGrid, star,1,starSize,-15) - LogError("hero star=="..star) - -- local effect=SetHeroFlyEffect(go,this.spLoader,heroData.star,this.sortingOrder+1,1) - -- if effect then - -- local particles=effect:GetComponentsInChildren(typeof(UnityEngine.ParticleSystem)) - -- for key, value in pairs(particles:ToTable()) do - -- local mat=value:GetComponent(typeof(UnityEngine.Renderer)) - -- if mat.material.shader.name=="YXZ/Effect/Mix Masking(Without Moving)_alphablend" then - -- mat.material.shader=poolManager:LoadAsset("YXZ_MixMaskingWithoutMoving_alphablend_1",poolManager.AssetType.Other) - -- end - -- end - -- end + Util.SetParticleSortLayer(starGrid,this.sortingOrder + 1) GongMingMask:SetActive(false)--最后检测是否共鸣 - if heroData.lockState == 1 or (heroData.isFormation ~= "" and heroData.isFormation ~= Language[10410]) then - else - if HarmonyManager.IsChangeColor(heroData.dynamicId) then - Util.GetGameObject(go.transform, "lv/Text"):GetComponent("Text").text = ""..heroData.lv.."" - GongMingMask:SetActive(true) - elseif HarmonyManager:IsEnvoy(heroData.dynamicId) and HarmonyManager.GetSingleAdditionsData(HarmonyAddType.AddLv) then - if HarmonyManager.GetSingleAdditionsData(HarmonyAddType.AddLv).heroTid == 0 then - -- body - Util.GetGameObject(go.transform, "lv/Text"):GetComponent("Text").text = ""..heroData.lv.."" - GongMingMask:SetActive(true) - end - - end - end - Util.AddOnceClick(GongMingMask, function() - PopupTipPanel.ShowTip(Language[12184]) - end) + Util.AddOnceClick(cardBtn, function() local isSelect = false local selectIndex = 0 @@ -498,7 +488,7 @@ function this.OnShowSingleCardData(go,heroData)--isSelect 1选择 2 没选择 end end) Util.AddLongPressClick(cardBtn, function() - UIManager.OpenPanel(UIName.RoleInfoPopup,heroData) + --UIManager.OpenPanel(UIName.RoleInfoPopup,heroData) end, 0.5) else for i = 1, #currentSelectItems do