614 lines
		
	
	
		
			24 KiB
		
	
	
	
		
			Lua
		
	
			
		
		
	
	
			614 lines
		
	
	
		
			24 KiB
		
	
	
	
		
			Lua
		
	
require("Base/BasePanel")
 | 
						|
local StoryMapPanel = Inherit(BasePanel)
 | 
						|
local this = StoryMapPanel
 | 
						|
--local playerSpeed = 0
 | 
						|
local curGroupId = 0
 | 
						|
 | 
						|
local storyMapConfig = ConfigManager.GetConfig(ConfigName.StoryMapConfig)
 | 
						|
local chapterEventPointData = ConfigManager.GetConfig(ConfigName.ChapterEventPointConfig)
 | 
						|
local artResConfig = ConfigManager.GetConfig(ConfigName.ArtResourcesConfig)
 | 
						|
local curGroupConfig = {}
 | 
						|
 | 
						|
this.eventIndex = 0
 | 
						|
this.showDiaLog = false
 | 
						|
 | 
						|
local lastLive2DId = 0
 | 
						|
local sortingOrder = 0
 | 
						|
local newSortingOrder = 0
 | 
						|
local isSkip = false
 | 
						|
local isFirstEnter = 1
 | 
						|
--初始化组件(用于子类重写)
 | 
						|
function StoryMapPanel:InitComponent()
 | 
						|
    this.map = Util.GetGameObject(self.gameObject,"bg/mapParent")   
 | 
						|
    this.mapPre = Util.GetGameObject(self.gameObject,"bg/mapPre")   
 | 
						|
    this.TT = Util.GetGameObject(self.gameObject,"bg/TT")   
 | 
						|
 | 
						|
    this.dialog = Util.GetGameObject(self.gameObject,"bg/dialog")   
 | 
						|
    this.diaLogName = Util.GetGameObject(this.dialog,"Image")   
 | 
						|
    this.diaLogNameText = Util.GetGameObject(this.diaLogName,"Name"):GetComponent("Text")
 | 
						|
    this.diaLogContent = Util.GetGameObject(this.dialog,"context"):GetComponent("Text")
 | 
						|
    -- 右切入
 | 
						|
    this.right2dRoot = Util.GetGameObject(self.gameObject, "rightLive2d")
 | 
						|
    -- 左切入
 | 
						|
    this.left2dRoot = Util.GetGameObject(self.gameObject, "leftLive2d")
 | 
						|
     -- 特效的节点
 | 
						|
    this.effectRoot = Util.GetGameObject(self.gameObject, "effectRoot")
 | 
						|
    -- 中间乱入的图片
 | 
						|
    this.showImg = Util.GetGameObject(self.gameObject, "showImg")
 | 
						|
 | 
						|
    this.GoOn = Util.GetGameObject(self.gameObject,"bg/btnGoOn") 
 | 
						|
    this.btnGoOn = Util.GetGameObject(this.GoOn ,"Click") 
 | 
						|
 | 
						|
    this.skip = Util.GetGameObject(self.gameObject,"bg/btnSkip")   
 | 
						|
    this.btnSkip = Util.GetGameObject(this.skip,"btnGo")   
 | 
						|
    this.btnSkipBtnComp = Util.GetGameObject(this.skip,"btnGo"):GetComponent("Button")   
 | 
						|
    this.skip.gameObject:SetActive(true)
 | 
						|
    this.PlayerGrouops = {}
 | 
						|
    this.Maps = {}
 | 
						|
 | 
						|
    this.mask = Util.GetGameObject(self.gameObject,"mask") 
 | 
						|
    this.maskBtn = Util.GetGameObject(this.mask,"Button") 
 | 
						|
    this.mask.gameObject:SetActive(false)
 | 
						|
end
 | 
						|
 | 
						|
--绑定事件(用于子类重写)
 | 
						|
function StoryMapPanel:BindEvent()
 | 
						|
    Util.AddClick(this.btnSkip, function ()                
 | 
						|
        --StoryMapManager.GetSingleStoryConfig()
 | 
						|
        isSkip = true
 | 
						|
        this:StackPop()
 | 
						|
    end)
 | 
						|
    Util.AddClick(this.btnGoOn, function ()                
 | 
						|
        this:ShowDialog()
 | 
						|
    end)
 | 
						|
    Util.AddClick(this.maskBtn, function ()    
 | 
						|
        this.mask.gameObject:SetActive(false)           
 | 
						|
        this:StackPop()
 | 
						|
    end)
 | 
						|
end
 | 
						|
 | 
						|
--添加事件监听(用于子类重写)
 | 
						|
function StoryMapPanel:AddListener()
 | 
						|
    Game.GlobalEvent:AddEvent(GameEvent.GuaJi.CloseStoryMapPanel,this.CloseThisPanel)
 | 
						|
end
 | 
						|
 | 
						|
function this.CloseThisPanel()
 | 
						|
    this:ClosePanel()
 | 
						|
end
 | 
						|
 | 
						|
--移除事件监听(用于子类重写)
 | 
						|
function StoryMapPanel:RemoveListener()
 | 
						|
    Game.GlobalEvent:RemoveEvent(GameEvent.GuaJi.CloseStoryMapPanel,this.ClosePanel)
 | 
						|
end
 | 
						|
 | 
						|
--界面打开时调用(用于子类重写)
 | 
						|
function StoryMapPanel:OnOpen(config)
 | 
						|
    this.mask.gameObject:SetActive(false)
 | 
						|
    this.map.transform.localPosition = Vector3.zero
 | 
						|
    --LogGreen("this.map.transform.localPosition:"..tostring(this.map.transform.localPosition))
 | 
						|
    sortingOrder = 0
 | 
						|
    this.PlayerGrouops = {}
 | 
						|
    this.triggerEvent = {}
 | 
						|
    curGroupConfig = config
 | 
						|
    curGroupId = config.Id
 | 
						|
    this.LoadMap()
 | 
						|
    this.LoadTT()
 | 
						|
end
 | 
						|
 | 
						|
---加载跑图角色
 | 
						|
function this.LoadTT()
 | 
						|
    if not curGroupConfig then
 | 
						|
        return
 | 
						|
    end 
 | 
						|
    if curGroupConfig.MonsterRoads and #curGroupConfig.MonsterRoads > 0 then
 | 
						|
        for i = 1 ,#curGroupConfig.MonsterRoads do
 | 
						|
            this.PlayerGrouops[i] = SubUIManager.Open(SubUIConfig.SingleStoryPlayerView,this.TT.transform,this)
 | 
						|
            this.PlayerGrouops[i]:SetData(curGroupConfig.MonsterRoads[i],0,this)
 | 
						|
        end
 | 
						|
    end
 | 
						|
    this.PlayerGrouops[0] = SubUIManager.Open(SubUIConfig.SingleStoryPlayerView,this.TT.transform,this)
 | 
						|
    this.PlayerGrouops[0]:SetData(curGroupConfig.PlayerRoads,1,this)
 | 
						|
end
 | 
						|
 | 
						|
function this.LoadMap()
 | 
						|
    if not curGroupConfig then
 | 
						|
        return
 | 
						|
    end 
 | 
						|
    if not this.Maps then
 | 
						|
        this.Maps = {}
 | 
						|
    end
 | 
						|
    for i = 1 ,#this.Maps do
 | 
						|
        this.Maps[i].gameObject:SetActive(false)
 | 
						|
    end
 | 
						|
    for i = 1 ,#curGroupConfig.Map do
 | 
						|
        if not this.Maps[i] then
 | 
						|
            this.Maps[i] = newObjToParent(this.mapPre,this.map)
 | 
						|
        end
 | 
						|
        this.Maps[i]:GetComponent("Image").sprite = Util.LoadSprite(curGroupConfig.Map[i][1])
 | 
						|
        this.Maps[i]:GetComponent("Image"):SetNativeSize()
 | 
						|
        this.Maps[i].gameObject:SetActive(true)
 | 
						|
        local vecs = string.split(curGroupConfig.Map[i][2],',')
 | 
						|
        this.Maps[i]:GetComponent("RectTransform").localPosition = Vector3.New(tonumber(vecs[1]),tonumber(vecs[2]),tonumber(vecs[3]))
 | 
						|
    end
 | 
						|
end
 | 
						|
 | 
						|
function StoryMapPanel:OnShow()
 | 
						|
    if not curGroupConfig.TriggerEvent or #curGroupConfig.TriggerEvent < 1 then
 | 
						|
        return 
 | 
						|
    end
 | 
						|
    --初始化触发事件
 | 
						|
    for i = 1,#curGroupConfig.TriggerEvent do
 | 
						|
        local event = {}
 | 
						|
        event.eventType = curGroupConfig.TriggerEvent[i][1]
 | 
						|
        event.groups = {}
 | 
						|
        for j = 2,#curGroupConfig.TriggerEvent[i] do
 | 
						|
            table.insert(event.groups,curGroupConfig.TriggerEvent[i][j])
 | 
						|
        end
 | 
						|
        table.insert(this.triggerEvent,event)
 | 
						|
    end
 | 
						|
    this.callList = Stack.New()
 | 
						|
    for i = #this.triggerEvent,1,-1 do
 | 
						|
        this.callList:Push(function()  
 | 
						|
            this:CheckTrigger(this.triggerEvent[i])
 | 
						|
        end)
 | 
						|
    end
 | 
						|
    this:StackPop()
 | 
						|
end
 | 
						|
 | 
						|
function this:StackPop()
 | 
						|
    if this.callList:Count() > 0 then           
 | 
						|
        this.callList:Pop()()     
 | 
						|
    else
 | 
						|
        sortingOrder = newSortingOrder
 | 
						|
        this:OnClose()
 | 
						|
        StoryMapManager.GetSingleStoryConfig()
 | 
						|
    end
 | 
						|
end
 | 
						|
local pos = {
 | 
						|
    [1] = Vector3.New(-130,0,0),
 | 
						|
    [2] = Vector3.New(0,0,0),
 | 
						|
    [3] = Vector3.New(130,0,0),
 | 
						|
    [4] = Vector3.New(-130,-144,0),
 | 
						|
    [6] = Vector3.New(130,-144,0),
 | 
						|
    [7] = Vector3.New(-130,-288,0),
 | 
						|
    [8] = Vector3.New(0,-288,0),
 | 
						|
    [9] = Vector3.New(130,-288,0),
 | 
						|
}
 | 
						|
 | 
						|
function this:CheckTrigger(data,go)
 | 
						|
    if isSkip then
 | 
						|
        LogGreen("data.eventType:"..tostring(data.eventType).."     this.curEvent.eventType:"..tostring(this.curEvent.eventType))
 | 
						|
        if (data.eventType == this.curEvent.eventType) then--(data.eventType ~= 3 and data.eventType ~= 1 and data.eventType ~= 2 and data.eventType ~= 10) or (data.eventType == this.curEvent.eventType) then
 | 
						|
            this:CloseDiaLog()
 | 
						|
            this:StackPop()
 | 
						|
            return
 | 
						|
        end
 | 
						|
        if this.curEvent.eventType == 2 then
 | 
						|
            for k,v in pairs(this.PlayerGrouops) do
 | 
						|
                v:StopAction()
 | 
						|
            end   
 | 
						|
        end
 | 
						|
        if this.curEvent.eventType == 1 then
 | 
						|
            this:CloseDiaLog()
 | 
						|
        end
 | 
						|
        isSkip = false
 | 
						|
    end
 | 
						|
    this.go = go
 | 
						|
    this.curEvent = data 
 | 
						|
    if data.eventType == 1 then     -- 1 对话  2跑图   3假战斗
 | 
						|
        this.eventIndex = 0
 | 
						|
        this:ShowDialog()
 | 
						|
    elseif data.eventType == 2 then    
 | 
						|
        this.eventIndex = 0
 | 
						|
        this:RunMap(data.eventType) 
 | 
						|
    elseif data.eventType == 3 then
 | 
						|
        this.eventIndex = 0
 | 
						|
        --PopupTipPanel.ShowTip("进入一场假战斗")
 | 
						|
        this:EnterFight()
 | 
						|
    elseif data.eventType == 4 then   --符咒闪烁了一下
 | 
						|
        this.eventIndex = 0
 | 
						|
        --PopupTipPanel.ShowTip("符咒闪烁了一下")
 | 
						|
        -- this:StackPop()
 | 
						|
        this.btnSkipBtnComp.enabled = false
 | 
						|
        if not this.UI_Effect_ChuFaEffect_04 then
 | 
						|
            this.UI_Effect_ChuFaEffect_04 = poolManager:LoadAsset("UI_Effect_ChuFaEffect_04", PoolManager.AssetType.GameObject)
 | 
						|
            this.UI_Effect_ChuFaEffect_04.name = "UI_Effect_ChuFaEffect_04"
 | 
						|
            this.UI_Effect_ChuFaEffect_04.transform:SetParent(this.effectRoot.transform)
 | 
						|
            this.UI_Effect_ChuFaEffect_04.transform.localPosition = Vector3.New(0,550,0)
 | 
						|
            this.UI_Effect_ChuFaEffect_04.transform.localScale = Vector3.one
 | 
						|
        end
 | 
						|
        this.UI_Effect_ChuFaEffect_04.gameObject:SetActive(true)
 | 
						|
        Util.AddParticleSortLayer(this.UI_Effect_ChuFaEffect_04,newSortingOrder - sortingOrder)
 | 
						|
        Timer.New(function()
 | 
						|
            if this.UI_Effect_ChuFaEffect_04 then
 | 
						|
                this.UI_Effect_ChuFaEffect_04.gameObject:SetActive(false)
 | 
						|
                this.btnSkipBtnComp.enabled = true
 | 
						|
                this:StackPop()
 | 
						|
            end         
 | 
						|
        end,data.groups[1],1,false):Start()
 | 
						|
    elseif data.eventType == 5 then   --符咒闪烁后消失
 | 
						|
        this.eventIndex = 0
 | 
						|
        if this.Maps and this.Maps[2] then
 | 
						|
            this.Maps[2].gameObject:SetActive(false)
 | 
						|
        end
 | 
						|
        this:StackPop()
 | 
						|
    elseif data.eventType == 6 then    --符咒消失,金箍棒砸在主角和怪物中间。
 | 
						|
        this.eventIndex = 0
 | 
						|
        this.btnSkipBtnComp.enabled = false
 | 
						|
        if not this.UI_Effect_ChuFaEffect_01 then
 | 
						|
            this.UI_Effect_ChuFaEffect_01 = poolManager:LoadAsset("UI_Effect_ChuFaEffect_01", PoolManager.AssetType.GameObject)
 | 
						|
            this.UI_Effect_ChuFaEffect_01.name = "UI_Effect_ChuFaEffect_01"
 | 
						|
            this.UI_Effect_ChuFaEffect_01.transform:SetParent(this.effectRoot.transform)
 | 
						|
            this.UI_Effect_ChuFaEffect_01.transform.localPosition = Vector3.zero
 | 
						|
            this.UI_Effect_ChuFaEffect_01.transform.localScale = Vector3.one
 | 
						|
        end
 | 
						|
        Util.AddParticleSortLayer(this.UI_Effect_ChuFaEffect_01,newSortingOrder - sortingOrder)
 | 
						|
        this.UI_Effect_ChuFaEffect_01.gameObject:SetActive(true)
 | 
						|
        Timer.New(function()
 | 
						|
            if this.UI_Effect_ChuFaEffect_01 then
 | 
						|
                this.UI_Effect_ChuFaEffect_01.gameObject:SetActive(false)
 | 
						|
            end    
 | 
						|
            this.btnSkipBtnComp.enabled = true       
 | 
						|
        end,data.groups[1],1,false):Start()
 | 
						|
        this:StackPop()
 | 
						|
        --PopupTipPanel.ShowTip("符咒消失,金箍棒砸在主角和怪物中间。")
 | 
						|
        -- this:StackPop()
 | 
						|
    elseif data.eventType == 7 then
 | 
						|
        this.eventIndex = 0
 | 
						|
        this.btnSkipBtnComp.enabled = false       
 | 
						|
        --PopupTipPanel.ShowTip("随着光芒闪烁,一把从天而降的神剑插在了一只怪物面前。")
 | 
						|
        if not this.UI_Effect_ChuFaEffect_02 then
 | 
						|
            this.UI_Effect_ChuFaEffect_02 = poolManager:LoadAsset("UI_Effect_ChuFaEffect_02", PoolManager.AssetType.GameObject)
 | 
						|
            this.UI_Effect_ChuFaEffect_02.name = "UI_Effect_ChuFaEffect_02"
 | 
						|
            this.UI_Effect_ChuFaEffect_02.transform:SetParent(this.effectRoot.transform)
 | 
						|
            this.UI_Effect_ChuFaEffect_02.transform.localPosition = Vector3.New(-415,700,0) 
 | 
						|
            this.UI_Effect_ChuFaEffect_02.transform.localScale = Vector3.one
 | 
						|
        end
 | 
						|
        if not this.UI_Effect_ChuFaEffect_05 then
 | 
						|
            this.UI_Effect_ChuFaEffect_05 = poolManager:LoadAsset("UI_Effect_ChuFaEffect_05", PoolManager.AssetType.GameObject)
 | 
						|
            this.UI_Effect_ChuFaEffect_05.name = "UI_Effect_ChuFaEffect_05"
 | 
						|
            this.UI_Effect_ChuFaEffect_05.transform:SetParent(this.effectRoot.transform)
 | 
						|
            this.UI_Effect_ChuFaEffect_05.transform.localPosition = pos[8]
 | 
						|
            this.UI_Effect_ChuFaEffect_05.transform.localScale = Vector3.one
 | 
						|
        end
 | 
						|
        this.UI_Effect_ChuFaEffect_05.gameObject:SetActive(false)
 | 
						|
        Util.AddParticleSortLayer(this.UI_Effect_ChuFaEffect_02,newSortingOrder - sortingOrder)
 | 
						|
        Util.AddParticleSortLayer(this.UI_Effect_ChuFaEffect_05,newSortingOrder - sortingOrder)
 | 
						|
        this.UI_Effect_ChuFaEffect_02.gameObject:SetActive(true)      
 | 
						|
        Timer.New(function() 
 | 
						|
            this.UI_Effect_ChuFaEffect_02.gameObject:SetActive(false)
 | 
						|
            this.UI_Effect_ChuFaEffect_05.gameObject:SetActive(true)
 | 
						|
        end,data.groups[1],1,false):Start()
 | 
						|
        
 | 
						|
        Timer.New(function()
 | 
						|
            if this.PlayerGrouops and this.PlayerGrouops[7] then
 | 
						|
                this.PlayerGrouops[7]:SetWalkDir(WALK_DIR.DEAD_BACK)
 | 
						|
            end
 | 
						|
        end,(data.groups[1] + 0.5),1,false):Start()
 | 
						|
        
 | 
						|
        Timer.New(function()
 | 
						|
            this.UI_Effect_ChuFaEffect_05.gameObject:SetActive(false)
 | 
						|
            this.btnSkipBtnComp.enabled = true       
 | 
						|
            this:StackPop()
 | 
						|
        end,(data.groups[1] + 0.5 + 1),1,false):Start()
 | 
						|
        --this:StackPop()
 | 
						|
    elseif data.eventType == 8 then
 | 
						|
        this.eventIndex = 0
 | 
						|
        this.btnSkipBtnComp.enabled = false       
 | 
						|
        --PopupTipPanel.ShowTip("数把飞剑在主角身边依次落下,将身边一圈的怪物都扎死在剑下。随后剑放出光芒,形成环绕主角的法阵。")
 | 
						|
        -- this:StackPop()
 | 
						|
        if not this.effectBrowList then
 | 
						|
            this.effectBrowList = {}
 | 
						|
        end
 | 
						|
        local tempList = {7,4,1,2,3,6,9}
 | 
						|
        for k,v in pairs(tempList) do
 | 
						|
            if not this.effectBrowList[v] then
 | 
						|
                this.effectBrowList[v] = poolManager:LoadAsset("UI_Effect_ChuFaEffect_05", PoolManager.AssetType.GameObject)
 | 
						|
                this.effectBrowList[v].name = "UI_Effect_ChuFaEffect_05"
 | 
						|
                this.effectBrowList[v].transform:SetParent(this.effectRoot.transform)
 | 
						|
                this.effectBrowList[v].transform.localPosition = pos[v]
 | 
						|
                this.effectBrowList[v].transform.localScale = Vector3.one
 | 
						|
                this.effectBrowList[v].gameObject:SetActive(false)
 | 
						|
            end
 | 
						|
        end
 | 
						|
        local indexTemp = 0
 | 
						|
        Timer.New(function()
 | 
						|
            indexTemp = indexTemp + 1
 | 
						|
            Util.AddParticleSortLayer(this.effectBrowList[tempList[indexTemp]],newSortingOrder - sortingOrder)
 | 
						|
            this.effectBrowList[tempList[indexTemp]].gameObject:SetActive(true)
 | 
						|
            local index = 0  
 | 
						|
            if tempList[indexTemp] < 5 then
 | 
						|
                index = tempList[indexTemp]
 | 
						|
            else
 | 
						|
                index = tempList[indexTemp] - 1
 | 
						|
            end
 | 
						|
            LogGreen("index:"..index.."   this.PlayerGrouops[index]:"..tostring(this.PlayerGrouops[index]))
 | 
						|
            if this.PlayerGrouops and this.PlayerGrouops[index] then
 | 
						|
                if index > 0 and index < 4 then
 | 
						|
                    this.PlayerGrouops[index]:SetWalkDir(WALK_DIR.DEAD_FRONT)
 | 
						|
                elseif index == 4 then
 | 
						|
                    this.PlayerGrouops[index]:SetWalkDir(WALK_DIR.DEAD_LEFT)
 | 
						|
                elseif index == 5 then
 | 
						|
                    this.PlayerGrouops[index]:SetWalkDir(WALK_DIR.DEAD_RIGHT)
 | 
						|
                elseif index > 5 and index < 9 then
 | 
						|
                    this.PlayerGrouops[index]:SetWalkDir(WALK_DIR.DEAD_BACK)
 | 
						|
                end    
 | 
						|
            end
 | 
						|
        end,data.groups[1],7,false):Start()
 | 
						|
 | 
						|
        Timer.New(function()
 | 
						|
            for k,v in pairs(this.effectBrowList) do
 | 
						|
                v.gameObject:SetActive(false)
 | 
						|
            end
 | 
						|
 | 
						|
            if not this.UI_Effect_ChuFaEffect_03 then
 | 
						|
                this.UI_Effect_ChuFaEffect_03 = poolManager:LoadAsset("UI_Effect_ChuFaEffect_03", PoolManager.AssetType.GameObject)
 | 
						|
                this.UI_Effect_ChuFaEffect_03.name = "UI_Effect_ChuFaEffect_03"
 | 
						|
                this.UI_Effect_ChuFaEffect_03.transform:SetParent(this.effectRoot.transform)
 | 
						|
                this.UI_Effect_ChuFaEffect_03.transform.localPosition = Vector3.New(0,-183,0)
 | 
						|
                this.UI_Effect_ChuFaEffect_03.transform.localScale = Vector3.one
 | 
						|
            end
 | 
						|
            Util.AddParticleSortLayer(this.UI_Effect_ChuFaEffect_03,newSortingOrder - sortingOrder)
 | 
						|
            this.UI_Effect_ChuFaEffect_03.gameObject:SetActive(true)
 | 
						|
            Timer.New(function()
 | 
						|
                this.btnSkipBtnComp.enabled = true       
 | 
						|
                this:StackPop()
 | 
						|
            end,1.3,1,false):Start()
 | 
						|
        end,data.groups[2],1,false):Start()
 | 
						|
    elseif data.eventType == 9 then         --等待几秒
 | 
						|
        this.eventIndex = 0
 | 
						|
        this.btnSkipBtnComp.enabled = false       
 | 
						|
        Timer.New(function()
 | 
						|
            this.btnSkipBtnComp.enabled = true       
 | 
						|
            this:StackPop()
 | 
						|
        end,data.groups[1],1,false):Start()
 | 
						|
    elseif data.eventType == 10 then            --保持某方向移动
 | 
						|
        this.eventIndex = 0
 | 
						|
        this:RunMap(data.eventType)
 | 
						|
    elseif data.eventType == 11 then            --设置全屏遮罩,显示高亮位置点击区域
 | 
						|
        this.eventIndex = 0
 | 
						|
        this.mask.gameObject:SetActive(true)
 | 
						|
        this.maskBtn.transform.localPosition = Vector3.New(data.groups[1],data.groups[2],data.groups[3])
 | 
						|
    elseif data.eventType == 12 then            --光芒四射的特效
 | 
						|
        --设置上一个特效为false
 | 
						|
        --加载光芒四射的特效
 | 
						|
        this.eventIndex = 0   
 | 
						|
        this.btnSkipBtnComp.enabled = false       
 | 
						|
        Timer.New(function()
 | 
						|
            this.btnSkipBtnComp.enabled = true       
 | 
						|
            this:StackPop()
 | 
						|
        end,data.groups[1],1,false):Start()
 | 
						|
    end
 | 
						|
end
 | 
						|
 | 
						|
function this:EnterFight()
 | 
						|
    this.eventIndex = this.eventIndex + 1
 | 
						|
    local fdata, fseed = BattleManager.GetFakeBattleData(this.curEvent.groups[this.eventIndex])
 | 
						|
    local testFightData = {
 | 
						|
        fightData = fdata,
 | 
						|
        fightSeed = fseed,
 | 
						|
        fightType = 0,
 | 
						|
        maxRound = 20,
 | 
						|
    }
 | 
						|
    UIManager.OpenPanel(UIName.BattlePanel, testFightData, BATTLE_TYPE.Test,function()
 | 
						|
        this:StackPop()
 | 
						|
    end)
 | 
						|
end
 | 
						|
 | 
						|
function this:CloseDiaLog()
 | 
						|
    this.showDiaLog = false
 | 
						|
    this.dialog.gameObject:SetActive(false)
 | 
						|
    this.GoOn.gameObject:SetActive(false)
 | 
						|
    this.showImg:SetActive(false)
 | 
						|
    this.ReSetLive2d()
 | 
						|
end
 | 
						|
 | 
						|
function this:ShowDialog()
 | 
						|
    this.eventIndex = this.eventIndex + 1
 | 
						|
    if #this.curEvent.groups < this.eventIndex then
 | 
						|
        this:CloseDiaLog()
 | 
						|
        if this.go then           
 | 
						|
            this.go:StackPop()
 | 
						|
            this.go = nil
 | 
						|
        else        
 | 
						|
            this:StackPop()
 | 
						|
        end    
 | 
						|
    else
 | 
						|
        this.showImg:SetActive(false)
 | 
						|
        this.dialog.gameObject:SetActive(true)
 | 
						|
        this.GoOn.gameObject:SetActive(true)
 | 
						|
        local config = chapterEventPointData[this.curEvent.groups[this.eventIndex]]
 | 
						|
        if not config then
 | 
						|
            LogGreen("this.curEvent.groups[this.eventIndex]:"..this.curEvent.groups[this.eventIndex].."    this.eventIndex:"..this.eventIndex)
 | 
						|
        end
 | 
						|
        local showValues = GetLanguageStrById(config.ShowValues)
 | 
						|
 | 
						|
        local options = config.Option
 | 
						|
        local dir = config.ShowDir
 | 
						|
        local live2dRoot = dir == 2 and this.left2dRoot or this.right2dRoot
 | 
						|
        local setId = config.DialogueViewId
 | 
						|
 | 
						|
         -- 角色信息
 | 
						|
        local contents = string.split(showValues, "|")
 | 
						|
        local resId = tonumber(contents[1])
 | 
						|
        local contexts =(contents[2])
 | 
						|
        contexts = string.gsub(contexts, Language[11248], NameManager.roleName)
 | 
						|
        --this.diaLogNameText.text = ""     
 | 
						|
        ShowText(this.diaLogContent.transform, contexts, 1)
 | 
						|
        this.SetList2d(resId,setId,live2dRoot)
 | 
						|
        if not this.showDiaLog then
 | 
						|
            PlayUIAnim(this.gameObject)
 | 
						|
            this.showDiaLog = true
 | 
						|
        end
 | 
						|
        --this.diaLogContent.text = contexts
 | 
						|
    end
 | 
						|
end
 | 
						|
 | 
						|
function this.SetList2d(resId,setId,live2dRoot)
 | 
						|
    -- 显示立绘
 | 
						|
    if resId > 0 and resId ~= 999 then
 | 
						|
        local data = artResConfig[resId]
 | 
						|
        this.diaLogName.gameObject:SetActive(true)
 | 
						|
        this.diaLogNameText.text = string.gsub(GetLanguageStrById(data.Desc), Language[11252], NameManager.roleName)
 | 
						|
 | 
						|
        local roleSex = NameManager.roleSex
 | 
						|
        local resPath 
 | 
						|
        if resId == 8001 then  --- 主角专用字段
 | 
						|
            resPath = roleSex == ROLE_SEX.BOY and StoryManager.boyRes or StoryManager.bitchRes 
 | 
						|
        else
 | 
						|
            resPath = artResConfig[resId].Name
 | 
						|
        end
 | 
						|
        if lastLive2DId ~= resId then
 | 
						|
            -- 需要加载立绘的时候清除所有
 | 
						|
            this.ReSetLive2d()    
 | 
						|
            if setId and setId ~= 0 then
 | 
						|
                StoryManager.InitLive2dState(setId, resPath, live2dRoot, this.effectRoot, true, this)
 | 
						|
            else
 | 
						|
                this.LoadLive2D(data, resPath, live2dRoot)
 | 
						|
            end
 | 
						|
        else
 | 
						|
            if setId then
 | 
						|
                StoryManager.InitLive2dState(setId, resPath, live2dRoot, this.effectRoot, false, this)
 | 
						|
            end
 | 
						|
        end
 | 
						|
    elseif resId == 999 then -- 显示图片
 | 
						|
        this.showImg:SetActive(true)
 | 
						|
        this.ReSetLive2d()
 | 
						|
        this.diaLogName.gameObject:SetActive(false)
 | 
						|
        if setId then
 | 
						|
            StoryManager.InitImgState(setId, this.showImg, this.effectRoot, this)
 | 
						|
        end
 | 
						|
    else
 | 
						|
        this.showImg:SetActive(false)
 | 
						|
        this.ReSetLive2d()
 | 
						|
        this.diaLogName.gameObject:SetActive(false)
 | 
						|
    end
 | 
						|
    lastLive2DId = resId
 | 
						|
end
 | 
						|
 | 
						|
-- 清除立绘
 | 
						|
function this.ReSetLive2d()
 | 
						|
    Util.ClearChild(this.left2dRoot.transform)
 | 
						|
    Util.ClearChild(this.right2dRoot.transform)
 | 
						|
end
 | 
						|
 | 
						|
function this:RunMap(indexType)  
 | 
						|
    if  this.startTimer then
 | 
						|
        this.startTimer:Stop()
 | 
						|
        this.startTimer = nil
 | 
						|
    end
 | 
						|
    local dua = 0
 | 
						|
    if isFirstEnter == 1 then
 | 
						|
        isFirstEnter = 0
 | 
						|
        dua = 0.1
 | 
						|
    else
 | 
						|
        dua = 0
 | 
						|
    end
 | 
						|
    this.startTimer = Timer.New(function ()      
 | 
						|
        for k,v in pairs(this.PlayerGrouops) do
 | 
						|
            v:RunMap(indexType)
 | 
						|
        end                                 
 | 
						|
    end,dua)
 | 
						|
    this.startTimer:Start()
 | 
						|
 | 
						|
    if  this.startTimer1 then
 | 
						|
        this.startTimer1:Stop()
 | 
						|
        this.startTimer1 = nil
 | 
						|
    end
 | 
						|
    local isEnterNext = true 
 | 
						|
    this.startTimer1 = Timer.New(function() 
 | 
						|
        isEnterNext = true     
 | 
						|
        for k,v in pairs(this.PlayerGrouops) do
 | 
						|
            if v:CheckState() then 
 | 
						|
                isEnterNext = false
 | 
						|
                break
 | 
						|
            end
 | 
						|
        end   
 | 
						|
        if isEnterNext then
 | 
						|
            this.startTimer1:Stop()
 | 
						|
            this.startTimer1 = nil
 | 
						|
            this:StackPop()
 | 
						|
        end                  
 | 
						|
    end,0.01,-1,false) 
 | 
						|
    Timer.New(function() 
 | 
						|
        if this.startTimer1 then
 | 
						|
            this.startTimer1:Start() 
 | 
						|
        end
 | 
						|
    end,0.2,1,false):Start()
 | 
						|
end
 | 
						|
 | 
						|
function StoryMapPanel:OnSortingOrderChange()
 | 
						|
    newSortingOrder = self.sortingOrder
 | 
						|
end
 | 
						|
 | 
						|
--界面关闭时调用(用于子类重写)
 | 
						|
function StoryMapPanel:OnClose()
 | 
						|
    isFirstEnter = 1
 | 
						|
    for k,v in pairs(this.PlayerGrouops) do
 | 
						|
        SubUIManager.Close(v)
 | 
						|
    end
 | 
						|
    this.PlayerGrouops = {}
 | 
						|
    if  this.startTimer then
 | 
						|
        this.startTimer:Stop()
 | 
						|
        this.startTimer = nil
 | 
						|
    end
 | 
						|
    lastLive2DId = 0
 | 
						|
    this.showDiaLog = false
 | 
						|
    this.dialog.gameObject:SetActive(false)
 | 
						|
    this.GoOn.gameObject:SetActive(false)
 | 
						|
    this.showImg:SetActive(false)
 | 
						|
    this.ReSetLive2d()
 | 
						|
    this.callList:Clear()
 | 
						|
    isSkip = false
 | 
						|
    this.triggerEvent = {}
 | 
						|
    if  this.startTimer then
 | 
						|
        this.startTimer:Stop()
 | 
						|
        this.startTimer = nil
 | 
						|
    end
 | 
						|
    if  this.startTimer1 then
 | 
						|
        this.startTimer1:Stop()
 | 
						|
        this.startTimer1 = nil
 | 
						|
    end
 | 
						|
    this.map.transform.localPosition = Vector3.New(0,0,0)
 | 
						|
    if this.effectBrowList then
 | 
						|
        for k ,v in pairs(this.effectBrowList)  do
 | 
						|
            v.gameObject:SetActive(false)
 | 
						|
            poolManager:UnLoadAsset(v.name, v, PoolManager.AssetType.GameObject)
 | 
						|
        end
 | 
						|
        this.effectBrowList = nil
 | 
						|
    end
 | 
						|
    if this.UI_Effect_ChuFaEffect_01 then
 | 
						|
        poolManager:UnLoadAsset("UI_Effect_ChuFaEffect_01", this.UI_Effect_ChuFaEffect_01, PoolManager.AssetType.GameObject)
 | 
						|
        this.UI_Effect_ChuFaEffect_01 = nil 
 | 
						|
    end
 | 
						|
    if this.UI_Effect_ChuFaEffect_02 then
 | 
						|
        poolManager:UnLoadAsset("UI_Effect_ChuFaEffect_02", this.UI_Effect_ChuFaEffect_02, PoolManager.AssetType.GameObject)
 | 
						|
        this.UI_Effect_ChuFaEffect_02 = nil 
 | 
						|
    end
 | 
						|
    if this.UI_Effect_ChuFaEffect_03 then
 | 
						|
        poolManager:UnLoadAsset("UI_Effect_ChuFaEffect_03", this.UI_Effect_ChuFaEffect_03, PoolManager.AssetType.GameObject)
 | 
						|
        this.UI_Effect_ChuFaEffect_03 = nil 
 | 
						|
    end
 | 
						|
    if this.UI_Effect_ChuFaEffect_04 then
 | 
						|
        poolManager:UnLoadAsset("UI_Effect_ChuFaEffect_04", this.UI_Effect_ChuFaEffect_04, PoolManager.AssetType.GameObject)
 | 
						|
        this.UI_Effect_ChuFaEffect_04 = nil 
 | 
						|
    end
 | 
						|
    if this.UI_Effect_ChuFaEffect_05 then
 | 
						|
        poolManager:UnLoadAsset("UI_Effect_ChuFaEffect_05", this.UI_Effect_ChuFaEffect_05, PoolManager.AssetType.GameObject)
 | 
						|
        this.UI_Effect_ChuFaEffect_05 = nil 
 | 
						|
    end
 | 
						|
end
 | 
						|
 | 
						|
--界面销毁时调用(用于子类重写)
 | 
						|
function StoryMapPanel:OnDestroy() 
 | 
						|
    for k,v in pairs(this.PlayerGrouops) do
 | 
						|
        SubUIManager.Close(v)
 | 
						|
    end
 | 
						|
    this.Maps = {}
 | 
						|
    this.PlayerGrouops = {}
 | 
						|
    if  this.startTimer then
 | 
						|
        this.startTimer:Stop()
 | 
						|
        this.startTimer = nil
 | 
						|
    end
 | 
						|
end
 | 
						|
return this |