コード例 #1
0
    private void ShowAudioAssetGUI(AudioAsset au, bool isShowAudioSource)
    {
        Color color = Color.white;

        switch (au.PlayState)
        {
        case AudioPlayState.Playing:
            color = Color.green;
            break;

        case AudioPlayState.Pause:
            color = Color.yellow;
            break;

        case AudioPlayState.Stop:
            break;
        }
        GUI.color = color;
        GUILayout.BeginVertical("box");
        GUILayout.Label("Asset Name : " + au.assetName);
        GUILayout.Label("Play State : " + au.PlayState);
        EditorGUILayout.Slider("VolumeScale : ", au.VolumeScale, 0, 1);
        EditorGUILayout.Slider("Volume : ", au.Volume, 0, au.GetMaxRealVolume());
        if (isShowAudioSource)
        {
            EditorGUILayout.ObjectField("AudioSource : ", au.audioSource, typeof(AudioSource), true);
        }
        GUILayout.EndVertical();
        GUI.color = Color.white;
    }
コード例 #2
0
    private void ShowAudioAssetGUI(AudioAsset au, bool isShowAudioSource)
    {
        Color color = Color.white;

        switch (au.PlayState)
        {
        case AudioPlayState.Playing:
            color = Color.green;
            break;

        case AudioPlayState.Pause:
            color = Color.yellow;
            break;

        case AudioPlayState.Stop:
            break;
        }
        GUI.color = color;
        GUILayout.BeginVertical("box");
        GUILayout.Label("Asset Name : " + au.AssetName);
        GUILayout.Label("Play State : " + au.PlayState);
        GUILayout.Label("Loop : " + au.audioSource.loop);
        GUILayout.Label("flag : " + au.flag);
        EditorGUILayout.Slider("VolumeScale : ", au.VolumeScale, 0, 1);
        EditorGUILayout.Slider("Volume : ", au.GetMaxRealVolume(), 0, 1f);
        changedTime = GUILayout.Toggle(changedTime, "Change Time");
        GUILayout.BeginHorizontal();
        if (au.audioSource != null && au.audioSource.clip != null)
        {
            float value = EditorGUILayout.Slider("Time:" + au.audioSource.clip.length, au.audioSource.time, 0, au.audioSource.clip.length);
            if (changedTime)
            {
                au.audioSource.time = value;
            }
        }

        GUILayout.EndHorizontal();

        if (isShowAudioSource)
        {
            EditorGUILayout.ObjectField("AudioSource : ", au.audioSource, typeof(AudioSource), true);
        }
        GUILayout.EndVertical();
        GUI.color = Color.white;
    }