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 fightOnHook = require("Modules/Fight/View/FightPointMapOnHook") local fightLevelConfig = ConfigManager.GetConfig(ConfigName.MainLevelConfig) local fightLevelSetConfig = ConfigManager.GetConfig(ConfigName.MainLevelSettingConfig) local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig) local points = {} local isCounting = false local orginLayer = 0 local hasLoad = false local hasMap = false this.funcBtnList = {} local curMianTaskData = {} local timePressStarted local callBack local count = 1 local maxKillNum = 10 local curKillNum = 0 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 --初始化组件(用于子类重写) function FightPointPassMainPanel:InitComponent() this.battleSceneLogicGameObject, this.battleSceneGameObject = BattleManager.CreateBattleScene(nil, nil) --创建战场Prefab --local battleCamera = Util.GetGameObject(self.battleSceneGameObject, "CameraRoot/CameraPos/Camera"):GetComponent( --"Camera") --local canvas = self.battleSceneLogicGameObject:GetComponent("Canvas") --canvas.camera = battleCamera fightOnHook:InitComponent(self.gameObject, this, this.battleSceneLogicGameObject, this.battleSceneGameObject) invadeMonster:InitComponent(self.gameObject, this) --this.RawBG = Util.GetGameObject(self.gameObject, "RawImage"):GetComponent("RawImage") local battleCamera = Util.GetGameObject(self.battleSceneGameObject, "CameraRoot/CameraPos/Camera"):GetComponent( "Camera") --battleCamera.targetTexture = this.RawBG.texture this.spLoader = SpriteLoader.New() isAnimActive = false --fightMap:InitComponent(self.gameObject, this) -- 通关豪礼入口 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") Util.GetGameObject(self.gameObject, "Bg/btnGroup/btnDailyMission/Image"):GetComponent("Image").sprite = this .spLoader:LoadSprite("UI_hz_lm_05") this.btnRank = Util.GetGameObject(self.gameObject, "Bg/btnGroup/btnRank") Util.GetGameObject(self.gameObject, "Bg/btnGroup/btnRank/Image"):GetComponent("Image").sprite = this.spLoader :LoadSprite("UI_hz_zhonghe05_14") -- 关卡小地图 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(self.gameObject, "Bg/chapter/areaName"):GetComponent("Text") this.chapterName = Util.GetGameObject(self.gameObject, "Bg/chapter/chapterName"):GetComponent("Text") SetEnglishActive(this.chapterName) 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.btnreward = Util.GetGameObject(self.gameObject, "Bg/getBoxReward/getBoxReward/btn") this.btnFight = Util.GetGameObject(self.gameObject, "Bg/btnDown/btnFight") this.fightText = Util.GetGameObject(this.btnFight, "Text"):GetComponent("Text") this.fightSaoGuang = Util.GetGameObject(this.btnFight, "saoguang") this.fightGuideEffect = Util.GetGameObject(this.btnFight, "GuideEffect") LanguageFontSizeFilter(this.fightText, 50) -- 你要变强 this.btnGetForce = Util.GetGameObject(self.gameObject, "Bg/btnDown/btnIWantMilk") Util.GetGameObject(self.gameObject, "Bg/btnDown/btnIWantMilk/Text"):GetComponent("Text").text = "推荐阵容" this.milkRed = Util.GetGameObject(self.gameObject, "Bg/btnDown/btnIWantMilk/redPoint") this.hookKill = Util.GetGameObject(self.gameObject, "Bg/btnDown/hookKill") this.hookKillText = Util.GetGameObject(self.gameObject, "Bg/btnDown/hookKill/Text"):GetComponent("Text") this.red_light = Util.GetGameObject(self.gameObject, "Bg/red_light") this.red_light:SetActive(false) this.red_wei = Util.GetGameObject(self.gameObject, "Bg/red_light/wei") this.hookSkillBtn = Util.GetGameObject(self.gameObject, "Bg/red_light/skillBtn") if not this.playerInfoView then this.playerInfoView = SubUIManager.Open(SubUIConfig.PlayerInfoView, this.transform) end 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.goVipButton = Util.GetGameObject(self.gameObject, "Bg/RightDown/mainTask/progressLayout") 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.OpenTips = Util.GetGameObject(self.gameObject, "Bg/RightDown/OpenTips") this.OpenTipsTxt = Util.GetGameObject(self.gameObject, "Bg/RightDown/OpenTips/Image/Text"):GetComponent("Text") 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.btnFindTreasure:GetComponent("Image").sprite = this.spLoader:LoadSprite("hiddenweapon_icon1") --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.btnXiaoYao = Util.GetGameObject(self.gameObject, "Bg/RightUpVertical/xiaoyaoBtn") this.btnXiaoYao:GetComponent("Image").sprite = this.spLoader:LoadSprite("x_xiaoyaoyou_daanniu_zh") this.xiaoyaoRedPoint = Util.GetGameObject(self.gameObject, "Bg/RightUpVertical/xiaoyaoBtn/redPoint") this.funcBtnList[FUNCTION_OPEN_TYPE.XiaoYaoYou] = this.btnXiaoYao --数字游戏按钮 this.numberGameBtn = Util.GetGameObject(self.gameObject, "Bg/RightUpVertical/numberGameBtn") this.numberGameRed = Util.GetGameObject(self.gameObject, "Bg/RightUpVertical/numberGameBtn/redPoint") this.funcBtnList[FUNCTION_OPEN_TYPE.Number_Game] = this.numberGameBtn --解锁功能 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") --世界等级 Util.GetGameObject(self.gameObject, "Bg/RightUpVertical/worldLv/Text"):GetComponent("Text").text = "世界等级:" this.worldLv = Util.GetGameObject(self.gameObject, "Bg/RightUpVertical/worldLv/lv"):GetComponent("Text") -- 开服福利 --this.UI_Effect_MuBiaoJiangLi = Util.GetGameObject(self.gameObject, "Bg/LeftUp/box/btnOpenSeverWelfare/UI_Effect_MuBiaoJiangLi") this.btnOpenSeverWelfare = Util.GetGameObject(self.gameObject, "Bg/btnGroup/btnOpenSeverWelfare") this.btnFirstRechar = Util.GetGameObject(self.gameObject, "Bg/LeftUp/box/btnFirstRecharge") Util.GetGameObject(this.btnFirstRechar, "Image"):GetComponent("Image").sprite = this.spLoader:LoadSprite( "X1_zhucheng_chaozhishouchong") this.firstRedPoint = Util.GetGameObject(this.btnFirstRechar, "redPoint") this.OpenSeverWelfare = Util.GetGameObject(self.gameObject, "Bg/btnGroup/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.OpenSeverWelfareProgressBg = Util.GetGameObject(this.OpenSeverWelfare, "progressBg") this.OpenSeverWelfareProgressText = Util.GetGameObject(this.OpenSeverWelfare, "progressBg/progress"):GetComponent( "Text") this.OpenSeverWelfareProgressImage = Util.GetGameObject(this.OpenSeverWelfare, "progressBg/progressImage") :GetComponent("Slider") this.OpenSeverWelfareTimeText = Util.GetGameObject(this.OpenSeverWelfare, "time"):GetComponent("Text") this.OpenSeverWelfareTimeText.gameObject:SetActive(false) this.OpenSeverWelfareInfoText = Util.GetGameObject(this.OpenSeverWelfare, "info"):GetComponent("Text") this.OpenSeverWelfareRed = Util.GetGameObject(this.OpenSeverWelfare, "redpot") this.battleUpLvTip = Util.GetGameObject(self.gameObject, "Bg/btnDown/battleUpLvTip") this.battleUpLvTipImg = this.battleUpLvTip:GetComponent("Image") this.battleUpLvTipTxt = Util.GetGameObject(self.gameObject, "Bg/btnDown/battleUpLvTip/Text"):GetComponent("Text") this.battleLockGo = Util.GetGameObject(self.gameObject, "Bg/btnDown/battleUpLvTip/Image") --山河社稷图OpenPanel this.btnFightLevel = Util.GetGameObject(self.gameObject, "Bg/LeftUp/box/btnFightLevel") this.btnFightLevel:SetActive(false) -- this.funcBtnList[FUNCTION_OPEN_TYPE.FIGHTLEVEL] = this.btnFightLevel -- this.btnFightLevelRedPoint = Util.GetGameObject(this.btnFightLevel, "redPoint") 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[38]) end) -- 挂机奖励 Util.AddClick(this.btnrewardDetail, function() UIManager.OpenPanel(UIName.FightAreaRewardPopup) end) Util.AddClick(this.btnreward, function() UIManager.OpenPanel(UIName.FightAreaRewardPopup) end) -- 我要喝牛奶变强 Util.AddClick(this.btnGetForce, function() --UIManager.OpenPanel(UIName.GiveMePowerPanel) UIManager.OpenPanel(UIName.FormationExamplePopup) end) Util.AddClick(this.btnFight, function() this.ExcuteBattle() end) Util.AddClick(this.hookSkillBtn, function() this:PlayerKillAllSkill() 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.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.btnXiaoYao, function() XiaoYaoManager.OpenMapList() end) --数字游戏 Util.AddClick(this.numberGameBtn, function() --RatioNumberManager.SelectInit() UIManager.OpenPanel(UIName.RatioNumberLevelPanel) end) Util.AddClick(this.btnOpenSeverWelfare, function() UIManager.OpenPanel(UIName.OpenSeverWelfarePanel) end) -- Util.AddClick(this.btnFightLevel, function() -- UIManager.OpenPanel(UIName.FightLevelChapterPanel) -- end) Util.AddClick(this.goVipButton, function() UIManager.OpenPanel(UIName.VipPanelV2) end) Util.AddClick(this.btnFirstRechar, function() UIManager.OpenPanel(UIName.FirstRechargePanel) end) Util.AddClick(this.getRewardButton, function() local t, task = VipManager.GetVipTaskShowInFight() if t == 1 and task.state == VipTaskStatusDef.NotFinished then local taskConfigInfo = ConfigManager.GetConfigData(ConfigName.TaskConfig, task.missionId) JumpManager.GoJump(taskConfigInfo.Jump[1]) else UIManager.OpenPanel(UIName.VipPanelV2) end end) BindRedPointObject(RedPointType.DailyTaskMain, this.dailyRedPoint) BindRedPointObject(RedPointType.SecretTer_IsCanFight, this.fightRP) BindRedPointObject(RedPointType.XiaoYaoYouRedPoint, this.xiaoyaoRedPoint) BindRedPointObject(RedPointType.FirstRecharge, this.firstRedPoint) BindRedPointObject(RedPointType.numberGame, this.numberGameRed) BindRedPointObject(RedPointType.tuijianzhenrong, this.milkRed) -- BindRedPointObject(RedPointType.FightLevel, this.btnFightLevelRedPoint) end function this.SetInitAnim() -- 隐藏界面特效 -- count = 1 -- this.GuideEffectGo:SetActive(false) -- this.GuideJumpEffectGo:SetActive(false) -- this.swicthPanel:SetActive(true) -- this.SetAnimPanelState(true) -- fightSkeleton.AnimationState:SetAnimation(0, fightAnim[2], false) -- isAnimActive = true -- chooseAnim = FightPointPassManager.IsFightBoss() and 4 or 3 --fightMap.StopAction() fightOnHook.StopAction() UIManager.OpenPanel(UIName.FightLevelSwitchPopup, true) end function this:PlayerKillAllSkill() local offset = Vector3.zero local go = BattleManager.LoadAsset("Effect_c_jw_0003_attack_01", 10) go.transform:SetParent(self.gameObject.transform) go.transform.localScale = Vector3.one go.transform.localPosition = offset go:SetActive(true) --this.skillTimer = Timer.New(function() --fightMap.AllBattleEnd() --end, 3) this.skillTimer:Start() Timer.New(function() destroy(go) end, 5):Start() 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.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) Game.GlobalEvent:AddEvent(GameEvent.Player.OnShowBattleUpLvTip, this.RefreshBattleUpLvTip) Game.GlobalEvent:AddEvent(GameEvent.Player.OnPlayerLvChange, this.SetFightBtnText) Game.GlobalEvent:AddEvent(GameEvent.Player.OnPlayerLvChange, this.RefreshOpenTips) Game.GlobalEvent:AddEvent(GameEvent.DynamicTask.OnMissionChange, this.refreshVipTask) Game.GlobalEvent:AddEvent(GameEvent.JumpServerHeightLadder.UpdateWordLv, this.UpdateWordLv) Game.GlobalEvent:AddEvent(GameEvent.UI.OnOpen, this.OnUIOpen) Game.GlobalEvent:AddEvent(GameEvent.Guide.FuncGuideDone, this.OnFuncGuideDone) end --移除事件监听(用于子类重写) function FightPointPassMainPanel:RemoveListener() invadeMonster:RemoveListener() --fightMap:RemoveListener() 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) Game.GlobalEvent:RemoveEvent(GameEvent.Player.OnShowBattleUpLvTip, this.RefreshBattleUpLvTip) Game.GlobalEvent:RemoveEvent(GameEvent.Player.OnPlayerLvChange, this.SetFightBtnText) Game.GlobalEvent:RemoveEvent(GameEvent.Player.OnPlayerLvChange, this.RefreshOpenTips) Game.GlobalEvent:RemoveEvent(GameEvent.DynamicTask.OnMissionChange, this.refreshVipTask) Game.GlobalEvent:RemoveEvent(GameEvent.JumpServerHeightLadder.UpdateWordLv, this.UpdateWordLv) Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnOpen, this.OnUIOpen) Game.GlobalEvent:RemoveEvent(GameEvent.Guide.FuncGuideDone, this.OnFuncGuideDone) end --界面打开时调用(用于子类重写) function FightPointPassMainPanel:OnOpen(func) this.UpView:OnOpen({ showType = UpViewOpenType.ShowRight, panelType = PanelType.FightPointPass }) this.BtView:OnOpen(self, { sortOrder = self.sortingOrder, panelType = PanelTypeView.JieLing }) callBack = nil if func then callBack = func end end function FightPointPassMainPanel:OnFocus() local activityId = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.FirstRecharge) if activityId and activityId ~= 0 and ActTimeCtrlManager.SingleFuncState(1) then this.btnFirstRechar:SetActive(true) else this.btnFirstRechar:SetActive(false) end end -- 从战斗出来会加载两次 function FightPointPassMainPanel:OnShow() UIManager.camera.clearFlags = CameraClearFlags.Depth CheckRedPointStatus(RedPointType.XiaoYaoYouRedPoint) CheckRedPointStatus(RedPointType.numberGame) if this.battleSceneLogicGameObject ~= nil then this.battleSceneLogicGameObject:SetActive(true) end if this.battleSceneGameObject ~= nil then this.battleSceneGameObject:SetActive(true) end local activityId = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.FirstRecharge) if activityId and activityId ~= 0 and ActTimeCtrlManager.SingleFuncState(1) then this.btnFirstRechar:SetActive(true) else this.btnFirstRechar:SetActive(false) end local curFightId = FightPointPassManager.curOpenFight -- 功能引导存在时不再显示成长界面 if FightPointPassManager.GetIsOpenRewardUpTip() and not GuideManager.IsFunctionGuideExist() then local oldLevelId = FightPointPassManager.lastPassFightId local curLevelId = curFightId local oldLevelConFig = ConfigManager.GetConfigData(ConfigName.MainLevelConfig, oldLevelId) local curLevelConFig = ConfigManager.GetConfigData(ConfigName.MainLevelConfig, curLevelId) local data = {} data.title = "g_guanka_jianglitishen_zh" data.itemList = {} data.type = 1 for i = 1, #curLevelConFig.RewardShowMin do local oldsinglePro = oldLevelConFig.RewardShowMin[i] local cursinglePro = curLevelConFig.RewardShowMin[i] local singleItem = {} singleItem.icon = cursinglePro[1] singleItem.proName = GetLanguageStrById(itemConfig[cursinglePro[1]].Name) singleItem.proValue = oldsinglePro[2] if cursinglePro[2] - oldsinglePro[2] > 0 then singleItem.proValue1 = "" .. cursinglePro[2] .. "" .. Language[11567] else singleItem.proValue1 = "" .. cursinglePro[2] .. Language[11568] end table.insert(data.itemList, singleItem) end UIManager.OpenPanel(UIName.GeneralPopup, GENERAL_POPUP_TYPE.Onhook, data) end this.RefreshLittleMap() this.RefreshPassGiftShow() SoundManager.PlayMusic(SoundConfig.BGM_Main) -- 调用onshow invadeMonster:OnShow() local curName = GetLanguageStrById(fightLevelConfig[curFightId].Name) local curDifficulty = fightLevelConfig[curFightId].Difficulty local chapterId = 0 local str = "" if not FightPointPassManager.IsChapterClossState() then chapterId = math.floor(FightPointPassManager.lastPassFightId / 1000) str = GetLanguageStrById(fightLevelConfig[FightPointPassManager.lastPassFightId].Name) else str = string.format("%s ", textColor[curDifficulty], curName) chapterId = FightPointPassManager.GetCurChapterIndex() end this.areaName.text = str if GetCurLanguage() ~= 0 then this.areaName.gameObject.transform.localPosition = Vector2.New(0, 0) end this.chapterName.text = GetLanguageStrById(fightLevelSetConfig[chapterId].Name) -- 奖励预览 this.IntiReward() -- 刷新关卡按钮状态 this.SetFightBtnText() local loadMapName = fightLevelConfig[FightPointPassManager.curOpenFight].BG LogError("@@@@@@"..loadMapName) if this.mapName ~= loadMapName then this.mapName = loadMapName if this.mapGameObject ~= nil then GameObject.Destroy(this.mapGameObject) end this.mapGameObject = BattleManager.CreateMap(this.battleSceneGameObject, loadMapName) fightOnHook:UpdateMap(this.mapGameObject) end if not hasLoad then timePressStarted = Time.realtimeSinceStartup isAnimActive = false fightOnHook.Init() isCounting = false -- 加载地图数据 coroutine.start(function() -- coroutine.wait(0.01) if UIManager.IsOpen(UIName.FightPointPassMainPanel) then --fightMap:Init() hasMap = true end end) FightPointPassManager.isBattleBack = false hasLoad = true this:Update() if callBack then callBack() callBack = nil end end this.BtnsIsOpen() --寻宝显示 this.UpdateFindTreasureMaterialNum() this.worldLv.text = PlayerManager.worldLeve 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[12163] .. openFunConFig.Name else this.openFun:SetActive(false) end --开服福利显示 this.UpdateOpenSeverWelfare() PlayerManager.StarBattleUpLvTipTime(2) Util.GetGameObject(this.btnXiaoYao, "curValue/num"):GetComponent("Text").text = string.format("%d/%d", BagManager.GetItemCountById(UpViewRechargeType.YunYouVle), PrivilegeManager.GetPrivilegeNumber(39)) -- 刷新一次编队战斗力 FormationManager.RefreshMainFormationPower() PatFaceManager.RefreshPatface() -- 刷新任务显示 this.refreshVipTask() -- 刷新解锁信息显示 this.RefreshOpenTips() -- this.battleUpLvTip:SetActive(false) this.RefreshBattleUpLvTip(true) this.hookSkillBtn.gameObject:SetActive(false) local hangArr = fightLevelConfig[curFightId].Hang if hangArr and hangArr[1] > 0 then maxKillNum = hangArr[2] this.btnFight.gameObject:SetActive(false) this.hookKill.gameObject:SetActive(true) curKillNum = 0 this.hookKillText.text = string.format("%s/%s", curKillNum, maxKillNum) this.red_light:SetActive(true) this.red_light:GetComponent("Image"):DOFade(1, 0) this.red_light:GetComponent("Image"):DOFade(0, 1):SetEase(Ease.Linear):SetLoops(-1, 1) else this.btnFight.gameObject:SetActive(true) this.hookKill.gameObject:SetActive(false) end end ---播放“危”动画 function this.PlayWeiAnim() this.red_wei:SetActive(true) this.red_wei:GetComponent("Image"):DOFade(0, 0.5):SetEase(Ease.Linear):SetLoops(4, 1):OnComplete(function() this.red_wei:SetActive(false) this.hookSkillBtn.gameObject:SetActive(true) end) end -- 刷新任务显示 function this.refreshVipTask() local t, task = VipManager.GetVipTaskShowInFight() -- 满级后不再显示 --this.mainTask:SetActive(t ~= -1) this.mainTask:SetActive(false) if t == 0 then -- 能激活时显示激活特权 this.titleText.text = "前往升级特权" this.progressText.text = "" elseif t == 1 then -- 不能激活时显示任务 local taskConfigInfo = ConfigManager.GetConfigData(ConfigName.TaskConfig, task.missionId) local color = task.state == VipTaskStatusDef.CanReceive and UIColorStr.GREEN or UIColorStr.YELLOW this.titleText.text = GetLanguageStrById(taskConfigInfo.Desc) -- 避免显示的太长 if tonumber(taskConfigInfo.TaskValue[2][1]) < 10000 then this.titleText.text = this.titleText.text .. string.format("(%s/%s)", color, task.progress, taskConfigInfo.TaskValue[2][1]) end this.progressText.text = "" this.mainTaskGRewardImage:SetActive(task.state ~= VipTaskStatusDef.NotFinished) this.mainTaskJumpImage:SetActive(task.state == VipTaskStatusDef.NotFinished) end end -- 刷新提示文字显示 function this.RefreshOpenTips() local tips = FightPointPassManager.GetCurLevelTips() if tips then ---不显示该提示 this.OpenTips:SetActive(false) this.OpenTipsTxt.text = tips else this.OpenTips:SetActive(false) end 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 fightOnHook.Update() end --按钮开启限制 function this.BtnsIsOpen() for i, v in pairs(this.funcBtnList) do LogError("i===" .. i) local isOpen = ActTimeCtrlManager.SingleFuncState(i) v:SetActive(isOpen) end this.btnRank.gameObject:SetActive(ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.ALLRANKING)) 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(this.spLoader, rewardData[i][1]) local addValue = FightPointPassManager.GetItemVipValue(rewardData[i][1]) -- local totalCurNum,totalLv,totalNum = LikabilityManager.GetTotalHeroLikeLv(-1) -- local prolist = {} -- if totalLv > 0 then -- prolist = LikabilityManager.GetPrivilageProData(1,-1,totalLv) -- local priId = _ItemIdToVipPrivilege[rewardData[i][1]] -- if prolist[priId] then -- addValue = addValue + (prolist[priId]/10000) -- end -- end local baseValue = rewardData[i][2] if addValue - 1 <= 0 then this.rewardList[i].text.text = "+" .. rewardData[i][2] else local valueShow = math.round((addValue - 1) * baseValue) this.rewardList[i].text.text = string.format("+%s\n(+%s)", baseValue, valueShow) end end 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 = this.spLoader:LoadSprite(GetResourcePath(heroData.Icon)) this.pgFrame.sprite = SetFrame(this.spLoader, liveId) if heroData.Natural == 13 or heroData.Natural == 14 then this.pgGive.text = Language[10613] elseif heroData.Natural == 11 or heroData.Natural == 12 then this.pgGive.text = Language[10614] end this.pgName.text = GetLanguageStrById(heroData.ReadingName) this.pgInfo.text = Language[10309] .. GetLanguageStrById(ActivityGiftManager.mainLevelConfig[tarPointId].Name) end -- 打开引导界面时关闭小手提示 function this.OnUIOpen(id) if id == UIName.GuidePanel then this.fightGuideEffect:SetActive(false) end end -- 引导结束再显示小手 function this.OnFuncGuideDone() this.fightGuideEffect:SetActive(not GuideManager.IsInMainGuide() and not GuideManager.IsFunctionGuideExist()) end -- 设置挑战按钮文字 function this.SetFightBtnText() this.fightLock:SetActive(false) this.fightSaoGuang:SetActive(true) -- 没在主线引导种就显示小手 this.fightGuideEffect:SetActive(not GuideManager.IsInMainGuide() and not GuideManager.IsFunctionGuideExist()) local isPass = FightPointPassManager.IsCanFight(FightPointPassManager.curOpenFight) if not isCounting then if not isPass then this.fightLock:SetActive(true) this.fightSaoGuang:SetActive(false) this.fightGuideEffect:SetActive(false) this.lockText.text = FightPointPassManager.GetBtnText() else this.fightText.text = FightPointPassManager.GetBtnText() end end end -- 执行关卡战斗 function this.ExcuteBattle() if not FightPointPassManager.IsChapterClossState() then -- fightMap.StopAction() -- if hasMap then -- LogGreen("关闭挂机") -- fightMap:OnClose() -- hasMap = false -- end -- UIManager.OpenPanel(UIName.FightMiddleChoosePanel, FightPointPassManager.curOpenFight, true,function () -- --- 临时代码 -- --FightPointPassManager.SetChapterOpenState(false) -- end) -- 章节解锁时添加对话 FightPointPassManager.SetChapterOpenState(false) LogError("FightPointPassManager.lastPassFightId==" .. FightPointPassManager.lastPassFightId) LogError("FightPointPassManager.GetCurFightId()" .. FightPointPassManager.GetCurFightId()) local chapterId = math.floor(FightPointPassManager.lastPassFightId / 1000) LogError("chapterid===================" .. chapterId) local curChapterId = fightLevelSetConfig[chapterId].EventId if curChapterId > 0 then StoryManager.EventTrigger(curChapterId, function() LogGreen("打开挂机界面") UIManager.OpenPanel(UIName.FightPointPassMainPanel) end) else UIManager.OpenPanel(UIName.FightPointPassMainPanel) end return end if isCounting then PopupTipPanel.ShowTip(Language[10615]) 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 -- 判断是否是剧情节点 if fightLevelConfig[curFightId].StoryId > 0 then StoryManager.EventTrigger(fightLevelConfig[curFightId].StoryId, function() FightPointPassManager.ExecuteFightStory(curFightId, function(drop) UIManager.OpenPanel(UIName.RewardItemPopup, drop, 1, function() this:OnShow() end, 1) end) end) else -- 检测是否有前置引导 GuideManager.BeforeFightCheck(curFightId, function() --屏蔽弹怪追认的动画 --this.SetInitAnim() local isBoss = FightPointPassManager.IsFightBoss() local sound = isBoss and SoundConfig.Sound_FightArea_Boss or SoundConfig.Sound_FightArea_Monster SoundManager.PlaySound(sound, AUDIO_FADE_TYPE.FADE_OUT_NOT_IN, AUDIO_RUN_TYPE.CONC, nil, 20) UIManager.OpenPanel(UIName.FormationPanelV2, FORMATION_TYPE.STORY, FightPointPassManager.curOpenFight) end) end end function this.RefreshFightBtnShow() local curFightId = FightPointPassManager.curOpenFight local hangArr = fightLevelConfig[curFightId].Hang if hangArr and hangArr[1] > 0 then curKillNum = curKillNum + 1 this.hookKillText.text = string.format("%s/%s", curKillNum, maxKillNum) if curKillNum >= maxKillNum then this.btnFight.gameObject:SetActive(true) this.hookKill.gameObject:SetActive(false) this.red_light:SetActive(false) curKillNum = 0 FightPointPassManager.ExecuteFightStory(curFightId, function(drop) UIManager.OpenPanel(UIName.RewardItemPopup, drop, 1, function() this:OnShow() end, 1) end) end end 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.UI_Effect_MuBiaoJiangLi, self.sortingOrder - orginLayer) Util.SetParticleSortLayer(this.fightSaoGuang, self.sortingOrder + 1) Util.SetParticleSortLayer(this.fightGuideEffect, self.sortingOrder + 2) --fightMap:OnSortingOrderChange(self.sortingOrder) fightOnHook:OnSortingOrderChange(self.sortingOrder) orginLayer = self.sortingOrder this.BtView:SetOrderStatus({ sortOrder = self.sortingOrder }) -- 头像层级 if this.playerInfoView then this.playerInfoView:SetLayer(self.sortingOrder) end end --界面关闭时调用(用于子类重写) function FightPointPassMainPanel:OnClose() if this.battleSceneLogicGameObject ~= nil then this.battleSceneLogicGameObject:SetActive(false) end if this.battleSceneGameObject ~= nil then this.battleSceneGameObject:SetActive(false) end PatFaceManager.isLogin = false PlayerManager.StopBattleUpLvTipTime() hasLoad = false invadeMonster:OnClose() if hasMap then --fightMap:OnClose() hasMap = false end fightOnHook:Dispose() if this.animTimer then this.animTimer:Stop() end this.animTimer = nil if this.liveNode then this.liveNode:OnClose() end if this.liveNode then this.liveNode:OnClose() end if this.timer then this.timer:Stop() this.timer = nil end if this.skillTimer then this.skillTimer:Stop() this.skillTimer = nil end end --界面销毁时调用(用于子类重写) function FightPointPassMainPanel:OnDestroy() orginLayer = 0 invadeMonster:OnDestroy() this.spLoader:Destroy() fightOnHook: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.SecretTer_IsCanFight, this.fightRP) ClearRedPointObject(RedPointType.XiaoYaoYouRedPoint, this.xiaoyaoRedPoint) ClearRedPointObject(RedPointType.numberGame, this.numberGameBtn) ClearRedPointObject(RedPointType.FirstRecharge, this.firstRedPoint) ClearRedPointObject(RedPointType.tuijianzhenrong, this.milkRed) -- ClearRedPointObject(RedPointType.FightLevel, this.btnFightLevelRedPoint) -- 头像层级 if this.playerInfoView then SubUIManager.Close(this.playerInfoView) this.playerInfoView = nil end points = {} --销毁战场 if this.battleSceneLogicGameObject ~= nil then GameObject.Destroy(this.battleSceneLogicGameObject) this.battleSceneLogicGameObject = nil end this.mapGameObject = nil this.mapName = nil if this.battleSceneGameObject ~= nil then GameObject.Destroy(this.battleSceneGameObject) this.battleSceneGameObject = nil end 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 = this.spLoader: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 if this.liveNode then this.liveNode:OnClose() end this.liveNode = PlayerLiveView:New(this.btnMap.transform, 1, nil, orginLayer, NPCPosType.smallMap) this.liveNode:OnOpen(GetPlayerRoleSingleConFig().Scale3, Vector3.New(0, -40, 0)) if FightPointPassManager.GetRoleDirection() == 1 then this.liveNode:SetWalkDir(WALK_DIR.RUN_LEFT) else this.liveNode:SetWalkDir(WALK_DIR.RUN_RIGHT) 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_zh" }, [19] = { image1 = "r_guanka_guankajianglishenfu", image2 = "r_guanka_guankajiangli02_zh" }, [81128] = { image1 = "r_guanka_guankajianglibaoxiang", image2 = "r_guanka_guankajiangli03_zh" }, [11023] = { image1 = "r_guanka_guankajianglishunwukong", image2 = "r_guanka_guankajiangli04_zh" }, [11014] = { image1 = "c_nz_00029_t1", image2 = "r_guanka_guankajiangli03_zh" }, [11033] = { image1 = "c_h_0007_t1", image2 = "r_guanka_guankajiangli03_zh" }, [87] = { image1 = "r_Material_Mineral_0003", image2 = "" }, } function this.UpdateOpenSeverWelfare() local mainLevelConfig = ConfigManager.GetConfig(ConfigName.MainLevelConfig) local activityRewardConfig = ConfigManager.GetConfig(ConfigName.ActivityRewardConfig) local activityId = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.SongWuXianChou) local activityData = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.SongWuXianChou) --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 isShowRed = false for i = 1, #activityData.mission do if activityData.mission[i].state == 0 and not curMissionConfig then curMissionConfig = activityRewardConfig[activityData.mission[i].missionId] --LogError("activityData.mission[i].missionId=="..activityData.mission[i].missionId) -- local value = curMissionConfig.Values[2][1] -- local isPass = FightPointPassManager.IsFightPointPass2(value) -- if isPass then -- isShowRed=true -- end end if activityData.mission[i].state == 1 then isShowRed = true end end local isAll = false if not curMissionConfig then isAll = true curMissionConfig = activityRewardConfig[20016] end if activityData and activityData.mission then this.btnOpenSeverWelfare:SetActive(true) else this.btnOpenSeverWelfare:SetActive(false) end -- 奖励图 -- this.OpenSeverWelfareicon.sprite = this.spLoader:LoadSprite(OpenSeverWelfareRewardShow[curMissionConfig.Reward[1][1]].image1) -- this.OpenSeverWelfareicon:SetNativeSize() -- -- 文字 -- local imgName2 = OpenSeverWelfareRewardShow[curMissionConfig.Reward[1][1]].image2 -- if imgName2 and imgName2 ~= "" then -- this.OpenSeverWelfareiconText.sprite = this.spLoader:LoadSprite(imgName2) -- this.OpenSeverWelfareiconText.gameObject:SetActive(true) -- this.OpenSeverWelfareiconText:SetNativeSize() -- else -- this.OpenSeverWelfareiconText.gameObject:SetActive(false) -- end LogError("FightPointPassManager.lastPassFightId==" .. FightPointPassManager.lastPassFightId) local curPassLevelSortId = FightPointPassManager.lastPassFightId ~= FightPointPassManager.curOpenFight and mainLevelConfig[FightPointPassManager.lastPassFightId].SortId or 0 local getRewardLevelSortId = mainLevelConfig[curMissionConfig.Values[2][1]].SortId this.OpenSeverWelfareRed:SetActive(isShowRed) if isAll then this.OpenSeverWelfareProgressText.gameObject:SetActive(false) this.OpenSeverWelfareProgressBg:SetActive(false) this.OpenSeverWelfareInfoText.gameObject:SetActive(false) else this.OpenSeverWelfareProgressText.gameObject:SetActive(true) this.OpenSeverWelfareProgressBg:SetActive(true) this.OpenSeverWelfareInfoText.gameObject:SetActive(true) end curPassLevelSortId = curPassLevelSortId >= getRewardLevelSortId and getRewardLevelSortId or curPassLevelSortId this.OpenSeverWelfareProgressText.text = curPassLevelSortId .. "/" .. getRewardLevelSortId this.OpenSeverWelfareProgressImage.value = curPassLevelSortId / getRewardLevelSortId this.OpenSeverWelfareInfoText.text = GetLanguageStrById(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 function this.RefreshBattleUpLvTip(isShowUIOpen) -- Util.AddOnceClick(this.battleUpLvTip, function() end) this.battleUpLvTip:SetActive(false) this.battleUpLvTipImg.enabled = false this.battleUpLvTipTxt.gameObject:SetActive(false) this.battleLockGo:SetActive(false) -- 么解锁章节不显示 if not FightPointPassManager.IsChapterClossState() then return end -- 判断状态 local curFightId = FightPointPassManager.GetCurFightId() local isOk, tip, btnTxt, lockState = FightPointPassManager.CheckFightOpenRule(curFightId) -- 可以挑战显示 挑战关卡快速升级 if not isShowUIOpen and isOk then this.battleUpLvTip:SetActive(true) this.battleUpLvTipImg.enabled = true this.battleUpLvTipTxt.gameObject:SetActive(true) this.battleLockGo:SetActive(false) this.battleUpLvTipTxt.text = Language[10610] return end -- 没有解锁条件不显示 local openRule = fightLevelConfig[curFightId].OpenRule if not openRule then return end -- 没有数据不显示 if not lockState then return end -- for index, state in ipairs(lockState) do if not state and openRule[index] then local ruleType = openRule[index][1] if ruleType then if ruleType == 1 then -- 山河社稷图 this.battleUpLvTip:SetActive(true) this.battleUpLvTipImg.enabled = false this.battleUpLvTipTxt.gameObject:SetActive(false) this.battleLockGo:SetActive(true) Util.AddOnceClick(this.battleUpLvTip, function() JumpManager.GoJump(36023) end) elseif ruleType == 2 then -- 心魔试炼 this.battleUpLvTip:SetActive(true) this.battleUpLvTipImg.enabled = false this.battleUpLvTipTxt.gameObject:SetActive(false) this.battleLockGo:SetActive(true) Util.AddOnceClick(this.battleUpLvTip, function() JumpManager.GoJump(1011) end) elseif ruleType == 4 then -- 背包 装备 this.battleUpLvTip:SetActive(true) this.battleUpLvTipImg.enabled = false this.battleUpLvTipTxt.gameObject:SetActive(false) this.battleLockGo:SetActive(true) Util.AddOnceClick(this.battleUpLvTip, function() JumpManager.GoJump(1007) end) elseif ruleType == 5 then -- 好感度 this.battleUpLvTip:SetActive(true) this.battleUpLvTipImg.enabled = false this.battleUpLvTipTxt.gameObject:SetActive(false) this.battleLockGo:SetActive(true) Util.AddOnceClick(this.battleUpLvTip, function() JumpManager.GoJump(40033) end) elseif ruleType == 7 then -- 获取神将 this.battleUpLvTip:SetActive(true) this.battleUpLvTipImg.enabled = false this.battleUpLvTipTxt.gameObject:SetActive(false) this.battleLockGo:SetActive(true) Util.AddOnceClick(this.battleUpLvTip, function() JumpManager.GoJump(22001) end) end end end end end function this.UpdateWordLv() this.worldLv.text = PlayerManager.worldLeve end --开服福利显示 结束 return FightPointPassMainPanel