127 lines
4.2 KiB
Lua
127 lines
4.2 KiB
Lua
----- 森罗次元炸弹 -----
|
|
local this = {}
|
|
--传入父脚本模块
|
|
local parent
|
|
--传入特效层级
|
|
local sortingOrder=0
|
|
|
|
local ctrlView = require("Modules/Map/View/MapControllView")
|
|
local itemConfig=ConfigManager.GetConfig(ConfigName.ItemConfig)
|
|
local trialSetting=ConfigManager.GetConfig(ConfigName.TrialSetting)
|
|
local trialConfig = ConfigManager.GetConfig(ConfigName.TrialConfig)
|
|
local item
|
|
local itemId=0 --消耗道具ID
|
|
local itemNum=0 --消耗道具数量
|
|
local usedNum=0 --已使用的数量
|
|
|
|
|
|
function this:InitComponent(gameObject)
|
|
this.titleText=Util.GetGameObject(gameObject,"TitleText"):GetComponent("Text")
|
|
this.body=Util.GetGameObject(gameObject,"Body")
|
|
this.item=Util.GetGameObject(this.body,"Item")
|
|
this.leftTime=Util.GetGameObject(this.body,"leftTime"):GetComponent("Text")
|
|
this.num=Util.GetGameObject(this.body,"Num"):GetComponent("Text")
|
|
-- this.root=Util.GetGameObject(gameObject,"Rot"):GetComponent("Text")
|
|
this.cancelBtn=Util.GetGameObject(gameObject,"CancelBtn")
|
|
this.confirmBtn=Util.GetGameObject(gameObject,"ConfirmBtn")
|
|
|
|
item=SubUIManager.Open(SubUIConfig.ItemView, this.item.transform)
|
|
end
|
|
|
|
function this:BindEvent()
|
|
--取消按钮
|
|
Util.AddClick(this.cancelBtn,function()
|
|
parent:ClosePanel()
|
|
end)
|
|
--使用按钮
|
|
Util.AddClick(this.confirmBtn,function()
|
|
if itemNum > 0 then
|
|
if MapTrialManager.isHaveBoss then
|
|
PopupTipPanel.ShowTip(Language[11248])
|
|
return
|
|
else
|
|
-- UIManager.OpenPanel(UIName.TrialOpPanel, 2)
|
|
-- 停止自动寻路
|
|
-- ctrlView.OnRoleDead()
|
|
|
|
--tiralOPpanel里面
|
|
--向服务器请求使用炸弹
|
|
MapManager.MapUpdateEvent(-1000, function ()
|
|
Log(Language[11270])
|
|
NetManager.RequestUseBomb(function (msg)
|
|
Log(Language[11271] .. #msg.drop.itemlist)
|
|
ctrlView.CallListPop()
|
|
-- 更新背包数量
|
|
BagManager.DeleteTempBagCountById(43, 1)
|
|
this.KillAllBitch()
|
|
|
|
local showDrop = function()
|
|
UIManager.OpenPanel(UIName.RewardItemPopup, msg.drop, 2, function ()
|
|
-- 回复精气值
|
|
MapTrialManager.UpdatePowerValue(msg.essenceValue)
|
|
end)
|
|
end
|
|
parent:ClosePanel()
|
|
end)
|
|
end)
|
|
|
|
end
|
|
else
|
|
PopupTipPanel.ShowTip(Language[11249])
|
|
end
|
|
end)
|
|
end
|
|
|
|
-- 弄死所有的小怪
|
|
function this:KillAllBitch()
|
|
--杀死所有的小怪
|
|
MapManager.isRemoving = true
|
|
local pointData = trialConfig[MapTrialManager.curTowerLevel].MonsterPoint --MonsterPoint
|
|
for i = 1, #pointData do
|
|
local mapPointId = pointData[i][1]
|
|
if mapPointId then
|
|
LogPink(Language[11266] .. mapPointId)
|
|
MapManager.DeletePos(mapPointId)
|
|
end
|
|
end
|
|
MapManager.isRemoving = false
|
|
end
|
|
|
|
function this:AddListener()
|
|
Game.GlobalEvent:AddEvent(GameEvent.Bag.BagGold, this.RefreshPanel)--监听背包信息改变刷新 用于回春散数量刷新
|
|
end
|
|
|
|
function this:RemoveListener()
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.Bag.BagGold, this.RefreshPanel)
|
|
end
|
|
|
|
function this:OnShow(_parent,...)
|
|
parent=_parent
|
|
sortingOrder = _parent.sortingOrder
|
|
--不定参中包含的不定参 _args[1]为面板类型 _args[2]之后(包括)为打开面板后传入的不定参
|
|
local _args = {...}
|
|
|
|
itemId=trialSetting[1].BombId[1][1]
|
|
itemNum= BagManager.GetItemCountById(itemId)
|
|
-- LogBlue(BagManager.GetItemCountById(itemId))
|
|
usedNum=MapTrialManager.bombUsed
|
|
this.RefreshPanel()
|
|
end
|
|
|
|
function this:OnClose()
|
|
end
|
|
|
|
function this:OnDestroy()
|
|
item=nil
|
|
end
|
|
|
|
|
|
--刷新面板
|
|
function this.RefreshPanel()
|
|
item:OnOpen(false, {itemId,1}, 1.2,false,false,false,sortingOrder)
|
|
item:Reset({itemId,1},ItemType.NoType,{nil,false,nil,false})
|
|
this.num.text=Language[11657]..itemNum
|
|
this.leftTime.text=Language[11656]..trialSetting[1].PrivilegeReward[2]-usedNum
|
|
end
|
|
|
|
return this |