剧情音效提交

dev_chengFeng
jiaoyangna 2021-05-13 16:32:40 +08:00
parent 35d0f1337f
commit ac8eaf78bb
1 changed files with 33 additions and 23 deletions

View File

@ -1,6 +1,9 @@
SingleStoryPlayerView = {}
local MapPointConfig = ConfigManager.GetConfig(ConfigName.MapPointConfig)
local _PlayTimeStamp = {
[0] = 0,
[1] = 0,
}
function SingleStoryPlayerView:New(gameObject)
local b = {}
b.gameObject = gameObject
@ -25,6 +28,11 @@ end
function SingleStoryPlayerView:OnOpen(parent)
self.parent = parent
_PlayTimeStamp = {
[0] = 0,
[1] = 0,
}
--LogGreen("_PlayTimeStamp[0]:".._PlayTimeStamp[0])
end
function SingleStoryPlayerView:SetData(data,playerType)
@ -42,11 +50,6 @@ function SingleStoryPlayerView:SetData(data,playerType)
self.gameObject.transform.localPosition = self.startPos
self.gameObject.transform.localScale = Vector3.one * 1.5
self._PlayTimeStamp = {
[0] = 0,
[1] = 0
}
end
function SingleStoryPlayerView:SetRoads0(data)
@ -80,9 +83,9 @@ function SingleStoryPlayerView:SetRoads0(data)
end
end
-- for k,v in ipairs(self.roadsList) do
-- LogGreen("Monster k:"..k.." dirList:"..self.dirList[k])
-- --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))
-- --LogGreen("Monster k:"..k.." n:"..n.." vec:"..tostring(m.vec))
-- end
-- end
self.startPos = self.roadsList[1][1].vec
@ -129,9 +132,9 @@ function SingleStoryPlayerView:SetRoads1(data)
end
end
-- for k,v in ipairs(self.roadsList) do
-- LogGreen("Player k:"..k.." dirList:"..self.dirList[k])
-- --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
@ -160,7 +163,7 @@ function SingleStoryPlayerView:RunMap(isSetRoleDir)
go = self.parent.map
end
local dis
--LogGreen("isSetRoleDir:"..isSetRoleDir)
----LogGreen("isSetRoleDir:"..isSetRoleDir)
if data.indexType == 2 or isSetRoleDir == 10 then
dis = math.abs(self:SetRoleDirAction(data.vec,go.transform.localPosition,false))
else
@ -188,34 +191,36 @@ function SingleStoryPlayerView:RunMap(isSetRoleDir)
end
function SingleStoryPlayerView:PlaySound(time,Sound,curTimeStamp,timeStamp)
LogGreen("curTimeStamp:"..curTimeStamp.." timeStamp:"..timeStamp.." curTimeStamp - timeStamp:"..curTimeStamp - timeStamp)
--LogGreen("curTimeStamp:"..curTimeStamp.." timeStamp:"..timeStamp.." curTimeStamp - timeStamp:"..curTimeStamp - timeStamp)
if curTimeStamp - timeStamp >= time then
LogGreen("播放音效:"..Sound)
--LogGreen("播放音效:"..Sound)
SoundManager.PlaySound(Sound)
return true
end
return false
end
function SingleStoryPlayerView:PlayStepSound(indexType,isSetRoleDir)
local curTimeStamp = GetTimeStamp()
self.curTimeStamp = GetTimeStamp()
if indexType == 0 then
self.isSet = self:PlaySound(1,(isSetRoleDir == 10 and SoundConfig.STORY_VOICE_1_4 or SoundConfig.STORY_FOOT_1_2),curTimeStamp,self._PlayTimeStamp[0])
self.isSet = self:PlaySound(0.5,(isSetRoleDir == 10 and SoundConfig.STORY_VOICE_1_4 or SoundConfig.STORY_FOOT_1_2),self.curTimeStamp,_PlayTimeStamp[0])
if self.isSet then
self._PlayTimeStamp[0] = curTimeStamp
_PlayTimeStamp[0] = self.curTimeStamp
end
--LogGreen("_PlayTimeStamp[0]:".._PlayTimeStamp[0])
elseif indexType == 1 then
self.isSet = self:PlaySound(0.2,SoundConfig.STORY_FOOT_1_1,curTimeStamp,self._PlayTimeStamp[1])
self.isSet = self:PlaySound(0.2,SoundConfig.STORY_FOOT_1_1,self.curTimeStamp,_PlayTimeStamp[1])
if self.isSet then
self._PlayTimeStamp[1] = curTimeStamp
_PlayTimeStamp[1] = self.curTimeStamp
end
else
self.isSet = self:PlaySound(1,(isSetRoleDir == 10 and SoundConfig.STORY_VOICE_1_4 or SoundConfig.STORY_FOOT_1_2),curTimeStamp,self._PlayTimeStamp[0])
self.isSet = self:PlaySound(0.5,(isSetRoleDir == 10 and SoundConfig.STORY_VOICE_1_4 or SoundConfig.STORY_FOOT_1_2),self.curTimeStamp,_PlayTimeStamp[0])
if self.isSet then
self._PlayTimeStamp[0] = curTimeStamp
_PlayTimeStamp[0] = self.curTimeStamp
end
self.isSet = self:PlaySound(0.2,SoundConfig.STORY_FOOT_1_1,curTimeStamp,self._PlayTimeStamp[1])
--LogGreen("_PlayTimeStamp[0]:".._PlayTimeStamp[0])
self.isSet = self:PlaySound(0.2,SoundConfig.STORY_FOOT_1_1,self.curTimeStamp,_PlayTimeStamp[1])
if self.isSet then
self._PlayTimeStamp[1] = curTimeStamp
_PlayTimeStamp[1] = self.curTimeStamp
end
end
end
@ -298,10 +303,15 @@ function SingleStoryPlayerView:OnClose()
if self.tween then
self.tween:Kill()
end
--LogGreen("_PlayTimeStamp[0]:".._PlayTimeStamp[0])
_PlayTimeStamp = {
[0] = 0,
[1] = 0,
}
end
function SingleStoryPlayerView:CheckState()
--LogGreen("self.state:"..self.state.." self.index:"..self.roadsIndex.." self.playerType:"..self.playerType.." #self.roadsList:"..#self.roadsList[self.index])
----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