2021-07-21 14:55:47 +08:00
|
|
|
|
--- 无尽副本
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--- Generated by EmmyLua(https://github.com/EmmyLua)
|
|
|
|
|
--- Created by aaa.
|
|
|
|
|
--- DateTime: 2019/7/30 16:30
|
|
|
|
|
---
|
|
|
|
|
EndLessMapView = {}
|
|
|
|
|
local this = EndLessMapView
|
|
|
|
|
local endLessData = ConfigManager.GetConfig(ConfigName.EndlessMapConfig)
|
|
|
|
|
local challengeMapConfig = ConfigManager.GetConfig(ConfigName.ChallengeMapConfig)
|
2021-05-21 16:39:08 +08:00
|
|
|
|
local heroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig)
|
|
|
|
|
local endlessMorale = ConfigManager.GetConfig(ConfigName.endlessMorale)
|
|
|
|
|
local PassiveSkillConfig = ConfigManager.GetConfig(ConfigName.PassiveSkillConfig)
|
2021-05-22 14:08:34 +08:00
|
|
|
|
local PropertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local ctrlView = require("Modules/Map/View/MapControllView")
|
|
|
|
|
local pointView = require("Modules/Map/View/PointHandleView")
|
|
|
|
|
local MapPanel
|
2021-05-21 16:39:08 +08:00
|
|
|
|
local isShow = false
|
|
|
|
|
this.shiQiValueId = 101
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.isPanelClose = false
|
|
|
|
|
-- 刷新前的行动力,用于判断递减
|
|
|
|
|
local preEnergy = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- 当前地图扣除行动力的类型
|
|
|
|
|
local COST_TYPE = {
|
|
|
|
|
WALK = 1,
|
|
|
|
|
DEAD = 2,
|
|
|
|
|
TRANSPORT = 3,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-- 当前地图行走与死亡消耗的行动力
|
|
|
|
|
local deadCost = 0
|
|
|
|
|
local walkCost = 0
|
|
|
|
|
|
|
|
|
|
|
2021-05-24 11:51:11 +08:00
|
|
|
|
function EndLessMapView:InitComponent(gameObject, mapPanel)
|
2021-04-21 13:12:04 +08:00
|
|
|
|
this.spLoader = SpriteLoader.New()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
MapPanel = mapPanel
|
|
|
|
|
-- 地图名字显示
|
|
|
|
|
this.areaName = Util.GetGameObject(gameObject, "endLessTitle/AreaImg/mapName"):GetComponent("Text")
|
|
|
|
|
this.btnReset = Util.GetGameObject(gameObject, "rightDown/btnReset")
|
|
|
|
|
this.btnFormat = Util.GetGameObject(gameObject, "rightDown/btnFormat")
|
2021-06-01 16:53:08 +08:00
|
|
|
|
this.btnFormatRed = Util.GetGameObject(this.btnFormat, "redpot")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.btnNote = Util.GetGameObject(gameObject, "rightDown/btnNote")
|
2021-05-21 16:39:08 +08:00
|
|
|
|
this.btnNoteRed = Util.GetGameObject(this.btnNote, "redPoint")
|
2021-07-06 14:43:45 +08:00
|
|
|
|
this.btnJiuYuanLu=Util.GetGameObject(gameObject,"rightDown/btnJiuYuanLu")
|
2021-07-06 15:19:56 +08:00
|
|
|
|
this.btnJiuYuanLuNum=Util.GetGameObject(this.btnJiuYuanLu,"num"):GetComponent("Text")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
-- 谢置按钮
|
2020-06-08 20:18:49 +08:00
|
|
|
|
this.btnSet = Util.GetGameObject(gameObject, "rightUp/btnSetting")
|
2021-07-06 14:43:45 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
-- 行动力显示
|
|
|
|
|
this.energyInfo = Util.GetGameObject(gameObject, "stepROot/bg/energyInfo"):GetComponent("Text")
|
|
|
|
|
this.totalEnergy = Util.GetGameObject(gameObject, "stepROot/bg/total"):GetComponent("Text")
|
|
|
|
|
this.btnAddEnergy = Util.GetGameObject(gameObject, "stepROot/bg/add")
|
|
|
|
|
this.energyRoot = Util.GetGameObject(gameObject, "stepROot")
|
|
|
|
|
|
|
|
|
|
-- 行动力警告显示
|
2021-05-24 11:51:11 +08:00
|
|
|
|
this.warn = Util.GetGameObject(gameObject, "EndLessEffect/effect")
|
|
|
|
|
this.warnRoot = Util.GetGameObject(gameObject, "EndLessEffect")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
|
|
|
|
-- 根节点
|
|
|
|
|
this.endLessTitleRoot = Util.GetGameObject(gameObject, "endLessTitle")
|
|
|
|
|
|
|
|
|
|
-- 道刷刷新倒计时
|
|
|
|
|
this.bgTime = Util.GetGameObject(gameObject, "stepROot/bg/Bgtime")
|
|
|
|
|
this.actCountTime = Util.GetGameObject(this.bgTime, "time"):GetComponent("Text")
|
|
|
|
|
|
|
|
|
|
-- 购买行动力的货币
|
|
|
|
|
this.moneyNum = Util.GetGameObject(gameObject, "endLessTitle/frame/num")
|
|
|
|
|
this.moneyIcon = Util.GetGameObject(gameObject, "endLessTitle/frame/icon")
|
2020-08-19 19:37:59 +08:00
|
|
|
|
|
|
|
|
|
this.helpBtn=Util.GetGameObject(gameObject,"helpBtn")
|
|
|
|
|
this.helpPos=this.helpBtn:GetComponent("RectTransform").localPosition
|
|
|
|
|
this.helpBtn:SetActive(false)
|
2021-05-21 16:39:08 +08:00
|
|
|
|
|
|
|
|
|
this.TargetRoot = Util.GetGameObject(gameObject,"TargetRoot")
|
|
|
|
|
this.TargetRootText = Util.GetGameObject(this.TargetRoot,"Image/Text"):GetComponent("Text")
|
|
|
|
|
this.TargetBtn1 = Util.GetGameObject(this.btnNote,"weiwancheng"):GetComponent("Image")
|
|
|
|
|
this.TargetBtn2 = Util.GetGameObject(this.btnNote,"yiwancheng"):GetComponent("Image")
|
|
|
|
|
this.curMission = {}
|
|
|
|
|
|
|
|
|
|
this.centerDown = Util.GetGameObject(gameObject,"centerDown")
|
|
|
|
|
this.bufflist = Util.GetGameObject(this.centerDown,"bufflist")
|
|
|
|
|
this.selectHero = Util.GetGameObject(this.centerDown,"selectHero")
|
|
|
|
|
this.selectHeroTip = Util.GetGameObject(this.selectHero,"tip")
|
2021-05-26 17:27:47 +08:00
|
|
|
|
this.selectHeroTip1 = Util.GetGameObject(this.selectHero,"tip1")
|
2021-05-21 16:39:08 +08:00
|
|
|
|
this.selectPre = Util.GetGameObject(this.selectHero,"pre")
|
|
|
|
|
this.selectHeroGrid = Util.GetGameObject(this.selectHero,"grid")
|
|
|
|
|
this.enemyInfo = Util.GetGameObject(this.centerDown,"enemyInfo")
|
|
|
|
|
|
|
|
|
|
this.leftCenter = Util.GetGameObject(gameObject,"leftCenter")
|
|
|
|
|
this.shiQi = Util.GetGameObject(this.leftCenter,"shiQi")
|
|
|
|
|
this.shiQiProgress = Util.GetGameObject(this.shiQi,"Image/progress"):GetComponent("Text")
|
|
|
|
|
this.shiQiLv = Util.GetGameObject(this.shiQi,"lv"):GetComponent("Text")
|
2021-05-26 10:29:34 +08:00
|
|
|
|
this.shiQifillAmount = Util.GetGameObject(this.shiQi,"Image/mask"):GetComponent("Image")
|
2021-05-21 16:39:08 +08:00
|
|
|
|
this.endLessTreasure = Util.GetGameObject(this.leftCenter,"endLessTreasure")
|
|
|
|
|
this.endLessTreasureRed = Util.GetGameObject(this.endLessTreasure ,"redPoint")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
2021-05-24 11:51:11 +08:00
|
|
|
|
function EndLessMapView:OnSortingOrderChange()
|
2021-06-08 18:07:22 +08:00
|
|
|
|
Util.SetParticleSortLayer(this.btnNoteRed,MapPanel.sortingOrder)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
2021-05-24 11:51:11 +08:00
|
|
|
|
function EndLessMapView:BindEvent()
|
2021-05-21 16:39:08 +08:00
|
|
|
|
-- --帮助按钮
|
|
|
|
|
-- Util.AddClick(this.helpBtn,function()
|
|
|
|
|
-- if ctrlView.GetCallListCount() > 1 then
|
|
|
|
|
-- PopupTipPanel.ShowTip(Language[11259])
|
|
|
|
|
-- return
|
|
|
|
|
-- end
|
|
|
|
|
-- UIManager.OpenPanel(UIName.HelpPopup,HELP_TYPE.Sunro,this.helpPos.x,this.helpPos.y)
|
|
|
|
|
-- end)
|
2021-07-06 14:43:45 +08:00
|
|
|
|
-- 重置
|
|
|
|
|
Util.AddClick(this.btnJiuYuanLu, function ()
|
|
|
|
|
if ctrlView.GetCallListCount() > 1 then
|
|
|
|
|
PopupTipPanel.ShowTip(Language[11259])
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
if not this:CanClick() then return end
|
2021-07-06 15:19:56 +08:00
|
|
|
|
if BagManager.GetItemCountById(EndLessMapManager.JiuYaunLuId) < 1 then
|
2021-07-06 14:43:45 +08:00
|
|
|
|
PopupTipPanel.ShowTip("九元露数量不足!")
|
|
|
|
|
return
|
|
|
|
|
end
|
2021-07-06 15:19:56 +08:00
|
|
|
|
local isFullHp = EndLessMapManager.IsAllFullHp()
|
2021-07-06 14:43:45 +08:00
|
|
|
|
if isFullHp then
|
|
|
|
|
PopupTipPanel.ShowTip("所有神将状态完好,无法使用!")
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
MsgPanel.ShowTwo("是否消耗一枚九元露,复活所有神将并将血量恢复为100%?", function()end, function()
|
2021-07-06 19:01:27 +08:00
|
|
|
|
NetManager.UseAddHpItemRequest(tostring(-1),function ()
|
2021-07-10 14:00:03 +08:00
|
|
|
|
this:OnShow()
|
2021-07-09 17:04:25 +08:00
|
|
|
|
PopupTipPanel.ShowTip("已将所有神将复活并恢复至满血!")
|
2021-07-06 14:43:45 +08:00
|
|
|
|
end)
|
|
|
|
|
end, "取消", "确认", "提示",false)
|
|
|
|
|
end)
|
2021-05-21 16:39:08 +08:00
|
|
|
|
|
|
|
|
|
Util.AddClick(this.shiQi, function ()
|
2020-12-16 17:23:52 +08:00
|
|
|
|
if ctrlView.GetCallListCount() > 1 then
|
2021-04-09 12:26:35 +08:00
|
|
|
|
PopupTipPanel.ShowTip(Language[11259])
|
2020-12-16 17:23:52 +08:00
|
|
|
|
return
|
|
|
|
|
end
|
2021-05-24 11:51:11 +08:00
|
|
|
|
if not this:CanClick() then return end
|
2021-05-28 11:29:27 +08:00
|
|
|
|
local s = function(pro)
|
2021-05-21 16:39:08 +08:00
|
|
|
|
local str = ""
|
2021-05-28 11:29:27 +08:00
|
|
|
|
local index = 1
|
|
|
|
|
for k,v in pairs(pro) do
|
|
|
|
|
local config = ConfigManager.GetConfigData(ConfigName.PropertyConfig,k)
|
2021-05-26 20:27:39 +08:00
|
|
|
|
if not config then
|
|
|
|
|
else
|
2021-05-28 11:29:27 +08:00
|
|
|
|
if index ~= 1 then
|
|
|
|
|
str = str .. ","
|
|
|
|
|
end
|
2021-05-26 20:27:39 +08:00
|
|
|
|
str = str .. config.Info .. "+"
|
2021-05-28 11:29:27 +08:00
|
|
|
|
str = str .. GetEquipPropertyFormatStr(config.Style,v)
|
|
|
|
|
index = index + 1
|
2021-05-26 20:27:39 +08:00
|
|
|
|
end
|
2021-05-21 16:39:08 +08:00
|
|
|
|
end
|
|
|
|
|
return str
|
|
|
|
|
end
|
2021-05-28 11:29:27 +08:00
|
|
|
|
local u = function(id,isAppend,pros)
|
|
|
|
|
for i = (isAppend and id or 1), id do
|
2021-05-28 11:43:14 +08:00
|
|
|
|
LogGreen("i:"..i)
|
|
|
|
|
local pro = endlessMorale[i].Props or {}
|
2021-05-28 11:29:27 +08:00
|
|
|
|
for k,v in ipairs(pro) do
|
|
|
|
|
if not pros[v[1]] then
|
|
|
|
|
pros[v[1]] = 0
|
|
|
|
|
end
|
|
|
|
|
pros[v[1]] = pros[v[1]] + v[2]
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return pros
|
|
|
|
|
end
|
2021-05-21 16:39:08 +08:00
|
|
|
|
local s = function(index)
|
|
|
|
|
local id, lv = EndLessMapManager.GetShiQiValue()
|
2021-05-28 11:29:27 +08:00
|
|
|
|
--local pro1,nextPro = nil
|
2021-05-21 16:39:08 +08:00
|
|
|
|
local pro = {}
|
|
|
|
|
if index == 1 then --属性加成
|
2021-05-28 11:29:27 +08:00
|
|
|
|
local pros = {}
|
|
|
|
|
local pros = u(id,false,pros)
|
|
|
|
|
local str = s(pros)
|
2021-05-21 16:39:08 +08:00
|
|
|
|
if str and str ~= "" then
|
2021-05-26 20:27:39 +08:00
|
|
|
|
table.insert(pro,string.format("本级加成:全体神将<color=#55c688>%s</color>",str))
|
2021-05-21 16:39:08 +08:00
|
|
|
|
end
|
2021-05-28 11:29:27 +08:00
|
|
|
|
id = id + 1
|
2021-05-28 11:43:14 +08:00
|
|
|
|
if endlessMorale[id] then
|
|
|
|
|
local pros = u(id,true,pros)
|
|
|
|
|
local str = s(pros)
|
|
|
|
|
if str and str ~= "" then
|
|
|
|
|
table.insert(pro,string.format("下级加成:全体神将<color=#55c688>%s</color>",str))
|
|
|
|
|
end
|
|
|
|
|
end
|
2021-05-21 16:39:08 +08:00
|
|
|
|
else --特殊加成
|
|
|
|
|
for k,v in ConfigPairs(endlessMorale) do
|
|
|
|
|
if v.Skill and v.Skill > 0 then
|
2021-05-26 20:27:39 +08:00
|
|
|
|
local volor = ""
|
|
|
|
|
if id >= v.Id then
|
|
|
|
|
volor = "#55c688"
|
|
|
|
|
else
|
|
|
|
|
volor = "#FFFFFF"
|
|
|
|
|
end
|
|
|
|
|
table.insert(pro,string.format("<color=%s>%s级:%s</color>",volor,v.Level,PassiveSkillConfig[v.Skill].Desc))
|
2021-05-21 16:39:08 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return pro
|
|
|
|
|
end
|
|
|
|
|
local data = {}
|
|
|
|
|
local singData = {}
|
|
|
|
|
singData.title = "属性加成"
|
|
|
|
|
singData.pro = s(1)
|
|
|
|
|
table.insert(data,singData)
|
|
|
|
|
local singData = {}
|
|
|
|
|
singData.title = "特殊加成"
|
|
|
|
|
singData.pro = s(2)
|
|
|
|
|
table.insert(data,singData)
|
|
|
|
|
-- for i = 1 ,#data do
|
|
|
|
|
-- LogGreen("data[i]:"..data[i].title.." #pro:"..#data[i].pro)
|
|
|
|
|
-- for k,v in ipairs(data[i].pro) do
|
|
|
|
|
-- LogGreen("data[i]:"..v)
|
|
|
|
|
-- end
|
|
|
|
|
-- end
|
|
|
|
|
UIManager.OpenPanel(UIName.GeneralBigPopup,GENERAL_POPUP_TYPE.WuJinShuXing,data)
|
2020-08-19 19:37:59 +08:00
|
|
|
|
end)
|
2021-05-21 16:39:08 +08:00
|
|
|
|
Util.AddClick(this.endLessTreasure, function ()
|
2020-12-16 17:23:52 +08:00
|
|
|
|
if ctrlView.GetCallListCount() > 1 then
|
2021-04-09 12:26:35 +08:00
|
|
|
|
PopupTipPanel.ShowTip(Language[11259])
|
2020-12-16 17:23:52 +08:00
|
|
|
|
return
|
|
|
|
|
end
|
2021-05-24 11:51:11 +08:00
|
|
|
|
if not this:CanClick() then return end
|
2021-07-26 11:23:26 +08:00
|
|
|
|
UIManager.OpenPanel(UIName.EndLessTreasurePanel)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
Util.AddClick(this.btnFormat, function ()
|
2020-12-16 17:23:52 +08:00
|
|
|
|
if ctrlView.GetCallListCount() > 1 then
|
2021-04-09 12:26:35 +08:00
|
|
|
|
PopupTipPanel.ShowTip(Language[11259])
|
2020-12-16 17:23:52 +08:00
|
|
|
|
return
|
|
|
|
|
end
|
2021-05-24 11:51:11 +08:00
|
|
|
|
if not this:CanClick() then return end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
NetManager.RequestAllHeroHp(function ()
|
|
|
|
|
-- UIManager.OpenPanel(UIName.FormationPanel, FORMATION_TYPE.CARBON, MapManager.curMapId)
|
|
|
|
|
UIManager.OpenPanel(UIName.FormationPanelV2, FORMATION_TYPE.CARBON, MapManager.curMapId)
|
|
|
|
|
EndLessMapManager.openedFormat = true
|
|
|
|
|
end)
|
|
|
|
|
end)
|
2021-05-27 15:16:46 +08:00
|
|
|
|
|
|
|
|
|
Util.AddClick(this.TargetRoot, function ()
|
|
|
|
|
if ctrlView.GetCallListCount() > 1 then
|
|
|
|
|
PopupTipPanel.ShowTip(Language[11259])
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
if not this:CanClick() then return end
|
|
|
|
|
MonsterCampManager.preType = 2
|
|
|
|
|
UIManager.OpenPanel(UIName.TrialRewardPopup,EndLessMapManager.SetRewardData(),function(id,rewardFunc)
|
|
|
|
|
NetManager.TakeMissionRewardRequest(TaskTypeDef.wujinfuben,id,function (msg)
|
|
|
|
|
UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1,function()
|
|
|
|
|
this:RefreshTargetRoote()
|
|
|
|
|
if rewardFunc then
|
|
|
|
|
rewardFunc()
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end)
|
|
|
|
|
end,1)
|
|
|
|
|
end)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
Util.AddClick(this.btnNote, function ()
|
2021-05-21 16:39:08 +08:00
|
|
|
|
if this.curMission.state == 1 then
|
|
|
|
|
NetManager.TakeMissionRewardRequest(TaskTypeDef.wujinfuben,this.curMission.Id,function(msg)
|
|
|
|
|
UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1,function (msg)
|
2021-05-24 11:51:11 +08:00
|
|
|
|
this:RefreshTargetRoote()
|
2021-05-21 16:39:08 +08:00
|
|
|
|
end)
|
|
|
|
|
end)
|
|
|
|
|
else
|
|
|
|
|
if ctrlView.GetCallListCount() > 1 then
|
|
|
|
|
PopupTipPanel.ShowTip(Language[11259])
|
|
|
|
|
return
|
|
|
|
|
end
|
2021-05-24 11:51:11 +08:00
|
|
|
|
if not this:CanClick() then return end
|
2021-05-26 18:07:09 +08:00
|
|
|
|
MonsterCampManager.preType = 2
|
2021-05-21 16:39:08 +08:00
|
|
|
|
UIManager.OpenPanel(UIName.TrialRewardPopup,EndLessMapManager.SetRewardData(),function(id,rewardFunc)
|
|
|
|
|
NetManager.TakeMissionRewardRequest(TaskTypeDef.wujinfuben,id,function (msg)
|
|
|
|
|
UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1,function()
|
2021-05-24 11:51:11 +08:00
|
|
|
|
this:RefreshTargetRoote()
|
2021-05-21 16:39:08 +08:00
|
|
|
|
if rewardFunc then
|
|
|
|
|
rewardFunc()
|
|
|
|
|
end
|
|
|
|
|
-- CheckRedPointStatus(RedPointType.TrialReward)
|
|
|
|
|
-- CheckRedPointStatus(RedPointType.Trial)
|
|
|
|
|
end)
|
|
|
|
|
end)
|
|
|
|
|
end,1)
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
Util.AddClick(this.btnAddEnergy, function ()
|
2020-12-16 17:23:52 +08:00
|
|
|
|
if ctrlView.GetCallListCount() > 1 then
|
2021-04-09 12:26:35 +08:00
|
|
|
|
PopupTipPanel.ShowTip(Language[11259])
|
2020-12-16 17:23:52 +08:00
|
|
|
|
return
|
|
|
|
|
end
|
2021-01-09 14:20:06 +08:00
|
|
|
|
Log("行走路径长度 ----- " .. #MapManager.stepList)
|
2021-05-24 11:51:11 +08:00
|
|
|
|
if not this:CanClick() then return end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if #MapManager.stepList > 0 then
|
|
|
|
|
MapManager.MapUpdateEvent(-1000, function ()
|
2021-01-09 14:20:06 +08:00
|
|
|
|
Log("购买之前同步位置!!")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
UIManager.OpenPanel(UIName.QuickPurchasePanel, { type = 1 })
|
|
|
|
|
end)
|
|
|
|
|
else
|
|
|
|
|
UIManager.OpenPanel(UIName.QuickPurchasePanel, { type = 1 })
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
2021-05-24 11:51:11 +08:00
|
|
|
|
function EndLessMapView:AddListener()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
Game.GlobalEvent:AddEvent(GameEvent.Map.OnAddNotePoint, this.SetNoteShow)
|
|
|
|
|
Game.GlobalEvent:AddEvent(GameEvent.Map.OnRemoveNotePoint, this.SetNoteShow)
|
|
|
|
|
Game.GlobalEvent:AddEvent(GameEvent.Bag.BagGold, this.GetBagEnergy)
|
2020-08-27 13:59:14 +08:00
|
|
|
|
Game.GlobalEvent:AddEvent(GameEvent.Map.EnergyFull, EndLessMapManager.EndlessRedCheck)
|
2021-05-21 16:39:08 +08:00
|
|
|
|
Game.GlobalEvent:AddEvent(GameEvent.EndLess.MissonChange,this.RefreshTargetRoote)
|
2021-05-25 21:27:38 +08:00
|
|
|
|
Game.GlobalEvent:AddEvent(GameEvent.EndLess.RefreshHeroData,this.OnShow)
|
2021-07-10 14:00:03 +08:00
|
|
|
|
Game.GlobalEvent:AddEvent(GameEvent.Bag.BagGold,this.RefreshItemNum)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
2021-05-24 11:51:11 +08:00
|
|
|
|
function EndLessMapView:RemoveListener()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.Map.OnAddNotePoint, this.SetNoteShow)
|
|
|
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.Map.OnRemoveNotePoint, this.SetNoteShow)
|
|
|
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.Bag.BagGold, this.GetBagEnergy)
|
2020-08-27 13:59:14 +08:00
|
|
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.Map.EnergyFull, EndLessMapManager.EndlessRedCheck)
|
2021-09-08 18:27:44 +08:00
|
|
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.EndLess.MissonChange,this.RefreshTargetRoote)
|
2021-05-25 21:27:38 +08:00
|
|
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.EndLess.RefreshHeroData,this.OnShow)
|
2021-07-10 14:00:03 +08:00
|
|
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.Bag.BagGold,this.RefreshItemNum)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
2021-07-10 14:00:03 +08:00
|
|
|
|
function this.RefreshItemNum()
|
|
|
|
|
this.num = BagManager.GetItemCountById(EndLessMapManager.JiuYaunLuId)
|
|
|
|
|
this.btnJiuYuanLuNum.text = this.num
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
2021-05-24 11:51:11 +08:00
|
|
|
|
function EndLessMapView:OnOpen()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
-- 初始化组件显示
|
2021-05-24 11:51:11 +08:00
|
|
|
|
this:InitCompShow(CarbonManager.difficulty)
|
|
|
|
|
if not this:IsEndLessMap() then return end
|
2021-06-01 17:10:07 +08:00
|
|
|
|
local serData = ActTimeCtrlManager.GetSerDataByTypeId(FUNCTION_OPEN_TYPE.ENDLESS)
|
|
|
|
|
PlayerPrefs.SetInt("WuJin"..PlayerManager.uid,serData.endTime)
|
2021-06-02 20:59:02 +08:00
|
|
|
|
CheckRedPointStatus(RedPointType.EndlessPanel)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
-- 初始化各种标志的状态
|
2021-05-24 11:51:11 +08:00
|
|
|
|
this:InitBoolState()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
-- 开始探索请求
|
2020-08-12 22:39:43 +08:00
|
|
|
|
-- this.StartExplore()
|
2020-08-20 14:56:29 +08:00
|
|
|
|
-- MapPanel.SetRoleShow(MapManager.mapScale, MapManager.roleInitPos,0)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
-- 设置任务显示
|
2021-05-24 11:51:11 +08:00
|
|
|
|
this:SetTipShow()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
-- 初始化行动力消耗的类型数值
|
2021-05-24 11:51:11 +08:00
|
|
|
|
this:InitCostValue()
|
|
|
|
|
this:RefreshEnergyValue(true, 0)
|
|
|
|
|
this:RefreshEnergyShow()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
-- 检测引导
|
|
|
|
|
GuideManager.CheckCarbonGuild(CARBON_TYPE.ENDLESS)
|
2021-05-26 17:27:47 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
2021-05-24 11:51:11 +08:00
|
|
|
|
function EndLessMapView:OnShow()
|
|
|
|
|
if not this:IsEndLessMap() then return end
|
2021-06-09 12:04:22 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
-- 避免其他界面打开时不刷新问题
|
|
|
|
|
-- 界面再次打开时,如果没有主动刷新过,则不需要刷新显示
|
|
|
|
|
--if not EndLessMapManager.isUpdateOnClose and not EndLessMapManager.openedFormat then
|
2021-05-24 11:51:11 +08:00
|
|
|
|
-- this:GetBagEnergy()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
-- EndLessMapManager.isUpdateOnClose = false
|
|
|
|
|
--end
|
2021-06-09 12:04:22 +08:00
|
|
|
|
BindRedPointObject(RedPointType.wujinTreasure,this.endLessTreasureRed)
|
2021-06-01 16:53:08 +08:00
|
|
|
|
BindRedPointObject(RedPointType.wujinBianDui,this.btnFormatRed)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
-- 如果全屏界面打开时刷新过,重新激活界面需要刷新一次
|
|
|
|
|
if EndLessMapManager.isUpdateOnClose then
|
2021-05-26 20:53:18 +08:00
|
|
|
|
this.GetBagEnergy()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
EndLessMapManager.isUpdateOnClose = false
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- 从编队界面切换回来,刷新事件点的战力显示
|
|
|
|
|
if EndLessMapManager.openedFormat then
|
|
|
|
|
pointView.RefreshAtkShow()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
EndLessMapManager.openedFormat = false
|
|
|
|
|
|
2021-11-05 15:50:49 +08:00
|
|
|
|
PlayerManager.RequestEnergy()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.isPanelClose = false
|
|
|
|
|
-- 刷新倒计时显示
|
2021-05-24 11:51:11 +08:00
|
|
|
|
this:ShowCountTime()
|
|
|
|
|
this:RefreshTargetRoote()
|
2021-05-25 20:37:12 +08:00
|
|
|
|
NetManager.RequestAllHeroHp(function ()
|
2021-05-26 17:27:47 +08:00
|
|
|
|
EndLessMapManager.RrefreshFormation()
|
2021-05-25 20:37:12 +08:00
|
|
|
|
this:ShowHeroData()
|
|
|
|
|
end)
|
2021-07-09 17:04:25 +08:00
|
|
|
|
this.num = BagManager.GetItemCountById(EndLessMapManager.JiuYaunLuId)
|
|
|
|
|
this.btnJiuYuanLuNum.text = this.num
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
2021-05-24 11:51:11 +08:00
|
|
|
|
function EndLessMapView:ShowHeroData()
|
2021-05-25 21:27:38 +08:00
|
|
|
|
local curFormation = EndLessMapManager.formation
|
2021-05-21 16:39:08 +08:00
|
|
|
|
if not this.heroList then
|
|
|
|
|
this.heroList = {}
|
|
|
|
|
end
|
|
|
|
|
for k = 1, #this.heroList do
|
2021-05-25 16:20:56 +08:00
|
|
|
|
if this.heroList[k] and this.heroList[k].go then
|
|
|
|
|
this.heroList[k].go.gameObject:SetActive(false)
|
|
|
|
|
end
|
2021-05-21 16:39:08 +08:00
|
|
|
|
end
|
2021-05-26 17:27:47 +08:00
|
|
|
|
if not curFormation or #curFormation < 1 then
|
|
|
|
|
this.selectHeroTip1.gameObject:SetActive(true)
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
this.selectHeroTip1.gameObject:SetActive(false)
|
2021-05-25 21:27:38 +08:00
|
|
|
|
for i, v in ipairs(curFormation) do
|
2021-05-25 20:37:12 +08:00
|
|
|
|
if not this.heroList[i] then
|
2021-05-21 16:39:08 +08:00
|
|
|
|
this.heroList[i] = {}
|
|
|
|
|
this.heroList[i].go = newObjToParent(this.selectPre,this.selectHeroGrid)
|
|
|
|
|
this.heroList[i].go.name="pre"..i
|
|
|
|
|
this.heroList[i].go:GetComponent("RectTransform").localScale = Vector2.New(0.9, 0.9)
|
|
|
|
|
this.heroList[i].frame=Util.GetGameObject(this.heroList[i].go,"frame"):GetComponent("Image")
|
|
|
|
|
this.heroList[i].icon=Util.GetGameObject(this.heroList[i].go,"icon"):GetComponent("Image")
|
|
|
|
|
this.heroList[i].pro=Util.GetGameObject(this.heroList[i].go,"proIcon"):GetComponent("Image")
|
|
|
|
|
this.heroList[i].lv=Util.GetGameObject(this.heroList[i].go,"lv/Text"):GetComponent("Text")
|
|
|
|
|
this.heroList[i].star=Util.GetGameObject(this.heroList[i].go,"star")
|
|
|
|
|
this.heroList[i].choosed=Util.GetGameObject(this.heroList[i].go,"choosed")
|
|
|
|
|
this.heroList[i].hpExp=Util.GetGameObject(this.heroList[i].go,"hpExp"):GetComponent("Slider")
|
|
|
|
|
end
|
|
|
|
|
this.heroList[i].go.gameObject:SetActive(true)
|
|
|
|
|
this.heroList[i].heroId = v.heroId
|
|
|
|
|
local heroData = HeroManager.GetSingleHeroData(v.heroId)
|
2021-05-28 14:41:58 +08:00
|
|
|
|
this.heroList[i].frame.sprite = this.spLoader:LoadSprite(GetHeroQuantityImageByquality(heroData.heroConfig.Quality, heroData.star))
|
2021-05-25 16:20:56 +08:00
|
|
|
|
SetHeroIcon(this.spLoader,heroData,this.heroList[i].icon,heroData.heroConfig)
|
2022-03-28 18:18:19 +08:00
|
|
|
|
this.heroList[i].pro.sprite = this.spLoader:LoadSprite(GetProStrImageByProNum(heroData.changeProId))
|
2021-05-24 11:51:11 +08:00
|
|
|
|
this.heroList[i].lv.text=heroData.lv
|
2021-05-25 16:20:56 +08:00
|
|
|
|
--spLoader, starGrid, star, type,_starSize,_scale,_pivot,rotation
|
2021-10-26 16:00:31 +08:00
|
|
|
|
local star,starType = heroData.GetStar(1)
|
|
|
|
|
SetHeroStars(this.spLoader,this.heroList[i].star, star,starType)
|
2021-05-25 16:20:56 +08:00
|
|
|
|
local heroData1 = EndLessMapManager.allHeroBlood[v.heroId]
|
2021-05-21 16:39:08 +08:00
|
|
|
|
--血量相关
|
2021-05-25 16:20:56 +08:00
|
|
|
|
this.heroList[i].hpExp.value=heroData1.percentHp
|
|
|
|
|
Util.SetGray(this.heroList[i].go,heroData1.percentHp<=0)--死啦
|
2021-05-27 18:08:26 +08:00
|
|
|
|
Util.AddOnceClick( this.heroList[i].go,function()
|
|
|
|
|
UIManager.OpenPanel(UIName.RoleInfoPopup, heroData)
|
|
|
|
|
end)
|
2021-05-21 16:39:08 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2021-05-25 21:27:38 +08:00
|
|
|
|
function EndLessMapView:RefreshTargetRoote()
|
2021-05-27 10:46:22 +08:00
|
|
|
|
-- 0 "已领取"
|
|
|
|
|
-- 1 "领取"
|
|
|
|
|
-- 2 "前往"
|
2021-06-09 17:02:04 +08:00
|
|
|
|
this.btnNoteRed.gameObject:SetActive(false)
|
2021-05-21 16:39:08 +08:00
|
|
|
|
this.curMission = EndLessMapManager.GetRewardData()
|
2021-05-27 10:46:22 +08:00
|
|
|
|
if this.curMission.state == 2 then
|
|
|
|
|
this.TargetBtn1.gameObject:SetActive(true) --未完成
|
|
|
|
|
this.TargetBtn2.gameObject:SetActive(false) --以达成
|
2021-05-27 15:16:46 +08:00
|
|
|
|
this.TargetRootText.text = string.format("%s<color=#FFFFFF>(%s/%s)</color>",this.curMission.Desc,this.curMission.progress,this.curMission.value)
|
2021-05-25 16:20:56 +08:00
|
|
|
|
else
|
2021-05-27 10:46:22 +08:00
|
|
|
|
this.TargetBtn1.gameObject:SetActive(false)
|
|
|
|
|
this.TargetBtn2.gameObject:SetActive(true)
|
|
|
|
|
if this.curMission.index == #EndLessMapManager.mission and this.curMission.state == 0 then
|
2021-05-25 16:20:56 +08:00
|
|
|
|
this.TargetRootText.text = "已完成全部任务"
|
2021-05-21 16:39:08 +08:00
|
|
|
|
else
|
2021-06-09 17:02:04 +08:00
|
|
|
|
this.btnNoteRed.gameObject:SetActive(true)
|
2021-05-27 15:16:46 +08:00
|
|
|
|
this.TargetRootText.text = string.format("%s<color=#55c688>(%s/%s)</color>",this.curMission.Desc,this.curMission.value,this.curMission.value)
|
2021-05-21 16:39:08 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2021-05-24 11:51:11 +08:00
|
|
|
|
function EndLessMapView:SetShiQiValue()
|
2021-05-22 14:08:34 +08:00
|
|
|
|
local cursinglePro
|
2021-05-25 16:20:56 +08:00
|
|
|
|
local itemCount = BagManager.GetItemCountById(EndLessMapManager.shiQiValue)
|
2021-05-21 16:39:08 +08:00
|
|
|
|
local id, lv = EndLessMapManager.GetShiQiValue()
|
2021-05-26 09:51:41 +08:00
|
|
|
|
local oldId = 0
|
2021-05-22 14:08:34 +08:00
|
|
|
|
if lv ~= EndLessMapManager.moraleLv then
|
2021-05-21 16:39:08 +08:00
|
|
|
|
isShow = true
|
2021-05-26 09:51:41 +08:00
|
|
|
|
oldId = EndLessMapManager.moraleLv
|
2021-05-22 14:08:34 +08:00
|
|
|
|
cursinglePro = endlessMorale[id]
|
2021-05-21 16:39:08 +08:00
|
|
|
|
EndLessMapManager.moraleLv = lv
|
2021-05-22 14:08:34 +08:00
|
|
|
|
EndLessMapManager.moraleId = id
|
2021-05-21 16:39:08 +08:00
|
|
|
|
end
|
2021-05-26 14:57:28 +08:00
|
|
|
|
this.shiQiProgress.text = (endlessMorale[id].Exp and endlessMorale[id].Exp[2] > 0) and itemCount.."/"..endlessMorale[id].Exp[2] or "1/1"
|
2021-05-25 16:20:56 +08:00
|
|
|
|
this.shiQiLv.text = lv.."级"
|
2021-05-26 14:57:28 +08:00
|
|
|
|
this.shiQifillAmount.fillAmount = (endlessMorale[id].Exp and endlessMorale[id].Exp[2] > 0) and itemCount/endlessMorale[id].Exp[2] or 1
|
2021-05-22 14:08:34 +08:00
|
|
|
|
|
2021-05-27 15:35:10 +08:00
|
|
|
|
-- if isShow then
|
|
|
|
|
-- --士气等级提升
|
|
|
|
|
-- isShow = false
|
|
|
|
|
-- local data = {}
|
|
|
|
|
-- data.title = "r_wujin_shiqitishengzi" --士气等级提升图片
|
|
|
|
|
-- data.itemList = {}
|
|
|
|
|
-- data.type = 2
|
|
|
|
|
-- local s = function(curId)
|
|
|
|
|
-- LogGreen("curId:"..curId)
|
|
|
|
|
-- local proPs = {}
|
|
|
|
|
-- for k,v in ConfigPairs(endlessMorale) do
|
|
|
|
|
-- if v.Id <= curId then
|
|
|
|
|
-- if v.Props then
|
|
|
|
|
-- for i = 1 ,#v.Props do
|
|
|
|
|
-- if not proPs[v.Props[i][1]] then
|
|
|
|
|
-- proPs[v.Props[i][1]] = 0
|
|
|
|
|
-- end
|
|
|
|
|
-- proPs[v.Props[i][1]] = proPs[v.Props[i][1]] + v.Props[i][2]
|
|
|
|
|
-- end
|
|
|
|
|
-- end
|
|
|
|
|
-- end
|
|
|
|
|
-- end
|
|
|
|
|
-- return proPs
|
|
|
|
|
-- end
|
|
|
|
|
-- local upPro = s(id)
|
|
|
|
|
-- for k,v in pairs(upPro) do
|
|
|
|
|
-- LogGreen("k:"..k.." v:"..v)
|
|
|
|
|
-- end
|
|
|
|
|
-- for i = 1, #cursinglePro.Props do
|
|
|
|
|
-- if not upPro[cursinglePro.Props[i][1]] then
|
|
|
|
|
-- upPro[cursinglePro.Props[i][1]] = 0
|
|
|
|
|
-- upPro[cursinglePro.Props[i][1]] = upPro[cursinglePro.Props[i][1]] + cursinglePro.Props[i][2]
|
|
|
|
|
-- end
|
|
|
|
|
-- local singleItem = {}
|
|
|
|
|
-- singleItem.icon = nil
|
|
|
|
|
-- singleItem.proName = string.format("全体神将%s",PropertyConfig[cursinglePro.Props[i][1]].Info)
|
|
|
|
|
-- LogGreen("k:"..cursinglePro.Props[i][1].." v:"..cursinglePro.Props[i][2])
|
|
|
|
|
-- singleItem.proValue = GetEquipPropertyFormatStr(upPro[cursinglePro.Props[i][1]] - cursinglePro.Props[i][2],PropertyConfig[cursinglePro.Props[i][1]].Style)
|
|
|
|
|
-- singleItem.proValue1 = "<color=#529864>"..GetEquipPropertyFormatStr(upPro[cursinglePro.Props[i][1]],PropertyConfig[cursinglePro.Props[i][1]].Style).."</color>"
|
|
|
|
|
-- table.insert(data.itemList,singleItem)
|
|
|
|
|
-- end
|
|
|
|
|
-- if cursinglePro.Skill and cursinglePro.Skill > 0 then
|
|
|
|
|
-- local config = ConfigManager.GetConfigData(ConfigName.PassiveSkillConfig,cursinglePro.Skill)
|
|
|
|
|
-- local singleItem = {}
|
|
|
|
|
-- singleItem.icon = nil
|
|
|
|
|
-- singleItem.proName = config.Desc
|
|
|
|
|
-- singleItem.proValue = nil
|
|
|
|
|
-- singleItem.proValue1 = nil
|
|
|
|
|
-- table.insert(data.itemList,singleItem)
|
|
|
|
|
-- end
|
|
|
|
|
-- UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.Onhook,data)
|
|
|
|
|
-- end
|
2021-05-21 16:39:08 +08:00
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
2021-05-24 11:51:11 +08:00
|
|
|
|
function EndLessMapView:InitCompShow(carbonType)
|
2020-06-08 20:18:49 +08:00
|
|
|
|
if carbonType ~= CARBON_TYPE.ENDLESS then
|
|
|
|
|
return
|
|
|
|
|
end
|
2021-05-21 16:39:08 +08:00
|
|
|
|
this.btnReset.gameObject:SetActive(false)
|
|
|
|
|
this.btnFormat:SetActive(true)
|
|
|
|
|
this.areaName.gameObject:SetActive(true)
|
|
|
|
|
this.btnSet:SetActive(true)
|
|
|
|
|
this.endLessTitleRoot:SetActive(true)
|
|
|
|
|
this.energyRoot:SetActive(true)
|
|
|
|
|
this.btnNote.gameObject:SetActive(true)
|
|
|
|
|
this.centerDown.gameObject:SetActive(true)
|
|
|
|
|
this.bufflist.gameObject:SetActive(false)
|
|
|
|
|
this.selectHero.gameObject:SetActive(true)
|
|
|
|
|
this.selectHeroTip.gameObject:SetActive(false)
|
|
|
|
|
this.selectHeroGrid.gameObject:SetActive(true)
|
|
|
|
|
this.enemyInfo.gameObject:SetActive(false)
|
|
|
|
|
this.shiQi.gameObject:SetActive(true)
|
2021-07-21 14:55:47 +08:00
|
|
|
|
this.endLessTreasure.gameObject:SetActive(SERVER_VERSION == 0)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
-- ================================================
|
|
|
|
|
-- ============ 初始化设置 =========================
|
2021-05-24 11:51:11 +08:00
|
|
|
|
function EndLessMapView:IsEndLessMap()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
return CarbonManager.difficulty == CARBON_TYPE.ENDLESS
|
|
|
|
|
end
|
|
|
|
|
|
2021-05-24 11:51:11 +08:00
|
|
|
|
function EndLessMapView:SetTipShow()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
Log("MapManager.curMapId ========== " .. MapManager.curMapId)
|
2021-05-24 11:51:11 +08:00
|
|
|
|
-- if not this:IsEndLessMap() then return end
|
2021-04-09 12:26:35 +08:00
|
|
|
|
if not endLessData[MapManager.curMapId] then Log(Language[11278]) return end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
2021-06-09 18:14:26 +08:00
|
|
|
|
local configs = ConfigManager.GetAllConfigsDataByKey(ConfigName.endlessDifficulty,"MapPool",EndLessMapManager.openMapId)
|
|
|
|
|
local lv = PlayerManager.level
|
|
|
|
|
local config = nil
|
|
|
|
|
for i = 1,#configs do
|
|
|
|
|
if lv >= configs[i].WorldLevel[1] and lv <= configs[i].WorldLevel[2] then
|
|
|
|
|
config = configs[i]
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
this.areaName.text = config.Title
|
|
|
|
|
EndLessMapManager.curMapName = config.Title
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
2021-05-24 11:51:11 +08:00
|
|
|
|
function EndLessMapView:InitBoolState()
|
2021-05-26 17:27:47 +08:00
|
|
|
|
--EndLessMapManager.isCanNote = false
|
2020-05-09 13:31:21 +08:00
|
|
|
|
EndLessMapManager.justEnterMap = true
|
|
|
|
|
EndLessMapManager.isReset = false
|
|
|
|
|
end
|
|
|
|
|
-- ===================================================
|
|
|
|
|
-- ========= 各种按键操作的设置 =========================
|
|
|
|
|
|
2021-05-26 17:27:47 +08:00
|
|
|
|
-- -- 标记设置
|
|
|
|
|
-- function EndLessMapView:SetNoteShow()
|
|
|
|
|
-- -- 进入标记状态
|
|
|
|
|
-- --EndLessMapManager.isCanNote = not EndLessMapManager.isCanNote
|
|
|
|
|
-- -- local canNote = EndLessMapManager.isCanNote
|
|
|
|
|
-- -- MapPanel.BtnBack:SetActive(not canNote)
|
|
|
|
|
-- -- this.btnReset:SetActive(not canNote)
|
|
|
|
|
-- -- this.btnFormat:SetActive(not canNote)
|
|
|
|
|
-- -- this.btnSet:SetActive(not canNote)
|
|
|
|
|
-- -- ctrlView.IsForbitLongClick(canNote)
|
|
|
|
|
-- end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
|
|
|
|
-- 按钮可点击的判断
|
2021-05-24 11:51:11 +08:00
|
|
|
|
function EndLessMapView:CanClick()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local canClick = true
|
|
|
|
|
|
|
|
|
|
-- 如果正在触发事件,不可复位
|
|
|
|
|
if ctrlView.GetTriggerState() then
|
2021-04-09 12:26:35 +08:00
|
|
|
|
PopupTipPanel.ShowTip(Language[11280])
|
2020-05-09 13:31:21 +08:00
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 正在寻路
|
|
|
|
|
if ctrlView.GetCallListCount() > 1 then
|
2021-04-09 12:26:35 +08:00
|
|
|
|
PopupTipPanel.ShowTip(Language[11281])
|
2020-05-09 13:31:21 +08:00
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
return canClick
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--- ============= 行动力刷新显示 ==============================
|
2021-05-24 11:51:11 +08:00
|
|
|
|
function EndLessMapView:OnRoleMove(u, v)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
-- 只有无尽副本才执行
|
2021-05-24 11:51:11 +08:00
|
|
|
|
if not this:IsEndLessMap() then return end
|
|
|
|
|
this:RefreshEnergyValue(false, COST_TYPE.WALK)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 初始化数值
|
2021-05-24 11:51:11 +08:00
|
|
|
|
function EndLessMapView:InitCostValue()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local mapData = endLessData[MapManager.curMapId]
|
|
|
|
|
walkCost = mapData.WalkCost
|
|
|
|
|
deadCost = mapData.DeathCost
|
|
|
|
|
|
|
|
|
|
-- 同步一次道具数据
|
2021-05-26 20:53:18 +08:00
|
|
|
|
this.GetBagEnergy()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
|
|
|
|
-- 显示你有多少钱钱
|
|
|
|
|
this.moneyNum:GetComponent("Text").text = BagManager.GetTotalItemNum(1201)
|
2021-04-21 13:12:04 +08:00
|
|
|
|
this.moneyIcon:GetComponent("Image").sprite = SetIcon(this.spLoader, 1201)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 根据类型刷新行动力数值
|
2021-05-24 11:51:11 +08:00
|
|
|
|
function EndLessMapView:RefreshEnergyValue(isInit, costType)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
-- 只是初始化返回
|
2020-08-20 14:56:29 +08:00
|
|
|
|
-- LogBlue("两次吧")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if isInit then return end
|
|
|
|
|
if EndLessMapManager.justEnterMap then
|
|
|
|
|
EndLessMapManager.justEnterMap = false
|
2021-01-09 14:20:06 +08:00
|
|
|
|
Log("刚进图的那一步不扣行动力")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local curEnergy = EndLessMapManager.leftEnergy
|
|
|
|
|
preEnergy = curEnergy
|
|
|
|
|
-- 行走
|
|
|
|
|
if costType == COST_TYPE.WALK then
|
|
|
|
|
curEnergy = curEnergy - walkCost <= 0 and 0 or curEnergy - walkCost
|
|
|
|
|
-- 只要动一哈就不再是复位状态
|
|
|
|
|
EndLessMapManager.isReset = false
|
|
|
|
|
-- 消除死亡状态
|
|
|
|
|
EndLessMapManager.EndLessRoleDead = false
|
|
|
|
|
-- 消除重登状态
|
|
|
|
|
MapManager.isReloadEnter = false
|
|
|
|
|
|
|
|
|
|
-- 行走时剩余行动力警告
|
|
|
|
|
if curEnergy == 5 and preEnergy > 5 then
|
|
|
|
|
-- 停止寻路
|
|
|
|
|
if ctrlView.GetCallListCount() > 1 then
|
|
|
|
|
ctrlView.StopWalk()
|
|
|
|
|
end
|
2020-08-04 16:18:48 +08:00
|
|
|
|
-- this.PlayWarnEffect()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
-- 死翘翘
|
|
|
|
|
elseif costType == COST_TYPE.DEAD then
|
|
|
|
|
|
|
|
|
|
-- 传送
|
|
|
|
|
elseif costType == COST_TYPE.TRANSPORT then
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
EndLessMapManager.leftEnergy = curEnergy
|
|
|
|
|
EndLessMapManager.isHungery()
|
2021-05-24 11:51:11 +08:00
|
|
|
|
this:RefreshEnergyShow()
|
2021-05-26 17:27:47 +08:00
|
|
|
|
-- MapManager.MapUpdateEvent(-1000, function ()
|
|
|
|
|
-- this:ShowCountTime()
|
|
|
|
|
-- end)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 刷新行动力组件显示
|
2021-05-24 11:51:11 +08:00
|
|
|
|
function EndLessMapView:RefreshEnergyShow()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local curEnergy = EndLessMapManager.leftEnergy
|
|
|
|
|
if curEnergy <= 0 then
|
|
|
|
|
ctrlView.StopWalk()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 设置一下颜色
|
|
|
|
|
local str = ""
|
|
|
|
|
|
|
|
|
|
if curEnergy <= 5 then
|
|
|
|
|
str = string.format("<color=#FF0014FF>%s</color>", tostring(curEnergy))
|
|
|
|
|
else
|
|
|
|
|
str = tostring(curEnergy)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
this.energyInfo.text = str
|
2021-05-25 16:20:56 +08:00
|
|
|
|
this.totalEnergy.text = ""
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 刷新数值
|
2021-05-26 20:53:18 +08:00
|
|
|
|
function this.GetBagEnergy()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
-- 无尽副本才刷新
|
2021-05-24 11:51:11 +08:00
|
|
|
|
if not this:IsEndLessMap() then return end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
EndLessMapManager.leftEnergy = BagManager.GetItemCountById(1)
|
2021-01-09 14:20:06 +08:00
|
|
|
|
Log("获取背包剩余行动力" .. BagManager.GetItemCountById(1))
|
2020-05-09 13:31:21 +08:00
|
|
|
|
EndLessMapManager.isHungery()
|
2021-05-24 11:51:11 +08:00
|
|
|
|
this:RefreshEnergyShow()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
|
|
|
|
-- 显示你有多少钱钱
|
|
|
|
|
this.moneyNum:GetComponent("Text").text = BagManager.GetTotalItemNum(1201)
|
2021-05-24 13:53:28 +08:00
|
|
|
|
|
2021-04-21 13:12:04 +08:00
|
|
|
|
this.moneyIcon:GetComponent("Image").sprite = SetIcon(this.spLoader, 1201)
|
2021-05-24 11:51:11 +08:00
|
|
|
|
this:SetShiQiValue()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 无尽副本中角色死翘翘
|
2021-05-24 11:51:11 +08:00
|
|
|
|
function EndLessMapView:OnRoleDead()
|
2021-05-25 16:20:56 +08:00
|
|
|
|
-- this:RefreshEnergyValue(false, COST_TYPE.DEAD)
|
|
|
|
|
-- -- 死亡退出触发事件状态
|
|
|
|
|
-- EndLessMapManager.isTrigger = false
|
|
|
|
|
-- -- 看看是否是死光光了
|
|
|
|
|
-- if EndLessMapManager.IsAllDead() then
|
|
|
|
|
-- PopupTipPanel.ShowTip(Language[11282])
|
|
|
|
|
-- this:ResetRoleState()
|
|
|
|
|
-- end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 无尽副本在地图之间传送
|
2021-05-24 11:51:11 +08:00
|
|
|
|
function EndLessMapView:OnRoleTransport(func)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
EndLessMapManager.GetLeftEnergy(function ()
|
2021-05-24 11:51:11 +08:00
|
|
|
|
this:RefreshEnergyValue(false, COST_TYPE.TRANSPORT)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if func then func() end
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 行动力警告特效
|
2020-08-04 16:18:48 +08:00
|
|
|
|
-- function this.PlayWarnEffect()
|
|
|
|
|
-- this.warn:SetActive(true)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
2020-08-04 16:18:48 +08:00
|
|
|
|
-- local timer = Timer.New(function ()
|
|
|
|
|
-- this.warn:SetActive(false)
|
|
|
|
|
-- end, 1.6)
|
|
|
|
|
-- timer:Start()
|
|
|
|
|
-- end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
|
|
|
|
-- 行动力是否显示倒计时
|
2021-05-24 11:51:11 +08:00
|
|
|
|
function EndLessMapView:ShowCountTime()
|
2021-05-25 16:20:56 +08:00
|
|
|
|
if this.timer then
|
|
|
|
|
this.timer:Stop()
|
|
|
|
|
this.timer = nil
|
|
|
|
|
end
|
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.actCountTime.text = ""
|
2021-05-25 16:20:56 +08:00
|
|
|
|
this.bgTime:SetActive(true)
|
2021-06-10 16:38:19 +08:00
|
|
|
|
local tempLeftTime = 0
|
2021-05-25 16:20:56 +08:00
|
|
|
|
this.timer = Timer.New(function ()
|
|
|
|
|
local leftTime = AutoRecoverManager.GetRecoverTime(1)
|
2021-06-10 16:38:19 +08:00
|
|
|
|
if leftTime >= tempLeftTime then
|
|
|
|
|
this:RefreshEnergyShow()
|
|
|
|
|
tempLeftTime = leftTime
|
|
|
|
|
end
|
2021-11-05 15:50:49 +08:00
|
|
|
|
if leftTime <= 0 then
|
|
|
|
|
PlayerManager.RequestEnergy()
|
2021-05-27 22:34:11 +08:00
|
|
|
|
leftTime = 0
|
|
|
|
|
end
|
2021-11-05 10:04:32 +08:00
|
|
|
|
if not this.isPanelClose then
|
|
|
|
|
this.actCountTime.text = GetTimeMaoHaoStrBySeconds(math.floor(leftTime)).."后恢复1点"
|
|
|
|
|
end
|
2021-05-25 16:20:56 +08:00
|
|
|
|
end, 1, -1, true)
|
|
|
|
|
this.timer:Start()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--- ==========================================================
|
|
|
|
|
|
2021-05-24 11:51:11 +08:00
|
|
|
|
function EndLessMapView:OnClose()
|
|
|
|
|
if not this:IsEndLessMap() then return end
|
2020-08-04 16:18:48 +08:00
|
|
|
|
-- this.warn:SetActive(false)
|
2021-05-25 20:37:12 +08:00
|
|
|
|
Util.ClearChild(this.selectHeroGrid.transform)
|
2021-06-01 16:53:08 +08:00
|
|
|
|
ClearRedPointObject(RedPointType.wujinBianDui,this.btnFormatRed)
|
2021-06-09 12:04:22 +08:00
|
|
|
|
ClearRedPointObject(RedPointType.wujinTreasure,this.endLessTreasureRed)
|
2021-05-25 20:37:12 +08:00
|
|
|
|
this.heroList = {}
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.isPanelClose = true
|
|
|
|
|
EndLessMapManager.isUpdateOnClose = false
|
|
|
|
|
if this.timer then
|
|
|
|
|
this.timer:Stop()
|
|
|
|
|
this.timer = nil
|
|
|
|
|
end
|
2021-05-31 14:22:40 +08:00
|
|
|
|
|
|
|
|
|
if UIManager.IsOpen(UIName.GeneralBigPopup) then
|
|
|
|
|
UIManager.ClosePanel(UIName.GeneralBigPopup)
|
|
|
|
|
end
|
|
|
|
|
if UIManager.IsOpen(UIName.GeneralPopup) then
|
|
|
|
|
UIManager.ClosePanel(UIName.GeneralPopup)
|
|
|
|
|
end
|
|
|
|
|
if UIManager.IsOpen(UIName.TrialRewardPopup) then
|
|
|
|
|
UIManager.ClosePanel(UIName.TrialRewardPopup)
|
|
|
|
|
end
|
|
|
|
|
if UIManager.IsOpen(UIName.EndLessTreasurePanel) then
|
|
|
|
|
UIManager.ClosePanel(UIName.EndLessTreasurePanel)
|
|
|
|
|
end
|
2021-06-02 18:22:45 +08:00
|
|
|
|
if UIManager.IsOpen(UIName.HelpPopup) then
|
|
|
|
|
UIManager.ClosePanel(UIName.HelpPopup)
|
|
|
|
|
end
|
2021-06-19 17:47:35 +08:00
|
|
|
|
if UIManager.IsOpen(UIName.ShowEnemyInfoPanel) then
|
|
|
|
|
UIManager.ClosePanel(UIName.ShowEnemyInfoPanel)
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
2021-05-24 11:51:11 +08:00
|
|
|
|
function EndLessMapView:OnDestroy()
|
2021-04-21 13:12:04 +08:00
|
|
|
|
this.spLoader:Destroy()
|
2021-05-24 11:51:11 +08:00
|
|
|
|
if not this:IsEndLessMap() then return end
|
2021-06-09 12:04:22 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
2021-04-21 13:12:04 +08:00
|
|
|
|
return EndLessMapView
|
|
|
|
|
|