From c6674710f954119221c74d108f204ec9dabd8289 Mon Sep 17 00:00:00 2001 From: gaoxin Date: Fri, 19 Mar 2021 18:14:52 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=BC=95=E5=AF=BC=E3=80=912=E5=80=8D?= =?UTF-8?q?=E9=80=9F=E5=BC=95=E5=AF=BC=E5=A2=9E=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../~Lua/Common/GlobalDefine.lua | 8 ++- .../ManagedResources/~Lua/Logic/GameEvent.lua | 2 + .../~Lua/Modules/Battle/View/BattlePanel.lua | 21 ++++-- .../Modules/Battle/View/GuideBattleLogic.lua | 67 +++++++++++++++++++ .../Battle/View/GuideBattleLogic.lua.meta | 7 ++ .../Modules/Battle/View/GuideBattlePanel.lua | 44 ++---------- .../Modules/Fight/FightPointPassManager.lua | 2 +- .../~Lua/Modules/Guide/GuideManager.lua | 2 + .../~Lua/Modules/Message/SwitchPanel.lua | 2 +- .../~Lua/Modules/Story/StoryManager.lua | 15 ++--- 10 files changed, 115 insertions(+), 55 deletions(-) create mode 100644 Assets/ManagedResources/~Lua/Modules/Battle/View/GuideBattleLogic.lua create mode 100644 Assets/ManagedResources/~Lua/Modules/Battle/View/GuideBattleLogic.lua.meta diff --git a/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua b/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua index 4310706414..06cb60faa0 100644 --- a/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua +++ b/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua @@ -12,7 +12,13 @@ RECHARGEABLE = true --false不可充值 true可充值 GuideType = { Force = 1,--强制 Function = 2, --功能 - Check = 3 --检测 + Check = 3, --检测 + Battle = 4 --战斗 +} + +BattleGuideType = { + FakeBattle = 1, + QuickFight = 1021, } SDKSubMitType = { diff --git a/Assets/ManagedResources/~Lua/Logic/GameEvent.lua b/Assets/ManagedResources/~Lua/Logic/GameEvent.lua index 3e87eec81c..7a4cafe51f 100644 --- a/Assets/ManagedResources/~Lua/Logic/GameEvent.lua +++ b/Assets/ManagedResources/~Lua/Logic/GameEvent.lua @@ -23,6 +23,8 @@ GameEvent = { GuideBattleTeamCDDone = "Guide.GuideBattleTeamCDDone", GuideBattleStageChange = "Guide.GuideBattleStageChange", GuidePanelScrollViewPos = "Guide.GuidePanelScrollViewPos", + + BattleGuideDone = "Guide.BattleGuideDone", }, Player = { --金币数量改变 diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/View/BattlePanel.lua b/Assets/ManagedResources/~Lua/Modules/Battle/View/BattlePanel.lua index 8e578686aa..0caec110d7 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/View/BattlePanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/View/BattlePanel.lua @@ -2,6 +2,7 @@ require("Base/Stack") require("Modules.Battle.Config.PokemonEffectConfig") local BattleView = require("Modules/Battle/View/BattleView") +local GuideBattleLogic = require("Modules/Battle/View/GuideBattleLogic") BattlePanel = Inherit(BasePanel) local this = BattlePanel @@ -208,7 +209,8 @@ function this:OnSortingOrderChange() end --界面打开时调用(用于子类重写) -function this:OnOpen(_fightData, _fightType, _endFunc) +function this:OnOpen(_fightData, _fightType, _endFunc, _guideType) + GuideBattleLogic:Init(_guideType) BattleView:OnOpen(_fightData,_fightType) endFunc = _endFunc @@ -232,10 +234,10 @@ function this:OnOpen(_fightData, _fightType, _endFunc) BattleView:SetNameStr(nil) this.DefResult:SetActive(false) this.AtkResult:SetActive(false) - local lvOpenTimeScaleConFig = ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.PrivilegeTypeConfig,"PrivilegeType",PRIVILEGE_TYPE.DoubleTimesFight,"UnlockType",1) - if lvOpenTimeScaleConFig and PlayerManager.level == lvOpenTimeScaleConFig.Condition[1][1] and BattleManager.GetTimeScale() == BATTLE_TIME_SCALE_ONE then - BattleManager.SetTimeScale(BATTLE_TIME_SCALE_TWO) - end + -- local lvOpenTimeScaleConFig = ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.PrivilegeTypeConfig,"PrivilegeType",PRIVILEGE_TYPE.DoubleTimesFight,"UnlockType",1) + -- if lvOpenTimeScaleConFig and PlayerManager.level == lvOpenTimeScaleConFig.Condition[1][1] and BattleManager.GetTimeScale() == BATTLE_TIME_SCALE_ONE then + -- BattleManager.SetTimeScale(BATTLE_TIME_SCALE_TWO) + -- end -- 开始战斗 BattleView:StartBattle() @@ -596,8 +598,10 @@ function this.OnOrderChanged(order) end -- 战斗回合变化回调 +this.curRound = 1 function this.OnRoundChanged(round) - -- body + -- 轮数变化 + this.curRound = round --显示波次 local curRound, maxRound = BattleLogic.GetCurRound() curRound = curRound <= 0 and 1 or curRound -- 最小显示第一回合 @@ -607,6 +611,11 @@ function this.OnRoundChanged(round) this.roundText.text = string.format(Language[10211], curRound, maxRound) end +-- 角色轮转回调 +function this.RoleTurnChange(role) + GuideBattleLogic:RoleTurnChange(this.curRound, role) +end + -- 由BattleView驱动 function this.OnUpdate() diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/View/GuideBattleLogic.lua b/Assets/ManagedResources/~Lua/Modules/Battle/View/GuideBattleLogic.lua new file mode 100644 index 0000000000..cd06e4dc7e --- /dev/null +++ b/Assets/ManagedResources/~Lua/Modules/Battle/View/GuideBattleLogic.lua @@ -0,0 +1,67 @@ +local GuideBattleLogic = {} + +-- 引导节点配置 +local _GuideConfig = { + -- 轮数 = {阵营 = { 释放位置 = 对话id}}} 新手引导假战斗 + [BattleGuideType.FakeBattle] = { + [1] = { + [0] = { + [1] = 300008, + [4] = 300010, + } + }, + [2] = { + [0] = { + [1] = 300012, + [2] = 300014, + [3] = 300016, + } + } + }, + [BattleGuideType.QuickFight] = { + -- 轮数 = {阵营 = { 释放位置 = 引导id}}} + [1] = { + [0] = { + [1] = 200000, + } + }, + } +} +function GuideBattleLogic:Init(guideType) + self.guideType = guideType +end + + +function GuideBattleLogic:RoleTurnChange(curRound, role) + local curCamp = role.camp + local curPos = role.position + local _config = _GuideConfig[self.guideType] + if not _config + or not _config[curRound] + or not _config[curRound][curCamp] + or not _config[curRound][curCamp][curPos] + then + return + end + -- 对话形式的引导 + if self.guideType == BattleGuideType.FakeBattle then + BattleManager.SetGuidePause(true) + local storyId = _config[curRound][curCamp][curPos] + StoryManager.EventTrigger(storyId, function() + BattleManager.SetGuidePause(false) + end) + -- 引导形式的引导 + elseif self.guideType == BattleGuideType.QuickFight then + BattleManager.SetGuidePause(true) + local guideId = _config[curRound][curCamp][curPos] + GuideManager.ShowGuide(guideId) + local function _onGuideDone() + Game.GlobalEvent:RemoveEvent(GameEvent.Guide.BattleGuideDone, _onGuideDone) + BattleManager.SetGuidePause(false) + end + Game.GlobalEvent:AddEvent(GameEvent.Guide.BattleGuideDone, _onGuideDone) + end +end + + +return GuideBattleLogic \ No newline at end of file diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/View/GuideBattleLogic.lua.meta b/Assets/ManagedResources/~Lua/Modules/Battle/View/GuideBattleLogic.lua.meta new file mode 100644 index 0000000000..dc6dbdcf92 --- /dev/null +++ b/Assets/ManagedResources/~Lua/Modules/Battle/View/GuideBattleLogic.lua.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 05943705ab7aeb841bb457e6658112b3 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/View/GuideBattlePanel.lua b/Assets/ManagedResources/~Lua/Modules/Battle/View/GuideBattlePanel.lua index 40a0bcdacb..19628798fd 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/View/GuideBattlePanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/View/GuideBattlePanel.lua @@ -2,6 +2,7 @@ require("Base/Stack") require("Modules.Battle.Config.PokemonEffectConfig") local BattleView = require("Modules/Battle/View/BattleView") +local GuideBattleLogic = require("Modules/Battle/View/GuideBattleLogic") GuideBattlePanel = Inherit(BasePanel) local this = GuideBattlePanel @@ -71,10 +72,12 @@ function this:OnSortingOrderChange() end --界面打开时调用(用于子类重写) -function this:OnOpen(_fightData, _endFunc) +function this:OnOpen(_fightData, _endFunc, guideType) + GuideBattleLogic:Init(guideType) BattleView:OnOpen(_fightData) - + this.guideType = guideType endFunc = _endFunc + fightType = BATTLE_TYPE.Test --判定战斗类型 this.BG:GetComponent("Image").sprite = Util.LoadSprite(BattleManager.GetBattleBg(fightType)) @@ -111,7 +114,6 @@ function this.InitOption() local curRound, maxRound = BattleLogic.GetCurRound() this.roundText.text = string.format(Language[10211], curRound, maxRound) - -- 初始化战斗时间,刷新前端显示 Time.timeScale = BATTLE_TIME_SCALE_ONE end @@ -181,43 +183,9 @@ function this.OnRoundChanged(round) end - --- 引导节点配置 -local _GuideConfig = { - -- 轮数 = {阵营 = { 释放位置 = 对话id}}} - [1] = { - [0] = { - [1] = 300008, - [4] = 300010, - } - }, - [2] = { - [0] = { - [1] = 300012, - [2] = 300014, - [3] = 300016, - } - } -} -- 角色轮转回调 function this.RoleTurnChange(role) - local curCamp = role.camp - local curPos = role.position - - if not _GuideConfig[this.curRound] then - return - end - if not _GuideConfig[this.curRound][curCamp] then - return - end - if not _GuideConfig[this.curRound][curCamp][curPos] then - return - end - - BattleManager.SetGuidePause(true) - StoryManager.EventTrigger(_GuideConfig[this.curRound][curCamp][curPos], function() - BattleManager.SetGuidePause(false) - end) + GuideBattleLogic:RoleTurnChange(this.curRound, role) end -- 由BattleView驱动 diff --git a/Assets/ManagedResources/~Lua/Modules/Fight/FightPointPassManager.lua b/Assets/ManagedResources/~Lua/Modules/Fight/FightPointPassManager.lua index 270f98a9bd..185fe84b0e 100644 --- a/Assets/ManagedResources/~Lua/Modules/Fight/FightPointPassManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Fight/FightPointPassManager.lua @@ -343,7 +343,7 @@ function this.ExecuteFightBattle(monsterGroupId, fightId, callBack) NetManager.LevelStarFightDataRequest(monsterGroupId, fightId, function (msg) hadUpdate = false local fightData = BattleManager.GetBattleServerData(msg) - UIManager.OpenPanel(UIName.BattlePanel, fightData, BATTLE_TYPE.STORY_FIGHT, callBack) + UIManager.OpenPanel(UIName.BattlePanel, fightData, BATTLE_TYPE.STORY_FIGHT, callBack, fightId) end) end diff --git a/Assets/ManagedResources/~Lua/Modules/Guide/GuideManager.lua b/Assets/ManagedResources/~Lua/Modules/Guide/GuideManager.lua index 1bb2807b2a..8992b375e0 100644 --- a/Assets/ManagedResources/~Lua/Modules/Guide/GuideManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Guide/GuideManager.lua @@ -192,6 +192,8 @@ function this.ShowGuide(id, ...) _IsFuncGuild = false -- 检测是否还需要功能引导 this.CheckFuncGuide() + elseif GuideConfig[id].Type == GuideType.Battle then + Game.GlobalEvent:DispatchEvent(GameEvent.Guide.BattleGuideDone) end end diff --git a/Assets/ManagedResources/~Lua/Modules/Message/SwitchPanel.lua b/Assets/ManagedResources/~Lua/Modules/Message/SwitchPanel.lua index 223b944127..b2c1f59793 100644 --- a/Assets/ManagedResources/~Lua/Modules/Message/SwitchPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Message/SwitchPanel.lua @@ -55,7 +55,7 @@ function this.PlayTransEffect(func) DoTween.To(DG.Tweening.Core.DOGetter_float( function () return 6 end), DG.Tweening.Core.DOSetter_float(function (progress) this.CircleMaskMat:SetFloat("_R", progress) - end), 0, 1):SetEase(Ease.OutQuad):OnComplete(function () + end), 0, 2):SetEase(Ease.OutQuad):OnComplete(function () if func then func() end diff --git a/Assets/ManagedResources/~Lua/Modules/Story/StoryManager.lua b/Assets/ManagedResources/~Lua/Modules/Story/StoryManager.lua index 131fc26318..67eb878f98 100644 --- a/Assets/ManagedResources/~Lua/Modules/Story/StoryManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Story/StoryManager.lua @@ -37,7 +37,7 @@ function this.EventTrigger(eventId, callBack) local options = chapterDataConfig[eventId].Option if showType and showValues and options then - LogError("showtype "..showType.." showvalue "..showValues) + -- LogError("showtype "..showType.." showvalue "..showValues) -- 如果是第一次打开,则打开开幕界面 if showType == 11 then -- 对话界面 if callBack then @@ -58,13 +58,12 @@ function this.EventTrigger(eventId, callBack) fightType = 0, maxRound = 20 } - UIManager.OpenPanel(UIName.GuideBattlePanel, testFightData, function() - StoryManager.EventTrigger(300017, function () - -- PatFaceManager.isLogin = true - -- UIManager.OpenPanel(UIName.FightPointPassMainPanel) - -- LoadingPanel.End() - end) - end) + local panel = UIManager.OpenPanel(UIName.GuideBattlePanel, testFightData, function() + StoryManager.EventTrigger(300017) + end, BattleGuideType.FakeBattle) + + + elseif showType == 15 then -- 播放转场特效 SwitchPanel.PlayTransEffect(function() this.StoryJumpType(options[1])