miduo_client/Assets/ManagedResources/~Lua/Modules/Story/StoryMapManager.lua

51 lines
1.4 KiB
Lua
Raw Normal View History

2021-04-26 09:41:41 +08:00
StoryMapManager = {}
local this = StoryMapManager
this.groupConfigs = {}
2021-04-29 17:00:12 +08:00
this.isShowStory = 0
2021-04-26 09:41:41 +08:00
local storyMapConfig = ConfigManager.GetConfig(ConfigName.StoryMapConfig)
2021-05-25 10:07:31 +08:00
local groupId
2021-04-26 09:41:41 +08:00
--初始化
function this.Initialize()
end
2021-05-25 10:07:31 +08:00
function this.InitData(_groupId)
groupId = _groupId
2021-04-26 18:29:47 +08:00
this.groupConfigs = {}
2021-05-25 10:07:31 +08:00
this.InitGroupIds(_groupId)
2021-04-26 09:41:41 +08:00
this.GetSingleStoryConfig()
end
2021-04-26 18:29:47 +08:00
function this.InitGroupIds(groupId)
2021-04-26 09:41:41 +08:00
local config = storyMapConfig[groupId]
2021-07-30 14:39:10 +08:00
if not config then
return
end
2021-04-26 09:41:41 +08:00
table.insert(this.groupConfigs,config)
if config.NextId and config.NextId > 0 then
this.InitGroupIds(config.NextId)
end
end
function this.GetSingleStoryConfig()
local config = {}
if #this.groupConfigs > 0 then
config = this.groupConfigs[1]
if UIManager.IsOpen(UIName.StoryMapPanel) then
UIManager.ClosePanel(UIName.StoryMapPanel)
end
2021-05-25 10:07:31 +08:00
if groupId == 1 then
SoundManager.PlayMusic(SoundConfig.BGM_STORY_1_1)
elseif groupId == 3 then
SoundManager.PlayMusic(SoundConfig.BGM_STORY_2_1)
end
2021-04-26 09:41:41 +08:00
UIManager.OpenPanel(UIName.StoryMapPanel,config)
table.remove(this.groupConfigs,1)
else
2021-04-29 17:44:35 +08:00
StoryMapManager.isShowStory = 0
2021-04-26 09:41:41 +08:00
Game.GlobalEvent:DispatchEvent(GameEvent.GuaJi.CloseStoryMapPanel)
2021-05-24 20:22:38 +08:00
SoundManager.PlayMusic(SoundConfig.BGM_Main)
2021-04-26 09:41:41 +08:00
end
end
return this