diff --git a/Assets/ManagedResources/Audio/UI/voice/story_foot_1_1.mp3 b/Assets/ManagedResources/Audio/UI/voice/story_foot_1_1.mp3 index 411be8421c..24e1b962f7 100644 Binary files a/Assets/ManagedResources/Audio/UI/voice/story_foot_1_1.mp3 and b/Assets/ManagedResources/Audio/UI/voice/story_foot_1_1.mp3 differ diff --git a/Assets/ManagedResources/~Lua/View/SingleStoryPlayerView.lua b/Assets/ManagedResources/~Lua/View/SingleStoryPlayerView.lua index 55f641b368..7e5907d0f3 100644 --- a/Assets/ManagedResources/~Lua/View/SingleStoryPlayerView.lua +++ b/Assets/ManagedResources/~Lua/View/SingleStoryPlayerView.lua @@ -42,6 +42,11 @@ 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) @@ -134,7 +139,6 @@ function SingleStoryPlayerView:SetRoads1(data) end function SingleStoryPlayerView:RunMap(isSetRoleDir) - self._PlayTimeStamp = 0 self.roadsIndex = 0 self.state = 1 self.index = self.index + 1 @@ -182,19 +186,37 @@ function SingleStoryPlayerView:RunMap(isSetRoleDir) end self:StackPop() end + +function SingleStoryPlayerView:PlaySound(time,Sound,curTimeStamp,timeStamp) + LogGreen("curTimeStamp:"..curTimeStamp.." timeStamp:"..timeStamp.." curTimeStamp - timeStamp:"..curTimeStamp - timeStamp) + if curTimeStamp - timeStamp >= time then + LogGreen("播放音效:"..Sound) + SoundManager.PlaySound(Sound) + return true + end + return false +end function SingleStoryPlayerView:PlayStepSound(indexType,isSetRoleDir) local curTimeStamp = GetTimeStamp() - if curTimeStamp - self._PlayTimeStamp >= 0.5 then - self._PlayTimeStamp = curTimeStamp - if indexType == 0 then - if isSetRoleDir == 10 then - SoundManager.PlaySound(SoundConfig.STORY_VOICE_1_4) - else - SoundManager.PlaySound(SoundConfig.STORY_FOOT_1_2) - end - else - SoundManager.PlaySound(SoundConfig.STORY_FOOT_1_1) - end + 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]) + if self.isSet then + self._PlayTimeStamp[0] = curTimeStamp + end + elseif indexType == 1 then + self.isSet = self:PlaySound(0.2,SoundConfig.STORY_FOOT_1_1,curTimeStamp,self._PlayTimeStamp[1]) + if self.isSet then + self._PlayTimeStamp[1] = 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]) + if self.isSet then + self._PlayTimeStamp[0] = curTimeStamp + end + self.isSet = self:PlaySound(0.2,SoundConfig.STORY_FOOT_1_1,curTimeStamp,self._PlayTimeStamp[1]) + if self.isSet then + self._PlayTimeStamp[1] = curTimeStamp + end end end -- 角色相关