引导战斗流程添加

gaoxin 2020-09-07 18:25:31 +08:00
parent c0d6feeb8d
commit 32b8705ab1
8 changed files with 256 additions and 19 deletions

View File

@ -56394,7 +56394,7 @@ MonoBehaviour:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 21300000, guid: 9efe99d7406bb0a41b39ce4c5aa85458, type: 3}
m_Sprite: {fileID: 21300000, guid: 3b9e57f7312a8c647bf8ff9c891ee6d1, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@ -143872,6 +143872,16 @@ PrefabInstance:
propertyPath: m_LocalScale.y
value: 1.1
objectReference: {fileID: 0}
- target: {fileID: 6210025963494768122, guid: a6d8e39b4fb07024f9346b5be60e8591,
type: 3}
propertyPath: m_SizeDelta.x
value: 2000
objectReference: {fileID: 0}
- target: {fileID: 6210025963494768122, guid: a6d8e39b4fb07024f9346b5be60e8591,
type: 3}
propertyPath: m_SizeDelta.y
value: 3000
objectReference: {fileID: 0}
- target: {fileID: 6210025964156221442, guid: a6d8e39b4fb07024f9346b5be60e8591,
type: 3}
propertyPath: m_LocalPosition.x
@ -144772,6 +144782,16 @@ PrefabInstance:
propertyPath: m_LocalScale.y
value: 1.1
objectReference: {fileID: 0}
- target: {fileID: 6969572681753893770, guid: 9eb941cb04fe8c944a138963e55bbdc6,
type: 3}
propertyPath: m_SizeDelta.x
value: 2000
objectReference: {fileID: 0}
- target: {fileID: 6969572681753893770, guid: 9eb941cb04fe8c944a138963e55bbdc6,
type: 3}
propertyPath: m_SizeDelta.y
value: 3000
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 9eb941cb04fe8c944a138963e55bbdc6, type: 3}
--- !u!224 &9135249695910312339 stripped

View File

@ -2045,9 +2045,9 @@ BATTLE_TYPE = {
DAILY_CHALLENGE = 9, -- 日常副本
GUILD_CAR_DELAY = 10, -- 车迟斗法
DEATH_POS = 11, -- 十绝阵
Senro = 12, --森罗幻境
Xuanyuan = 13, --轩辕宝镜
GuildTranscript = 14, --公会副本
Senro = 12, -- 森罗幻境
Xuanyuan = 13, -- 轩辕宝镜
GuildTranscript = 14, -- 公会副本
}
rankKingList={ [1] = { bgImage = "r_zjm_paihangbang_banner04", name = Language[12164] ,rankType = RANK_TYPE.FIGHT_LEVEL_RANK,activiteId = 0,isRankingMainPanelShow = true},
[2] = { bgImage = "r_zjm_paihangbang_banner02", name = Language[12165] ,rankType = RANK_TYPE.FORCE_CURR_RANK,activiteId = 0,isRankingMainPanelShow = true},

View File

@ -332,6 +332,7 @@ UIName = {
XuanYuanMirrorRewardSortPopup = 331,--轩辕宝镜奖励
GuildTranscriptMainPopup = 332,--公会副本
GuildTranscriptRewardSortPanel = 333,--公会副本奖励排行
GuideBattlePanel = 334, --引导战斗
}
SubUIConfig = {

View File

@ -663,23 +663,18 @@ function this.GetBattleSorting()
if UIManager.IsOpen(UIName.BattleTestPanel) then
return BattleTestPanel.sortingOrder
end
if UIManager.IsOpen(UIName.GuideBattlePanel) then
return GuideBattlePanel.sortingOrder
end
end
-- 获取战斗背景
local bgConfig = {
[1] = "r_zhandou_changjing017",
[2] = "r_zhandou_changjing016",
[3] = "r_zhandou_changjing017",
[4] = "r_zhandou_changjing017",
[5] = "r_zhandou_changjing017",
[1001] = "r_zhandou_changjing018",
[1002] = "r_zhandou_changjing019",
}
function this.GetBattleBg(fightType)
local index = 1
if fightType == BATTLE_TYPE.STORY_FIGHT then
local curChapter = FightPointPassManager.GetCurChapterIndex()
index = math.floor((curChapter + 1) % 3 + 1)
index = math.floor((curChapter - 1) % 5 + 1)
elseif fightType == BATTLE_TYPE.BACK then
index = 1001
elseif fightType == BATTLE_TYPE.EXECUTE_FIGHT then

View File

@ -0,0 +1,202 @@
require("Base/BasePanel")
require("Base/Stack")
require("Modules.Battle.Config.PokemonEffectConfig")
local BattleView = require("Modules/Battle/View/BattleView")
GuideBattlePanel = Inherit(BasePanel)
local this = GuideBattlePanel
local timeCount
local endFunc
local isBack = false --是否为战斗回放
local fightType -- 1关卡 2副本 3限时怪, 5兽潮, 6新关卡, 7公会boss
local orginLayer
--初始化组件(用于子类重写)
function this:InitComponent()
BattleView:InitComponent(self)
orginLayer = 0
this.BG = Util.GetGameObject(self.gameObject, "BG")
this.UpRoot = Util.GetGameObject(self.gameObject, "UpRoot")
this.Option = Util.GetGameObject(this.UpRoot, "option")
this.DownRoot = Util.GetGameObject(self.gameObject, "DownRoot")
this.roundText = Util.GetGameObject(this.Option, "timeCount"):GetComponent("Text")
this.orderText = Util.GetGameObject(this.Option, "order/text"):GetComponent("Text")
this.BtnTimeScale = Util.GetGameObject(this.DownRoot, "option/BtnTimeScale")
this.BtnExit = Util.GetGameObject(this.DownRoot, "option/BtnExit")
this.ButtonLock = Util.GetGameObject(this.DownRoot, "option/Button/lock")
this.BtnGM = Util.GetGameObject(this.DownRoot, "option/Button")
this.submit = Util.GetGameObject(this.DownRoot, "bg")
this.DefResult = Util.GetGameObject(this.UpRoot, "result")
this.AtkResult = Util.GetGameObject(this.DownRoot, "result")
this.damagePanel = Util.GetGameObject(this.UpRoot, "damage")
this.damageBoxBg = Util.GetGameObject(this.damagePanel, "bg")
this.damageBoxIcon = Util.GetGameObject(this.damagePanel, "bg/iconRoot/icon"):GetComponent("Image")
this.damageBoxLevel = Util.GetGameObject(this.damagePanel, "lv"):GetComponent("Text")
this.damageProgress = Util.GetGameObject(this.damagePanel, "progress/Fill")
this.damageText = Util.GetGameObject(this.damagePanel, "progress/Text"):GetComponent("Text")
end
--绑定事件(用于子类重写)
function this:BindEvent()
Util.AddLongPressClick(this.submit, function()
BattleRecordManager.SubmitBattleRecord()
end, 0.5)
end
--添加事件监听(用于子类重写)
function this:AddListener()
end
--移除事件监听(用于子类重写)
function this:RemoveListener()
end
function this:OnSortingOrderChange()
Util.AddParticleSortLayer(this.gameObject, this.sortingOrder - orginLayer)
orginLayer = this.sortingOrder
BattleView:OnSortingOrderChange(this.sortingOrder)
end
--界面打开时调用(用于子类重写)
function this:OnOpen(_fightData, _endFunc)
BattleView:OnOpen(_fightData)
endFunc = _endFunc
fightType = BATTLE_TYPE.Test --判定战斗类型
this.BG:GetComponent("Image").sprite = Util.LoadSprite(BattleManager.GetBattleBg(fightType))
this.BtnGM:SetActive(false)
this.BtnExit:SetActive(false)
this.ButtonLock:SetActive(false)
this.BtnTimeScale:SetActive(false)
this.damagePanel:SetActive(false)
SoundManager.PlayMusic(SoundConfig.BGM_Battle_1, true, function()
SoundManager.PlayMusic(SoundConfig.BGM_Battle_2, false)
end)
this.fightResult = nil
-- 清空名字数据
this.DefResult:SetActive(false)
this.AtkResult:SetActive(false)
-- 开始战斗
BattleView:StartBattle()
this.InitPanelData()
end
-- 初始化
function this.InitPanelData()
this.InitOption()
end
function this.InitOption()
--显示倒计时
local curRound, maxRound = BattleLogic.GetCurRound()
this.roundText.text = string.format(Language[10252], curRound, maxRound)
-- 初始化战斗时间,刷新前端显示
Time.timeScale = BATTLE_TIME_SCALE_ONE
end
function this.SwitchTimeScale()
local _scale = BattleManager.GetTimeScale()
local child = this.BtnTimeScale.transform.childCount - 3 -- 3倍速时-2
local s = "x".. math.floor(_scale)
for i=1, child do
local g = this.BtnTimeScale.transform:GetChild(i-1).gameObject
g:SetActive(g.name == s)
end
end
function this.BattleEnd(result)
BattleManager.PauseBattle()
-- 强制停止倍速
Time.timeScale = 1
-- 设置音效播放的速度
SoundManager.SetAudioSpeed(1)
--用一个变量接收最近的战斗结果
this.lastBattleResult = {
result = result,
hpList = {},
drop = {},
}
-- 直接显示结果
this.ShowBattleResult(result)
end
function this.ShowBattleResult(result, msg)
SoundManager.StopMusic()
-- 战斗结束时,如果元素光环面板还开着,则先关闭
if UIManager.IsOpen(UIName.ElementPopup) then
UIManager.ClosePanel(UIName.ElementPopup)
end
-- 播放结算音效
if result == 0 then
this.resultSoundAudio = SoundManager.PlaySound(SoundConfig.Sound_BattleLose)
else
this.resultSoundAudio = SoundManager.PlaySound(SoundConfig.Sound_BattleWin)
end
if result == 0 then -- 失败
local haveRecord = BattleRecordManager.isHaveRecord()
UIManager.OpenPanel(UIName.BattleFailPopup, this, haveRecord,nil,fightType)
else -- 胜利
UIManager.OpenPanel(UIName.BattleWinPopup, this, isBack, fightType, this.lastBattleResult)
end
end
-- 战斗波次变化回调
function this.OnOrderChanged(order)
-- body
--显示波次
this.orderText.text = string.format("%d/%d", order, BattleLogic.TotalOrder)
end
-- 战斗回合变化回调
function this.OnRoundChanged(round)
-- body
--显示波次
local curRound, maxRound = BattleLogic.GetCurRound()
this.roundText.text = string.format(Language[10252], curRound, maxRound)
end
-- 由BattleView驱动
function this.OnUpdate()
end
--界面关闭时调用(用于子类重写)
function this:OnClose()
BattleView:OnClose()
if endFunc then
endFunc(this.lastBattleResult)
end
end
--界面销毁时调用(用于子类重写)
function this:OnDestroy()
BattleView:OnDestroy()
end
return GuideBattlePanel

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 17502686c9d15784aaf4714feb987c2c
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -195,10 +195,10 @@ function this:LoadMapData()
local curChapter = FightPointPassManager.GetCurChapterIndex()
local index = 1
index = math.floor((curChapter - 1) % 5 + 1)
Log(curChapter)
Log(index)
-- Log(curChapter)
-- Log(index)
m_curMapId = mapIdList[index]
LogPink("#mapIdList:"..#mapIdList.." m_curMapId:"..m_curMapId.." curChapter:"..curChapter.." index:"..index.." State:"..tostring(FightPointPassManager.isOpenNewChapter))
-- LogPink("#mapIdList:"..#mapIdList.." m_curMapId:"..m_curMapId.." curChapter:"..curChapter.." index:"..index.." State:"..tostring(FightPointPassManager.isOpenNewChapter))
TileMapView.AwakeInit(this.mapRoot, m_curMapId, nil, Vector2.New(180, 180))
TileMapView.isShowFog = false

View File

@ -49,6 +49,17 @@ function this.EventTrigger(eventId, callBack)
--UIManager.OpenPanel(UIName.StoryOptionPopup, eventId)
elseif showType == 10 then -- 起名字界面
UIManager.OpenPanel(UIName.CreateNamePopup, showType, eventId, showValues, options)
elseif showType == 14 then -- 引导战斗
local fb = ConfigManager.GetConfigData(ConfigName.FakeBattle, 1004)
local testFightData = {
fightData = loadstring("return "..fb.FightData)(),
fightSeed = fb.TimeSeed,
fightType = 0,
maxRound = 20
}
UIManager.OpenPanel(UIName.GuideBattlePanel, testFightData, function()
StoryManager.EventTrigger(300017, callBack)
end)
end
else
Log(Language[11972])
@ -79,13 +90,14 @@ end
-- 剧情跳转
function this.StoryJumpType(optionId, panel)
Log("OptionId " .. optionId)
local jumpType = chapterOptionData[optionId].JumpType
if jumpType then
if jumpType == 4 then -- 关闭所有界面,结束对话
panel:ClosePanel()
if panel then
panel:ClosePanel()
end
if UIManager.IsOpen(UIName.StoryDialoguePanel) then
UIManager.ClosePanel(UIName.StoryDialoguePanel)
end