From 8be79fa29fd71b313d757356333a79d14ce79e74 Mon Sep 17 00:00:00 2001 From: wangzhenxing <1545929779@qq.com> Date: Mon, 27 Nov 2023 18:04:43 +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 --- .../Modules/HomeLand/TrainBuildManager.lua | 40 ++++++++++--------- .../~Lua/Modules/HomeLand/TrainBuildPanel.lua | 1 + .../Modules/HomeLand/TrainSelectHeroPanel.lua | 7 +--- .../~Lua/Modules/Net/NetManager.lua | 5 +-- .../~Lua/Modules/RoleInfo/RoleInfoPanel.lua | 2 +- 5 files changed, 28 insertions(+), 27 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/HomeLand/TrainBuildManager.lua b/Assets/ManagedResources/~Lua/Modules/HomeLand/TrainBuildManager.lua index 8bd956e6c5..a3fda8ee6d 100644 --- a/Assets/ManagedResources/~Lua/Modules/HomeLand/TrainBuildManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/HomeLand/TrainBuildManager.lua @@ -5,9 +5,11 @@ local HomeLandLevel = ConfigManager.GetConfig(ConfigName.TrainBuildLevel) local ItemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig) local trainConfig=ConfigManager.GetConfig(ConfigName.Train) local heroConfig=ConfigManager.GetConfig(ConfigName.HeroConfig) - +--所有正在特训的英雄id +local trainHeroId={} function this.Initialize() this.BuildData = {} + for _, configData in ConfigPairs(HomeLand) do this.BuildData[configData.Id] = {} this.BuildData[configData.Id].dataMain = configData--HomeLand中数据 @@ -30,8 +32,7 @@ function this.Initialize() table.insert(this.allHeroId,configData.HeroID) end end - --所有正在特训的英雄id - this.trainHeroId={} + end @@ -78,6 +79,7 @@ end --接收服务器信息 function this.GetServerData(msg,func) + trainHeroId={} if msg.infos and #msg.infos > 0 then for index, value in ipairs(msg.infos) do LogGreen("Id:"..tostring(value.id).." startTime:"..tostring(TimeStampToDateStr4(value.startTime)).." value.lv:"..value.lv) @@ -96,7 +98,7 @@ function this.GetServerData(msg,func) end this.BuildData[value.id].dataSingle = singledata if value.heroId and value.heroId~="" then - table.insert(this.trainHeroId,value.heroId) + table.insert(trainHeroId,value.heroId) end --end end @@ -110,12 +112,26 @@ function this.GetServerData(msg,func) end end function this.RemoveTrainHero(_heroId) - if CheckListIsContainValue1(this.trainHeroId,_heroId) then - table.removebyvalue(this.trainHeroId,_heroId) + if CheckListIsContainValue1(trainHeroId,_heroId) then + --table.removebyvalue(this.trainHeroId,_heroId) + for i=1,#trainHeroId do + if trainHeroId[i]==_heroId then + LogError("i==========================="..i) + table.remove(trainHeroId,i) + end + end + LogError("this.trainHeroId len==================="..#trainHeroId) LogError("成功移除特训英雄") end end +function this.AddTrainHero(_heroId) + table.insert(trainHeroId,_heroId) +end + +function this.GetTrainHeroIds() + return trainHeroId +end --设置特训点信息 function this.SetBuildInfo(_info) if _info and this.BuildData[_info.id] then @@ -205,18 +221,6 @@ function this.CheckRedMain() return false end -function this.Check1to5Building() - local data = this.BuildData - for i = 1, 5 do - if data[i].dataMain.IsOpen == 1 and (this.singleUpgrade(i) or this.singleGet(i)) then - return true - end - end - return false -end - - - --===============设置按钮位置================= diff --git a/Assets/ManagedResources/~Lua/Modules/HomeLand/TrainBuildPanel.lua b/Assets/ManagedResources/~Lua/Modules/HomeLand/TrainBuildPanel.lua index 100356e6be..c1696812b9 100644 --- a/Assets/ManagedResources/~Lua/Modules/HomeLand/TrainBuildPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/HomeLand/TrainBuildPanel.lua @@ -266,6 +266,7 @@ function TrainBuildPanel:SetBuildsState() args[4]=sureFunc UIManager.OpenPanel(UIName.GMCommonConfirmPanel,args) else + LogError("data.heroid==============================="..data.heroId) NetManager.TrainingRequest(data.dataMain.Id,data.heroId,2,function () self:OnShow() end) diff --git a/Assets/ManagedResources/~Lua/Modules/HomeLand/TrainSelectHeroPanel.lua b/Assets/ManagedResources/~Lua/Modules/HomeLand/TrainSelectHeroPanel.lua index 3fb7e8062b..90d945b7e5 100644 --- a/Assets/ManagedResources/~Lua/Modules/HomeLand/TrainSelectHeroPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/HomeLand/TrainSelectHeroPanel.lua @@ -180,8 +180,9 @@ function this:SetHeroList(isTop,isAni) local heroList = TrainBuildManager.GetAllCanTrainHero() local list={} --LogError("buildData.heroId======="..buildData.heroId) + local upList=TrainBuildManager.GetTrainHeroIds() for k, v in pairs(heroList) do - if CheckListIsContainValue1(TrainBuildManager.trainHeroId,v.dynamicId)==false or v.dynamicId==buildData.heroId then + if CheckListIsContainValue1(upList,v.dynamicId)==false or v.dynamicId==buildData.heroId then table.insert(list,v) end end @@ -243,10 +244,6 @@ function this:ShowSingleHero(go,data,index) trainLv.text="特训等级"..data.HeroTraining.trainingLv local starGrid = Util.GetGameObject(go, "star") SetHeroStars(self.spLoader,starGrid,data.star) - -- Util.AddLongPressClick(go,function () - -- UIManager.OpenPanel(UIName.RoleGetInfoPopup, false, data.Reward[1], 5) - -- end,0.5) - --LogError("data.HeroTraining.attackExp=="..data.HeroTraining.attackExp.." heroData.HeroTraining.defenseExp=="..data.HeroTraining.defenseExp.." heroData.HeroTraining.hpExp=="..data.HeroTraining.hpExp) Util.AddOnceClick(go,function() if buildData.heroId and buildData.heroId~="" then if data.dynamicId~=buildData.heroId then diff --git a/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua b/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua index a9e49be1dc..4347df2a2e 100644 --- a/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua @@ -7639,13 +7639,12 @@ function NetManager.TrainingRequest(_id,_heroId,_type,_func) local msg = HeroInfoProto_pb.TrainingResponse() msg:ParseFromString(data) LogError("特训请求") - LogError("TrainBuildManager.trainHeroId len==="..#TrainBuildManager.trainHeroId) + --LogError("TrainBuildManager.trainHeroId len==="..#TrainBuildManager.trainHeroId) if _type==1 then - table.insert(TrainBuildManager.trainHeroId,_heroId) + TrainBuildManager.AddTrainHero(_heroId) PopupTipPanel.ShowTip("英雄开始特训") elseif _type==2 then LogError("remove heroid==============".._heroId) - --table.removebyvalue(TrainBuildManager.trainHeroId,_heroId) TrainBuildManager.RemoveTrainHero(_heroId) PopupTipPanel.ShowTip("英雄特训结束") -- LogError("TrainBuildManager.trainHeroId len==="..#TrainBuildManager.trainHeroId) diff --git a/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleInfoPanel.lua b/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleInfoPanel.lua index 197e2b36e4..28c212484e 100644 --- a/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleInfoPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleInfoPanel.lua @@ -599,7 +599,7 @@ function this:UpdateBtnList() -- if curHeroData.star == 10 and curHeroData.heroConfig.MaxRank > curHeroData.star then -- tabsList[k].gameObject:SetActive(true) -- else - -- tabsList[k].gameObject:SetActive(false) + tabsList[k].gameObject:SetActive(false) -- end elseif k == RoleInfoPanelIndex.shenhun then if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.shenhun)