51 lines
1.4 KiB
Lua
51 lines
1.4 KiB
Lua
StoryMapManager = {}
|
|
local this = StoryMapManager
|
|
this.groupConfigs = {}
|
|
this.isShowStory = 0
|
|
local storyMapConfig = ConfigManager.GetConfig(ConfigName.StoryMapConfig)
|
|
local groupId
|
|
--初始化
|
|
function this.Initialize()
|
|
|
|
end
|
|
|
|
function this.InitData(_groupId)
|
|
groupId = _groupId
|
|
this.groupConfigs = {}
|
|
this.InitGroupIds(_groupId)
|
|
this.GetSingleStoryConfig()
|
|
end
|
|
|
|
function this.InitGroupIds(groupId)
|
|
local config = storyMapConfig[groupId]
|
|
if not config then
|
|
return
|
|
end
|
|
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
|
|
if groupId == 1 then
|
|
SoundManager.PlayMusic(SoundConfig.BGM_STORY_1_1)
|
|
elseif groupId == 3 then
|
|
SoundManager.PlayMusic(SoundConfig.BGM_STORY_2_1)
|
|
end
|
|
UIManager.OpenPanel(UIName.StoryMapPanel,config)
|
|
table.remove(this.groupConfigs,1)
|
|
else
|
|
StoryMapManager.isShowStory = 0
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.GuaJi.CloseStoryMapPanel)
|
|
SoundManager.PlayMusic(SoundConfig.BGM_Main)
|
|
end
|
|
end
|
|
|
|
return this |