剧情提交

dev_chengFeng
jiaoyangna 2021-04-26 18:29:47 +08:00
parent f38e838967
commit 637aa36041
7 changed files with 133 additions and 90 deletions

View File

@ -260,7 +260,7 @@ end
--绑定事件(用于子类重写)
function this:BindEvent()
Util.AddOnceClick(this.btnEndLess,function()
UIManager.OpenPanel(UIName.StoryMapPanel)
StoryMapManager.InitData(1)
end)
self.trigger = Util.GetEventTriggerListener(self.ctrl)

View File

@ -112,6 +112,10 @@ MapFloatingConfig = {
scale = Vector3.New(0.2, 0.2, 0.2),
scale1 = Vector3.New(0.1, 0.1, 0.1),
position = Vector3.New(0, 40, 0)},
[25] = {name = "live2d_npc_map_boy",--人
scale = Vector3.New(0.2, 0.2, 0.2),
scale1 = Vector3.New(0.1, 0.1, 0.1),
position = Vector3.New(0, 40, 0)},
}
-- 特效资源的相关数组

View File

@ -8,11 +8,12 @@ function this.Initialize()
end
function this.InitData(groupId)
this.groupConfigs = {}
this.InitGroupIds(groupId)
this.GetSingleStoryConfig()
end
function this.InitGroupIds(groupId)
function this.InitGroupIds(groupId)
local config = storyMapConfig[groupId]
table.insert(this.groupConfigs,config)
if config.NextId and config.NextId > 0 then
@ -22,7 +23,6 @@ end
function this.GetSingleStoryConfig()
local config = {}
LogGreen("#this.groupConfigs:"..#this.groupConfigs)
if #this.groupConfigs > 0 then
config = this.groupConfigs[1]
if UIManager.IsOpen(UIName.StoryMapPanel) then

View File

@ -58,7 +58,11 @@ end
--添加事件监听(用于子类重写)
function StoryMapPanel:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.GuaJi.CloseStoryMapPanel,this.ClosePanel)
Game.GlobalEvent:AddEvent(GameEvent.GuaJi.CloseStoryMapPanel,this.CloseThisPanel)
end
function this.CloseThisPanel()
this:ClosePanel()
end
--移除事件监听(用于子类重写)
@ -137,21 +141,23 @@ function StoryMapPanel:OnShow()
end
function this:StackPop()
local isEnterNext = true
for k,v in pairs(this.PlayerGrouops) do
if v.state == 1 then
isEnterNext = false
break
end
end
if isEnterNext then
if this.callList:Count() > 0 then
-- local isEnterNext = true
-- for k,v in pairs(this.PlayerGrouops) do
-- if v.state == 1 then
-- isEnterNext = false
-- break
-- end
-- end
-- if isEnterNext then
LogGreen("前:"..this.callList:Count())
if this.callList:Count() > 0 then
this.callList:Pop()()
LogGreen("后:"..this.callList:Count())
else
LogGreen("进入下一场景")
StoryMapManager.GetSingleStoryConfig()
end
end
--end
end
function this:CheckTrigger(data,go)
@ -187,6 +193,15 @@ function this:CheckTrigger(data,go)
this.eventIndex = 0
PopupTipPanel.ShowTip("数把飞剑在主角身边依次落下,将身边一圈的怪物都扎死在剑下。随后剑放出光芒,形成环绕主角的法阵。")
this:StackPop()
elseif data.eventType == 9 then --等待几秒
this.eventIndex = 0
LogGreen("data.groups[1]:"..data.groups[1])
Timer.New(function()
this:StackPop()
end,data.groups[1],1,false):Start()
elseif data.eventType == 10 then --保持某方向移动
this.eventIndex = 0
this:RunMap()
end
end
@ -222,6 +237,9 @@ function this:ShowDialog()
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
@ -299,7 +317,7 @@ function this:RunMap()
for k,v in pairs(this.PlayerGrouops) do
v:RunMap()
end
end,0.1)
end,0.5)
this.startTimer:Start()
if this.startTimer1 then
@ -320,8 +338,12 @@ function this:RunMap()
this.startTimer1 = nil
this:StackPop()
end
end,0.5,-1,false)
this.startTimer1:Start()
end,0.01,-1,false)
Timer.New(function()
if this.startTimer then
this.startTimer1:Start()
end
end,1,1,false):Start()
end
function StoryMapPanel:OnSortingOrderChange()

View File

@ -18,25 +18,37 @@ function MonsterLiveView:New(gameObj,iconId,scale)
b.live2d = poolManager:LoadLive(MapFloatingConfig[iconId].name, Util.GetTransform(b.gameObject, "root"),
MapFloatingConfig[iconId].scale1, MapFloatingConfig[iconId].position)
b.skeleton = b.live2d:GetComponent("SkeletonGraphic")
self.oldPlayerDirAnimation = 0
self.oldPlayerDiry = 0
setmetatable(b, { __index = MonsterLiveView })
return b
end
function MonsterLiveView:SetWalkDir(index)
function MonsterLiveView:SetWalkDir(dir)
if dir == WALK_DIR.IDLE_FRONT then-- 站立_向前
self:SetWalkDirInfo(PLAYER_WALK_DIR.IDLE)
elseif dir == WALK_DIR.IDLE_BACK then-- 站立_向后
self:SetWalkDirInfo(PLAYER_WALK_DIR.IDLEBACK)
elseif dir == WALK_DIR.IDLE_LEFT then-- 站立_向左
self:SetWalkDirInfo(PLAYER_WALK_DIR.IDLE)
elseif dir == WALK_DIR.IDLE_RIGHT then-- 站立_向右
self:SetWalkDirInfo(PLAYER_WALK_DIR.IDLE)
elseif dir == WALK_DIR.RUN_RIGHT then-- 跑_向右
self:SetWalkDirInfo(PLAYER_WALK_DIR.RIGHT)
elseif dir == WALK_DIR.RUN_LEFT then-- 跑_向左
self:SetWalkDirInfo(PLAYER_WALK_DIR.LEFT)
elseif dir == WALK_DIR.RUN_UP then-- 跑_向上
self:SetWalkDirInfo(PLAYER_WALK_DIR.UP)
elseif dir == WALK_DIR.RUN_DOWN then-- 跑_向下
self:SetWalkDirInfo(PLAYER_WALK_DIR.DOWN)
end
end
-- 设置事件点动画
function MonsterLiveView:SetPointAnimation(iconId, index)
local skeleton = self.live:GetComponent("SkeletonGraphic")
local animation = ANIMATION[iconId]
if animation then
local aniName = ANIMATION[iconId].animation[index]
if aniName then
skeleton.AnimationState:SetAnimation(0, aniName, false)
end
else
--Log("当前地图点立绘没有其他动画!")
function MonsterLiveView:SetWalkDirInfo(playerDir)
if playerDir and (self.oldPlayerDirAnimation ~= playerDir.animation or self.oldPlayerDiry ~= playerDir.y) then
self.skeleton.transform.localEulerAngles = Vector3.New(0, playerDir.y, 0)
self.skeleton.AnimationState:SetAnimation(0, playerDir.animation, true)
self.oldPlayerDirAnimation = playerDir.animation
self.oldPlayerDiry = playerDir.y
end
end

View File

@ -137,7 +137,7 @@ function PlayerLiveView:OnShowLive()
--坐骑
local isRide=false
if self.PlayerLiveViewData.ride and self.PlayerLiveViewData.ride > 0 then
isRide=true
isRide = true
self.rideLiveGo:SetActive(true)
local curPlayerRole = ConfigManager.GetConfigData(ConfigName.PlayerRole,self.PlayerLiveViewData.ride)
local curArtResourcesConfig = ConfigManager.GetConfigData(ConfigName.ArtResourcesConfig,curPlayerRole.LiveAnimName)

View File

@ -14,9 +14,11 @@ function SingleStoryPlayerView:InitComponent()
self.nameDi = Util.GetGameObject(self.gameObject, "nemeDi")
self.name = Util.GetGameObject(self.nameDi, "name"):GetComponent("Text")
self.roadsList = {}
self.dirList = {}
self.roads = {}
self.startPos = {}
self.index = 1 --当前应该走哪一段 self.roads = self.roadsList[self.index] 第一段是出生点 从第二段开始跑图
self.roadsIndex = 0 --走到当前路线哪一步
self.callList = Stack.New()
self.state = 0
end
@ -26,6 +28,7 @@ function SingleStoryPlayerView:OnOpen(parent)
end
function SingleStoryPlayerView:SetData(data,playerType)
self.playerType = playerType
if self.playerLiveView then
self.playerLiveView:OnClose()
self.playerLiveView = nil
@ -42,21 +45,22 @@ function SingleStoryPlayerView:SetData(data,playerType)
end
function SingleStoryPlayerView:SetRoads0(data)
local index = 1
if not self.roadsList[index] then
self.roadsList[index] = {}
end
local index = 0
for i = 2 ,#data do
if tonumber(data[i]) and tonumber(data[i]) == 0 then
index = index + 1
if not self.roadsList[index] then
self.roadsList[index] = {}
end
local vecs = string.split(data[i],',')
if #vecs < 3 then
if tonumber(vecs[1]) == 0 then
index = index + 1
if not self.roadsList[index] then
self.roadsList[index] = {}
end
if not self.dirList[index] then
self.dirList[index] = tonumber(vecs[2]) or 1
end
end
else
local road = {}
road.indexType = 0 -- 0 怪 1 人 2 地图
LogGreen("data[i]:"..data[i])
local vecs = string.split(data[i],',')
road.vec = Vector3.New(tonumber(vecs[1] or 0),tonumber(vecs[2] or 0),tonumber(vecs[3] or 0))
if tonumber(vecs[4]) and tonumber(vecs[4]) > 0 then
local event = {}
@ -70,33 +74,38 @@ function SingleStoryPlayerView:SetRoads0(data)
table.insert(self.roadsList[index],road)
end
end
for k,v in ipairs(self.roadsList) do
LogGreen("Monster k:"..k.." dirList:"..self.dirList[k])
for n,m in ipairs(v) do
LogGreen("Monster k:"..k.." n:"..n.." vec:"..tostring(m.vec))
end
end
self.startPos = self.roadsList[1][1].vec
local pointId = tonumber(data[1])
self.playerLiveView = MonsterLiveView:New(self.roleRoot,pointId)
for k,v in ipairs(self.roadsList) do
for n,m in ipairs(v) do
LogGreen("Monster k:"..k.." n:"..n.." vec:"..tostring(m.vec))
end
end
self:SetWalkDir(self.dirList[1])
end
function SingleStoryPlayerView:SetRoads1(data)
self.playerLiveView = PlayerLiveView:New(self.roleRoot,1,nil)
self.playerLiveView = PlayerLiveView:New(self.roleRoot,2,{
skin = PlayerManager.GetPlayerSkin(),
sex = NameManager.roleSex,
ride = 0,
designation = 0,
})
self.playerLiveView:OnOpen(GetPlayerRoleSingleConFig().Scale14)
self.playerLiveView.name = "npc"
self:SetWalkDir(WALK_DIR.IDLE_FRONT)
--PlayUIAnim(self.gameObject)
local index = 1
if not self.roadsList[index] then
self.roadsList[index] = {}
end
local index = 0
for i = 1 ,#data do
if tonumber(data[i][1]) and tonumber(data[i][1]) == 0 then
index = index + 1
if not self.roadsList[index] then
self.roadsList[index] = {}
end
if not self.dirList[index] then
self.dirList[index] = tonumber(data[i][2]) or 1
end
else
local road = {}
road.indexType = tonumber(data[i][1]) -- 0 怪 1 人 2 地图
@ -114,19 +123,23 @@ function SingleStoryPlayerView:SetRoads1(data)
table.insert(self.roadsList[index],road)
end
end
self.startPos = self.roadsList[1][1].vec
for k,v in ipairs(self.roadsList) do
LogGreen("Player k:"..k.." dirList:"..self.dirList[k])
for n,m in ipairs(v) do
LogGreen("player k:"..k.." n:"..n.." vec:"..tostring(m.vec))
LogGreen("Player k:"..k.." n:"..n.." vec:"..tostring(m.vec))
end
end
self.startPos = self.roadsList[1][1].vec
self:SetWalkDir(self.dirList[1])
end
function SingleStoryPlayerView:RunMap()
self.roadsIndex = 0
self.state = 1
self.index = self.index + 1
self.roads = self.roadsList[self.index]
self.eventpoint = self.dirList[self.index]
self:SetRoleDir()
if not self.roads or #self.roads < 1 then
self.state = 0
return
@ -139,7 +152,7 @@ function SingleStoryPlayerView:RunMap()
if data.indexType == 2 then
go = self.parent.map
end
local dis = math.abs(self:SetRoleDirAction(data.vec,go))
local dis = math.abs(self:SetRoleDirAction(data.vec,go,data.indexType))
local speed = 0
if data.indexType ~= 0 then
speed = (1/600)*dis
@ -150,6 +163,7 @@ function SingleStoryPlayerView:RunMap()
--self:PlayStepSound()
end):OnComplete(function ()
if data.event and data.event.eventType > 0 then
self:SetRoleDir()
self.parent:CheckTrigger(data.event,self)
else
self:StackPop()
@ -161,20 +175,32 @@ function SingleStoryPlayerView:RunMap()
end
-- 角色相关
function SingleStoryPlayerView:SetRoleDirAction(pos,go)
function SingleStoryPlayerView:SetRoleDirAction(pos,go,indexType)
local du = pos.x - go.transform.localPosition.x
local dy = pos.y - go.transform.localPosition.y
if du > 0 then
self:SetWalkDir(WALK_DIR.RUN_RIGHT)
if indexType ~= 2 then
self:SetWalkDir(WALK_DIR.RUN_RIGHT)
end
self.eventpoint = 4
return du
elseif du < 0 then
self:SetWalkDir(WALK_DIR.RUN_LEFT)
if indexType ~= 2 then
self:SetWalkDir(WALK_DIR.RUN_LEFT)
end
self.eventpoint = 3
return du
elseif dy < 0 then
self:SetWalkDir(WALK_DIR.RUN_DOWN)
if indexType ~= 2 then
self:SetWalkDir(WALK_DIR.RUN_DOWN)
end
self.eventpoint = 1
return dy
elseif dy > 0 then
self:SetWalkDir(WALK_DIR.RUN_UP)
if indexType ~= 2 then
self:SetWalkDir(WALK_DIR.RUN_UP)
end
self.eventpoint = 2
return dy
end
return 0
@ -185,39 +211,16 @@ function SingleStoryPlayerView:SetWalkDir(dir)
end
-- 角色停止行走时的朝向
function SingleStoryPlayerView:SetRoleDir(rolePos, iconPos)
local u0, v0 = Map_Pos2UV(rolePos)
local u, v = Map_Pos2UV(iconPos)
if v0 == v then
if u0 > u then
self.m_roleFaceDir = Vector2.New(-1, 0)
--LogGreen("他要朝左左左左左")
self.eventpoint = 3
else
self.m_roleFaceDir = Vector2.New(1, 0)
--LogGreen("他要朝右右右右")
self.eventpoint = 4
end
else
if v0 > v then
self.m_roleFaceDir = Vector2.New(0, 1)
--LogGreen("他要朝上上上上")
self.eventpoint = 2
else
self.m_roleFaceDir = Vector2.New(0, -1)
--LogGreen("他要朝下下下下下下")
self.eventpoint = 1
end
end
function SingleStoryPlayerView:SetRoleDir()
self:SetWalkDir(self.eventpoint)
end
function SingleStoryPlayerView:StackPop()
if self.callList:Count() > 0 then
self.roadsIndex = self.roadsIndex + 1
self.callList:Pop()()
else
self.state = 0
self.parent:StackPop()
end
end
@ -238,9 +241,11 @@ function SingleStoryPlayerView:OnClose()
end
function SingleStoryPlayerView:CheckState()
if self.state == 1 or self.index < #self.roadsList then --v.state == 1 or v.index < #v.roadsList
--LogGreen("self.state:"..self.state.." self.index:"..self.roadsIndex.." self.playerType:"..self.playerType.." #self.roadsList:"..#self.roadsList[self.index])
if self.state == 1 or self.roadsIndex < (self.roadsList[self.index] and #self.roadsList[self.index] or 0) then
return true
end
return false
end
return SingleStoryPlayerView