require("Base/BasePanel") FightPointPassMainPanel = Inherit(BasePanel) local this = FightPointPassMainPanel -- 外地入侵模块 local invadeMonster = require("Modules/Fight/View/InvadeMonsterView") -- 小人行动 --local roleWalkView = require("Modules/Fight/View/RoleShowView") -- 小地图 local fightMap = require("Modules/Fight/View/FightPointMapView") local fightLevelConfig = ConfigManager.GetConfig(ConfigName.MainLevelConfig) local fightLevelSetConfig = ConfigManager.GetConfig(ConfigName.MainLevelSettingConfig) local points = {} local isCounting = false local orginLayer=0 local hasLoad = false this.funcBtnList = {} local curMianTaskData = {} local timePressStarted local callBack local count = 1 local timeImg = { [1] = "r_guanka_daojishi_01", [2] = "r_guanka_daojishi_02", [3] = "r_guanka_daojishi_03", [4] = "r_guanka_daojishi_04", [5] = "r_guanka_daojishi_05", } -- 关卡颜色文字 local textColor = { [FightDifficultyState.SimpleLevel] = "F1E1C0FF", [FightDifficultyState.NrmalLevel] = "F1E1C0FF", [FightDifficultyState.DifficultyLevel] = "F1E1C0FF", [FightDifficultyState.HellLevel] = "F1E1C0FF", [FightDifficultyState.NightmareLevel] = "F1E1C0FF", } -- 是否激活了动画 local isAnimActive = false local chooseAnim = 0 -- 转场动画 local fightAnimRes = "live2d_guaji_yuguai" -- local fightSkeleton local fightAnim = { [2] = "diban", [3] = "xiaoguai", [4] = "bnoss", [1] = "idle", } local mapNpc = "live2d_npc_map" local mapNpc2 = "live2d_npc_map_nv" local npc, scale --初始化组件(用于子类重写) function FightPointPassMainPanel:InitComponent() invadeMonster:InitComponent(self.gameObject, this) fightMap:InitComponent(self.gameObject, this) isAnimActive = false --头像、战力 this.level = Util.GetGameObject(self.gameObject, "Bg/LeftUp/headBox/lvFrame/lv"):GetComponent("Text") this.playName = Util.GetGameObject(self.gameObject, "Bg/LeftUp/headBox/name"):GetComponent("Text") this.expSliderValue = Util.GetGameObject(self.gameObject, "Bg/LeftUp/headBox/exp"):GetComponent("Slider") this.headBox = Util.GetGameObject(self.gameObject, "Bg/LeftUp/headBox") this.headPos = Util.GetGameObject(self.gameObject, "Bg/LeftUp/headBox/headpos") this.headRedpot = Util.GetGameObject(self.gameObject, "Bg/LeftUp/headBox/redpot") this.teamPower = Util.GetGameObject(self.gameObject, "Bg/LeftUp/powerBtn/value"):GetComponent("Text") -- 通关豪礼入口 this.pgBtn=Util.GetGameObject(self.gameObject,"LeftUp/box/passGift") this.pgFrame=Util.GetGameObject(this.pgBtn,"frame"):GetComponent("Image") this.pgHead=Util.GetGameObject(this.pgBtn,"head"):GetComponent("Image") this.pgGive=Util.GetGameObject(this.pgBtn,"give"):GetComponent("Text") this.pgName=Util.GetGameObject(this.pgBtn,"name"):GetComponent("Text") this.pgInfo=Util.GetGameObject(this.pgBtn,"info"):GetComponent("Text") this.pgEffect=Util.GetGameObject(this.pgBtn,"effect") -- 四个小按钮 this.btnDailyMission = Util.GetGameObject(self.gameObject, "Bg/btnGroup/btnDailyMission") this.btnRank = Util.GetGameObject(self.gameObject, "Bg/btnGroup/btnRank") -- 关卡小地图 this.btnMap = Util.GetGameObject(self.gameObject, "Bg/btnArea") this.btnMapRadarBG = Util.GetGameObject(self.gameObject, "Bg/btnArea/RadarBG/RadarBG"):GetComponent("Image") this.RadarBGText = Util.GetGameObject(self.gameObject, "Bg/btnArea/RadarBGTextBg/RadarBGText"):GetComponent("Text") this.areaName = Util. GetGameObject(this.btnMap, "areaName"):GetComponent("Text") this.chapterName = Util.GetGameObject(this.btnMap, "chapterName"):GetComponent("Text") this.map=Util.GetGameObject(self.gameObject, "Bg/btnArea/MapMask/Map"):GetComponent("RectTransform") this.mapImage=Util.GetGameObject(self.gameObject,"Bg/btnArea/MapMask/Map"):GetComponent("Image") for i = 1, 20 do points[i]=Util.GetGameObject(self.gameObject, "Bg/btnArea/MapMask/Map/mapAreaPre (".. i ..")") end -- 挂机奖励 this.rewardList = {} this.rewardItemPre = Util.GetGameObject(self.gameObject, "Bg/rewardContent/item") this.rewardGrid = Util.GetGameObject(self.gameObject, "Bg/rewardContent") this.btnrewardDetail = Util.GetGameObject(self.gameObject, "Bg/btnRdDetail/click") this.btnFight = Util.GetGameObject(self.gameObject, "Bg/btnDown/btnFight") this.fightText = Util.GetGameObject(this.btnFight, "Text"):GetComponent("Text") -- 你要变强 this.btnGetForce = Util.GetGameObject(self.gameObject, "Bg/btnDown/btnIWantMilk") this.BtView = SubUIManager.Open(SubUIConfig.BtView, self.gameObject.transform) this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform) -- 红点 this.dailyRedPoint = Util.GetGameObject(this.btnDailyMission, "redPoint") --this.rankRedPoint = Util.GetGameObject(this.btnRank, "redPoint") --this.funcBtnList[16] = invadeMonster.btnRewardOnline --this.funcBtnList[19] = invadeMonster.btnRewrdChapter this.funcBtnList[12] = this.btnDailyMission -- 主线任务显示 this.mainTask = Util.GetGameObject(self.gameObject, "Bg/RightDown/mainTask") this.titleText = Util.GetGameObject(self.gameObject, "Bg/RightDown/mainTask/progressLayout/titleText"):GetComponent("Text") this.progressText = Util.GetGameObject(self.gameObject, "Bg/RightDown/mainTask/progressLayout/progressText"):GetComponent("Text") this.getRewardButton = Util.GetGameObject(self.gameObject, "Bg/RightDown/mainTask/getRewardButton") this.mainTaskGRewardImage = Util.GetGameObject(self.gameObject, "Bg/RightDown/mainTask/getRewardButton/getRewardImage") this.mainTaskJumpImage = Util.GetGameObject(self.gameObject, "Bg/RightDown/mainTask/getRewardButton/jumpImage") this.mainTask:SetActive(false) this.GuideEffectGo = poolManager:LoadAsset("GuideEffect", PoolManager.AssetType.GameObject) this.GuideEffectGo.transform:SetParent(this.mainTaskGRewardImage.transform) this.GuideEffectGo.transform.localPosition = Vector3.zero this.GuideEffectGo.transform.localScale = Vector3.one Util.GetGameObject(this.GuideEffectGo, "GameObject"):SetActive(false) this.GuideJumpEffectGo = poolManager:LoadAsset("GuideEffect", PoolManager.AssetType.GameObject) this.GuideJumpEffectGo.transform:SetParent(this.mainTaskJumpImage.transform) this.GuideJumpEffectGo.transform.localPosition = Vector3.zero this.GuideJumpEffectGo.transform.localScale = Vector3.one Util.GetGameObject(this.GuideJumpEffectGo, "GameObject"):SetActive(false) this.GuideJumpEffectGo:SetActive(false) this.fightRP = Util.GetGameObject(this.btnFight, "redPoint") -- 按钮 this.fightLock = Util.GetGameObject(this.btnFight, "lock") this.lockText = Util.GetGameObject(this.fightLock, "Text"):GetComponent("Text") --倒计时5秒 this.timeRoot = Util.GetGameObject(this.btnFight, "countRoot") this.timeImg = Util.GetGameObject(this.timeRoot, "time"):GetComponent("Image") this.timeRoot:SetActive(false) -- -- 转场动画 -- local idle = function() -- if not isAnimActive then return end -- --Log("第 " .. count .. " 次执行这个函数" ) -- if count == 2 then -- --isAnimActive = false -- --count = 1 -- --fightSkeleton.AnimationState:SetAnimation(0, fightAnim[1], false) -- --this.SetAnimPanelState(false) -- else -- fightSkeleton.AnimationState:SetAnimation(0, fightAnim[chooseAnim], false) -- count = count + 1 -- this.animTimer = nil -- this.animTimer = Timer.New(function () -- isAnimActive = false -- count = 1 -- fightSkeleton.AnimationState:SetAnimation(0, fightAnim[1], false) -- this.SetAnimPanelState(false) -- UIManager.OpenPanel(UIName.FormationPanel, FORMATION_TYPE.STORY, FightPointPassManager.curOpenFight) -- end, 1) -- this.animTimer:Start() -- -- 第一个动画播放完毕之后 -- this.PlayInfoAnim(false, FightPointPassManager.IsFightBoss()) -- end -- end -- this.swicthPanel = Util.GetGameObject(self.gameObject, "SwitchAnim") -- this.animGo = poolManager:LoadLive(fightAnimRes, this.swicthPanel.transform, Vector3.one, Vector3.one) -- fightSkeleton = this.animGo:GetComponent("SkeletonGraphic") -- fightSkeleton.AnimationState.Complete = fightSkeleton.AnimationState.Complete + idle -- poolManager:SetLiveClearCall(fightAnimRes, this.animGo, function() -- fightSkeleton.AnimationState.Complete = fightSkeleton.AnimationState.Complete - idle -- end) -- this.fightInfo = Util.GetGameObject(self.gameObject, "Bg/Image/info"):GetComponent("Text") -- this.imgInfo = Util.GetGameObject(self.gameObject, "Bg/Image") FightPointPassManager.GetLastFightID() --寻宝入口 this.btnFindTreasure = Util.GetGameObject(self.gameObject, "Bg/RightUpVertical/btnFindTreasure/Button") this.btnFindTreasureImage = Util.GetGameObject(self.gameObject, "Bg/RightUpVertical/btnFindTreasure/Button/RadarBG"):GetComponent("Image") this.btnFindTreasureText = Util.GetGameObject(self.gameObject, "Bg/RightUpVertical/btnFindTreasure/Image/num"):GetComponent("Text") this.btnFindTreasureredPoint = Util.GetGameObject(self.gameObject, "Bg/RightUpVertical/btnFindTreasure/redPoint") --解锁功能 this.openFun = Util.GetGameObject(self.gameObject, "Bg/RightUpVertical/openFun") this.openFunNeedInfo = Util.GetGameObject(self.gameObject, "Bg/RightUpVertical/openFun/needInfo"):GetComponent("Text") this.openFunFunInfo = Util.GetGameObject(self.gameObject, "Bg/RightUpVertical/openFun/funInfo"):GetComponent("Text") -- 特权 this.vipPrivilegeBtn = Util.GetGameObject(self.gameObject, "Bg/LeftUp/vipPrivilege/vipPrivilegeBtn") this.vipLevelText = Util.GetGameObject(this.vipPrivilegeBtn, "bg/vip"):GetComponent("Image") this.vipRedPoint = Util.GetGameObject(self.gameObject, "Bg/LeftUp/vipPrivilege/redPoint") screenAdapte(this.vipPrivilegeBtn) -- 开服福利 this.UI_Effect_MuBiaoJiangLi = Util.GetGameObject(self.gameObject, "Bg/LeftUp/box/btnOpenSeverWelfare/UI_Effect_MuBiaoJiangLi") this.btnOpenSeverWelfare = Util.GetGameObject(self.gameObject, "Bg/LeftUp/box/btnOpenSeverWelfare") this.OpenSeverWelfare = Util.GetGameObject(self.gameObject, "Bg/LeftUp/box/btnOpenSeverWelfare/bg") this.OpenSeverWelfareicon = Util.GetGameObject(this.UI_Effect_MuBiaoJiangLi, "UI_MuBiaoJiangLi_Import_05"):GetComponent("Image") this.OpenSeverWelfareiconText = Util.GetGameObject(this.OpenSeverWelfare, "iconText"):GetComponent("Image") this.OpenSeverWelfareProgressText = Util.GetGameObject(this.OpenSeverWelfare, "progressBg/progress"):GetComponent("Text") this.OpenSeverWelfareProgressImage = Util.GetGameObject(this.OpenSeverWelfare, "progressBg/progressImage"):GetComponent("Image") this.OpenSeverWelfareTimeText = Util.GetGameObject(this.OpenSeverWelfare, "time"):GetComponent("Text") this.OpenSeverWelfareInfoText = Util.GetGameObject(this.OpenSeverWelfare, "info"):GetComponent("Text") this.OpenSeverWelfareRed = Util.GetGameObject(this.OpenSeverWelfare, "redpot") end --绑定事件(用于子类重写) function FightPointPassMainPanel:BindEvent() invadeMonster:BindEvent() -- 日常任务 Util.AddClick(this.btnDailyMission, function () FightPointPassManager.isBeginFight = true UIManager.OpenPanel(UIName.MissionDailyPanel) end) -- 关卡排行 Util.AddClick(this.btnRank, function () --PopupTipPanel.ShowTip("关卡排行!") FightPointPassManager.isBeginFight = true --UIManager.OpenPanel(UIName.FightPointPassRankPopup) UIManager.OpenPanel(UIName.RankingSingleListPanel,rankKingList[1]) end) -- 挂机奖励 Util.AddClick(this.btnrewardDetail, function () UIManager.OpenPanel(UIName.FightAreaRewardPopup) end) -- 我要喝牛奶变强 Util.AddClick(this.btnGetForce, function () UIManager.OpenPanel(UIName.GiveMePowerPanel) end) Util.AddClick(this.btnFight, function () this.ExcuteBattle() end) Util.AddClick(this.btnMap, function () if not FightPointPassManager.IsChapterClossState() then UIManager.OpenPanel(UIName.FightSmallChoosePanel, FightPointPassManager.lastPassFightId) else UIManager.OpenPanel(UIName.FightSmallChoosePanel, FightPointPassManager.curOpenFight) end end) Util.AddClick(this.headBox, function () UIManager.OpenPanel(UIName.SettingPanel) end) --特权 Util.AddClick(this.vipPrivilegeBtn, function() UIManager.OpenPanel(UIName.VipPanelV2) end) --通关豪礼 Util.AddClick(this.pgBtn,function() FightPointPassManager.isBeginFight = true UIManager.OpenPanel(UIName.PassGiftPopup) end) --寻宝 Util.AddClick(this.btnFindTreasure,function() if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.FINDTREASURE) then UIManager.OpenPanel(UIName.FindTreasureMainPanel) else PopupTipPanel.ShowTip(ActTimeCtrlManager.GetFuncTip(FUNCTION_OPEN_TYPE.FINDTREASURE)) end end) Util.AddClick(this.vipPrivilegeBtn, function() UIManager.OpenPanel(UIName.VipPanelV2) end) Util.AddClick(this.btnOpenSeverWelfare, function() UIManager.OpenPanel(UIName.OpenSeverWelfarePanel) end) BindRedPointObject(RedPointType.DailyTaskMain, this.dailyRedPoint) BindRedPointObject(RedPointType.Setting, this.headRedpot) BindRedPointObject(RedPointType.VipPrivilege, this.vipRedPoint) BindRedPointObject(RedPointType.SecretTer_IsCanFight, this.fightRP) end function this.SetInitAnim() -- 隐藏界面特效 -- count = 1 -- this.GuideEffectGo:SetActive(false) -- this.GuideJumpEffectGo:SetActive(false) fightMap.StopAction() -- this.swicthPanel:SetActive(true) -- this.SetAnimPanelState(true) -- fightSkeleton.AnimationState:SetAnimation(0, fightAnim[2], false) -- isAnimActive = true -- chooseAnim = FightPointPassManager.IsFightBoss() and 4 or 3 UIManager.OpenPanel(UIName.FightLevelSwitchPopup, true) end -- 隐藏显示面板 -- function this.SetAnimPanelState(isShow) -- local offset = isShow and 0 or 2000 -- this.swicthPanel.transform.localPosition = Vector3.New(offset, 0, 0 ) -- end --添加事件监听(用于子类重写) function FightPointPassMainPanel:AddListener() invadeMonster:AddListener() fightMap:AddListener() Game.GlobalEvent:AddEvent(GameEvent.Player.OnPlayerLvChange, this.FreshPlayerInfo) Game.GlobalEvent:AddEvent(GameEvent.FunctionCtrl.OnFunctionOpen, this.BtnsIsOpen) Game.GlobalEvent:AddEvent(GameEvent.Bag.BagGold, this.UpdateFindTreasureMaterialNum) Game.GlobalEvent:AddEvent(GameEvent.FindTreasure.RefreshFindTreasureRedPot, this.RefreshFindTreasureRedPoint) Game.GlobalEvent:AddEvent(GameEvent.Mission.GetOpenServerRewardRefreshFightPoint, this.UpdateOpenSeverWelfare) end --移除事件监听(用于子类重写) function FightPointPassMainPanel:RemoveListener() invadeMonster:RemoveListener() fightMap:RemoveListener() Game.GlobalEvent:RemoveEvent(GameEvent.Player.OnPlayerLvChange, this.FreshPlayerInfo) Game.GlobalEvent:RemoveEvent(GameEvent.FunctionCtrl.OnFunctionOpen, this.BtnsIsOpen) Game.GlobalEvent:RemoveEvent(GameEvent.Bag.BagGold, this.UpdateFindTreasureMaterialNum) Game.GlobalEvent:RemoveEvent(GameEvent.FindTreasure.RefreshFindTreasureRedPot, this.RefreshFindTre3asureRedPoint) Game.GlobalEvent:RemoveEvent(GameEvent.Mission.GetOpenServerRewardRefreshFightPoint, this.UpdateOpenSeverWelfare) end --界面打开时调用(用于子类重写) function FightPointPassMainPanel:OnOpen(func) this.UpView:OnOpen({ showType = UpViewOpenType.ShowRight, panelType = PanelType.FightPointPass }) this.BtView:OnOpen({ sortOrder = self.sortingOrder, panelType = PanelTypeView.JieLing }) callBack = nil if func then callBack = func end end -- 从战斗出来会加载两次 function FightPointPassMainPanel:OnShow() if FightPointPassManager.GetIsOpenRewardUpTip() then UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.Onhook) end this.RefreshLittleMap() this.RefreshPassGiftShow() SoundManager.PlayMusic(SoundConfig.BGM_Main) -- 调用onshow invadeMonster:OnShow() if not hasLoad then timePressStarted = Time.realtimeSinceStartup isAnimActive = false local curName = fightLevelConfig[FightPointPassManager.curOpenFight].Name local curDifficulty = fightLevelConfig[FightPointPassManager.curOpenFight].Difficulty local chapterId = 0 local str = "" if not FightPointPassManager.IsChapterClossState() then chapterId = math.floor(FightPointPassManager.lastPassFightId / 1000) str = fightLevelConfig[FightPointPassManager.lastPassFightId].Name else str = string.format("%s ", textColor[curDifficulty], curName) chapterId = FightPointPassManager.GetCurChapterIndex() end this.areaName.text = str this.chapterName.text = fightLevelSetConfig[chapterId].Name this.FreshPlayerInfo() this.InitShow() -- 奖励预览 this.IntiReward() isCounting = false -- 加载地图数据 fightMap:Init() FightPointPassManager.isBattleBack = false hasLoad = true this:Update() this.FreshVip() if callBack then callBack() callBack = nil end end this.BtnsIsOpen() --寻宝显示 this.UpdateFindTreasureMaterialNum() local openFunConFig = this.GetNextFightOpenFun() if openFunConFig then this.openFun:SetActive(true) this.openFunNeedInfo.text = ConfigManager.GetConfigData(ConfigName.MainLevelConfig,openFunConFig.OpenRules[2]).Name this.openFunFunInfo.text = Language[10584]..openFunConFig.Name else this.openFun:SetActive(false) end --开服福利显示 this.UpdateOpenSeverWelfare() end --寻宝显示 function this.UpdateFindTreasureMaterialNum() local mazeTreasureMax = ConfigManager.GetConfigData(ConfigName.PlayerLevelConfig,PlayerManager.level).MazeTreasureMax this.btnFindTreasureImage.fillAmount = BagManager.GetItemCountById(FindTreasureManager.materialItemId) / mazeTreasureMax this.btnFindTreasureText.text = BagManager.GetItemCountById(FindTreasureManager.materialItemId) this.RefreshFindTreasureRedPoint() end function this.RefreshFindTreasureRedPoint() this.btnFindTreasureredPoint:SetActive(FindTreasureManager.RefreshFindTreasureRedPoint()) end -- -- 小怪 258 boss 570 -- -- 播放那个动画 -- function this.PlayInfoAnim(isInit, isBoss) -- if isInit then -- this.imgInfo.transform.localPosition = Vector3.New(0, -187, 0) -- this.imgInfo:SetActive(false) -- else -- this.imgInfo:SetActive(true) -- local targetPos = Vector3.zero -- targetPos = isBoss and Vector3.New(0, 570, 0) or Vector3.New(0, 288, 0) -- this.imgInfo:GetComponent("RectTransform"):DOAnchorPos(targetPos, 0.3, false):OnComplete(function () -- --this.imgInfo:SetActive(false) -- end) -- this.imgInfo:GetComponent("Image"):DOFade(1, 0.3):OnComplete(function () -- end) -- end -- end local isCanShowMainTaskJumpEffect = true function this:Update() if curMianTaskData and curMianTaskData.state == 0 then if isCanShowMainTaskJumpEffect then if Time.realtimeSinceStartup - timePressStarted > 5 then isCanShowMainTaskJumpEffect = false this.GuideJumpEffectGo:SetActive(true) end end if Input.GetMouseButtonDown(0) then timePressStarted = Time.realtimeSinceStartup isCanShowMainTaskJumpEffect = true this.GuideJumpEffectGo:SetActive(false) end end end -- 刷新特权显示 function this.FreshVip() this.vipLevelText.sprite = VipManager.SetVipLevelImg() end --按钮开启限制 function this.BtnsIsOpen() for i, v in pairs(this.funcBtnList) do local isOpen = ActTimeCtrlManager.SingleFuncState(i) v:SetActive(isOpen) end this.btnRank.gameObject:SetActive(ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.ALLRANKING)) end function this.InitShow() if not this.playerHead then this.playerHead = SubUIManager.Open(SubUIConfig.PlayerHeadView, this.headPos.transform) end this.playerHead:SetHead(PlayerManager.head) this.playerHead:SetFrame(PlayerManager.frame) this.playerHead:SetScale(Vector3.one * 0.9) this.playerHead:SetPosition(Vector3.New(-5, 0, 0)) end function this.IntiReward() local rewardData if FightPointPassManager.isOpenNewChapter then rewardData = fightLevelConfig[FightPointPassManager.curOpenFight].RewardShowMin else rewardData = fightLevelConfig[FightPointPassManager.lastPassFightId].RewardShowMin end for i = 1, #rewardData do if not this.rewardList[i] then local go = {} go.item = newObjToParent(this.rewardItemPre, this.rewardGrid) go.icon = Util.GetGameObject(go.item, "iconBg/icon"):GetComponent("Image") go.text = Util.GetGameObject(go.item, "rewardbg/context"):GetComponent("Text") this.rewardList[i] = go end this.rewardList[i].icon.sprite = SetIcon(rewardData[i][1]) local addValue = FightPointPassManager.GetItemVipValue(rewardData[i][1]) if addValue - 1 <= 0 then this.rewardList[i].text.text = string.format(Language[10585], rewardData[i][2]) else local valueShow = (addValue - 1) * 100 this.rewardList[i].text.text =" ×" ..rewardData[i][2].."(+"..valueShow..Language[10586] end end end -- 刷新玩家信息显示 function this.FreshPlayerInfo() this.level.text = PlayerManager.level this.expSliderValue.value = PlayerManager.exp / PlayerManager.userLevelData[PlayerManager.level].Exp this.playName.text = PlayerManager.nickName this.teamPower.text = FormationManager.GetFormationPower(FormationManager.curFormationIndex) this.SetFightBtnText() end --刷新通关豪礼主界面显示 function this.RefreshPassGiftShow() local mainLevelEndId=ConfigManager.TryGetConfigDataByKey(ConfigName.MainLevelConfig,"NextLevel",-1).Id--最高关卡 if FightPointPassManager.curOpenFight==mainLevelEndId then this.pgBtn:SetActive(false) return end if ActTimeCtrlManager.IsQualifiled(56) then this.pgBtn:SetActive(true) else this.pgBtn:SetActive(false) return end local liveId,tarPointId=ActivityGiftManager.GetNextHeroInfo() if liveId==0 or tarPointId==0 then this.pgBtn:SetActive(false) return end --通过立绘id在itemconfig表中读出herostar 已确定该id在heroconfig中的唯一值 local heroStar=ConfigManager.GetConfigData(ConfigName.ItemConfig,liveId).HeroStar[1] local heroData=ConfigManager.GetConfigData(ConfigName.HeroConfig,heroStar) this.pgHead.sprite=Util.LoadSprite(GetResourcePath(heroData.Icon)) this.pgFrame.sprite=SetFrame(liveId) if heroData.Natural==13 or heroData.Natural==14 then this.pgGive.text=Language[10587] elseif heroData.Natural==11 or heroData.Natural==12 then this.pgGive.text=Language[10588] end this.pgName.text=heroData.ReadingName this.pgInfo.text= Language[10356]..ActivityGiftManager.mainLevelConfig[tarPointId].Name end -- 设置挑战按钮文字 function this.SetFightBtnText() this.fightLock:SetActive(false) local isPass = FightPointPassManager.IsCanFight(FightPointPassManager.curOpenFight) if not isCounting then if not isPass then this.fightLock:SetActive(true) this.lockText.text = FightPointPassManager.GetBtnText() else this.fightText.text = FightPointPassManager.GetBtnText() end end end -- 执行关卡战斗 function this.ExcuteBattle() if not FightPointPassManager.IsChapterClossState() then UIManager.OpenPanel(UIName.FightMiddleChoosePanel, FightPointPassManager.curOpenFight, true,function () --- 临时代码 --FightPointPassManager.SetChapterOpenState(false) end) return end if isCounting then PopupTipPanel.ShowTip(Language[10589]) return end local curFightId = FightPointPassManager.curOpenFight local state, tip = FightPointPassManager.IsCanFight(curFightId) if state == -1 then PopupTipPanel.ShowTip(tip) return end if not state then PopupTipPanel.ShowTip(tip) return end this.SetInitAnim() end function FightPointPassMainPanel:OnSortingOrderChange() invadeMonster:OnSortingOrderChange() Util.AddParticleSortLayer(this.GuideEffectGo, self.sortingOrder - orginLayer) Util.AddParticleSortLayer(this.GuideJumpEffectGo, self.sortingOrder - orginLayer) Util.AddParticleSortLayer(this.pgEffect, self.sortingOrder - orginLayer) Util.AddParticleSortLayer(this.vipPrivilegeBtn, self.sortingOrder - orginLayer) Util.AddParticleSortLayer(this.UI_Effect_MuBiaoJiangLi, self.sortingOrder - orginLayer) fightMap:OnSortingOrderChange(self.sortingOrder) orginLayer = self.sortingOrder this.BtView:SetOrderStatus({ sortOrder = self.sortingOrder }) end --界面关闭时调用(用于子类重写) function FightPointPassMainPanel:OnClose() hasLoad = false invadeMonster:OnClose() fightMap:Dispose() if this.animTimer then this.animTimer:Stop() end this.animTimer = nil if this.liveNode then --Log("==YSP== 删除立绘") poolManager:UnLoadLive(npc, this.liveNode) this.liveNode=nil end if this.timer then this.timer:Stop() this.timer = nil end end --界面销毁时调用(用于子类重写) function FightPointPassMainPanel:OnDestroy() invadeMonster:OnDestroy() poolManager:UnLoadAsset("GuideEffect", this.GuideEffectGo, PoolManager.AssetType.GameObject) poolManager:UnLoadAsset("GuideEffect", this.GuideJumpEffectGo, PoolManager.AssetType.GameObject) poolManager:UnLoadLive(fightAnimRes, this.animGo, PoolManager.AssetType.GameObject) SubUIManager.Close(this.UpView) SubUIManager.Close(this.BtView) ClearRedPointObject(RedPointType.DailyTaskMain, this.DailyRedPoint) ClearRedPointObject(RedPointType.Setting, this.headRedpot) ClearRedPointObject(RedPointType.VipPrivilege, this.vipRedPoint) ClearRedPointObject(RedPointType.SecretTer_IsCanFight, this.fightRP) end --跳转显示新手提示圈 function FightPointPassMainPanel.ShowGuideGo(btnIndex) if btnIndex == 1 then--关卡 if this.btnFight then JumpManager.ShowGuide(UIName.FightPointPassMainPanel, this.btnFight) end elseif btnIndex == 6 then--在线 if invadeMonster.btnRewardOnline then JumpManager.ShowGuide(UIName.FightPointPassMainPanel, invadeMonster.btnRewardOnline) end elseif btnIndex == 5 then--章节奖励 if invadeMonster.btnRewrdChapter then JumpManager.ShowGuide(UIName.FightPointPassMainPanel, invadeMonster.btnRewrdChapter) end elseif btnIndex == 2 then--极速探索 if invadeMonster.btnFastExplore then JumpManager.ShowGuide(UIName.FightPointPassMainPanel, invadeMonster.btnFastExplore) end elseif btnIndex == 3 then--召唤外敌 if invadeMonster.callMonsterBtn then JumpManager.ShowGuide(UIName.FightPointPassMainPanel, invadeMonster.callMonsterBtn) end elseif btnIndex == 4 then--挂机宝箱 if invadeMonster.rewardBox then JumpManager.ShowGuide(UIName.FightPointPassMainPanel, invadeMonster.rewardBox) end end end --刷新小地图 function this.RefreshLittleMap() --获取数据 if not FightPointPassManager.IsChapterClossState() then this.integer, this.decimal = math.modf(FightPointPassManager.lastPassFightId/1000)--确定区域id else this.integer, this.decimal = math.modf(FightPointPassManager.curOpenFight/1000) end local data=ConfigManager.GetConfigData(ConfigName.MainLevelSettingConfig,this.integer)--获取这一区域所有数据 local difficulty=FightPointPassManager.curOpenFight%10 --确定当前区域难度 local curAllLevelNum = 0 --根据当前难度 检查对应区域数据 if difficulty==1 then this.CheckMapPointsData(data.SimpleLevel) curAllLevelNum = #data.SimpleLevel elseif difficulty==2 then this.CheckMapPointsData(data.NormalLevel) curAllLevelNum = #data.NormalLevel elseif difficulty==3 then this.CheckMapPointsData(data.DifficultyLevel) curAllLevelNum = #data.DifficultyLevel elseif difficulty==4 then this.CheckMapPointsData(data.HellLevel) curAllLevelNum = #data.HellLevel elseif difficulty==5 then this.CheckMapPointsData(data.NightmareLevel) curAllLevelNum = #data.NightmareLevel end --计算小地图当前点位 更换地图 local sonPoint = FightPointPassManager.GetLevelPointPosition() local parentPosX,parentPosY=FightPointPassManager.CalculateMapPointPos(this.map.transform,sonPoint) this.map.transform.anchoredPosition3D=Vector3(parentPosX,parentPosY-52.4,0) --52.4是策划的选择!! this.mapImage.sprite=Util.LoadSprite(data.ChapterBg) --加载立绘 if this.liveNode then return end npc = NameManager.roleSex == ROLE_SEX.BOY and mapNpc or mapNpc2 scale = NameManager.roleSex == ROLE_SEX.BOY and Vector3.one * 0.14 or Vector3.one * 0.07 local curLevel = 0 if not FightPointPassManager.IsChapterClossState() then curLevel = math.floor(FightPointPassManager.lastPassFightId/10)%100 else curLevel = math.floor(FightPointPassManager.curOpenFight/10)%100 end this.btnMapRadarBG.fillAmount = curLevel / curAllLevelNum this.RadarBGText.text = curLevel .."/".. curAllLevelNum this.liveNode = poolManager:LoadLive(npc, this.btnMap.transform, scale, Vector3.New(0,-52.4,0)) local SkeletonGraphic = this.liveNode:GetComponent("SkeletonGraphic") if SkeletonGraphic then SkeletonGraphic.AnimationState:SetAnimation(0, "move2", true) if FightPointPassManager.GetRoleDirection()==1 then SkeletonGraphic.transform.localEulerAngles = Vector3.New(0, 180, 0) else SkeletonGraphic.transform.localEulerAngles = Vector3.New(0, 0, 0) end end end --检查地图点数据 function this.CheckMapPointsData(pointsData) for i = 1, math.max(#pointsData, #points)do local go = points[i] if not go then go=newObject(points[1]) go.transform:SetParent(Util.GetGameObject(this.btnMap,"MapMask/Map").transform) go.transform.localScale = Vector3.one go.transform.localPosition=Vector3.zero; go.gameObject.name = "mapAreaPre (".. i ..")" points[i] = go end go.gameObject:SetActive(false) end --位置赋值 for i = 1, #pointsData do local data=ConfigManager.GetConfigData(ConfigName.MainLevelConfig, pointsData[i]) points[i].transform.anchoredPosition3D=Vector3(data.LevelPointPosition[1],data.LevelPointPosition[2],0) Util.GetGameObject(points[i].transform, "icon"):SetActive((math.floor((data.Id%100)/10))%5 ~= 0) Util.GetGameObject(points[i].transform, "icon2"):SetActive((math.floor((data.Id%100)/10))%5 == 0) end --显示位置点 for i = 1, #pointsData do points[i]:SetActive(true) end end --预先显示玩家等级 解锁的功能list function this.GetNextFightOpenFun() local nextFightId = 0 local nextFightSortId = ConfigManager.GetConfigData(ConfigName.MainLevelConfig,FightPointPassManager.curOpenFight).SortId - 1 for i, v in ConfigPairs(ConfigManager.GetConfig(ConfigName.GlobalSystemConfig)) do if v.OpenRules then if v.OpenRules[1] == 1 then--1关卡开启 local OpenRulesSortId = ConfigManager.GetConfigData(ConfigName.MainLevelConfig,v.OpenRules[2]).SortId if OpenRulesSortId > nextFightSortId and v.IsOpen == 1 and v.IsShow == 1 then if nextFightId == 0 then nextFightId = v.OpenRules[2] else if ConfigManager.GetConfigData(ConfigName.MainLevelConfig,nextFightId).SortId > OpenRulesSortId then nextFightId = v.OpenRules[2] end end end end end end for i, v in ConfigPairs(ConfigManager.GetConfig(ConfigName.GlobalSystemConfig)) do if v.OpenRules then if v.OpenRules[1] == 1 then--1关卡开启 if v.OpenRules[2] == nextFightId and v.IsOpen == 1 and v.IsShow == 1 then return v end end end end return nil end --开服福利显示 开始 local OpenSeverWelfareRewardShow = { [16] = {image1 = "r_guanka_guankajiangliyaojin",image2 = "r_guanka_guankajiangli01"}, [19] = {image1 = "r_guanka_guankajianglishenfu",image2 = "r_guanka_guankajiangli02"}, [81128] = {image1 = "r_guanka_guankajianglibaoxiang",image2 = "r_guanka_guankajiangli03"}, [11023] = {image1 = "r_guanka_guankajianglishunwukong",image2 = "r_guanka_guankajiangli04"}, } function this.UpdateOpenSeverWelfare() local mainLevelConfig = ConfigManager.GetConfig(ConfigName.MainLevelConfig) local activityRewardConfig = ConfigManager.GetConfig(ConfigName.ActivityRewardConfig) local activityId = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.OpenSeverWelfare) local activityData = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.OpenSeverWelfare) --LogGreen("#activityData.mission "..#activityData.mission) if activityId and activityId > 0 and activityData and #activityData.mission > 0 then ActivityGiftManager.OpenSeverWelfareRewardTabsSort(activityData.mission) local curMissionConfig = nil local isShowBtn = false for i = 1, #activityData.mission do if activityData.mission[i].state == 0 and not curMissionConfig then curMissionConfig = activityRewardConfig[activityData.mission[i].missionId] end if activityData.mission[i].state == 0 then isShowBtn = true end end this.btnOpenSeverWelfare:SetActive(isShowBtn) if not curMissionConfig then return end this.OpenSeverWelfareicon.sprite = Util.LoadSprite(OpenSeverWelfareRewardShow[curMissionConfig.Reward[1][1]].image1) this.OpenSeverWelfareiconText.sprite = Util.LoadSprite(OpenSeverWelfareRewardShow[curMissionConfig.Reward[1][1]].image2) this.OpenSeverWelfareicon:SetNativeSize() local curPassLevelSortId = FightPointPassManager.lastPassFightId ~= FightPointPassManager.curOpenFight and mainLevelConfig[FightPointPassManager.lastPassFightId].SortId or 0 local getRewardLevelSortId = mainLevelConfig[curMissionConfig.Values[1][1]].SortId this.OpenSeverWelfareRed:SetActive(curPassLevelSortId >= getRewardLevelSortId) curPassLevelSortId = curPassLevelSortId >= getRewardLevelSortId and getRewardLevelSortId or curPassLevelSortId this.OpenSeverWelfareProgressText.text = curPassLevelSortId .. "/" .. getRewardLevelSortId this.OpenSeverWelfareProgressImage.fillAmount =curPassLevelSortId/ getRewardLevelSortId this.OpenSeverWelfareInfoText.text = curMissionConfig.ContentsShow this.RemainTimeDown(this.btnOpenSeverWelfare,this.OpenSeverWelfareTimeText,activityData.endTime - GetTimeStamp()) else this.btnOpenSeverWelfare:SetActive(false) end end this.timer = Timer.New() --刷新倒计时显示 function this.RemainTimeDown(_timeTextExpertgo,_timeTextExpert,timeDown) if timeDown > 0 then if _timeTextExpertgo then _timeTextExpertgo:SetActive(true) end if _timeTextExpert then _timeTextExpert.text = GetLeftTimeStrByDeltaTime2(timeDown) end if this.timer then this.timer:Stop() this.timer = nil end this.timer = Timer.New(function() if _timeTextExpert then _timeTextExpert.text = GetLeftTimeStrByDeltaTime2(timeDown) end if timeDown < 0 then if _timeTextExpertgo then _timeTextExpertgo:SetActive(false) end this.timer:Stop() this.timer = nil end timeDown = timeDown - 1 end, 1, -1, true) this.timer:Start() else if _timeTextExpertgo then _timeTextExpertgo:SetActive(false) end end end --开服福利显示 结束 return FightPointPassMainPanel