----- 森罗次元炸弹 ----- 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.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("当前不可使用炸弹!") return elseif MapTrialManager.curTowerLevel>10000 then PopupTipPanel.ShowTip(Language[12379]) return elseif usedNum>=5 then PopupTipPanel.ShowTip(Language[12380]) else NetManager.RequestUseBomb(function (msg)--请求使用炸弹 SoundManager.PlaySound(SoundConfig.Sound_zd) parent:ClosePanel() UIManager.OpenPanel(UIName.RewardItemPopup, msg.drop, 1,function() MapTrialManager.bombUsed = MapTrialManager.bombUsed + 1 MapTrialManager.UpdatePowerValue(msg.essenceValue) Game.GlobalEvent:DispatchEvent(GameEvent.Map.PointAdd, msg.cell.cellId, msg.cell.pointId) MapTrialManager.killCount = MapTrialManager.killCount + msg.monsterNum 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.GetTotalItemNum(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]..(usedNum>=5 and 0 or (trialSetting[1].PrivilegeReward[2]-usedNum)) end return this