miduo_client/Assets/ManagedResources/~Lua/Modules/Map/MapPanel.lua

813 lines
28 KiB
Lua
Raw Normal View History

require("Base/BasePanel")
2020-05-09 13:31:21 +08:00
require("Modules/Map/Logic/TileMapController")
require("Modules/Map/Logic/TileMapView")
require("Modules/Map/View/MapPointView")
MapPanel = Inherit(BasePanel)
local this = MapPanel
local ChallengeMapConfig = ConfigManager.GetConfig(ConfigName.ChallengeMapConfig)
local DifficultyData = ConfigManager.GetConfig(ConfigName.ChallengeConfig)
2021-05-21 16:39:08 +08:00
-- local missionView = require("Modules/Map/View/MapMissionView")
2020-05-09 13:31:21 +08:00
local ctrlView = require("Modules/Map/View/MapControllView")
local playerView = require("Modules/Map/View/MapPlayerView")
local trialPanel = require("Modules/Map/TrialMapPanel")
local eliteMissionView = require("Modules/Map/View/CarbonMissionTypeView")
local endLessMapView = require("Modules/Map/View/EndLessMapView")
local pointHandleView = require("Modules/Map/View/PointHandleView")
local _PropItemList = {}
local _PointerDownList = {}
local _PointerUpList = {}
--初始化组件(用于子类重写)
function this:InitComponent()
this.spLoader = SpriteLoader.New()
2021-05-21 16:39:08 +08:00
this.effect = Util.GetGameObject(self.gameObject, "effect")
this.effect.gameObject:SetActive(false)
2020-05-09 13:31:21 +08:00
2021-05-21 16:39:08 +08:00
-- 试炼副本相关组件
this.leftUp = Util.GetGameObject(self.gameObject, "leftUp")
this.leftDown = Util.GetGameObject(self.gameObject, "leftDown")
this.fireRoot = Util.GetGameObject(self.gameObject, "fireRoot")
this.leftCenter = Util.GetGameObject(self.gameObject, "leftCenter")
this.btnRank = Util.GetGameObject(this.leftCenter,"btnRank")
this.btnReward=Util.GetGameObject(this.leftCenter,"btnReward")
this.shiQi=Util.GetGameObject(this.leftCenter,"shiQi")
this.endLessTreasure=Util.GetGameObject(this.leftCenter,"endLessTreasure")
this.rightUp = Util.GetGameObject(self.gameObject, "rightUp")
this.btnSetting = Util.GetGameObject(this.rightUp,"btnSetting")
this.btnSetting.gameObject:SetActive(true)
this.btnRightUpShop = Util.GetGameObject(this.leftCenter,"btnShop")
this.helpBtn = Util.GetGameObject(self.gameObject, "helpBtn")
this.helpPos = this.helpBtn:GetComponent("RectTransform").localPosition
2021-05-21 16:39:08 +08:00
this.rightDown = Util.GetGameObject(self.gameObject, "rightDown")
this.btnAchive = Util.GetGameObject(this.rightDown,"btnAchive")
this.btnXingYao=Util.GetGameObject(this.rightDown,"btnXingYao")
this.btnBomb=Util.GetGameObject(this.rightDown,"btnBomb")
this.btnBuff=Util.GetGameObject(this.rightDown,"buff")
this.btnShop=Util.GetGameObject(this.rightDown,"shop")
this.btnReset=Util.GetGameObject(this.rightDown,"btnReset")
this.btnFormat=Util.GetGameObject(this.rightDown,"btnFormat")
this.btnNode=Util.GetGameObject(this.rightDown,"btnNote")
this.btnJiuYuanLu=Util.GetGameObject(this.rightDown,"btnJiuYuanLu")
this.btnJiuYuanLu:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_Map_JiuYuanLu_zh")
2021-05-21 16:39:08 +08:00
this.centerDown = Util.GetGameObject(self.gameObject, "centerDown")
this.BtnBack = Util.GetGameObject(this.centerDown,"bg/btnBack")
this.selectHero = Util.GetGameObject(this.centerDown,"selectHero")
this.selectHero:SetActive(true)
this.selectHeroTip = Util.GetGameObject(this.selectHero, "tip")
this.heroPre = Util.GetGameObject(this.centerDown,"selectHero/pre")
this.heroGrid = Util.GetGameObject(this.centerDown,"selectHero/grid")
2021-05-28 16:26:12 +08:00
this.heroGridtip1 = Util.GetGameObject(this.centerDown,"selectHero/tip1")
2021-05-21 16:39:08 +08:00
this.enemyInfo = Util.GetGameObject(this.centerDown,"enemyInfo")
this.propList = Util.GetGameObject(this.centerDown,"bufflist")
2020-05-09 13:31:21 +08:00
this.propBox = Util.GetGameObject(this.propList, "box")
this.propItem = Util.GetGameObject(this.propBox, "buff")
this.propInfo = Util.GetGameObject(this.propList, "info")
this.propContent = Util.GetGameObject(this.propList, "info/Text"):GetComponent("Text")
2021-05-21 16:39:08 +08:00
this.FloatBlood = Util.GetGameObject(self.gameObject, "FloatBlood")
this.FloatBlood.gameObject:SetActive(false)
this.UI_effect_shilian_tab = Util.GetGameObject(self.gameObject, "UI_effect_shilian_tab")
--无尽组件
this.EndLessEffect = Util.GetGameObject(self.gameObject, "EndLessEffect")
this.EndLessEffect.gameObject:SetActive(false)
this.endLessTitle = Util.GetGameObject(self.gameObject, "endLessTitle")
this.endLessTitle.gameObject:SetActive(false)
this.stepROot = Util.GetGameObject(self.gameObject, "stepROot")
this.stepROot.gameObject:SetActive(false)
this.TargetRoot = Util.GetGameObject(self.gameObject, "TargetRoot")
2020-05-09 13:31:21 +08:00
-- 面板遮罩, 没有接地图任务前不可点击
this.Mask = Util.GetGameObject(self.gameObject, "Mask")
2021-05-21 16:39:08 +08:00
this.Mask.gameObject:SetActive(false)
2020-05-09 13:31:21 +08:00
2021-05-21 16:39:08 +08:00
--missionView.InitComponent(self.gameObject, this)
2020-06-08 20:18:49 +08:00
playerView.InitComponent(self.gameObject, this)
ctrlView.InitComponent(self.gameObject, this, playerView)
2020-05-09 13:31:21 +08:00
trialPanel:InitComponent(self.gameObject, this)
2021-05-24 11:51:11 +08:00
endLessMapView:InitComponent(self.gameObject, this)
2020-05-09 13:31:21 +08:00
end
function this:OnSortingOrderChange()
trialPanel.OnSortingOrderChange()
2021-05-24 11:51:11 +08:00
endLessMapView:OnSortingOrderChange()
2020-05-09 13:31:21 +08:00
end
--绑定事件(用于子类重写)
function this:BindEvent()
Util.AddClick(this.BtnBack, function()
NetManager.RequestTrialReward(function(msg)
2022-01-12 13:49:16 +08:00
if CarbonManager.difficulty ~= 4 then
if msg.drop and #msg.drop.itemlist > 0 then
UIManager.OpenPanel(UIName.TrialRewardBackPopup,msg.drop,function()
if ctrlView.GetCallListCount() > 1 then
PopupTipPanel.ShowTip(Language[11258])
return
end
this.SetEndlessShow()
end)
else
if ctrlView.GetCallListCount() > 1 then
PopupTipPanel.ShowTip(Language[11258])
return
end
this.SetEndlessShow()
2022-01-12 13:49:16 +08:00
end
else
if ctrlView.GetCallListCount() > 1 then
PopupTipPanel.ShowTip(Language[11258])
return
end
this.SetEndlessShow()
end
end)
2020-05-09 13:31:21 +08:00
end)
-- 功绩按钮
Util.AddClick(this.btnAchive, function ()
if ctrlView.GetCallListCount() > 1 then
2021-04-09 12:26:35 +08:00
PopupTipPanel.ShowTip(Language[11259])
return
end
2020-05-09 13:31:21 +08:00
UIManager.OpenPanel(UIName.EliteCarbonAchievePanel, MapManager.GetCurCarbonId(), false, 1)
end)
2020-06-03 19:09:01 +08:00
--排行
Util.AddClick(this.btnRank, function ()
if ctrlView.GetCallListCount() > 1 then
2021-04-09 12:26:35 +08:00
PopupTipPanel.ShowTip(Language[11259])
return
end
2020-06-08 13:57:30 +08:00
UIManager.OpenPanel(UIName.CarbonScoreSortPanel,1)
2020-06-03 19:09:01 +08:00
end)
2020-08-04 20:22:56 +08:00
2020-06-08 13:57:30 +08:00
--奖励
Util.AddClick(this.btnReward,function()
if ctrlView.GetCallListCount() > 1 then
2021-04-09 12:26:35 +08:00
PopupTipPanel.ShowTip(Language[11259])
return
end
MonsterCampManager.preType = 1
UIManager.OpenPanel(UIName.TrialRewardPopup,MapTrialManager.SetRewardData(),function(id,rewardFunc)
NetManager.RequestLevelReward(id, function(msg)
MapTrialManager.SetTrialRewardInfo(id) --本地记录已领奖励信息
UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1,function()
if rewardFunc then
rewardFunc()
end
CheckRedPointStatus(RedPointType.TrialReward)
CheckRedPointStatus(RedPointType.Trial)
end)
end)
end,1)
2020-06-08 13:57:30 +08:00
end)
2020-05-09 13:31:21 +08:00
2021-05-27 10:46:22 +08:00
--帮助按钮
Util.AddClick(this.btnSetting,function()
if ctrlView.GetCallListCount() > 1 then
PopupTipPanel.ShowTip(Language[11259])
return
end
if CarbonManager.carbonType == CARBON_TYPE.TRIAL then
UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.TrialSetting)
else
UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.WuJinSetting)
end
end)
Util.AddClick(this.btnRightUpShop,function()
JumpManager.GoJump(760001)
end)
Util.AddClick(this.helpBtn, function()
if ctrlView.GetCallListCount() > 1 then
PopupTipPanel.ShowTip(Language[11259])
return
end
if CarbonManager.carbonType == CARBON_TYPE.TRIAL then
UIManager.OpenPanel(UIName.HelpPopup,HELP_TYPE.Sunro,this.helpPos.x,this.helpPos.y)
else
UIManager.OpenPanel(UIName.HelpPopup,HELP_TYPE.EndLessMap,this.helpPos.x,this.helpPos.y)
end
end)
2021-05-21 16:39:08 +08:00
--missionView.BindEvent()
2020-05-09 13:31:21 +08:00
trialPanel:BindEvent()
2021-05-24 11:51:11 +08:00
endLessMapView:BindEvent()
2020-05-09 13:31:21 +08:00
end
-- ================ 点击回城时一些稀里糊涂的操作 ======
-- 无尽副本
function this.SetEndlessShow()
-- 无尽副本的回城设置
if CarbonManager.difficulty == 4 then
2021-05-25 20:37:12 +08:00
endLessMapView:OnClose()
2020-05-09 13:31:21 +08:00
-- 先发更新事件点协议
MapManager.MapUpdateEvent(-1000, function ()
Log("出图同步位置")
Game.GlobalEvent:DispatchEvent(GameEvent.Map.Out,0)
2020-05-09 13:31:21 +08:00
end)
else
2020-08-18 15:48:41 +08:00
Game.GlobalEvent:DispatchEvent(GameEvent.Map.Out,0)
2020-05-09 13:31:21 +08:00
end
end
-- ===============================================
--添加事件监听(用于子类重写)
function this:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.Map.Out, this.OnMapOut)
Game.GlobalEvent:AddEvent(GameEvent.Map.DeadOut, this.OnMapDeadOut)
Game.GlobalEvent:AddEvent(GameEvent.Map.MapDataChange, this.OnMapDataChange)
2020-07-02 17:04:46 +08:00
Game.GlobalEvent:AddEvent(GameEvent.Map.StopWalk, this.StopWalking)
2020-05-09 13:31:21 +08:00
Game.GlobalEvent:AddEvent(GameEvent.FoodBuff.OnFoodBuffStateChanged, this.RefreshBuffShow)
2020-08-06 15:05:33 +08:00
-- Game.GlobalEvent:AddEvent(GameEvent.Map.MaskState, this.MaskState)
2021-05-27 17:34:59 +08:00
Game.GlobalEvent:AddEvent(GameEvent.FunctionCtrl.OnFunctionClose, this.InitFuncShow)
2021-05-21 16:39:08 +08:00
--missionView.AddListener()
2020-05-09 13:31:21 +08:00
playerView.AddListener()
ctrlView.AddListener()
trialPanel:AddListener()
2021-05-24 11:51:11 +08:00
endLessMapView:AddListener()
2020-05-09 13:31:21 +08:00
pointHandleView.AddListener()
end
--移除事件监听(用于子类重写)
function this:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.Map.Out, this.OnMapOut)
Game.GlobalEvent:RemoveEvent(GameEvent.Map.DeadOut, this.OnMapDeadOut)
Game.GlobalEvent:RemoveEvent(GameEvent.Map.MapDataChange, this.OnMapDataChange)
2020-07-02 17:04:46 +08:00
Game.GlobalEvent:RemoveEvent(GameEvent.Map.StopWalk, this.StopWalking)
2020-05-09 13:31:21 +08:00
Game.GlobalEvent:RemoveEvent(GameEvent.FoodBuff.OnFoodBuffStateChanged, this.RefreshBuffShow)
2021-05-27 17:34:59 +08:00
Game.GlobalEvent:RemoveEvent(GameEvent.FunctionCtrl.OnFunctionClose, this.InitFuncShow)
2020-08-06 15:05:33 +08:00
-- Game.GlobalEvent:RemoveEvent(GameEvent.Map.MaskState, this.MaskState)
2020-05-09 13:31:21 +08:00
2021-05-21 16:39:08 +08:00
--missionView.RemoveListener()
2020-05-09 13:31:21 +08:00
playerView.RemoveListener()
ctrlView.RemoveListener()
trialPanel:RemoveListener()
2021-05-24 11:51:11 +08:00
endLessMapView:RemoveListener()
2020-05-09 13:31:21 +08:00
pointHandleView.RemoveListener()
end
2021-05-27 17:34:59 +08:00
function this.InitFuncShow(funcType)
if funcType == FUNCTION_OPEN_TYPE.ENDLESS and CarbonManager.carbonType == CARBON_TYPE.ENDLESS then
this.SetEndlessShow()
end
end
2020-05-09 13:31:21 +08:00
function this:OnShow()
if CarbonManager.carbonType == CARBON_TYPE.ENDLESS and not ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.ENDLESS) then
this.InitFuncShow(FUNCTION_OPEN_TYPE.ENDLESS)
return
end
2020-05-09 13:31:21 +08:00
UIManager.camera.clearFlags = CameraClearFlags.Depth
local mapId = MapManager.curMapId
--- 副本地图音效统一改成一个
SoundManager.PlayMusic(SoundConfig.BGM_CarbonMap)
-- 环境音
local amb = ChallengeMapConfig[mapId].EnvironmentSound
if amb and amb ~= "" then
SoundManager.PlayAmbient(amb)
end
playerView.OnShow()
2021-05-24 11:51:11 +08:00
endLessMapView:OnShow()
2020-05-09 13:31:21 +08:00
pointHandleView.OnShow()
2020-06-30 18:59:44 +08:00
trialPanel:OnShow()
2021-05-21 16:39:08 +08:00
this:SetActiveGameObj()
end
function this:SetActiveGameObj()
local isShow = MapManager.curCarbonType == CarBonTypeId.TRIAL
this.helpBtn.gameObject:SetActive(true)
2021-05-21 16:39:08 +08:00
this.leftUp.gameObject:SetActive(isShow)
this.btnRightUpShop.gameObject:SetActive(not isShow)
2021-05-21 16:39:08 +08:00
this.btnRank.gameObject:SetActive(isShow)
this.btnReward.gameObject:SetActive(isShow)
this.shiQi.gameObject:SetActive(not isShow)
this.endLessTreasure.gameObject:SetActive(not isShow and SERVER_VERSION == 0)
2021-05-21 16:39:08 +08:00
this.TargetRoot.gameObject:SetActive(not isShow)
this.leftDown.gameObject:SetActive(isShow)
2021-05-28 16:26:12 +08:00
this.heroGridtip1.gameObject:SetActive(not isShow)
2021-05-21 16:39:08 +08:00
this.btnAchive.gameObject:SetActive(false)
this.btnXingYao.gameObject:SetActive(isShow)
this.btnBomb.gameObject:SetActive(isShow)
this.btnBuff.gameObject:SetActive(isShow)
this.btnShop.gameObject:SetActive(isShow)
this.btnReset .gameObject:SetActive(false)
this.btnFormat.gameObject:SetActive(not isShow)
this.btnNode.gameObject:SetActive(not isShow)
this.btnJiuYuanLu.gameObject:SetActive(not isShow)
2021-05-21 16:39:08 +08:00
this.BtnBack.gameObject:SetActive(true)
this.selectHero.gameObject:SetActive(true)
this.selectHeroTip.gameObject:SetActive(isShow)
this.heroGrid.gameObject:SetActive(true)
this.enemyInfo.gameObject:SetActive(false)
this.propList.gameObject:SetActive(false)
this.fireRoot.gameObject:SetActive(isShow)
2021-05-21 16:39:08 +08:00
this.EndLessEffect.gameObject:SetActive(false)
this.endLessTitle.gameObject:SetActive(not isShow)
this.stepROot.gameObject:SetActive(not isShow)
this.UI_effect_shilian_tab.gameObject:SetActive(false)
2020-05-09 13:31:21 +08:00
end
--界面打开时调用(用于子类重写)
function this:OnOpen(...)
MapManager.FirstEnter = true
EndLessMapManager.EndLessRoleDead = true
-- 永久隐藏设置按钮
ctrlView.Init()
2020-07-28 16:45:28 +08:00
CarbonManager.isPassFight = true
2020-05-09 13:31:21 +08:00
-- 在这设置所有副本的初始化设置
-- 地图迷雾显示
this.SetMapFog()
pointHandleView.GeneratePoint()
-- 进地图初始化位置
local pos = MapManager.roleInitPos
this.InitRolePosition(pos, MapManager.curMapId)
EndLessMapManager.srcMapId = MapManager.curMapId
2021-05-21 16:39:08 +08:00
--missionView.Init()
2020-05-09 13:31:21 +08:00
trialPanel:OnOpen()
2021-05-24 11:51:11 +08:00
endLessMapView:OnOpen()
2020-05-09 13:31:21 +08:00
-- 副本相关的初始化设置
this.InitCarbonSet()
-- 如果100%,弹出离开界面
-- this.ExploreInitSet()
2020-05-09 13:31:21 +08:00
this.InitrightUpBtn()
---- 刷新被主角狗眼糟蹋过的点
EndLessMapManager.isOpenedFullPanel = false
--- 刷新buff显示
this.RefreshBuffShow()
end
---==================== 地图初始化处理部分 ==================================
function this.SetMapFog()
2021-05-27 17:34:59 +08:00
local mapId = MapManager.curMapId > 0 and MapManager.curMapId or 4001
2020-05-09 13:31:21 +08:00
local fogVal = ChallengeMapConfig[mapId].isShowFog
if fogVal and fogVal == 0 then
TileMapView.isShowFog = false
else
TileMapView.isShowFog = true
end
end
-- 有探索度地图的初始化
-- function this.ExploreInitSet()
-- --首先他得有探索度
-- local curMapId = MapManager.curMapId
-- if DifficultyData[curMapId] and DifficultyData[curMapId].IsExplore == 1 then
-- local isPass = CarbonManager.ExplorationDone()
-- if isPass then
-- UIManager.OpenPanel(UIName.MapStatsPanel)
-- end
-- end
-- end
2020-05-09 13:31:21 +08:00
function this.InitCarbonSet()
-- 面板遮罩
this.MaskState(1)
this.timer = Timer.New(function()
this.MaskState(0)
end, 2.5)
this.timer:Start()
2020-05-09 13:31:21 +08:00
--如果是在序章
local isStartMap = MapManager.curMapId == 100
2020-07-29 20:18:19 +08:00
this.BtnBack:SetActive(not isStartMap)
2020-05-09 13:31:21 +08:00
end
--设置遮罩开关 1 是开 其他都是关
function this.MaskState(state)
this.Mask:SetActive(state == 1)
end
2020-05-09 13:31:21 +08:00
-- 角色位置初始化bb
function this.InitRolePosition(pos, curMapId)
local u, v = Map_Pos2UV(pos)
TileMapView.Init()
TileMapController.LocateToUV(u, v)
local scale = TileMapView.GetMapScale()
MapManager.mapScale = scale
TileMapController.SetScale(TileMapView.GetMapMinScale())
TileMapView.UpdateFunc()
if MapManager.isOpen then
2020-08-19 17:18:38 +08:00
this.SetRoleShow(scale, pos,1)
2020-05-09 13:31:21 +08:00
end
MapManager.stepList = {}
end
-- 设置小人落地
2020-08-19 17:18:38 +08:00
function this.SetRoleShow(scale, pos,num)
2020-05-09 13:31:21 +08:00
DoTween.To(DG.Tweening.Core.DOGetter_float(function () return TileMapView.GetMapMinScale() end),
DG.Tweening.Core.DOSetter_float(TileMapController.SetScale),
scale, 1):SetEase(Ease.Linear):OnComplete(function ()
2020-08-19 17:18:38 +08:00
playerView.Init(pos,num)
2020-05-09 13:31:21 +08:00
-- 进图初始化完成
MapManager.FirstEnter = false
playerView.leader.transform:SetParent(ctrlView.Ctrl.transform)
-- leader的父级设置为Ctrl后Z轴的值发生了变化 需要重新设置
local v3 = playerView.leader.transform.localPosition
playerView.leader.transform.localPosition = Vector3.New(v3.x, v3.y, -10)
end)
end
-- 根据选择的副本类型设置显示的按钮
function this.InitrightUpBtn()
this.btnAchive:SetActive(CarbonManager.difficulty == 3)
end
---===============================================================================
-- 修改地图的数据时相应的表现
function this.OnMapDataChange(refreshType)
if refreshType then
if refreshType == 1 then
-- 增加地图移动速度
elseif refreshType == 2 then
-- 增加视野范围
local u, v = Map_Pos2UV(MapManager.curPos)
TileMapView.UpdateWarFog(u, v, MapManager.fogSize)
elseif refreshType == 3 then
-- 增加扎营次数
elseif refreshType == 4 then
--增加采矿暴击率
elseif refreshType == 5 then
-- 刷新行动力显示
elseif refreshType == 6 then
-- 驱散指定区域的迷雾
else
Log("刷新类型为空")
2020-05-09 13:31:21 +08:00
end
end
end
--界面关闭时调用(用于子类重写)
function this:OnClose()
playerView.PlayerMove()
UIManager.camera.clearFlags = CameraClearFlags.Skybox
trialPanel:OnClose()
2021-05-24 11:51:11 +08:00
endLessMapView:OnClose()
2020-05-09 13:31:21 +08:00
MapTrialManager.firstEnter = false
-- 记录界面关闭但是没有注销
EndLessMapManager.isOpenedFullPanel = true
SoundManager.PauseAmbient()
end
-- 刷新buff显示
function this.RefreshBuffShow()
-- 关闭所有显示
for _, propItem in pairs(_PropItemList) do
propItem:SetActive(false)
end
-- 重新显示
local props = FoodBuffManager.GetBuffPropList()
if not props then return end
for index, prop in ipairs(props) do
if GetProIndexByProId(prop.id) ~= 2 then
local item = _PropItemList[index]
if not item then
item = newObjToParent(this.propItem, this.propBox)
_PropItemList[index] = item
end
this.BuffItemAdapter(item, prop, index)
item:SetActive(true)
end
end
end
-- buff显示匹配
function this.BuffItemAdapter(item, prop, index)
local icon = Util.GetGameObject(item, "icon"):GetComponent("Image")
local stepImg = Util.GetGameObject(item, "stepImg")
local leftStep = Util.GetGameObject(item, "stepImg/step"):GetComponent("Text")
local propInfo = ConfigManager.GetConfigData(ConfigName.PropertyConfig, prop.id)
-- 图标
if propInfo.BuffShow then
local lastStr = ""
if propInfo.IfBuffShow == 1 then
lastStr = prop.value >= 0 and "_Up" or "_Down"
end
2021-04-21 13:12:04 +08:00
icon.sprite = this.spLoader:LoadSprite(propInfo.BuffShow .. lastStr)
2020-05-09 13:31:21 +08:00
else
Log("属性id == "..prop.id.." 不存在显示图标")
2020-05-09 13:31:21 +08:00
end
-- 剩余步数
stepImg:SetActive(prop.step >= 0)
leftStep.text = prop.step
-- 长按事件监听
local trigger = Util.GetEventTriggerListener(item)
--当之前注册过长按监听,则先移除
if _PointerDownList[index] then
trigger.onPointerDown = trigger.onPointerDown - _PointerDownList[index]
trigger.onPointerUp = trigger.onPointerUp - _PointerUpList[index]
end
-- 事件监听
_PointerDownList[index] = function(Pointgo, data)
-- 显示内容
local val = prop.value
local express1 = val >= 0 and "+" or ""
local express2 = ""
if propInfo.Style == 2 then
val = val / 100
express2 = "%"
end
2021-01-26 17:08:39 +08:00
this.propContent.text = GetLanguageStrById(propInfo.Info) .. express1..val..express2
2020-05-09 13:31:21 +08:00
-- 显示位置
local pos = item.transform.localPosition
this.propInfo.transform.localPosition = Vector3(pos.x, pos.y + 120, 0)
this.propInfo:SetActive(true)
end
_PointerUpList[index] = function(Pointgo, data)
this.propInfo:SetActive(false)
end
trigger.onPointerDown = trigger.onPointerDown + _PointerDownList[index]
trigger.onPointerUp = trigger.onPointerUp + _PointerUpList[index]
end
--界面销毁时调用(用于子类重写)
function this:OnDestroy()
this.Dispose()
trialPanel:OnDestroy()
2021-05-24 11:51:11 +08:00
endLessMapView:OnDestroy()
2020-05-09 13:31:21 +08:00
2021-04-21 13:12:04 +08:00
this.spLoader:Destroy()
2020-05-09 13:31:21 +08:00
if this.timer then
this.timer:Stop()
this.timer = nil
end
2020-05-09 13:31:21 +08:00
_PropItemList = {}
_PointerDownList = {}
_PointerUpList = {}
end
function this.PathEnd()
ctrlView.ClearCallList()
playerView.PlayerIdle()
end
--刷新动态点的显示
function this.RefreshShow()
pointHandleView.leaderMapData = playerView.leaderMapData
pointHandleView.RefreshShow()
end
2020-08-20 14:43:48 +08:00
2020-08-18 15:48:41 +08:00
function this.OnMapOut(outType)
2020-08-18 16:36:24 +08:00
--出图不需要发协议了
2020-05-09 13:31:21 +08:00
Log("outType ====== " .. outType)
if outType == 0 then
CarbonManager.difficulty = 0
this.BackHome()
MapManager.Mapping = false
else --换层或者换地图
-- 音效
SoundManager.PlaySound(SoundConfig.Sound_xyc)
this.ChangeMapByType()
end
Game.GlobalEvent:DispatchEvent(GameEvent.Event.PointTriggerEnd)
2020-05-09 13:31:21 +08:00
end
-- ========================= 死出图的各种方法 ==========================
-- 序章回到主界面
function this.BackHome()
2020-09-01 15:32:24 +08:00
CheckRedPointStatus(RedPointType.Trial)
CheckRedPointStatus(RedPointType.TrialReward)
CheckRedPointStatus(RedPointType.EndlessPanel)
2020-05-09 13:31:21 +08:00
local triggerCallBack
triggerCallBack = function (panelType, panel)
if panelType == UIName.MapPanel then
this.Dispose()
2021-05-24 11:51:11 +08:00
this:ClosePanel()
2020-05-09 13:31:21 +08:00
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnClose, triggerCallBack)
end
-- BagManager.InBagGetMapBag()
2020-05-09 13:31:21 +08:00
end
Game.GlobalEvent:AddEvent(GameEvent.UI.OnClose, triggerCallBack)
-- 清空一下副本任务
MissionManager.carBonMission = {}
2021-04-22 16:50:45 +08:00
SwitchPanel.ClosePanel(UIName.MainPanel, function()
UIManager.CloseAllStack(true)
UIManager.OpenPanel(UIName.CarbonsPanel)
2021-04-22 16:50:45 +08:00
end)
2020-05-09 13:31:21 +08:00
poolManager:ClearPool()
end
-- 正常出图时需要打开的界面类型
local panelNeedOpen = {
[1] = UIName.PlotCarbonPanel,
[2] = UIName.TrialCarbonPanel,
[3] = UIName.EliteCarbonPanel,
[4] = UIName.EndLessCarbonPanel,
}
-- 正常出图需要消除的数据
function this.ResetMapData()
EndLessMapManager.srcMapId = 0
MissionManager.carBonMission = {}
MapTrialManager.doneTime = 0
MapManager.isTimeOut = false
this.StopWalking()
end
-- 换层或者换地图
function this.ChangeMapByType()
2020-05-09 13:31:21 +08:00
local carbonType = CarbonManager.difficulty
-- 在试炼副本中的是换层操作
if carbonType == 2 then
Log("换层")
this.TrialChangeFloor()
2020-05-09 13:31:21 +08:00
elseif carbonType == 4 then
Log("换图")
2020-05-09 13:31:21 +08:00
-- 执行换图方法
2020-08-18 16:36:24 +08:00
this.ChangeMap()
2020-05-09 13:31:21 +08:00
end
end
-- 试炼副本的换层操作
function this.TrialChangeFloor()
2020-05-09 13:31:21 +08:00
-- 设置不可点击
ctrlView.SetCtrlState(true)
this.ClearBag()
this.StopWalking()
NetManager.MapInfoRequest(MapManager.curCarbonType,function ()
2020-05-09 13:31:21 +08:00
local triggerCallBack
triggerCallBack = function (panelType, panel)
if panelType == UIName.SwitchPanel then
this.Dispose()
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnClose, triggerCallBack)
end
end
Game.GlobalEvent:AddEvent(GameEvent.UI.OnClose, triggerCallBack)
SwitchPanel.OpenPanel(UIName.MapPanel)
MapTrialManager.isChangeLevel = false
2020-06-13 11:47:13 +08:00
--设置 进入下一层后领取全部奖励
MissionManager.GetAllRewardTrigger()
2020-05-09 13:31:21 +08:00
end)
end
-- 换图操作
function this.ChangeMap(nextMapId)
this.ClearBag()
this.StopWalking()
Log(" nextMapId ====== " .. nextMapId)
local index = CarbonManager.difficulty == CARBON_TYPE.ENDLESS and 401 or FormationManager.curFormationIndex
NetManager.MapInfoRequest(nextMapId,function ()
2020-05-09 13:31:21 +08:00
local triggerCallBack
triggerCallBack = function (panelType, panel)
if panelType == UIName.SwitchPanel then
this.Dispose()
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnClose, triggerCallBack)
end
end
Game.GlobalEvent:AddEvent(GameEvent.UI.OnClose, triggerCallBack)
-- 如果是无尽副本,则需要消耗行动力
if CarbonManager.difficulty == CARBON_TYPE.ENDLESS then
-- 更新行动力
Log("传送一下")
2021-05-24 11:51:11 +08:00
endLessMapView:OnRoleTransport(function ()
2020-05-09 13:31:21 +08:00
end)
end
SwitchPanel.OpenPanel(UIName.MapPanel)
2020-06-13 11:47:13 +08:00
--设置 进入下一层后领取全部奖励
MissionManager.GetAllRewardTrigger()
2020-05-09 13:31:21 +08:00
end)
end
-- =================================================================
-- 清除道具
function this.ClearBag()
BagManager.mapShotTimeItemData = {}
EquipManager.mapShotTimeItemData = {}
HeroManager.mapShotTimeItemData = {}
end
--出图数据刷新
function this.TrialCopyData()
local isPass = CarbonManager.IsMapPlayed(MapManager.curMapId)
if(isPass==true) then
for k, v in ConfigPairs(DifficultyData) do
if(v.Id==MapManager.curMapId and v.Type==3) then
if(CarbonManager.difficultyMask[v.MapId]~=-1) then
if(v.DifficultType> CarbonManager.difficultyMask[v.MapId]) then
CarbonManager.difficultyMask[v.MapId]=v.DifficultType
end
else
CarbonManager.difficultyMask[v.MapId]=v.DifficultType
end
end
end
end
if(CarbonManager.difficulty==2) then
MapTrialManager.isCanReset=1
end
end
-- 角色死亡, 血量重置
function this.OnMapDeadOut(startTime, lastPos)
if CarbonManager.difficulty == CARBON_TYPE.ENDLESS then
this.OnEndLessDead(lastPos)
else
this.OnDeadCount(startTime, lastPos)
end
end
-- 无尽副本的死亡表现
function this.OnEndLessDead(lastPos)
-- 进入死亡状态
EndLessMapManager.EndLessRoleDead = true
-- 清空血条值
playerView.InitRoleHp(false)
MapManager.deadTime = 0
-- 清空相应的队伍英雄血量
EndLessMapManager.DeleteMapTeam()
-- 设置角色位置
playerView.SetRolePos(lastPos)
-- 隐藏战斗特效
playerView.SetBattleState(false)
-- 如果正在触发事件则停止
ctrlView.OnRoleDead()
ctrlView.SetCtrlState(false)
-- 无尽副本中死亡扣行动力
if CarbonManager.difficulty == CARBON_TYPE.ENDLESS then
2021-05-24 11:51:11 +08:00
endLessMapView:OnRoleDead()
2020-05-09 13:31:21 +08:00
end
end
-- 死亡倒计时的表现
function this.OnDeadCount(startTime, lastPos)
ctrlView.SetCtrlState(true)
-- 死亡次前端无奈的加一次
MapManager.deadCount = MapManager.deadCount + 1
-- 清空血条值
playerView.InitRoleHp(false)
playerView.SetBattleState(false)
-- 设置角色位置
playerView.SetRolePos(lastPos)
-- 如果正在触发事件则停止
ctrlView.OnRoleDead()
-- 角色死亡不出图, 立马设置遮罩,让你瞎几把点
2020-07-16 13:45:07 +08:00
-- this.deadRoot:SetActive(true)
2020-08-27 18:31:39 +08:00
local t=(PlayerPrefs.HasKey(PlayerManager.uid.."GeneralPopup_TrialSettingBtn"..1)
and PlayerPrefs.GetInt(PlayerManager.uid.."GeneralPopup_TrialSettingBtn"..1)==1) and 1 or 0
if t==1 then
UIManager.OpenPanel(UIName.BattleFailPopup,nil,false,nil,12)
end
2020-07-23 19:05:43 +08:00
ctrlView.SetCtrlState(false)
2020-05-09 13:31:21 +08:00
-- 无尽副本中死亡扣行动力
if CarbonManager.difficulty == CARBON_TYPE.ENDLESS then
2021-05-24 11:51:11 +08:00
endLessMapView:OnRoleDead()
2020-05-09 13:31:21 +08:00
end
end
-- 清空寻路
function this.StopWalking()
ctrlView.OnRoleDead()
-- 换层时路径不一定完了,不弹完会卡死
end
function this.CallListPop()
ctrlView.CallListPop()
end
function this.Dispose()
if not ctrlView.Ctrl then
return
end
ctrlView.Dispose()
playerView.Dispose()
pointHandleView.Dispose()
end
2020-06-23 18:36:24 +08:00
return MapPanel