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

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