主界面添加,许多bug修复。祝贺黑盒1如期开始
This commit is contained in:
@@ -5,6 +5,7 @@ using System.IO;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.Audio;
|
||||
|
||||
public class BgmPlaybackManager : MonoBehaviour
|
||||
{
|
||||
@@ -12,6 +13,7 @@ public class BgmPlaybackManager : MonoBehaviour
|
||||
|
||||
[Header("Audio")]
|
||||
public AudioSource audioSource;
|
||||
public AudioMixerGroup outputMixerGroup;
|
||||
public AudioClip clip;
|
||||
[Tooltip("Optional playlist. If empty, will load all clips in Resources/BGM.")]
|
||||
public List<AudioClip> playlist = new List<AudioClip>();
|
||||
@@ -49,6 +51,9 @@ public class BgmPlaybackManager : MonoBehaviour
|
||||
if (audioSource == null)
|
||||
audioSource = gameObject.AddComponent<AudioSource>();
|
||||
|
||||
if (outputMixerGroup != null)
|
||||
audioSource.outputAudioMixerGroup = outputMixerGroup;
|
||||
|
||||
audioSource.playOnAwake = false;
|
||||
audioSource.loop = loop;
|
||||
|
||||
@@ -96,6 +101,9 @@ public class BgmPlaybackManager : MonoBehaviour
|
||||
if (audioSource == null)
|
||||
audioSource = gameObject.AddComponent<AudioSource>();
|
||||
|
||||
if (outputMixerGroup != null)
|
||||
audioSource.outputAudioMixerGroup = outputMixerGroup;
|
||||
|
||||
audioSource.loop = loop;
|
||||
|
||||
if (audioSource.clip == null && clip != null)
|
||||
|
||||
@@ -4,6 +4,7 @@ using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.Audio;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
[ExecuteAlways]
|
||||
@@ -61,6 +62,9 @@ public class BgmUiBinder : MonoBehaviour
|
||||
public Vector2 pointerEndPos = new Vector2(195.3f, -87.05f);
|
||||
public Vector2 spectrumPosition = new Vector2(-238.9f, -111.5f);
|
||||
|
||||
[Header("Audio")]
|
||||
public AudioMixerGroup outputMixerGroup;
|
||||
|
||||
private readonly List<TMP_Text> timeTmps = new List<TMP_Text>();
|
||||
private readonly List<Text> timeTexts = new List<Text>();
|
||||
|
||||
@@ -104,6 +108,8 @@ public class BgmUiBinder : MonoBehaviour
|
||||
if (Application.isPlaying)
|
||||
{
|
||||
var mgr = BgmPlaybackManager.EnsureInstance();
|
||||
if (outputMixerGroup != null)
|
||||
mgr.outputMixerGroup = outputMixerGroup;
|
||||
mgr.EnsurePlaying();
|
||||
}
|
||||
}
|
||||
@@ -129,6 +135,11 @@ public class BgmUiBinder : MonoBehaviour
|
||||
|
||||
Canvas sceneCanvas = FindSceneCanvas();
|
||||
var controller = Object.FindAnyObjectByType<btmandtopController>();
|
||||
if (controller != null && controller.bgmMixerGroup != null)
|
||||
{
|
||||
outputMixerGroup = controller.bgmMixerGroup;
|
||||
}
|
||||
|
||||
if (controller != null && controller.musicPicRoot != null)
|
||||
{
|
||||
SetMusicRoot(controller.musicPicRoot, sceneCanvas);
|
||||
|
||||
Reference in New Issue
Block a user