【家园】提交

dev_chengFeng
ZhangBiao 2022-01-05 18:16:10 +08:00
parent aa761fc4e9
commit 29a16ba5c8
3 changed files with 3 additions and 32 deletions

View File

@ -132,18 +132,6 @@ function this.SetRewardData()
return dataList
end
--等级总和
-- function this.GetLevelNum()
-- local num = 0
-- for index, value in ipairs(this.BuildData) do
-- if value.level then
-- num = num + value.level
-- end
-- end
-- LogYellow("等级总和:"..num)
-- return num
-- end
--检测当前停留
function this.GetCurIndex()
for i = 1, 4 do
@ -156,9 +144,6 @@ end
--检测按钮显示
function this.GetCurIndexBtnsShow()
-- LogBlue("this.curEquip:"..tostring(this.curEquip))
-- LogBlue("Limit2:"..tostring(this.EquipData[this.curEquip].configData.Limit2))
-- LogBlue("this.levelProLevel:"..tostring(EquipRankUp[this.levelProId].Level))
return this.EquipData[this.curEquip].configData.Limit2 == EquipRankUp[this.levelProId].Level
end
@ -231,18 +216,14 @@ end
--烦人的红点检测我决定1-4写一个、5写一个6写一个、任务写一个、7移植过来,然后写个总的检测跑一遍所有)
function this.CheckRedMain()
if this.Check1to5Building() then
LogRed("1")
return true
end
if this.CheckMission() then
LogRed("2")
return true
end
if this.CheckEquipUpgrade() then
LogRed("3")
return true
end
LogRed("4")
return false
end
@ -250,18 +231,15 @@ 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
LogRed("5")
return true
end
end
LogRed("6")
return false
end
--1-5建筑的单个升级
function this.singleUpgrade(id)
local data = this.BuildData[id].dataSingle
LogGreen("建筑Id:"..tostring(data.Id))
if HomeLand[id].UnlockLevel[1] == 1 and PlayerManager.level < HomeLand[id].UnlockLevel[2] then
elseif HomeLand[id].UnlockLevel[1] == 2 and HomeLandManager.BuildData[5].level < HomeLand[id].UnlockLevel[2] then
elseif HomeLand[id].UnlockLevel[1] == 3 and PlayerManager.level < GlobalSystemConfig[HomeLand[id].UnlockLevel[2]].OpenRules[2] then
@ -269,13 +247,11 @@ function this.singleUpgrade(id)
if BagManager.GetTotalItemNum(data.Cost[1][1]) >= data.Cost[1][2] then--所需材料够
if not data.Rule or (this.BuildData[data.Rule[1]].level >= data.Rule[2]) then--到达升级条件
if this.BuildData[id].endTime <= GetTimeStamp() then
LogRed("7")
return true
end
end
end
end
LogRed("8")
return false
end
@ -283,10 +259,8 @@ end
function this.singleGet(id)
local data = this.BuildData[id]
if data.dataMain.Type == 1 and data.dataSingle.Gain and this.BuildData[5].level > data.dataMain.UnlockLevel[2] then
LogRed("9:"..tostring((GetTimeStamp() - data.startTime)/60*data.dataSingle.Gain[2] >= data.dataSingle.Storage[1][2]))
return (GetTimeStamp() - data.startTime)/60*data.dataSingle.Gain[2] >= data.dataSingle.Storage[1][2]
end
LogRed("10")
return false
end
@ -295,11 +269,9 @@ function this.CheckMission()
local data = this.SetRewardData()
for index, value in ipairs(data) do
if value.state == 1 then
LogRed("11")
return true
end
end
LogRed("12")
return false
end
@ -308,12 +280,10 @@ function this.CheckEquipUpgrade()
if this.BuildData[5].level >= HomeLand[6].UnlockLevel[2] then
for i = 1, 4 do
if this.CheckSingleEquipUpgrade(i) then
LogRed("13")
return true
end
end
end
LogRed("14")
return false
end
@ -321,13 +291,11 @@ end
function this.CheckSingleEquipUpgrade(id)
local bool = false
local data = this.EquipData[id]
LogBlue("装备Id:"..tostring(data.Id))
if BagManager.GetTotalItemNum(data.configData.Cost[1][1]) >= data.configData.Cost[1][2] then--所需材料够
if this.BuildData[data.configData.Limit[1]].level >= data.configData.Limit[2] then--到达升级条件
bool = true
end
end
LogRed("15:"..tostring(bool))
return bool
end

View File

@ -262,10 +262,12 @@ end
function HomeLand:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.UI.OnUpdateData, self.OnShow,self)
Game.GlobalEvent:AddEvent(GameEvent.Bag.BagGold, self.OnShow,self)
end
function HomeLand:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnUpdateData, self.OnShow,self)
Game.GlobalEvent:RemoveEvent(GameEvent.Bag.BagGold, self.OnShow,self)
end
--待功能扩展(试图打开某个状态)

View File

@ -145,6 +145,7 @@ function this:SetData()
--不同显示
this.Cost:SetActive(bool)
this.Tips:SetActive(not bool)
this.Tips:GetComponent("Text").text = string.format("全部加持到达%s级后方可进行突破",EquipStrengthen[HomeLandManager.EquipData[curIndex].Id].Level)
if not bool and HomeLandManager.GetAllCanUpgrade() then
this.Cost:SetActive(true)
end