【寻宝迷踪】增加音效

dev_chengFeng
ZhangBiao 2021-08-18 15:31:52 +08:00
parent 06b3814099
commit 52bf5c79f2
3 changed files with 23 additions and 2 deletions

View File

@ -139,7 +139,8 @@ function ActivityMainPanel:OnOpen(_activityType,_index)
end
-- 打开,重新打开时回调
function ActivityMainPanel:OnShow()
function ActivityMainPanel:OnShow()
SoundManager.PlayMusic(SoundConfig.BGM_Main)
orginLayer = self.sortingOrder
if _CurPageIndex and (_CurPageIndex > #tabs or _CurPageIndex < 1) then
_CurPageIndex = #tabs

View File

@ -8,6 +8,7 @@ local mainLevelSettingConfig = ConfigManager.GetConfig(ConfigName.MainLevelSetti
local func = nil
local mapCtrl = "MapCtrl"
local cantWalk = false
local inside = false
-- 缩放值
local offsetScale = math.min(Screen.width/3241, Screen.height/1920)
--初始化组件(用于子类重写)
@ -48,6 +49,7 @@ function XunBaoMiZongMap:BindEvent()
self.effect:SetActive(true)
self.btnGet.gameObject:GetComponent("Button").interactable = false
cantWalk = true
SoundManager.PlaySound("UI_021")
Timer.New(function ()
self.effect:SetActive(false)
self.effectBtnGet:SetActive(false)
@ -57,6 +59,9 @@ function XunBaoMiZongMap:BindEvent()
end)
end)
end,1.5):Start()
Timer.New(function ()
SoundManager.PlaySound("Audio_linglongbaojing_neiquanlunge_007")
end,0.4,2):Start()
end)
else
PopupTipPanel.ShowTip("请根据箭头找到宝藏!")
@ -69,12 +74,13 @@ end
function XunBaoMiZongMap:OnOpen(_data,_func)
self.actData = _data
func = _func
SoundManager.PlaySound(SoundConfig.Sound_WorldMap)
-- SoundManager.PlaySound(SoundConfig.Sound_WorldMap)
end
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
function XunBaoMiZongMap:OnShow()
SoundManager.PlayMusic("BGM_026")
if self.liveNode then
self.liveNode:OnClose()
end
@ -139,6 +145,7 @@ function XunBaoMiZongMap:LoadMapData()
local thread = coroutine.start(function()
coroutine.wait(1)
SoundManager.PlaySound("UI_Battle_04")
self.effectLuoDi.transform:SetParent(Util.GetTransform(self.mapRoot, "uiObj#"))
self.effectLuoDi:SetActive(true)
coroutine.wait(0.5)
@ -202,9 +209,14 @@ function XunBaoMiZongMap:SetRoleWalk(_targetPos,_fuv)
TileMapView.CameraTween(_fuv.x,26,duration)
self.liveNode.leader.transform:DOLocalMove(targetPos, duration, false):OnStart(function ()
self:SetRoleDirAction(targetPos.x, targetPos.y, pos.x, pos.y)
self.timeCount = 0
end):OnUpdate(function() --TODO:测试速度
cantWalk = true
self:DoCheckDistance()
self.timeCount = self.timeCount + 1
if self.timeCount%20 == 0 then
SoundManager.PlaySound("Footsteps_Run_07",false)
end
end):OnComplete(function ()
cantWalk = false
self.oldPos = self.liveNode.leader.transform.localPosition
@ -218,10 +230,15 @@ function XunBaoMiZongMap:DoCheckDistance()
local distance = math.distanceXY(self.rewardPos,self.liveNode.leader.transform.localPosition)
local banjing = ConfigManager.GetConfigData(ConfigName.SpecialConfig,125).Value
if distance <= tonumber(banjing) then
if not inside then
SoundManager.PlaySound("Audio_linglongbaojing_kaiqi_002",false)
inside = true
end
self.btnGet.sprite = self.spLoader:LoadSprite("x_xbmz_xunbaoanniu")
self.liveNode:SetSelfDirectingTag(false)
self.effectBtnGet:SetActive(true)
else
inside = false
self.btnGet.sprite = self.spLoader:LoadSprite("x_xbmz_xunbaoanniu01")
self.liveNode:SetSelfDirectingTag(true,self.liveNode.leader.transform.localPosition,self.rewardPos)
self.effectBtnGet:SetActive(false)
@ -272,6 +289,7 @@ function XunBaoMiZongMap:OnClose()
self.effectLuoDi.transform:SetParent(Util.GetTransform(self.gameObject, "mapParent"))
self.effectLuoDi:SetActive(false)
self:Dispose()
SoundManager.StopMusic("BGM_010")
if func then
func()
func = nil

View File

@ -50,8 +50,10 @@ function XunBaoMiZong:BindEvent()
--判断进入地图时是否是完整地图,不是需要播放特效
self.btnGO:GetComponent("Button").interactable = false
if CompleteMap then
SoundManager.PlaySound("UI_Breach_01")
SwitchPanel.OpenPanel(UIName.XunBaoMiZongMapPanel,nil,self.actData)
else
SoundManager.PlaySound("UI_Breach_01")
self.effect:SetActive(true)
self.ImagePic3:SetActive(true)
Timer.New(function ()