--- 无尽副本 --- 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) local heroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig) local endlessMorale = ConfigManager.GetConfig(ConfigName.endlessMorale) local PassiveSkillConfig = ConfigManager.GetConfig(ConfigName.PassiveSkillConfig) local PropertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig) local ctrlView = require("Modules/Map/View/MapControllView") local pointView = require("Modules/Map/View/PointHandleView") local MapPanel local isShow = false this.shiQiValueId = 101 this.isPanelClose = false -- 刷新前的行动力,用于判断递减 local preEnergy = 0 -- 当前地图扣除行动力的类型 local COST_TYPE = { WALK = 1, DEAD = 2, TRANSPORT = 3, } -- 当前地图行走与死亡消耗的行动力 local deadCost = 0 local walkCost = 0 function EndLessMapView:InitComponent(gameObject, mapPanel) this.spLoader = SpriteLoader.New() 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") this.btnFormatRed = Util.GetGameObject(this.btnFormat, "redpot") this.btnNote = Util.GetGameObject(gameObject, "rightDown/btnNote") this.btnNoteRed = Util.GetGameObject(this.btnNote, "redPoint") -- 谢置按钮 this.btnSet = Util.GetGameObject(gameObject, "rightUp/btnSetting") -- 行动力显示 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") -- 行动力警告显示 this.warn = Util.GetGameObject(gameObject, "EndLessEffect/effect") this.warnRoot = Util.GetGameObject(gameObject, "EndLessEffect") -- 根节点 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") this.helpBtn=Util.GetGameObject(gameObject,"helpBtn") this.helpPos=this.helpBtn:GetComponent("RectTransform").localPosition this.helpBtn:SetActive(false) 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") this.selectHeroTip1 = Util.GetGameObject(this.selectHero,"tip1") 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") this.shiQifillAmount = Util.GetGameObject(this.shiQi,"Image/mask"):GetComponent("Image") this.endLessTreasure = Util.GetGameObject(this.leftCenter,"endLessTreasure") this.endLessTreasureRed = Util.GetGameObject(this.endLessTreasure ,"redPoint") end function EndLessMapView:OnSortingOrderChange() end function EndLessMapView:BindEvent() -- --帮助按钮 -- 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) -- -- 重置 -- Util.AddClick(this.btnReset, function () -- if ctrlView.GetCallListCount() > 1 then -- PopupTipPanel.ShowTip(Language[11259]) -- return -- end -- if not this:CanClick() then return end -- -- 复位角色的状态 -- MsgPanel.ShowTwo(Language[11277], nil, function() -- this.ResetRoleState() -- end) -- end) Util.AddClick(this.shiQi, function () if ctrlView.GetCallListCount() > 1 then PopupTipPanel.ShowTip(Language[11259]) return end if not this:CanClick() then return end local s = function(pro) local str = "" local index = 1 for k,v in pairs(pro) do local config = ConfigManager.GetConfigData(ConfigName.PropertyConfig,k) if not config then else if index ~= 1 then str = str .. "," end str = str .. config.Info .. "+" str = str .. GetEquipPropertyFormatStr(config.Style,v) index = index + 1 end end return str end local u = function(id,isAppend,pros) for i = (isAppend and id or 1), id do LogGreen("i:"..i) local pro = endlessMorale[i].Props or {} 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 local s = function(index) local id, lv = EndLessMapManager.GetShiQiValue() --local pro1,nextPro = nil local pro = {} if index == 1 then --属性加成 local pros = {} local pros = u(id,false,pros) local str = s(pros) if str and str ~= "" then table.insert(pro,string.format("本级加成:全体神将%s",str)) end id = id + 1 if endlessMorale[id] then local pros = u(id,true,pros) local str = s(pros) if str and str ~= "" then table.insert(pro,string.format("下级加成:全体神将%s",str)) end end else --特殊加成 for k,v in ConfigPairs(endlessMorale) do if v.Skill and v.Skill > 0 then local volor = "" if id >= v.Id then volor = "#55c688" else volor = "#FFFFFF" end table.insert(pro,string.format("%s级:%s",volor,v.Level,PassiveSkillConfig[v.Skill].Desc)) 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) end) BindRedPointObject(RedPointType.wujinTreasure,this.endLessTreasureRed) Util.AddClick(this.endLessTreasure, function () if ctrlView.GetCallListCount() > 1 then PopupTipPanel.ShowTip(Language[11259]) return end if not this:CanClick() then return end local data = EndLessMapManager.treasureData UIManager.OpenPanel(UIName.EndLessTreasurePanel,data) end) Util.AddClick(this.btnFormat, function () if ctrlView.GetCallListCount() > 1 then PopupTipPanel.ShowTip(Language[11259]) return end if not this:CanClick() then return end 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) 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) BindRedPointObject(RedPointType.wujinMission,this.btnNoteRed) Util.AddClick(this.btnNote, function () if this.curMission.state == 1 then NetManager.TakeMissionRewardRequest(TaskTypeDef.wujinfuben,this.curMission.Id,function(msg) UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1,function (msg) this:RefreshTargetRoote() end) end) else 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 -- CheckRedPointStatus(RedPointType.TrialReward) -- CheckRedPointStatus(RedPointType.Trial) end) end) end,1) end end) Util.AddClick(this.btnAddEnergy, function () if ctrlView.GetCallListCount() > 1 then PopupTipPanel.ShowTip(Language[11259]) return end Log("行走路径长度 ----- " .. #MapManager.stepList) if not this:CanClick() then return end if #MapManager.stepList > 0 then MapManager.MapUpdateEvent(-1000, function () Log("购买之前同步位置!!") UIManager.OpenPanel(UIName.QuickPurchasePanel, { type = 1 }) end) else UIManager.OpenPanel(UIName.QuickPurchasePanel, { type = 1 }) end end) end function EndLessMapView:AddListener() Game.GlobalEvent:AddEvent(GameEvent.Map.OnAddNotePoint, this.SetNoteShow) Game.GlobalEvent:AddEvent(GameEvent.Map.OnRemoveNotePoint, this.SetNoteShow) Game.GlobalEvent:AddEvent(GameEvent.Bag.BagGold, this.GetBagEnergy) Game.GlobalEvent:AddEvent(GameEvent.Map.EnergyFull, EndLessMapManager.EndlessRedCheck) Game.GlobalEvent:AddEvent(GameEvent.EndLess.MissonChange,this.RefreshTargetRoote) Game.GlobalEvent:AddEvent(GameEvent.EndLess.RefreshHeroData,this.OnShow) end function EndLessMapView:RemoveListener() Game.GlobalEvent:RemoveEvent(GameEvent.Map.OnAddNotePoint, this.SetNoteShow) Game.GlobalEvent:RemoveEvent(GameEvent.Map.OnRemoveNotePoint, this.SetNoteShow) Game.GlobalEvent:RemoveEvent(GameEvent.Bag.BagGold, this.GetBagEnergy) Game.GlobalEvent:RemoveEvent(GameEvent.Map.EnergyFull, EndLessMapManager.EndlessRedCheck) Game.GlobalEvent:RemoveEvent(GameEvent.EndLess.RefreshHeroData,this.OnShow) end function EndLessMapView:OnOpen() -- 初始化组件显示 this:InitCompShow(CarbonManager.difficulty) if not this:IsEndLessMap() then return end local serData = ActTimeCtrlManager.GetSerDataByTypeId(FUNCTION_OPEN_TYPE.ENDLESS) PlayerPrefs.SetInt("WuJin"..PlayerManager.uid,serData.endTime) CheckRedPointStatus(RedPointType.EndlessPanel) -- 初始化各种标志的状态 this:InitBoolState() -- 开始探索请求 -- this.StartExplore() -- MapPanel.SetRoleShow(MapManager.mapScale, MapManager.roleInitPos,0) -- 设置任务显示 this:SetTipShow() -- 初始化行动力消耗的类型数值 this:InitCostValue() this:RefreshEnergyValue(true, 0) this:RefreshEnergyShow() -- 检测引导 GuideManager.CheckCarbonGuild(CARBON_TYPE.ENDLESS) end function EndLessMapView:OnShow() if not this:IsEndLessMap() then return end -- 避免其他界面打开时不刷新问题 -- 界面再次打开时,如果没有主动刷新过,则不需要刷新显示 --if not EndLessMapManager.isUpdateOnClose and not EndLessMapManager.openedFormat then -- this:GetBagEnergy() -- EndLessMapManager.isUpdateOnClose = false --end BindRedPointObject(RedPointType.wujinBianDui,this.btnFormatRed) -- 如果全屏界面打开时刷新过,重新激活界面需要刷新一次 if EndLessMapManager.isUpdateOnClose then this.GetBagEnergy() EndLessMapManager.isUpdateOnClose = false end -- 从编队界面切换回来,刷新事件点的战力显示 if EndLessMapManager.openedFormat then pointView.RefreshAtkShow() end EndLessMapManager.openedFormat = false this.isPanelClose = false -- 刷新倒计时显示 this:ShowCountTime() this:RefreshTargetRoote() NetManager.RequestAllHeroHp(function () EndLessMapManager.RrefreshFormation() this:ShowHeroData() end) end function EndLessMapView:ShowHeroData() local curFormation = EndLessMapManager.formation if not this.heroList then this.heroList = {} end for k = 1, #this.heroList do if this.heroList[k] and this.heroList[k].go then this.heroList[k].go.gameObject:SetActive(false) end end if not curFormation or #curFormation < 1 then this.selectHeroTip1.gameObject:SetActive(true) return end this.selectHeroTip1.gameObject:SetActive(false) for i, v in ipairs(curFormation) do if not this.heroList[i] then 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) this.heroList[i].frame.sprite = this.spLoader:LoadSprite(GetHeroQuantityImageByquality(heroData.heroConfig.Quality, heroData.star)) SetHeroIcon(this.spLoader,heroData,this.heroList[i].icon,heroData.heroConfig) this.heroList[i].pro.sprite = this.spLoader:LoadSprite(GetProStrImageByProNum(heroData.heroConfig.PropertyName)) this.heroList[i].lv.text=heroData.lv --spLoader, starGrid, star, type,_starSize,_scale,_pivot,rotation SetHeroStars(this.spLoader,this.heroList[i].star, heroData.star) local heroData1 = EndLessMapManager.allHeroBlood[v.heroId] --血量相关 this.heroList[i].hpExp.value=heroData1.percentHp Util.SetGray(this.heroList[i].go,heroData1.percentHp<=0)--死啦 Util.AddOnceClick( this.heroList[i].go,function() UIManager.OpenPanel(UIName.RoleInfoPopup, heroData) end) end end function EndLessMapView:RefreshTargetRoote() -- 0 "已领取" -- 1 "领取" -- 2 "前往" this.curMission = EndLessMapManager.GetRewardData() LogGreen(this.curMission.state.." this.curMission.state") if this.curMission.state == 2 then this.TargetBtn1.gameObject:SetActive(true) --未完成 this.TargetBtn2.gameObject:SetActive(false) --以达成 this.TargetRootText.text = string.format("%s(%s/%s)",this.curMission.Desc,this.curMission.progress,this.curMission.value) else this.TargetBtn1.gameObject:SetActive(false) this.TargetBtn2.gameObject:SetActive(true) if this.curMission.index == #EndLessMapManager.mission and this.curMission.state == 0 then this.TargetRootText.text = "已完成全部任务" else this.TargetRootText.text = string.format("%s(%s/%s)",this.curMission.Desc,this.curMission.value,this.curMission.value) end end end function EndLessMapView:SetShiQiValue() local cursinglePro local itemCount = BagManager.GetItemCountById(EndLessMapManager.shiQiValue) local id, lv = EndLessMapManager.GetShiQiValue() local oldId = 0 if lv ~= EndLessMapManager.moraleLv then isShow = true oldId = EndLessMapManager.moraleLv cursinglePro = endlessMorale[id] EndLessMapManager.moraleLv = lv EndLessMapManager.moraleId = id end this.shiQiProgress.text = (endlessMorale[id].Exp and endlessMorale[id].Exp[2] > 0) and itemCount.."/"..endlessMorale[id].Exp[2] or "1/1" this.shiQiLv.text = lv.."级" this.shiQifillAmount.fillAmount = (endlessMorale[id].Exp and endlessMorale[id].Exp[2] > 0) and itemCount/endlessMorale[id].Exp[2] or 1 -- 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 = ""..GetEquipPropertyFormatStr(upPro[cursinglePro.Props[i][1]],PropertyConfig[cursinglePro.Props[i][1]].Style).."" -- 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 end function EndLessMapView:InitCompShow(carbonType) if carbonType ~= CARBON_TYPE.ENDLESS then return end 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) this.endLessTreasure.gameObject:SetActive(true) end -- ================================================ -- ============ 初始化设置 ========================= function EndLessMapView:IsEndLessMap() return CarbonManager.difficulty == CARBON_TYPE.ENDLESS end function EndLessMapView:SetTipShow() Log("MapManager.curMapId ========== " .. MapManager.curMapId) -- if not this:IsEndLessMap() then return end if not endLessData[MapManager.curMapId] then Log(Language[11278]) return end this.areaName.text = GetLanguageStrById(endLessData[MapManager.curMapId].Info) EndLessMapManager.curMapName = GetLanguageStrById(endLessData[MapManager.curMapId].Info) end function EndLessMapView:InitBoolState() --EndLessMapManager.isCanNote = false EndLessMapManager.justEnterMap = true EndLessMapManager.isReset = false end -- =================================================== -- ========= 各种按键操作的设置 ========================= -- -- 标记设置 -- 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 -- 按钮可点击的判断 function EndLessMapView:CanClick() local canClick = true -- 如果正在触发事件,不可复位 if ctrlView.GetTriggerState() then PopupTipPanel.ShowTip(Language[11280]) return false end -- 正在寻路 if ctrlView.GetCallListCount() > 1 then PopupTipPanel.ShowTip(Language[11281]) return false end return canClick end --- ============= 行动力刷新显示 ============================== function EndLessMapView:OnRoleMove(u, v) -- 只有无尽副本才执行 if not this:IsEndLessMap() then return end this:RefreshEnergyValue(false, COST_TYPE.WALK) end -- 初始化数值 function EndLessMapView:InitCostValue() local mapData = endLessData[MapManager.curMapId] walkCost = mapData.WalkCost deadCost = mapData.DeathCost -- 同步一次道具数据 this.GetBagEnergy() -- 显示你有多少钱钱 this.moneyNum:GetComponent("Text").text = BagManager.GetTotalItemNum(1201) this.moneyIcon:GetComponent("Image").sprite = SetIcon(this.spLoader, 1201) end -- 根据类型刷新行动力数值 function EndLessMapView:RefreshEnergyValue(isInit, costType) -- 只是初始化返回 -- LogBlue("两次吧") if isInit then return end if EndLessMapManager.justEnterMap then EndLessMapManager.justEnterMap = false Log("刚进图的那一步不扣行动力") 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 -- this.PlayWarnEffect() end -- 死翘翘 elseif costType == COST_TYPE.DEAD then -- 传送 elseif costType == COST_TYPE.TRANSPORT then end EndLessMapManager.leftEnergy = curEnergy EndLessMapManager.isHungery() this:RefreshEnergyShow() -- MapManager.MapUpdateEvent(-1000, function () -- this:ShowCountTime() -- end) end -- 刷新行动力组件显示 function EndLessMapView:RefreshEnergyShow() local curEnergy = EndLessMapManager.leftEnergy if curEnergy <= 0 then ctrlView.StopWalk() end -- 设置一下颜色 local str = "" if curEnergy <= 5 then str = string.format("%s", tostring(curEnergy)) else str = tostring(curEnergy) end this.energyInfo.text = str this.totalEnergy.text = "" end -- 刷新数值 function this.GetBagEnergy() -- 无尽副本才刷新 if not this:IsEndLessMap() then return end EndLessMapManager.leftEnergy = BagManager.GetItemCountById(1) Log("获取背包剩余行动力" .. BagManager.GetItemCountById(1)) EndLessMapManager.isHungery() this:RefreshEnergyShow() -- 显示你有多少钱钱 this.moneyNum:GetComponent("Text").text = BagManager.GetTotalItemNum(1201) this.moneyIcon:GetComponent("Image").sprite = SetIcon(this.spLoader, 1201) this:SetShiQiValue() end -- 无尽副本中角色死翘翘 function EndLessMapView:OnRoleDead() -- this:RefreshEnergyValue(false, COST_TYPE.DEAD) -- -- 死亡退出触发事件状态 -- EndLessMapManager.isTrigger = false -- -- 看看是否是死光光了 -- if EndLessMapManager.IsAllDead() then -- PopupTipPanel.ShowTip(Language[11282]) -- this:ResetRoleState() -- end end -- 无尽副本在地图之间传送 function EndLessMapView:OnRoleTransport(func) EndLessMapManager.GetLeftEnergy(function () this:RefreshEnergyValue(false, COST_TYPE.TRANSPORT) if func then func() end end) end -- 行动力警告特效 -- function this.PlayWarnEffect() -- this.warn:SetActive(true) -- local timer = Timer.New(function () -- this.warn:SetActive(false) -- end, 1.6) -- timer:Start() -- end -- 行动力是否显示倒计时 function EndLessMapView:ShowCountTime() if this.timer then this.timer:Stop() this.timer = nil end this.actCountTime.text = "" this.bgTime:SetActive(true) this.timer = Timer.New(function () local leftTime = AutoRecoverManager.GetRecoverTime(1) if leftTime < 0 then leftTime = 0 end if not this.isPanelClose then this.actCountTime.text = GetTimeMaoHaoStrBySeconds(math.floor(leftTime)).."后恢复1点" end end, 1, -1, true) this.timer:Start() end --- ========================================================== function EndLessMapView:OnClose() if not this:IsEndLessMap() then return end -- this.warn:SetActive(false) Util.ClearChild(this.selectHeroGrid.transform) ClearRedPointObject(RedPointType.wujinBianDui,this.btnFormatRed) this.heroList = {} this.isPanelClose = true EndLessMapManager.isUpdateOnClose = false if this.timer then this.timer:Stop() this.timer = nil end 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 if UIManager.IsOpen(UIName.HelpPopup) then UIManager.ClosePanel(UIName.HelpPopup) end end function EndLessMapView:OnDestroy() this.spLoader:Destroy() if not this:IsEndLessMap() then return end ClearRedPointObject(RedPointType.wujinTreasure,this.endLessTreasureRed) ClearRedPointObject(RedPointType.wujinMission,this.btnNoteRed) end return EndLessMapView