特训修改

wangzhenxing 2023-11-27 18:04:43 +08:00
parent 14063f16eb
commit 8be79fa29f
5 changed files with 28 additions and 27 deletions

View File

@ -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
--===============设置按钮位置=================

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -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)