【心魔试炼】增加快速挑战功能

dev_chengFeng
zhangqiang 2021-07-06 16:50:48 +08:00
parent 6cc47ddac1
commit 22e00b9fcd
1 changed files with 72 additions and 33 deletions

View File

@ -41,7 +41,7 @@ function MonsterCampNewPanel:InitComponent()
this.titleText = Util.GetGameObject(self.gameObject, "InfoRoot/tiitleRoot/title"):GetComponent("Text")
this.moppingUpBtn = Util.GetGameObject(self.gameObject, "InfoRoot/bottomLayout/moppingUpBtn")
Util.GetGameObject(self.gameObject, "InfoRoot/bottomLayout/moppingUpBtn/Text"):GetComponent("Text").text = "一键扫荡"
Util.GetGameObject(self.gameObject, "InfoRoot/bottomLayout/moppingUpBtn/Text"):GetComponent("Text").text = "快速挑战"
this.freeMoppingTimes = Util.GetGameObject(self.gameObject, "InfoRoot/bottomLayout/freeMoppingTimes"):GetComponent("Text")
this.buyMoppingTimes = Util.GetGameObject(self.gameObject, "InfoRoot/bottomLayout/buyMoppingTimes"):GetComponent("Text")
this.addBtn = Util.GetGameObject(self.gameObject, "InfoRoot/bottomLayout/addBtn")
@ -95,44 +95,83 @@ function MonsterCampNewPanel:BindEvent()
end,2)
end)
Util.AddClick(this.moppingUpBtn, function ()
if MonsterCampManager.monsterWave - 1 <= 0 then
PopupTipPanel.ShowTip("无法扫荡,请先挑战心魔试炼!")
return
end
if freeTimes <= 0 and buyTimes <= 0 then
PopupTipPanel.ShowTip("今日已无扫荡次数!")
return
end
local _storeDataId,_itemId,_costNum,moppingUpNum = MonsterCampManager.MonsterCampGetYJGMCost()
MsgPanel.ShowTwo(string.format("是否花费%s%s进行一键扫荡",_costNum,itemConfig[itemId].Name),function() end,function()
if BagManager.GetItemCountById(_itemId) < _costNum then
PopupTipPanel.ShowTip(string.format(Language[10298], itemConfig[itemId].Name))
else
if moppingUpNum > 0 then
ShopManager.RequestBuyShopItem(SHOP_TYPE.FUNCTION_SHOP,storeDataId,moppingUpNum,function()
PrivilegeManager.RefreshPrivilegeUsedTimes(PRIVILEGE_TYPE.MONSTERCAMP_BUY_BATTLENUM, moppingUpNum)
NetManager.SweepDemonRequest(MonsterCampManager.monsterWave - 1,true,function(msg)
UIManager.OpenPanel(UIName.RewardItemPopup,msg.Drop,1,function()
PrivilegeManager.RefreshPrivilegeUsedTimes(PRIVILEGE_TYPE.MONSTERCAMP_BATTLENUM, MonsterCampManager.GetCanBattleCount() )
this.UpdatePrivilage()
end)
end)
end)
else
NetManager.SweepDemonRequest(MonsterCampManager.monsterWave - 1,true,function(msg)
UIManager.OpenPanel(UIName.RewardItemPopup,msg.Drop,1,function()
PrivilegeManager.RefreshPrivilegeUsedTimes(PRIVILEGE_TYPE.MONSTERCAMP_BATTLENUM, MonsterCampManager.GetCanBattleCount() )
this.UpdatePrivilage()
end)
end)
end
-- if MonsterCampManager.monsterWave - 1 <= 0 then
-- PopupTipPanel.ShowTip("无法扫荡,请先挑战心魔试炼!")
-- return
-- end
-- if freeTimes <= 0 and buyTimes <= 0 then
-- PopupTipPanel.ShowTip("今日已无扫荡次数!")
-- return
-- end
-- local _storeDataId,_itemId,_costNum,moppingUpNum = MonsterCampManager.MonsterCampGetYJGMCost()
-- MsgPanel.ShowTwo(string.format("是否花费%s%s进行一键扫荡",_costNum,itemConfig[itemId].Name),function() end,function()
-- if BagManager.GetItemCountById(_itemId) < _costNum then
-- PopupTipPanel.ShowTip(string.format(Language[10298], itemConfig[itemId].Name))
-- else
-- if moppingUpNum > 0 then
-- ShopManager.RequestBuyShopItem(SHOP_TYPE.FUNCTION_SHOP,storeDataId,moppingUpNum,function()
-- PrivilegeManager.RefreshPrivilegeUsedTimes(PRIVILEGE_TYPE.MONSTERCAMP_BUY_BATTLENUM, moppingUpNum)
-- NetManager.SweepDemonRequest(MonsterCampManager.monsterWave - 1,true,function(msg)
-- UIManager.OpenPanel(UIName.RewardItemPopup,msg.Drop,1,function()
-- PrivilegeManager.RefreshPrivilegeUsedTimes(PRIVILEGE_TYPE.MONSTERCAMP_BATTLENUM, MonsterCampManager.GetCanBattleCount() )
-- this.UpdatePrivilage()
-- end)
-- end)
-- end)
-- else
-- NetManager.SweepDemonRequest(MonsterCampManager.monsterWave - 1,true,function(msg)
-- UIManager.OpenPanel(UIName.RewardItemPopup,msg.Drop,1,function()
-- PrivilegeManager.RefreshPrivilegeUsedTimes(PRIVILEGE_TYPE.MONSTERCAMP_BATTLENUM, MonsterCampManager.GetCanBattleCount() )
-- this.UpdatePrivilage()
-- end)
-- end)
-- end
-- end
-- end,"取消","确定")
if FormationManager.CheckFormationValid(FormationTypeDef.MONSTER_CAMP_ATTACK) then
this.QuickStartMonsterFightRequest()
else
local formationList = FormationManager.GetFormationByID(FormationTypeDef.MONSTER_CAMP_ATTACK)
if formationList.teamHeroInfos > 0 then
this.QuickStartMonsterFightRequest()
end
end,"取消","确定")
end
end)
BindRedPointObject(RedPointType.EpicExplore_LevleReward,Util.GetGameObject(this.btnHelpFight, "redPoint"))
end
--快速战斗
function this.QuickStartMonsterFightRequest()
-- 请求战斗结果
NetManager.GetMonsterFightResult(MonsterCampManager.monsterWave, FormationTypeDef.MONSTER_CAMP_ATTACK, function (msg)
local result = {}
result.drop = msg.enventDrop
-- 设置战斗数据用于统计战斗
local _fightData = BattleManager.GetBattleServerData(msg)
BattleRecordManager.SetBattleRecord(_fightData)
--用一个变量接收最近的战斗结果
this.lastBattleResult = {
result = msg.result,
hpList = {},
drop = msg.enventDrop,
}
BattleManager.SetLastBattleResult(this.lastBattleResult,BATTLE_TYPE.MONSTER_CAMP)
if msg.result == 0 then
UIManager.OpenPanel(UIName.BattleFailPopup, nil, true, UIName.MonsterCampNewPanel)
else
MonsterCampManager.monsterWave = MonsterCampManager.monsterWave + 1
UIManager.OpenPanel(UIName.BattleWinPopup, nil, false, BATTLE_TYPE.MONSTER_CAMP, result, true, true,function()
-- UIManager.OpenPanel(UIName.RewardItemPopup,msg.enventDrop,1,function()
this.OnShowPanel()--刷新界面
-- end)
end)
end
end)
end
this.UpdatePrivilage = function()
if this.singledataList[MonsterCampManager.monsterWave - 1] then
this.singledataList[MonsterCampManager.monsterWave - 1]:UpdatePrivilage()