【家园】加速确认

dev_chengFeng
ZhangBiao 2021-12-28 18:27:31 +08:00
parent 69cb591edb
commit 197b28b3da
5 changed files with 1849 additions and 16 deletions

View File

@ -53,11 +53,15 @@ end
function this:BindEvent()
Util.AddClick(this.fastDoneBtn, function()
-- local priviId = PrivilegeManager.GetPrivilegeRemainValue()
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)
HomeLandManager.ResumeCost(data.dataSingle,string.split(costOneSec,"#"),function (num)
MsgPanel.ShowTwo(string.format("是否花费%s妖晶立即升级",num),function() end,function()
NetManager.ArchitectureOperateRequest({data.dataMain.Id},2,0,function ()
Game.GlobalEvent:DispatchEvent(GameEvent.UI.OnUpdateData)
parent:ClosePanel()
end)
end,"取消","确定")
end)
end)
Util.AddClick(this.doneBtn, function()

View File

@ -56,7 +56,8 @@ function this.ResumeCost(_data,_str,func)
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])
LogGreen(tostring(_data.Time).." "..tostring(tonumber(_str[1])).." "..tonumber(_str[3]))
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)))
@ -65,7 +66,7 @@ function this.ResumeCost(_data,_str,func)
return
end
end
func()
func(data[16])
end
return HomeLandManager

View File

@ -3,7 +3,9 @@ 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 ItemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
local costStr = string.split(ConfigManager.GetConfigData(ConfigName.SpecialConfig,100).Value,"#")
local bool = false
function HomeLand:InitComponent()
self.spLoader = SpriteLoader.New()
-- if not self.playerInfoView then
@ -18,6 +20,24 @@ function HomeLand:InitComponent()
self.RightUp = Util.GetGameObject(self.map,"RightUp")
self.RightDown = Util.GetGameObject(self.map,"RightDown")
--产出详情框
self.GainDetail = Util.GetGameObject(self.map,"GainDetail")
self.maskBtn = Util.GetGameObject(self.GainDetail,"mask")
self.Kuang = Util.GetGameObject(self.GainDetail,"Kuang")
self.Btn = Util.GetGameObject(self.GainDetail,"Btn")
self.BtnImage = Util.GetGameObject(self.Btn,"Image")
--progress
self.progress = Util.GetGameObject(self.Kuang,"Progress")
self.helpBtn1 = Util.GetGameObject(self.progress,"Help1")
self.progressPre = Util.GetGameObject(self.progress,"progressPre")
self.preList1 = {}
--detail
self.detail = Util.GetGameObject(self.Kuang,"Detail")
self.helpBtn2 = Util.GetGameObject(self.detail,"Help2")
self.detailPre = Util.GetGameObject(self.detail,"detailPre")
self.preList2 = {}
--地图点信息
self.mapData = {}
for i = 1, 7 do
self.mapData[i] = {}
@ -46,10 +66,6 @@ function HomeLand:InitComponent()
end
function HomeLand:BindEvent()
--帮助按钮
-- Util.AddClick(self.helpBtn, function()
-- UIManager.OpenPanel(UIName.HelpPopup, HELP_TYPE.HomeLand, self.helpPosition.x,self.helpPosition.y)
-- end)
Util.AddClick(self.btnBack, function()
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
@ -94,9 +110,12 @@ function HomeLand:BindEvent()
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)
MsgPanel.ShowTwo(string.format("是否花费%s妖晶立即升级",value),function() end,function()
NetManager.ArchitectureOperateRequest({HomeLandManager.BuildData[i].dataMain.Id},2,0,function ()
self.mapData[i].leftTime = -1
self:OnShow()
end)
end,"取消","确定")
else
PopupTipPanel.ShowTip("妖晶不足!")
end
@ -118,6 +137,23 @@ function HomeLand:BindEvent()
Util.AddOnceClick(self.mapData[6].Obj,function ()
PopupTipPanel.ShowTip("摘星阁")
end)
--帮助按钮
-- Util.AddClick(self.helpBtn, function()
-- UIManager.OpenPanel(UIName.HelpPopup, HELP_TYPE.HomeLand, self.helpPosition.x,self.helpPosition.y)
-- end)
Util.AddClick(self.maskBtn, function()
bool = false
self.maskBtn:SetActive(bool)
self:SetDetailBar()
end)
Util.AddClick(self.Btn, function()
bool = not bool
self:SetDetailBar()
end)
end
function HomeLand:AddListener()
@ -140,6 +176,64 @@ end
function HomeLand:OnShow()
self:SetBuildsState()
self:SetTime()
self:InitDetailBar()
end
function HomeLand:InitDetailBar()
local targetPos = bool and Vector3.zero or Vector3.New(1000,0,0)
self.Kuang:GetComponent("RectTransform").localPosition = targetPos
self.maskBtn:SetActive(bool)
for key, value in pairs(self.preList1) do
value:SetActive(false)
end
for key, value in pairs(self.preList2) do
value:SetActive(false)
end
for i = 1, 7 do
local data = HomeLandManager.BuildData[i]
if data.dataMain.Type == 1 and data.startTime > 0 then
--进度条部分
if data.dataSingle.Gain[1] ~= 14 then
local go = self.preList1[i]
if not go then
go = newObjToParent(self.progressPre,self.progress.transform)
self.preList1[i] = go
end
go:SetActive(true)
local icon = Util.GetGameObject(go,"Icon"):GetComponent("Image")
local num = Util.GetGameObject(go,"Num"):GetComponent("Text")
local slider = Util.GetGameObject(go,"Slide/Image"):GetComponent("Image")
icon.sprite = self.spLoader:LoadSprite(GetSpriteNameByItemId(data.dataSingle.Gain[1]))
local value = data.dataSingle.Storage[2][2]/100000 > 1 and math.floor(data.dataSingle.Storage[2][2]/100000).."" or data.dataSingle.Storage[2][2]
num.text = string.format("%s/%s",BagManager.GetTotalItemNum(data.dataSingle.Storage[2][1]),value)
slider.fillAmount = BagManager.GetTotalItemNum(data.dataSingle.Storage[2][1])/data.dataSingle.Storage[2][2]
end
--数值部分
local go2 = self.preList2[i]
if not go2 then
go2 = newObjToParent(self.detailPre,self.detail.transform)
self.preList2[i] = go2
end
go2:SetActive(true)
local icon = Util.GetGameObject(go2,"Icon"):GetComponent("Image")
local num = Util.GetGameObject(go2,"Num"):GetComponent("Text")
icon.sprite = self.spLoader:LoadSprite(GetSpriteNameByItemId(data.dataSingle.Gain[1]))
num.text = string.format("%s产量%s",ItemConfig[data.dataSingle.Gain[1]].Name,data.dataSingle.Gain[2])
end
end
end
function HomeLand:SetDetailBar()
self.maskBtn:SetActive(bool)
local targetPos = bool and Vector3.zero or Vector3.New(1000,0,0)
local rotation = bool and Vector3.New(0,180,0) or Vector3.zero
self.Kuang.transform:DOLocalMove(targetPos, 0.8)
self.BtnImage.transform:DORotate(rotation,0.8)
end
function HomeLand:SetBuildsState()
@ -236,6 +330,7 @@ end
function HomeLand:OnClose()
self.curSelect = 0
bool = false
for j = 1, 5 do
self.mapData[j].Btns:SetActive(false)
end

View File

@ -6377,7 +6377,9 @@ function NetManager.HomeAllGainRequset(_id,func)
local data = buffer:DataByte()
local msg = PlayerInfoProto_pb.HomeAllGainResponse()
msg:ParseFromString(data)
UIManager.OpenPanel(UIName.RewardItemPopup, msg.drop, 1)
-- UIManager.OpenPanel(UIName.RewardItemPopup, msg.drop, 1)
local ItemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig,msg.drop.itemlist[1].itemId)
PopupTipPanel.ShowColorTip(ItemConfig.Name, Util.LoadSprite(GetSpriteNameByItemId(msg.drop.itemlist[1].itemId)), msg.drop.itemlist[1].itemNum)
this.HomeInfoRequest(function ()
if func then
func(msg)