Browse Source

战斗音乐播放时机

zhaoyang 3 years ago
parent
commit
8e6022a9f3

+ 1 - 4
GameClient/Assets/Game/HotUpdate/Views/DressUp/DressUpFightView.cs

@@ -125,10 +125,7 @@ namespace GFGGame
             }
 
 
-            if (!string.IsNullOrEmpty(_fightCfg.music))
-            {
-                MusicManager.Instance.Play(ResPathUtil.GetMusicPath(_fightCfg.music, "mp3"));
-            }
+
             _ui.m_compNeed.target.visible = _fightCfg.needItemId > 0 || _fightCfg.needSuitId > 0 || _fightCfg.needTagsArr.Length > 0;
             if (_ui.m_compNeed.target.visible)
             {

+ 6 - 0
GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryFightSingleView.cs

@@ -42,6 +42,12 @@ namespace GFGGame
                 _sceneObject = GameObject.Instantiate(_scenePrefab);
             }
             SceneController.UpdateRole(EquipDataCache.cacher.equipDatas, _sceneObject);
+            StoryLevelCfg levelCfg = StoryLevelCfgArray.Instance.GetCfg(InstanceZonesDataManager.currentLevelCfgId);
+            StoryFightCfg fightCfg = StoryFightCfgArray.Instance.GetCfg(levelCfg.fightID);
+            if (!string.IsNullOrEmpty(fightCfg.music))
+            {
+                MusicManager.Instance.Play(ResPathUtil.GetMusicPath(fightCfg.music, "mp3"));
+            }
             _ui.m_roleName.m_txtName.text = RoleDataManager.roleName;
             Timers.inst.Add(0.9f, 1, (object param) =>
             {

+ 10 - 4
GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryFightTargetView.cs

@@ -11,7 +11,7 @@ namespace GFGGame
 
         public override void Dispose()
         {
-            if(_scenePrefab != null)
+            if (_scenePrefab != null)
             {
                 GameObject.Destroy(_scenePrefab);
                 _scenePrefab = null;
@@ -37,7 +37,8 @@ namespace GFGGame
         protected override void OnShown()
         {
             base.OnShown();
-            if(_sceneObject == null)
+
+            if (_sceneObject == null)
             {
                 _sceneObject = GameObject.Instantiate(_scenePrefab);
             }
@@ -45,9 +46,14 @@ namespace GFGGame
             StoryLevelCfg levelCfg = StoryLevelCfgArray.Instance.GetCfg(InstanceZonesDataManager.currentLevelCfgId);
             StoryFightCfg fightCfg = StoryFightCfgArray.Instance.GetCfg(levelCfg.fightID);
             SceneController.UpdateFightTarget(fightCfg.targetRes, _sceneObject);
+            if (!string.IsNullOrEmpty(fightCfg.music))
+            {
+                MusicManager.Instance.Play(ResPathUtil.GetMusicPath(fightCfg.music, "mp3"));
+            }
             _ui.m_roleName.m_txtName.text = RoleDataManager.roleName;
             _ui.m_targetName.m_txtName.text = fightCfg.targetName;
-            Timers.inst.Add(1.1f, 1, (object param) => {
+            Timers.inst.Add(1.1f, 1, (object param) =>
+            {
                 this.Hide();
                 ViewManager.Show(ViewName.STORY_FIGHT_TARGET_SCORE_VIEW);
             });
@@ -56,7 +62,7 @@ namespace GFGGame
         protected override void OnHide()
         {
             base.OnHide();
-            if(_sceneObject != null)
+            if (_sceneObject != null)
             {
                 GameObject.Destroy(_sceneObject);
                 _sceneObject = null;

+ 1 - 0
GameClient/Assets/Game/HotUpdate/Views/MainStory/StroyFightResultView.cs

@@ -77,6 +77,7 @@ namespace GFGGame
             }
             InstanceZonesDataManager.usedRecommend = false;
             SceneController.UpdateRole(EquipDataCache.cacher.equipDatas, _sceneObject);
+            MusicManager.Instance.Play(ResPathUtil.GetMusicPath(ConstMusicName.DEFAULT));
 
             _ui.m_txtScore.text = "" + _resultData.Score;
             _ui.m_expBar.m_txtLvl.text = "" + GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl);