【编队优化】无尽副本增加一键

dev_chengFeng
ZhangBiao 2020-11-17 17:12:52 +08:00
parent 8980c6be4a
commit 233ff1b361
1 changed files with 132 additions and 136 deletions

View File

@ -15,17 +15,13 @@ this.IsNeedChangeFormation = true
--- 逻辑初始化
function this.Init(root, curMapId)
this.root = root
-- if CarbonManager.difficulty == CARBON_TYPE.ENDLESS then
this.curMapId = EndLessMapManager.openMapId
-- else
-- this.curMapId = curMapId
-- end
this.curMapId = EndLessMapManager.openMapId
this.InitView()
end
--- 获取需要显示的编队id
function this.GetFormationIndex()
local index = 0
if CarbonManager.difficulty == 4 then
if CarbonManager.difficulty == CARBON_TYPE.ENDLESS then
index = FormationTypeDef.FORMATION_ENDLESS_MAP
else
FormationManager.curFormationIndex = FormationTypeDef.FORMATION_NORMAL
@ -37,131 +33,131 @@ end
-- 扫荡按钮
--- btn1点击回调事件
function this.On_Btn1_Click()
if CarbonManager.difficulty == 4 and MapManager.Mapping then
if this.root.order>=1 then
--保存编队
FormationManager.RefreshFormation(this.root.curFormationIndex, this.root.choosedList,
FormationManager.formationList[this.root.curFormationIndex].teamPokemonInfos)
PopupTipPanel.ShowTip(Language[10713])
else
PopupTipPanel.ShowTip(Language[10714])
end
return
end
-- 刷新扫荡数据
this.root.ShowStartMopUpInfoData()
-- 显示扫荡界面
this.root.mopUpGo:SetActive(true)
PlayUIAnim( this.root.mopUpGo)
this.root.SetOneKeyGo()
--以前的换成的一键上阵
-- if CarbonManager.difficulty == CARBON_TYPE.ENDLESS and MapManager.Mapping then
-- if this.root.order>=1 then
-- --保存编队
-- FormationManager.RefreshFormation(this.root.curFormationIndex, this.root.choosedList,
-- FormationManager.formationList[this.root.curFormationIndex].teamPokemonInfos)
-- PopupTipPanel.ShowTip(Language[10713])
-- else
-- PopupTipPanel.ShowTip(Language[10714])
-- end
-- return
-- end
-- 刷新扫荡数据--应该是没了
-- this.root.ShowStartMopUpInfoData()
-- -- 显示扫荡界面
-- this.root.mopUpGo:SetActive(true)
-- PlayUIAnim( this.root.mopUpGo)
end
--- btn2点击回调事
local itemType = {
[1] = 27,
[3] = 28,
}
-- local itemType = {
-- [1] = 27,
-- [3] = 28,
-- }
-- 进入地图
function this.On_Btn2_Click()
--保存编队
if this.root.order>=1 then
--保存编队
FormationManager.RefreshFormation(this.root.curFormationIndex, this.root.choosedList,
FormationManager.formationList[this.root.curFormationIndex].teamPokemonInfos)
this.root:ClosePanel()
else
PopupTipPanel.ShowTip(string.format(Language[10701], 1))
PopupTipPanel.ShowTip(Language[10714])
return
end
-- 判断当前选择的副本类型
local itemId = itemType[CarbonManager.difficulty]
-- 无尽副本
if CarbonManager.difficulty == CARBON_TYPE.ENDLESS then
if #FormationManager.GetFormationByID(401).teamHeroInfos == 0 then
PopupTipPanel.ShowTip(Language[10714])
return
end
else
if #FormationManager.formationList[FormationManager.curFormationIndex].teamHeroInfos == 0 then
Log(Language[10715])
PopupTipPanel.ShowTip(Language[10714])
return
if MapManager.Mapping then--在地图里
if this.root.order>=1 then
FormationManager.RefreshFormation(this.root.curFormationIndex, this.root.choosedList,
FormationManager.formationList[this.root.curFormationIndex].teamPokemonInfos)
PopupTipPanel.ShowTip(Language[10713])
else
PopupTipPanel.ShowTip(Language[10714])
end
else
Log("进入的副本difficulty:"..CarbonManager.difficulty)
this.EnterMapbyType(CarbonManager.difficulty)--, itemId)
end
end
--+=======================================
-- if this.root.order>=1 then
-- --保存编队
-- FormationManager.RefreshFormation(this.root.curFormationIndex, this.root.choosedList,
-- FormationManager.formationList[this.root.curFormationIndex].teamPokemonInfos)
-- else
-- PopupTipPanel.ShowTip(string.format(Language[10701], 1))
-- return
-- end
-- -- 判断当前选择的副本类型
-- local itemId = itemType[CarbonManager.difficulty]
-- 无尽副本
-- if CarbonManager.difficulty == CARBON_TYPE.ENDLESS then
-- if #FormationManager.GetFormationByID(401).teamHeroInfos == 0 then
-- PopupTipPanel.ShowTip(Language[10714])
-- return
-- end
-- else
-- if #FormationManager.formationList[FormationManager.curFormationIndex].teamHeroInfos == 0 then
-- Log(Language[10715])
-- PopupTipPanel.ShowTip(Language[10714])
-- return
-- end
-- end
-- 判断挑战次数
if CarbonManager.difficulty == 1 then -- 普通副本
if BagManager.GetItemCountById(itemId) <= 0 and CarbonManager.GetNormalState(this.curMapId)then
PopupTipPanel.ShowTip(Language[10716])
return
end
elseif CarbonManager.difficulty == 3 then -- 英雄副本
if BagManager.GetItemCountById(itemId) <= 0 then
PopupTipPanel.ShowTip(Language[10717])
UIManager.OpenPanel(UIName.QuickPurchasePanel, { type = UpViewRechargeType.EliteCarbonTicket })
return
end
-- elseif CarbonManager.difficulty == 2 then -- 失恋副本
-- Log("即将进入试炼副本!")
end
if CarbonManager.difficulty == 1 or CarbonManager.difficulty == 3 then
-- 战斗力判断
if this.root.formationPower <CarbonManager.recommendFightAbility[this.curMapId] then
MsgPanel.ShowTwo(Language[10718], function()
end, function()
-- 开始挑战
this.EnterMapbyType(CarbonManager.difficulty, itemId)
end, Language[10719], Language[10720]
)
else
this.EnterMapbyType(CarbonManager.difficulty, itemId)
end
else
LogGreen("进入的副本difficulty:"..CarbonManager.difficulty.." itemId: "..tostring(itemId))
MapManager.endlessEnter = true
this.EnterMapbyType(CarbonManager.difficulty, itemId)
end
-- if CarbonManager.difficulty == CARBON_TYPE.NORMAL then -- 普通副本
-- if BagManager.GetItemCountById(itemId) <= 0 and CarbonManager.GetNormalState(this.curMapId)then
-- PopupTipPanel.ShowTip(Language[10716])
-- return
-- end
-- elseif CarbonManager.difficulty == CARBON_TYPE.HERO then -- 英雄副本
-- if BagManager.GetItemCountById(itemId) <= 0 then
-- PopupTipPanel.ShowTip(Language[10717])
-- UIManager.OpenPanel(UIName.QuickPurchasePanel, { type = UpViewRechargeType.EliteCarbonTicket })
-- return
-- end
-- end
-- if CarbonManager.difficulty == CARBON_TYPE.NORMAL or CarbonManager.difficulty == CARBON_TYPE.HERO then
-- -- 战斗力判断
-- if this.root.formationPower <CarbonManager.recommendFightAbility[this.curMapId] then
-- MsgPanel.ShowTwo(Language[10718], function()
-- end, function()
-- -- 开始挑战
-- this.EnterMapbyType(CarbonManager.difficulty, itemId)
-- end, Language[10719], Language[10720]
-- )
-- else
-- this.EnterMapbyType(CarbonManager.difficulty, itemId)
-- end
-- else
-- LogGreen("进入的副本difficulty:"..CarbonManager.difficulty.." itemId: "..tostring(itemId))
-- this.EnterMapbyType(CarbonManager.difficulty, itemId)
-- end
end
-- 根据不同的副本类型进入地图
function this.EnterMapbyType(type, itemId)
if type == 1 or type == 3 or type == 4 then
function this.EnterMapbyType(type)--, itemId)
if type == CARBON_TYPE.NORMAL or type == CARBON_TYPE.HERO or type == CARBON_TYPE.ENDLESS then
MapManager.curMapId = this.curMapId
-- elseif type == 2 then
-- MapManager.curMapId = trialMapData[MapTrialManager.curTowerLevel].MapId
end
local index = CarbonManager.difficulty == 4 and 401 or FormationManager.curFormationIndex
local index = CarbonManager.difficulty == CARBON_TYPE.ENDLESS and FormationTypeDef.FORMATION_ENDLESS_MAP or FormationManager.curFormationIndex
NetManager.MapInfoRequest(MapManager.curCarbonType, function()
MapManager.curAreaId = this.root.curFormationIndex
-- ======== 副本额外的设置 =================================
-- 普通副本解锁后第一次进图
if not CarbonManager.GetNormalState(MapManager.curMapId) and CarbonManager.difficulty == 1 then
-- 更新一次本地值
CarbonManager.playedMapId[MapManager.curMapId] = MapManager.curMapId
PopupTipPanel.ShowTip(Language[10721])
-- 普通、精英副本正常进图
elseif CarbonManager.difficulty == 3 or CarbonManager.difficulty == 1 then
--BagManager.UpdateItemsNum(itemId, 1)
--Log("扣除一次进入副本券, ID是 " .. itemId)
-- 试炼副本
-- elseif CarbonManager.difficulty == 2 then
-- MapTrialManager.firstEnter = true
elseif CarbonManager.difficulty == CARBON_TYPE.ENDLESS then
-- 是否已经开放
-- if not ActTimeCtrlManager.SingleFuncState(46) then
-- PopupTipPanel.ShowTip(Language[10722])
-- return
-- end
end
-- ===========================================================
MapManager.isReloadEnter = false
SwitchPanel.OpenPanel(UIName.MapPanel)
end)
end
@ -173,52 +169,51 @@ end
-- 初始化界面显示
function this.InitView()
if CarbonManager.difficulty == 2 then
if CarbonManager.difficulty == CARBON_TYPE.TRIAL then
this.TrialCarbon()
elseif CarbonManager.difficulty == 1 or CarbonManager.difficulty == 3 then
this.NormalCarbon()
elseif CarbonManager.difficulty == 4 then
-- elseif CarbonManager.difficulty == CARBON_TYPE.NORMAL or CarbonManager.difficulty == CARBON_TYPE.HERO then
-- this.NormalCarbon()
elseif CarbonManager.difficulty == CARBON_TYPE.ENDLESS then
this.EndLessCarbon()
end
-- 初始化编队数据
this.IniFormationSet(CarbonManager.difficulty)
this.root.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = _PanelType[CarbonManager.difficulty] })
this.root.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = PanelType.Main})--_PanelType[CarbonManager.difficulty] })
end
--
function this.IniFormationSet(type)
this.IsNeedChangeFormation = type ~= 4
this.IsNeedChangeFormation = type ~= CARBON_TYPE.ENDLESS
end
-- 普通,精英副本设置
function this.NormalCarbon()
this.root.bg:SetActive(true)
this.root.btn_1:SetActive(true)
this.root.btn_2:SetActive(true)
this.root.btn_1_lab.text = Language[10723]
this.root.btn_2_lab.text = Language[10724]
-- 进入副本显示设置
MapManager.isCarbonEnter = true
-- function this.NormalCarbon()
-- this.root.bg:SetActive(true)
-- this.root.btn_1:SetActive(true)
-- this.root.btn_2:SetActive(true)
-- this.root.btn_1_lab.text = Language[10723]
-- this.root.btn_2_lab.text = Language[10724]
-- -- 进入副本显示设置
-- MapManager.isCarbonEnter = true
-- 设置扫荡条件
local canSweep = CarbonManager.GetMapSweepState(this.curMapId)
local rgbValue = canSweep and 1 or 0.5
Util.SetColor(this.root.btn_1, Color.New(rgbValue, rgbValue, rgbValue, 1))
this.root.btn_1:GetComponent("Button").enabled = canSweep
this.SetTipShowByType(CarbonManager.difficulty, canSweep)
end
-- -- 设置扫荡条件
-- local canSweep = CarbonManager.GetMapSweepState(this.curMapId)
-- local rgbValue = canSweep and 1 or 0.5
-- Util.SetColor(this.root.btn_1, Color.New(rgbValue, rgbValue, rgbValue, 1))
-- this.root.btn_1:GetComponent("Button").enabled = canSweep
-- this.SetTipShowByType(CarbonManager.difficulty, canSweep)
-- end
-- 设置精英副本跟普通副本的提示显示
function this.SetTipShowByType(type, canSweep)
local isEliteCarbon = type == 3
this.root.mobTip:SetActive(not canSweep and not isEliteCarbon)
this.root.eliteTip:SetActive(not canSweep and isEliteCarbon)
-- 普通-精英副本得到的地图ID this.curMapId
this.root.eliteNumNeed.text = CarbonManager.EliteSweepCondition(this.curMapId)
end
-- -- 设置精英副本跟普通副本的提示显示
-- function this.SetTipShowByType(type, canSweep)
-- local isEliteCarbon = type == 3
-- this.root.mobTip:SetActive(not canSweep and not isEliteCarbon)
-- this.root.eliteTip:SetActive(not canSweep and isEliteCarbon)
-- -- 普通-精英副本得到的地图ID this.curMapId
-- this.root.eliteNumNeed.text = CarbonManager.EliteSweepCondition(this.curMapId)
-- end
-- 试炼副本设置
function this.TrialCarbon()
@ -236,13 +231,14 @@ function this.EndLessCarbon()
if MapManager.Mapping then
this.root.bg:SetActive(true)
this.root.btn_1:SetActive(true)
this.root.btn_2:SetActive(false)
this.root.btn_1_lab.text = Language[10726]
this.root.btn_2:SetActive(true)
this.root.btn_1_lab.text = Language[10743]
this.root.btn_2_lab.text = Language[10726]
else
this.root.bg:SetActive(true)
this.root.btn_1:SetActive(false)
this.root.btn_1:SetActive(true)
this.root.btn_2:SetActive(true)
this.root.btn_1_lab.text = Language[10723]
this.root.btn_1_lab.text = Language[10743]
this.root.btn_2_lab.text = Language[10724]
-- 进入副本显示设置
MapManager.isCarbonEnter = true