【家园】加速确认
parent
69cb591edb
commit
197b28b3da
File diff suppressed because it is too large
Load Diff
|
|
@ -53,11 +53,15 @@ end
|
||||||
function this:BindEvent()
|
function this:BindEvent()
|
||||||
Util.AddClick(this.fastDoneBtn, function()
|
Util.AddClick(this.fastDoneBtn, function()
|
||||||
-- local priviId = PrivilegeManager.GetPrivilegeRemainValue()
|
-- local priviId = PrivilegeManager.GetPrivilegeRemainValue()
|
||||||
HomeLandManager.ResumeCost(data.dataSingle,string.split(costOneSec,"#"),function ()
|
HomeLandManager.ResumeCost(data.dataSingle,string.split(costOneSec,"#"),function (num)
|
||||||
NetManager.ArchitectureOperateRequest({data.dataMain.Id},2,0,function ()
|
|
||||||
Game.GlobalEvent:DispatchEvent(GameEvent.UI.OnUpdateData)
|
MsgPanel.ShowTwo(string.format("是否花费%s妖晶立即升级?",num),function() end,function()
|
||||||
parent:ClosePanel()
|
NetManager.ArchitectureOperateRequest({data.dataMain.Id},2,0,function ()
|
||||||
end)
|
Game.GlobalEvent:DispatchEvent(GameEvent.UI.OnUpdateData)
|
||||||
|
parent:ClosePanel()
|
||||||
|
end)
|
||||||
|
end,"取消","确定")
|
||||||
|
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
Util.AddClick(this.doneBtn, function()
|
Util.AddClick(this.doneBtn, function()
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,8 @@ function this.ResumeCost(_data,_str,func)
|
||||||
data[_data.Cost[i][1]] = data[_data.Cost[i][1]] + _data.Cost[i][2]
|
data[_data.Cost[i][1]] = data[_data.Cost[i][1]] + _data.Cost[i][2]
|
||||||
end
|
end
|
||||||
if _str then--立即完成
|
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
|
end
|
||||||
for key, value in pairs(data) do
|
for key, value in pairs(data) do
|
||||||
LogGreen(string.format("需要%s: %s,现有:%s",key,value,BagManager.GetTotalItemNum(key)))
|
LogGreen(string.format("需要%s: %s,现有:%s",key,value,BagManager.GetTotalItemNum(key)))
|
||||||
|
|
@ -65,7 +66,7 @@ function this.ResumeCost(_data,_str,func)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
func()
|
func(data[16])
|
||||||
end
|
end
|
||||||
|
|
||||||
return HomeLandManager
|
return HomeLandManager
|
||||||
|
|
@ -3,7 +3,9 @@ local HomeLandConfig = 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 GlobalSystemConfig = ConfigManager.GetConfig(ConfigName.GlobalSystemConfig)
|
local GlobalSystemConfig = ConfigManager.GetConfig(ConfigName.GlobalSystemConfig)
|
||||||
|
local ItemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
|
||||||
local costStr = string.split(ConfigManager.GetConfigData(ConfigName.SpecialConfig,100).Value,"#")
|
local costStr = string.split(ConfigManager.GetConfigData(ConfigName.SpecialConfig,100).Value,"#")
|
||||||
|
local bool = false
|
||||||
function HomeLand:InitComponent()
|
function HomeLand:InitComponent()
|
||||||
self.spLoader = SpriteLoader.New()
|
self.spLoader = SpriteLoader.New()
|
||||||
-- if not self.playerInfoView then
|
-- if not self.playerInfoView then
|
||||||
|
|
@ -18,6 +20,24 @@ function HomeLand:InitComponent()
|
||||||
self.RightUp = Util.GetGameObject(self.map,"RightUp")
|
self.RightUp = Util.GetGameObject(self.map,"RightUp")
|
||||||
self.RightDown = Util.GetGameObject(self.map,"RightDown")
|
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 = {}
|
self.mapData = {}
|
||||||
for i = 1, 7 do
|
for i = 1, 7 do
|
||||||
self.mapData[i] = {}
|
self.mapData[i] = {}
|
||||||
|
|
@ -46,10 +66,6 @@ function HomeLand:InitComponent()
|
||||||
end
|
end
|
||||||
|
|
||||||
function HomeLand:BindEvent()
|
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()
|
Util.AddClick(self.btnBack, function()
|
||||||
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
|
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])
|
local value = math.ceil((HomeLandManager.BuildData[i].endTime - GetTimeStamp())/tonumber(costStr[1]))*tonumber(costStr[3])
|
||||||
LogGreen("需要16:"..tostring(value).." 现有:"..tostring(BagManager.GetTotalItemNum(16)))
|
LogGreen("需要16:"..tostring(value).." 现有:"..tostring(BagManager.GetTotalItemNum(16)))
|
||||||
if BagManager.GetTotalItemNum(16) >= value then
|
if BagManager.GetTotalItemNum(16) >= value then
|
||||||
NetManager.ArchitectureOperateRequest({HomeLandManager.BuildData[i].dataMain.Id},2,0,function ()
|
MsgPanel.ShowTwo(string.format("是否花费%s妖晶立即升级?",value),function() end,function()
|
||||||
self:OnShow()
|
NetManager.ArchitectureOperateRequest({HomeLandManager.BuildData[i].dataMain.Id},2,0,function ()
|
||||||
end)
|
self.mapData[i].leftTime = -1
|
||||||
|
self:OnShow()
|
||||||
|
end)
|
||||||
|
end,"取消","确定")
|
||||||
else
|
else
|
||||||
PopupTipPanel.ShowTip("妖晶不足!")
|
PopupTipPanel.ShowTip("妖晶不足!")
|
||||||
end
|
end
|
||||||
|
|
@ -118,6 +137,23 @@ function HomeLand:BindEvent()
|
||||||
Util.AddOnceClick(self.mapData[6].Obj,function ()
|
Util.AddOnceClick(self.mapData[6].Obj,function ()
|
||||||
PopupTipPanel.ShowTip("摘星阁")
|
PopupTipPanel.ShowTip("摘星阁")
|
||||||
end)
|
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
|
end
|
||||||
|
|
||||||
function HomeLand:AddListener()
|
function HomeLand:AddListener()
|
||||||
|
|
@ -140,6 +176,64 @@ end
|
||||||
function HomeLand:OnShow()
|
function HomeLand:OnShow()
|
||||||
self:SetBuildsState()
|
self:SetBuildsState()
|
||||||
self:SetTime()
|
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
|
end
|
||||||
|
|
||||||
function HomeLand:SetBuildsState()
|
function HomeLand:SetBuildsState()
|
||||||
|
|
@ -236,6 +330,7 @@ end
|
||||||
|
|
||||||
function HomeLand:OnClose()
|
function HomeLand:OnClose()
|
||||||
self.curSelect = 0
|
self.curSelect = 0
|
||||||
|
bool = false
|
||||||
for j = 1, 5 do
|
for j = 1, 5 do
|
||||||
self.mapData[j].Btns:SetActive(false)
|
self.mapData[j].Btns:SetActive(false)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -6377,7 +6377,9 @@ function NetManager.HomeAllGainRequset(_id,func)
|
||||||
local data = buffer:DataByte()
|
local data = buffer:DataByte()
|
||||||
local msg = PlayerInfoProto_pb.HomeAllGainResponse()
|
local msg = PlayerInfoProto_pb.HomeAllGainResponse()
|
||||||
msg:ParseFromString(data)
|
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 ()
|
this.HomeInfoRequest(function ()
|
||||||
if func then
|
if func then
|
||||||
func(msg)
|
func(msg)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue