【家园】提交

dev_chengFeng
ZhangBiao 2022-01-05 14:17:53 +08:00
parent a4ab9eb231
commit f0de43aad2
7 changed files with 2025 additions and 1133 deletions

View File

@ -3100,7 +3100,7 @@ MonoBehaviour:
m_HorizontalOverflow: 0 m_HorizontalOverflow: 0
m_VerticalOverflow: 1 m_VerticalOverflow: 1
m_LineSpacing: 1 m_LineSpacing: 1
m_Text: "\u4EA7\u91CF(/\u65F6)\uFF1A" m_Text: "\u4EA7\u91CF(/\u5206)\uFF1A"
LanguageIndex: 0 LanguageIndex: 0
--- !u!114 &7857547895480091280 --- !u!114 &7857547895480091280
MonoBehaviour: MonoBehaviour:

View File

@ -58,7 +58,7 @@ function this:OnShow(_parent,_args)
this.harvest:SetActive(true) this.harvest:SetActive(true)
this.limitIcon.sprite = this.spLoader:LoadSprite(GetSpriteNameByItemId(data.dataSingle.Storage[1][1])) this.limitIcon.sprite = this.spLoader:LoadSprite(GetSpriteNameByItemId(data.dataSingle.Storage[1][1]))
this.limitNum.text = data.dataSingle.Storage[1][2] this.limitNum.text = data.dataSingle.Storage[1][2]
this.harvestNum.text = string.format("%s/每小时",data.dataSingle.Gain[2]) this.harvestNum.text = string.format("%s/每分钟",data.dataSingle.Gain[2])
this.harvestIcon.sprite = this.spLoader:LoadSprite(GetSpriteNameByItemId(data.dataSingle.Gain[1])) this.harvestIcon.sprite = this.spLoader:LoadSprite(GetSpriteNameByItemId(data.dataSingle.Gain[1]))
end end

View File

@ -3,6 +3,7 @@ local this = {}
local HomeLand = ConfigManager.GetConfig(ConfigName.HomeLand) local HomeLand = ConfigManager.GetConfig(ConfigName.HomeLand)
local HomeLandLevel = ConfigManager.GetConfig(ConfigName.HomeLandLevel) local HomeLandLevel = ConfigManager.GetConfig(ConfigName.HomeLandLevel)
local HomeLandTask = ConfigManager.GetConfig(ConfigName.HomeLandTask) local HomeLandTask = ConfigManager.GetConfig(ConfigName.HomeLandTask)
local price = ConfigManager.GetConfigData(ConfigName.RechargeCommodityConfig,1120).Price
--传入父脚本模块 --传入父脚本模块
local parent local parent
--传入特效层级 --传入特效层级
@ -48,13 +49,13 @@ end
function this:Refresh() function this:Refresh()
this.leftTime.text = "有效时间30天" this.leftTime.text = "有效时间30天"
this.btnText = "激活特权" this.btnText.text = string.format("%s元激活特权",price)
Util.SetGray(this.btn,false) Util.SetGray(this.btn,false)
this.btn:GetComponent("Button").enabled = true this.btn:GetComponent("Button").enabled = true
local data = PrivilegeManager.GetSerData(4022) local data = PrivilegeManager.GetSerData(4022)
if data and data.endTime > GetTimeStamp() then if data and data.endTime > GetTimeStamp() then
this.leftTime.text = "有效时间30天" this.leftTime.text = "有效时间30天"
this.btnText = "已激活" this.btnText.text = "已激活"
Util.SetGray(this.btn,true) Util.SetGray(this.btn,true)
this.btn:GetComponent("Button").enabled = false this.btn:GetComponent("Button").enabled = false
@ -63,10 +64,10 @@ function this:Refresh()
this.timer = nil this.timer = nil
end end
local leftTime = data.endTime - GetTimeStamp() local leftTime = data.endTime - GetTimeStamp()
this.leftTime.text = string.format("(剩余时间%s",TimeToFelaxible(leftTime)) this.leftTime.text = string.format("(剩余时间%s",TimeToD(leftTime))
this.timer = Timer.New(function () this.timer = Timer.New(function ()
leftTime = leftTime - 1 leftTime = leftTime - 1
this.leftTime.text = string.format("(剩余时间%s",TimeToFelaxible(leftTime)) this.leftTime.text = string.format("(剩余时间%s",TimeToD(leftTime))
end,1,-1) end,1,-1)
this.timer:Start() this.timer:Start()
end end

View File

@ -262,10 +262,15 @@ end
function this.singleUpgrade(id) function this.singleUpgrade(id)
local data = this.BuildData[id].dataSingle local data = this.BuildData[id].dataSingle
LogGreen("建筑Id:"..tostring(data.Id)) LogGreen("建筑Id:"..tostring(data.Id))
if BagManager.GetTotalItemNum(data.Cost[1][1]) >= data.Cost[1][2] then--所需材料够 if HomeLand[id].UnlockLevel[1] == 1 and PlayerManager.level < HomeLand[id].UnlockLevel[2] then
if not data.Rule or (this.BuildData[data.Rule[1]].level >= data.Rule[2]) then--到达升级条件 elseif HomeLand[id].UnlockLevel[1] == 2 and HomeLandManager.BuildData[5].level < HomeLand[id].UnlockLevel[2] then
LogRed("7") elseif HomeLand[id].UnlockLevel[1] == 3 and PlayerManager.level < GlobalSystemConfig[HomeLand[id].UnlockLevel[2]].OpenRules[2] then
return true else
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--到达升级条件
LogRed("7")
return true
end
end end
end end
LogRed("8") LogRed("8")
@ -275,7 +280,7 @@ end
--1-4建筑的单个领取 --1-4建筑的单个领取
function this.singleGet(id) function this.singleGet(id)
local data = this.BuildData[id] local data = this.BuildData[id]
if data.dataMain.Type == 1 and data.dataSingle.Gain then 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])) 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] return (GetTimeStamp() - data.startTime)/60*data.dataSingle.Gain[2] >= data.dataSingle.Storage[1][2]
end end
@ -298,10 +303,12 @@ end
--摘星阁 --摘星阁
function this.CheckEquipUpgrade() function this.CheckEquipUpgrade()
for i = 1, 4 do if this.BuildData[5].level >= HomeLand[6].UnlockLevel[2] then
if this.CheckSingleEquipUpgrade(i) then for i = 1, 4 do
LogRed("13") if this.CheckSingleEquipUpgrade(i) then
return true LogRed("13")
return true
end
end end
end end
LogRed("14") LogRed("14")

View File

@ -51,16 +51,19 @@ function HomeLand:InitComponent()
for i = 1, 7 do for i = 1, 7 do
self.mapData[i] = {} self.mapData[i] = {}
self.mapData[i].Obj = Util.GetGameObject(self.Bg,"Map ("..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].Title = Util.GetGameObject(self.mapData[i].Obj,"Title")
self.mapData[i].NameImg = Util.GetGameObject(self.mapData[i].Obj,"Title/Image") self.mapData[i].levelImg = Util.GetGameObject(self.mapData[i].Title,"levelImg")
self.mapData[i].RedPoint = Util.GetGameObject(self.mapData[i].Obj,"Title/redpoint") self.mapData[i].level = Util.GetGameObject(self.mapData[i].levelImg,"levelText"):GetComponent("Text")
self.mapData[i].NameImg = Util.GetGameObject(self.mapData[i].Title,"NameImg")
self.mapData[i].RedPoint = Util.GetGameObject(self.mapData[i].Title,"redpoint")
self.mapData[i].Lock = Util.GetGameObject(self.mapData[i].Title,"lock")
self.mapData[i].RedPoint:SetActive(false) self.mapData[i].RedPoint:SetActive(false)
self.mapData[i].CanGet = Util.GetGameObject(self.mapData[i].Obj,"CanGet") 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,"Title/Image"):GetComponent("Image")
self.mapData[i].Icon = Util.GetGameObject(self.mapData[i].Obj,"CanGet/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].Btns = Util.GetGameObject(self.mapData[i].Obj,"Btns")
self.mapData[i].OpenLimit = Util.GetGameObject(self.mapData[i].Obj,"OpenLimit") self.mapData[i].OpenLimit = Util.GetGameObject(self.mapData[i].Title,"OpenLimit")
self.mapData[i].limitText = Util.GetGameObject(self.mapData[i].OpenLimit,"Text"):GetComponent("Text") self.mapData[i].limitText = Util.GetGameObject(self.mapData[i].OpenLimit,"OpenLimitText"):GetComponent("Text")
self.mapData[i].upgradeImg = Util.GetGameObject(self.mapData[i].Obj,"Updating") 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].updateTime = Util.GetGameObject(self.mapData[i].Obj,"updateTime")
self.mapData[i].updateTimeText = Util.GetGameObject(self.mapData[i].updateTime,"Text"):GetComponent("Text") self.mapData[i].updateTimeText = Util.GetGameObject(self.mapData[i].updateTime,"Text"):GetComponent("Text")
@ -94,7 +97,6 @@ function HomeLand:BindEvent()
--打开菜单 --打开菜单
Util.AddOnceClick(self.mapData[i].Obj,function () Util.AddOnceClick(self.mapData[i].Obj,function ()
if self.curSelect ~= i then if self.curSelect ~= i then
self.curSelect = i
for j = 1, 5 do for j = 1, 5 do
self.mapData[j].Btns:SetActive(false) self.mapData[j].Btns:SetActive(false)
end end
@ -106,6 +108,7 @@ function HomeLand:BindEvent()
PopupTipPanel.ShowTip(string.format("浮生殿到达%s级开启",HomeLandConfig[i].UnlockLevel[2])) PopupTipPanel.ShowTip(string.format("浮生殿到达%s级开启",HomeLandConfig[i].UnlockLevel[2]))
return return
end end
self.curSelect = i
self.mapData[i].Btns:SetActive(true) self.mapData[i].Btns:SetActive(true)
PlayUIAnim(self.mapData[i].Btns) PlayUIAnim(self.mapData[i].Btns)
end end
@ -160,6 +163,15 @@ function HomeLand:BindEvent()
end) end)
--摘星阁 --摘星阁
Util.AddOnceClick(self.mapData[6].Obj,function () Util.AddOnceClick(self.mapData[6].Obj,function ()
if HomeLandManager.BuildData[6].dataMain.IsOpen ~= 1 then
PopupTipPanel.ShowTip(string.format("%s 暂未开放",HomeLandManager.BuildData[6].dataMain.Name))
return
end
if HomeLandConfig[6].UnlockLevel[1] == 2 and HomeLandManager.BuildData[5].level < HomeLandConfig[6].UnlockLevel[2] then
PopupTipPanel.ShowTip(string.format("浮生殿到达%s级开启",HomeLandConfig[6].UnlockLevel[2]))
return
end
UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.HomeLandEquip) UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.HomeLandEquip)
end) end)
@ -324,11 +336,13 @@ function HomeLand:SetBuildsState()
local curObj = self.mapData[i] local curObj = self.mapData[i]
curObj.data = HomeLandManager.BuildData[i] curObj.data = HomeLandManager.BuildData[i]
curObj.OpenLimit:SetActive(true) curObj.OpenLimit:SetActive(true)
curObj.Lock:SetActive(true)
curObj.btnUpgrade:SetActive(false) curObj.btnUpgrade:SetActive(false)
curObj.btnCancel:SetActive(false) curObj.btnCancel:SetActive(false)
curObj.btnSpeedUp:SetActive(false) curObj.btnSpeedUp:SetActive(false)
curObj.btnUsePri:SetActive(false) curObj.btnUsePri:SetActive(false)
curObj.NameImg:SetActive(true) curObj.levelImg:SetActive(false)
Util.SetGray(curObj.NameImg,true)
curObj.upgradeImg:SetActive(false) curObj.upgradeImg:SetActive(false)
curObj.updateTime:SetActive(false) curObj.updateTime:SetActive(false)
curObj.CanGet:SetActive(false) curObj.CanGet:SetActive(false)
@ -343,6 +357,12 @@ function HomeLand:SetBuildsState()
curObj.limitText.text = string.format("玩家等级到达%s级开启",GlobalSystemConfig[HomeLandConfig[i].UnlockLevel[2]].OpenRules[2]) curObj.limitText.text = string.format("玩家等级到达%s级开启",GlobalSystemConfig[HomeLandConfig[i].UnlockLevel[2]].OpenRules[2])
else else
curObj.OpenLimit:SetActive(false) curObj.OpenLimit:SetActive(false)
curObj.Lock:SetActive(false)
Util.SetGray(curObj.NameImg,false)
if data.dataSingle then
curObj.level.text = string.format("%s级",data.dataSingle.level)
curObj.levelImg:SetActive(true)
end
end end
if data.dataSingle then if data.dataSingle then
if data.dataSingle.Gain then--有产出的才需要icon if data.dataSingle.Gain then--有产出的才需要icon
@ -372,13 +392,6 @@ function HomeLand:SetBuildsState()
else else
curObj.limitText.text = "暂未开放" curObj.limitText.text = "暂未开放"
end end
if data.dataSingle and data.dataMain.IsOpen == 1 then--需要升级的才显示等级
curObj.Name.text = string.format("%s级",data.dataSingle.level)
curObj.NameImg:SetActive(true)
else--部分没有等级所以不需要显示等级
curObj.NameImg:SetActive(false)
curObj.Name.text = ""
end
Util.AddOnceClick(curObj.CanGet,function () Util.AddOnceClick(curObj.CanGet,function ()
if data.dataSingle.Storage[2][1] ~= 14 and data.dataSingle.Storage[2][2] <= BagManager.GetTotalItemNum(data.dataSingle.Storage[2][1]) then if data.dataSingle.Storage[2][1] ~= 14 and data.dataSingle.Storage[2][2] <= BagManager.GetTotalItemNum(data.dataSingle.Storage[2][1]) then
@ -420,6 +433,7 @@ function HomeLand:SetTime()
end end
end end
self.priviDi:SetActive(HomeLandManager.activePrivilege) self.priviDi:SetActive(HomeLandManager.activePrivilege)
Util.SetGray(self.Privi,not HomeLandManager.activePrivilege)
self.priviText.text = string.format("剩余:%s",HomeLandManager.priviLeftTime) self.priviText.text = string.format("剩余:%s",HomeLandManager.priviLeftTime)
end, 1, -1, true) end, 1, -1, true)
self.timer:Start() self.timer:Start()
@ -427,7 +441,7 @@ end
function HomeLand:SetRedPoint() function HomeLand:SetRedPoint()
for i = 1, 5 do for i = 1, 5 do
self.mapData[i].RedPoint:SetActive(HomeLandManager.singleGet(i)) self.mapData[i].RedPoint:SetActive(HomeLandManager.singleGet(i) or HomeLandManager.singleUpgrade(i))
end end
self.mapData[6].RedPoint:SetActive(HomeLandManager.CheckEquipUpgrade()) self.mapData[6].RedPoint:SetActive(HomeLandManager.CheckEquipUpgrade())
self.taskRed:SetActive(HomeLandManager.CheckMission()) self.taskRed:SetActive(HomeLandManager.CheckMission())

View File

@ -650,12 +650,12 @@ function this.RegisterRedCheckFunc()
RPData:AddCheckFunc(RedPointType.chaozhifanli,DynamicActivityManager.CheckRedPointPremium) RPData:AddCheckFunc(RedPointType.chaozhifanli,DynamicActivityManager.CheckRedPointPremium)
--家园 --家园
RPData:AddCheckFunc(RedPointType.HomeLand,HomeLandManager.CheckRedMain) RPData:AddCheckFunc(RedPointType.HomeLand,HomeLandManager.CheckRedMain,FUNCTION_OPEN_TYPE.HOMELAND)
end end
-- 向红点绑定物体 -- 向红点绑定物体
function this.BindObject(rpType, rpObj) function this.BindObject(rpType, rpObj)
if not rpObj or not rpType then if not rpObj or not rpType then
LogError("rpObj:"..tostring(rpObj).." rpType:"..tostring(rpType)) LogError("rpObj:"..tostring(rpObj).." rpType:"..tostring(rpType))
return return
end end