【家园】提交
parent
337261f8b2
commit
b66cfdc61d
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1548,7 +1548,7 @@ end
|
|||
function TimeStampToDateStr4(timestamp)
|
||||
local date = os.date("*t", timestamp)
|
||||
local cdate = os.date("*t", GetTimeStamp())
|
||||
return string.format(Language[12056], date.year, date.month, date.day, date.hour, date.min)
|
||||
return string.format("%d年%d月%d日 %02d:%02d:%02d", date.year, date.month, date.day, date.hour, date.min,date.sec)
|
||||
end
|
||||
|
||||
-- 将时间转换为年月日
|
||||
|
|
|
@ -9,6 +9,10 @@ local parent
|
|||
--传入特效层级
|
||||
local sortingOrder=0
|
||||
local data=nil
|
||||
local OPENTEXT = {
|
||||
[1] = "祈福斋",
|
||||
[2] = "望月居、摘星阁",
|
||||
}
|
||||
function this:InitComponent(gameObject)
|
||||
this.spLoader = SpriteLoader.New()
|
||||
this.titleText = Util.GetGameObject(gameObject,"TitleText"):GetComponent("Text")
|
||||
|
@ -16,23 +20,29 @@ function this:InitComponent(gameObject)
|
|||
--当前两个名字
|
||||
this.curName = Util.GetGameObject(gameObject,"Buildings/curName"):GetComponent("Text")
|
||||
this.nextName = Util.GetGameObject(gameObject,"Buildings/nextName"):GetComponent("Text")
|
||||
|
||||
this.Content = Util.GetGameObject(gameObject,"Content")
|
||||
this.Obtain = Util.GetGameObject(this.Content,"Obtain")
|
||||
this.Cost = Util.GetGameObject(this.Content,"Cost")
|
||||
--Obtain
|
||||
this.limitIcon = Util.GetGameObject(gameObject,"Obtain/limit/Icon"):GetComponent("Image")
|
||||
this.limitNum = Util.GetGameObject(gameObject,"Obtain/limit/Num"):GetComponent("Text")
|
||||
this.limitAdd = Util.GetGameObject(gameObject,"Obtain/limit/Add"):GetComponent("Text")
|
||||
this.gainIcon = Util.GetGameObject(gameObject,"Obtain/gain/Icon"):GetComponent("Image")
|
||||
this.gainNum = Util.GetGameObject(gameObject,"Obtain/gain/Num"):GetComponent("Text")
|
||||
this.gainAdd = Util.GetGameObject(gameObject,"Obtain/gain/Add"):GetComponent("Text")
|
||||
this.limitIcon = Util.GetGameObject(this.Obtain,"limit/Icon"):GetComponent("Image")
|
||||
this.limitNum = Util.GetGameObject(this.Obtain,"limit/Num"):GetComponent("Text")
|
||||
this.limitAdd = Util.GetGameObject(this.Obtain,"limit/Add"):GetComponent("Text")
|
||||
this.gainIcon = Util.GetGameObject(this.Obtain,"gain/Icon"):GetComponent("Image")
|
||||
this.gainNum = Util.GetGameObject(this.Obtain,"gain/Num"):GetComponent("Text")
|
||||
this.gainAdd = Util.GetGameObject(this.Obtain,"gain/Add"):GetComponent("Text")
|
||||
--Open
|
||||
this.Open = Util.GetGameObject(this.Content,"Open")
|
||||
this.OpenText = Util.GetGameObject(this.Open,"Num"):GetComponent("Text")
|
||||
--cost
|
||||
this.cost1Icon1 = Util.GetGameObject(gameObject,"Cost/cost1/Icon"):GetComponent("Image")
|
||||
this.cost1Num1 = Util.GetGameObject(gameObject,"Cost/cost1/Num"):GetComponent("Text")
|
||||
this.cost1Icon2 = Util.GetGameObject(gameObject,"Cost/cost1/Icon2"):GetComponent("Image")
|
||||
this.cost1Num2 = Util.GetGameObject(gameObject,"Cost/cost1/Num2"):GetComponent("Text")
|
||||
this.cost2Name = Util.GetGameObject(gameObject,"Cost/cost2/Text"):GetComponent("Text")
|
||||
this.cost2Num = Util.GetGameObject(gameObject,"Cost/cost2/Num"):GetComponent("Text")
|
||||
this.cost1Icon1 = Util.GetGameObject(this.Cost,"cost1/Icon"):GetComponent("Image")
|
||||
this.cost1Num1 = Util.GetGameObject(this.Cost,"cost1/Num"):GetComponent("Text")
|
||||
this.cost2Name = Util.GetGameObject(this.Cost,"cost2/Text"):GetComponent("Text")
|
||||
this.cost2Num = Util.GetGameObject(this.Cost,"cost2/Num"):GetComponent("Text")
|
||||
--fastDone
|
||||
this.fastDoneIcon = Util.GetGameObject(gameObject,"fastDone/Money/Image"):GetComponent("Image")
|
||||
this.fastDoneNum = Util.GetGameObject(gameObject,"fastDone/Money/Text"):GetComponent("Text")
|
||||
this.fastDoneMoney = Util.GetGameObject(gameObject,"fastDone/Money")
|
||||
this.fastDoneIcon = Util.GetGameObject(this.fastDoneMoney,"Icon"):GetComponent("Image")
|
||||
this.fastDoneNum = Util.GetGameObject(this.fastDoneMoney,"Num"):GetComponent("Text")
|
||||
this.fastDoneBtn = Util.GetGameObject(gameObject,"fastDone/BtnDo")
|
||||
--Done
|
||||
this.doneNum = Util.GetGameObject(gameObject,"Done/Money/Text"):GetComponent("Text")
|
||||
|
@ -43,15 +53,19 @@ end
|
|||
function this:BindEvent()
|
||||
Util.AddClick(this.fastDoneBtn, function()
|
||||
-- local priviId = PrivilegeManager.GetPrivilegeRemainValue()
|
||||
NetManager.ArchitectureOperateRequest({data.dataMain.Id},2,0,function ()
|
||||
Game.GlobalEvent:DispatchEvent(GameEvent.UI.OnUpdateData)
|
||||
parent:ClosePanel()
|
||||
HomeLandManager.ResumeCost(data.dataSingle,string.split(costOneSec,"#"),function ()
|
||||
NetManager.ArchitectureOperateRequest({data.dataMain.Id},2,0,function ()
|
||||
Game.GlobalEvent:DispatchEvent(GameEvent.UI.OnUpdateData)
|
||||
parent:ClosePanel()
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
Util.AddClick(this.doneBtn, function()
|
||||
NetManager.ArchitectureOperateRequest({data.dataMain.Id},1,0,function ()
|
||||
Game.GlobalEvent:DispatchEvent(GameEvent.UI.OnUpdateData)
|
||||
parent:ClosePanel()
|
||||
HomeLandManager.ResumeCost(data.dataSingle,nil,function ()
|
||||
NetManager.ArchitectureOperateRequest({data.dataMain.Id},1,0,function ()
|
||||
Game.GlobalEvent:DispatchEvent(GameEvent.UI.OnUpdateData)
|
||||
parent:ClosePanel()
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
@ -70,33 +84,46 @@ function this:OnShow(_parent,_args)
|
|||
local nextData = HomeLandLevel[curData.Id + 1]
|
||||
local str = string.split(costOneSec,"#")
|
||||
|
||||
|
||||
this.curName.text = string.format("%s %s级",data.dataMain.Name,curData.level)
|
||||
this.nextName.text = string.format("%s级",nextData.level)
|
||||
|
||||
-- this.limitIcon.sprite = this.spLoader:LoadSprite(GetSpriteNameByItemId(curData.Storage[1][1]))
|
||||
-- this.limitNum.text = curData.Storage[1][2]
|
||||
-- this.limitAdd.text = string.format(" +%s",nextData.Storage[1][2] - curData.Storage[1][2])
|
||||
-- this.gainIcon.sprite = this.spLoader:LoadSprite(GetSpriteNameByItemId(curData.Gain[1]))
|
||||
-- this.gainNum.text = curData.Gain[2]
|
||||
-- this.gainAdd.text = string.format(" +%s",nextData.Gain[2] - curData.Gain[2])
|
||||
this.Obtain:SetActive(false)
|
||||
if curData.Storage then
|
||||
this.Obtain:SetActive(true)
|
||||
this.limitIcon.sprite = this.spLoader:LoadSprite(GetSpriteNameByItemId(curData.Storage[1][1]))
|
||||
this.limitNum.text = curData.Storage[1][2]
|
||||
this.limitAdd.text = string.format(" +%s",nextData.Storage[1][2] - curData.Storage[1][2])
|
||||
this.gainIcon.sprite = this.spLoader:LoadSprite(GetSpriteNameByItemId(curData.Gain[1]))
|
||||
this.gainNum.text = curData.Gain[2]
|
||||
this.gainAdd.text = string.format(" +%s",nextData.Gain[2] - curData.Gain[2])
|
||||
end
|
||||
|
||||
-- this.cost1Icon1.sprite = this.spLoader:LoadSprite(GetSpriteNameByItemId(curData.Cost[1][1]))
|
||||
-- this.cost1Num1.text = curData.Storage[1][2]
|
||||
-- this.cost1Icon2.sprite = this.spLoader:LoadSprite(GetSpriteNameByItemId(curData.Storage[2][1]))
|
||||
-- this.cost1Num2.text = curData.Storage[2][2]
|
||||
this.Open:SetActive(false)
|
||||
if OPENTEXT[data.level] and curData.PoolID == 5 then
|
||||
this.Open:SetActive(true)
|
||||
this.OpenText.text = OPENTEXT[data.level]
|
||||
end
|
||||
|
||||
-- this.cost2Name.text = HomeLand[curData.Rule[1]].Name
|
||||
-- this.cost2Num.text = string.format("%s级",curData.Rule[2])
|
||||
this.Cost:SetActive(false)
|
||||
if curData.Cost then
|
||||
this.Cost:SetActive(true)
|
||||
this.cost1Icon1.sprite = this.spLoader:LoadSprite(GetSpriteNameByItemId(curData.Cost[1][1]))
|
||||
local color1 = BagManager.GetTotalItemNum(curData.Cost[1][1]) >= curData.Cost[1][2] and "#FFFFFF" or "red"
|
||||
this.cost1Num1.text = string.format("<color=%s>%s</color>",color1,curData.Cost[1][2])
|
||||
end
|
||||
|
||||
if curData.Rule then
|
||||
this.cost2Name.text = HomeLand[curData.Rule[1]].Name
|
||||
this.cost2Num.text = string.format("%s级",curData.Rule[2])
|
||||
else
|
||||
this.cost2Name.text = ""
|
||||
this.cost2Num.text = ""
|
||||
end
|
||||
|
||||
this.fastDoneIcon.sprite = this.spLoader:LoadSprite(GetSpriteNameByItemId(tonumber(str[2])))
|
||||
this.fastDoneNum.text = math.ceil(curData.Time/tonumber(str[1]))*tonumber(str[3])
|
||||
this.doneNum.text = string.format("耗时:%s",TimeToMS(curData.Time))
|
||||
|
||||
if data.dataMain.Id == 5 then
|
||||
else
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function this:OnClose()
|
||||
|
|
|
@ -3,6 +3,7 @@ local this = HomeLandManager
|
|||
local HomeLand = ConfigManager.GetConfig(ConfigName.HomeLand)
|
||||
local HomeLandLevel = ConfigManager.GetConfig(ConfigName.HomeLandLevel)
|
||||
local HomeLandTask = ConfigManager.GetConfig(ConfigName.HomeLandTask)
|
||||
local ItemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
|
||||
function this.Initialize()
|
||||
this.BuildData = {}
|
||||
for _, configData in ConfigPairs(HomeLand) do
|
||||
|
@ -20,10 +21,9 @@ end
|
|||
|
||||
--接收服务器信息
|
||||
function this.GetServerData(msg,func)
|
||||
LogGreen("长度:"..tostring(#msg.infos))
|
||||
if msg.infos and #msg.infos > 0 then
|
||||
for index, value in ipairs(msg.infos) do
|
||||
LogGreen("Id:"..tostring(value.id).." startTime:"..tostring(value.productionStartTime).." endTime:"..tostring(value.upLvEndTime))
|
||||
LogGreen("Id:"..tostring(value.id).." startTime:"..tostring(TimeStampToDateStr4(value.productionStartTime)).." endTime:"..tostring(TimeStampToDateStr4(value.upLvEndTime)))
|
||||
if value.id and value.id > 0 then
|
||||
local data = HomeLandLevel[value.id]
|
||||
this.BuildData[data.PoolID].level = data.level
|
||||
|
@ -41,4 +41,31 @@ function this.GetServerData(msg,func)
|
|||
end
|
||||
end
|
||||
|
||||
--升级材料和前置浮生殿等级检测
|
||||
function this.ResumeCost(_data,_str,func)
|
||||
if _data.Rule and this.BuildData[_data.Rule[1]].level < _data.Rule[2] then
|
||||
PopupTipPanel.ShowTip(string.format("%s到达%s级可升级!",this.BuildData[_data.Rule[1]].dataMain.Name,_data.Rule[2]))
|
||||
return
|
||||
end
|
||||
|
||||
local data = {}
|
||||
for i = 1, #_data.Cost do
|
||||
if not data[_data.Cost[i][1]] then
|
||||
data[_data.Cost[i][1]] = 0
|
||||
end
|
||||
data[_data.Cost[i][1]] = data[_data.Cost[i][1]] + _data.Cost[i][2]
|
||||
end
|
||||
if _str then--立即完成
|
||||
data[16] = data[16] + math.ceil(_data.Time/tonumber(_str[1]))*tonumber(_str[3])
|
||||
end
|
||||
for key, value in pairs(data) do
|
||||
LogGreen(string.format("需要%s: %s,现有:%s",key,value,BagManager.GetTotalItemNum(key)))
|
||||
if BagManager.GetTotalItemNum(key) < value then
|
||||
PopupTipPanel.ShowTip(string.format("%s不足!",ItemConfig[key].Name))
|
||||
return
|
||||
end
|
||||
end
|
||||
func()
|
||||
end
|
||||
|
||||
return HomeLandManager
|
|
@ -2,6 +2,8 @@ local HomeLand = quick_class("HomeLand", BasePanel)
|
|||
local HomeLandConfig = ConfigManager.GetConfig(ConfigName.HomeLand)
|
||||
local HomeLandLevel = ConfigManager.GetConfig(ConfigName.HomeLandLevel)
|
||||
local HomeLandTask = ConfigManager.GetConfig(ConfigName.HomeLandTask)
|
||||
local GlobalSystemConfig = ConfigManager.GetConfig(ConfigName.GlobalSystemConfig)
|
||||
local costStr = string.split(ConfigManager.GetConfigData(ConfigName.SpecialConfig,100).Value,"#")
|
||||
function HomeLand:InitComponent()
|
||||
self.spLoader = SpriteLoader.New()
|
||||
-- if not self.playerInfoView then
|
||||
|
@ -17,20 +19,26 @@ function HomeLand:InitComponent()
|
|||
self.RightDown = Util.GetGameObject(self.map,"RightDown")
|
||||
|
||||
self.mapData = {}
|
||||
for i = 1, 5 do
|
||||
for i = 1, 7 do
|
||||
self.mapData[i] = {}
|
||||
self.mapData[i].Obj = Util.GetGameObject(self.Bg,"Map ("..i..")")
|
||||
self.mapData[i].Name = Util.GetGameObject(self.mapData[i].Obj,"Title/Text"):GetComponent("Text")
|
||||
self.mapData[i].Icon = Util.GetGameObject(self.mapData[i].Obj,"Title/Image"):GetComponent("Image")
|
||||
self.mapData[i].CanGet = Util.GetGameObject(self.mapData[i].Obj,"CanGet")
|
||||
-- self.mapData[i].Icon = Util.GetGameObject(self.mapData[i].Obj,"Title/Image"):GetComponent("Image")
|
||||
self.mapData[i].Icon = Util.GetGameObject(self.mapData[i].Obj,"CanGet/Image"):GetComponent("Image")
|
||||
self.mapData[i].Btns = Util.GetGameObject(self.mapData[i].Obj,"Btns")
|
||||
self.mapData[i].OpenLimit = Util.GetGameObject(self.mapData[i].Obj,"OpenLimit")
|
||||
self.mapData[i].limitText = Util.GetGameObject(self.mapData[i].OpenLimit,"Text"):GetComponent("Text")
|
||||
self.mapData[i].upgradeImg = Util.GetGameObject(self.mapData[i].Obj,"Upgrade")
|
||||
self.mapData[i].upgradeImg = Util.GetGameObject(self.mapData[i].Obj,"Updating")
|
||||
self.mapData[i].updateTime = Util.GetGameObject(self.mapData[i].Obj,"updateTime")
|
||||
self.mapData[i].updateTimeText = Util.GetGameObject(self.mapData[i].updateTime,"Text"):GetComponent("Text")
|
||||
|
||||
self.mapData[i].btnDetail = Util.GetGameObject(self.mapData[i].Btns,"Detail")
|
||||
self.mapData[i].btnUpgrade = Util.GetGameObject(self.mapData[i].Btns,"Upgrade")
|
||||
self.mapData[i].btnCancel = Util.GetGameObject(self.mapData[i].Btns,"Cancel")
|
||||
self.mapData[i].btnSpeedUp = Util.GetGameObject(self.mapData[i].Btns,"Speed")
|
||||
self.mapData[i].leftTime = -1
|
||||
self.mapData[i].showTime = -1
|
||||
end
|
||||
|
||||
self.curSelect = 0
|
||||
|
@ -55,19 +63,19 @@ function HomeLand:BindEvent()
|
|||
for i = 1, 5 do
|
||||
--打开菜单
|
||||
Util.AddOnceClick(self.mapData[i].Obj,function ()
|
||||
if HomeLandManager.BuildData[i].dataMain.IsOpen ~= 1 then
|
||||
PopupTipPanel.ShowTip(string.format("%s 暂未开放",HomeLandManager.BuildData[i].dataMain.Name))
|
||||
return
|
||||
end
|
||||
if HomeLandConfig[i].UnlockLevel[1] == 2 and HomeLandManager.BuildData[5].level < HomeLandConfig[i].UnlockLevel[2] then
|
||||
PopupTipPanel.ShowTip(string.format("浮生殿到达%s级开启",HomeLandConfig[i].UnlockLevel[2]))
|
||||
return
|
||||
end
|
||||
if self.curSelect ~= i then
|
||||
self.curSelect = i
|
||||
for j = 1, 5 do
|
||||
self.mapData[j].Btns:SetActive(false)
|
||||
end
|
||||
if HomeLandManager.BuildData[i].dataMain.IsOpen ~= 1 then
|
||||
PopupTipPanel.ShowTip(string.format("%s 暂未开放",HomeLandManager.BuildData[i].dataMain.Name))
|
||||
return
|
||||
end
|
||||
if HomeLandConfig[i].UnlockLevel[1] == 2 and HomeLandManager.BuildData[5].level < HomeLandConfig[i].UnlockLevel[2] then
|
||||
PopupTipPanel.ShowTip(string.format("浮生殿到达%s级开启",HomeLandConfig[i].UnlockLevel[2]))
|
||||
return
|
||||
end
|
||||
self.mapData[i].Btns:SetActive(true)
|
||||
PlayUIAnim(self.mapData[i].Btns)
|
||||
end
|
||||
|
@ -82,9 +90,15 @@ function HomeLand:BindEvent()
|
|||
end)
|
||||
--打开加速
|
||||
Util.AddOnceClick(self.mapData[i].btnSpeedUp,function ()
|
||||
NetManager.ArchitectureOperateRequest({HomeLandManager.BuildData[i].dataMain.Id},2,0,function ()
|
||||
self:OnShow()
|
||||
end)
|
||||
local value = math.ceil((HomeLandManager.BuildData[i].endTime - GetTimeStamp())/tonumber(costStr[1]))*tonumber(costStr[3])
|
||||
LogGreen("需要16:"..tostring(value).." 现有:"..tostring(BagManager.GetTotalItemNum(16)))
|
||||
if BagManager.GetTotalItemNum(16) >= value then
|
||||
NetManager.ArchitectureOperateRequest({HomeLandManager.BuildData[i].dataMain.Id},2,0,function ()
|
||||
self:OnShow()
|
||||
end)
|
||||
else
|
||||
PopupTipPanel.ShowTip("妖晶不足!")
|
||||
end
|
||||
end)
|
||||
--取消
|
||||
Util.AddOnceClick(self.mapData[i].btnCancel,function ()
|
||||
|
@ -93,6 +107,16 @@ function HomeLand:BindEvent()
|
|||
end)
|
||||
end)
|
||||
end
|
||||
--建木神树
|
||||
Util.AddOnceClick(self.mapData[7].Obj,function ()
|
||||
if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.SACREDTREE) then
|
||||
UIManager.OpenPanel(UIName.SacredTreePanel)
|
||||
end
|
||||
end)
|
||||
--摘星阁
|
||||
Util.AddOnceClick(self.mapData[6].Obj,function ()
|
||||
PopupTipPanel.ShowTip("摘星阁")
|
||||
end)
|
||||
end
|
||||
|
||||
function HomeLand:AddListener()
|
||||
|
@ -114,49 +138,100 @@ end
|
|||
|
||||
function HomeLand:OnShow()
|
||||
self:SetBuildsState()
|
||||
self:SetTime()
|
||||
end
|
||||
|
||||
function HomeLand:SetBuildsState()
|
||||
for i = 1, 5 do
|
||||
for i = 1, 7 do
|
||||
local data = HomeLandManager.BuildData[i]
|
||||
local curObj = self.mapData[i]
|
||||
curObj.OpenLimit:SetActive(true)
|
||||
curObj.btnUpgrade:SetActive(false)
|
||||
curObj.btnCancel:SetActive(false)
|
||||
curObj.btnSpeedUp:SetActive(false)
|
||||
curObj.Icon.gameObject:SetActive(false)
|
||||
-- curObj.Icon.gameObject:SetActive(false)
|
||||
curObj.upgradeImg:SetActive(false)
|
||||
curObj.updateTime:SetActive(false)
|
||||
curObj.CanGet:SetActive(false)
|
||||
|
||||
if data.dataSingle then--部分没有等级所以不需要显示等级
|
||||
curObj.Name.text = string.format("%s(%s级)",data.dataMain.Name,data.dataSingle.level)
|
||||
if data.dataMain.IsOpen == 1 then--部分建筑未进入版本显示未开放
|
||||
if data.dataMain.IsOpen == 1 then--部分建筑未进入版本显示未开放
|
||||
--如果主城未到等级,显示开启条件
|
||||
if HomeLandConfig[i].UnlockLevel[1] == 1 and PlayerManager.level < HomeLandConfig[i].UnlockLevel[2] then
|
||||
curObj.limitText.text = string.format("玩家等级到达%s级开启",HomeLandConfig[i].UnlockLevel[2])
|
||||
elseif HomeLandConfig[i].UnlockLevel[1] == 2 and HomeLandManager.BuildData[5].level < HomeLandConfig[i].UnlockLevel[2] then
|
||||
curObj.limitText.text = string.format("浮生殿到达%s级开启",HomeLandConfig[i].UnlockLevel[2])
|
||||
elseif HomeLandConfig[i].UnlockLevel[1] == 3 and PlayerManager.level < GlobalSystemConfig[HomeLandConfig[i].UnlockLevel[2]].OpenRules[2] then
|
||||
curObj.limitText.text = string.format("玩家等级到达%s级开启",GlobalSystemConfig[HomeLandConfig[i].UnlockLevel[2]].OpenRules[2])
|
||||
else
|
||||
curObj.OpenLimit:SetActive(false)
|
||||
end
|
||||
if data.dataSingle then
|
||||
if data.dataSingle.Gain then--有产出的才需要icon
|
||||
curObj.Icon.sprite = self.spLoader:LoadSprite(GetSpriteNameByItemId(data.dataSingle.Gain[1]))
|
||||
curObj.Icon.gameObject:SetActive(true)
|
||||
-- curObj.Icon.gameObject:SetActive(true)
|
||||
if not curObj.OpenLimit.activeInHierarchy then
|
||||
curObj.showTime = data.startTime + 60
|
||||
curObj.CanGet:SetActive(data.startTime + 60 < GetTimeStamp())
|
||||
PlayUIAnim(curObj.CanGet)
|
||||
end
|
||||
end
|
||||
--如果主城未到等级,显示开启条件
|
||||
if HomeLandConfig[i].UnlockLevel[1] == 2 and HomeLandManager.BuildData[5].level < HomeLandConfig[i].UnlockLevel[2] then
|
||||
curObj.limitText.text = string.format("浮生殿到达%s级开启",HomeLandConfig[i].UnlockLevel[2])
|
||||
else
|
||||
curObj.OpenLimit:SetActive(false)
|
||||
if data.endTime > 0 then--如果有结束时间说明在升级,可以取消,可以加速
|
||||
curObj.btnCancel:SetActive(true)
|
||||
curObj.btnSpeedUp:SetActive(true)
|
||||
curObj.upgradeImg:SetActive(true)
|
||||
else--如果没有就是可以点击升级
|
||||
if data.endTime > GetTimeStamp() then--如果有结束时间说明在升级,可以取消,可以加速
|
||||
curObj.btnCancel:SetActive(true)
|
||||
curObj.btnSpeedUp:SetActive(true)
|
||||
curObj.upgradeImg:SetActive(true)
|
||||
curObj.updateTime:SetActive(true)
|
||||
curObj.leftTime = data.endTime - GetTimeStamp() >= 0 and data.endTime - GetTimeStamp() or -1
|
||||
curObj.updateTimeText.text = TimeToFelaxible(curObj.leftTime)
|
||||
PlayUIAnim(curObj.upgradeImg)
|
||||
else--如果没有就是可以点击升级
|
||||
if data.dataSingle.Cost then
|
||||
curObj.btnUpgrade:SetActive(true)
|
||||
end
|
||||
end
|
||||
else
|
||||
curObj.limitText.text = "暂未开放"
|
||||
end
|
||||
else--需要升级的
|
||||
else
|
||||
curObj.limitText.text = "暂未开放"
|
||||
end
|
||||
if data.dataSingle and data.dataMain.IsOpen == 1 then--需要升级的才显示等级
|
||||
curObj.Name.text = string.format("%s(%s级)",data.dataMain.Name,data.dataSingle.level)
|
||||
else--部分没有等级所以不需要显示等级
|
||||
curObj.Name.text = string.format("%s",data.dataMain.Name)
|
||||
end
|
||||
|
||||
Util.AddOnceClick(curObj.CanGet,function ()
|
||||
NetManager.HomeAllGainRequset(data.dataMain.Id,function ()
|
||||
self:OnShow()
|
||||
end)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function HomeLand:SetTime()
|
||||
if self.timer then
|
||||
self.timer:Stop()
|
||||
self.timer = nil
|
||||
end
|
||||
self.timer = Timer.New(function ()
|
||||
for i = 1, 7 do
|
||||
local curObj = self.mapData[i]
|
||||
curObj.updateTime:SetActive(curObj.leftTime >= 0)
|
||||
if curObj.leftTime >= 0 then
|
||||
curObj.updateTimeText.text = TimeToFelaxible(curObj.leftTime)
|
||||
curObj.leftTime = curObj.leftTime -1
|
||||
if curObj.leftTime < 0 then
|
||||
NetManager.HomeInfoRequest(function ()
|
||||
self:OnShow()
|
||||
end)
|
||||
end
|
||||
end
|
||||
curObj.CanGet:SetActive(curObj.showTime > 0 and curObj.showTime < GetTimeStamp())
|
||||
end
|
||||
end, 1, -1, true)
|
||||
self.timer:Start()
|
||||
end
|
||||
|
||||
function HomeLand:OnClose()
|
||||
self.curSelect = 0
|
||||
for j = 1, 5 do
|
||||
self.mapData[j].Btns:SetActive(false)
|
||||
end
|
||||
|
@ -166,6 +241,10 @@ function HomeLand:OnDestroy()
|
|||
self.spLoader:Destroy()
|
||||
SubUIManager.Close(self.UpView)
|
||||
self.UpView = nil
|
||||
if self.timer then
|
||||
self.timer:Stop()
|
||||
self.timer = nil
|
||||
end
|
||||
-- if self.playerInfoView then
|
||||
-- SubUIManager.Close(self.playerInfoView)
|
||||
-- self.playerInfoView = nil
|
||||
|
|
|
@ -152,6 +152,8 @@ function this.RegisterMessage(network)
|
|||
socket:RegistNetMessage(MessageTypeProto_pb.WeekCardIndicationInfoResponse, this.WeekCardIndication)
|
||||
-- 灵脉被抢夺推送
|
||||
socket:RegistNetMessage(MessageTypeProto_pb.CrossLingmaiIndicationResponse, this.LingMaiIndication)
|
||||
-- 家园推送
|
||||
socket:RegistNetMessage(MessageTypeProto_pb.ArchitectureUnlockIndication, this.HomeLandIndication)
|
||||
end
|
||||
|
||||
function this.EquipBookInfoIndication(buff)
|
||||
|
@ -1084,4 +1086,16 @@ function this.LingMaiIndication(buffer)
|
|||
|
||||
end
|
||||
|
||||
-- 家园功能解锁
|
||||
function this.HomeLandIndication(buffer)
|
||||
local data = buffer:DataByte()
|
||||
local msg = PlayerInfoProto_pb.ArchitectureUnlockIndication()
|
||||
msg:ParseFromString(data)
|
||||
LogError("家园功能解锁建筑Indication")
|
||||
for index, value in ipairs(msg.infos) do
|
||||
LogError("Id:"..tostring(value.id).." startTime:"..tostring(TimeStampToDateStr4(value.productionStartTime)).." endTime:"..tostring(TimeStampToDateStr4(value.upLvEndTime)))
|
||||
end
|
||||
HomeLandManager.GetServerData(msg)
|
||||
end
|
||||
|
||||
return this
|
|
@ -6351,7 +6351,6 @@ end
|
|||
function NetManager.ArchitectureOperateRequest(_idList,_type,_priviId,func)
|
||||
local data = PlayerInfoProto_pb.ArchitectureOperateRequest()
|
||||
for k,v in pairs(_idList) do
|
||||
LogGreen("k:"..k.." v"..tostring(v))
|
||||
data.ids:append(v)
|
||||
end
|
||||
data.type = _type
|
||||
|
|
Loading…
Reference in New Issue