示例#1
0
    void DrawData(SoundTableEditor p_editor, int p_index, out string p_action)
    {
        GUILayout.BeginHorizontal();

        p_action = "";
        GUILayout.Label("clip", GUILayout.Height(18));
        clip = (AudioClip)EditorGUILayout.ObjectField(clip, typeof(AudioClip));
        GUILayout.Label("Loop");
        defaultLoop = GUILayout.Toggle(defaultLoop, "");
        GUILayout.Label("Volume");
        defaultVolume = EditorGUILayout.Slider(defaultVolume, 0f, 1f, GUILayout.Width(150));

        GUILayout.EndHorizontal();
    }
示例#2
0
    public void OnInspectorGUI(SoundTableEditor p_editor)
    {
        EditorGUI.BeginChangeCheck();

        GUILayout.BeginHorizontal();
        GUILayout.Label("Mute");
        bool _mute = GUILayout.Toggle(mute, "");

        GUILayout.Label("Adjust Volume");
        float _adjustVolume = EditorGUILayout.Slider(adjustVolume, 0f, 1f);

        GUILayout.EndHorizontal();

        if (EditorGUI.EndChangeCheck())
        {
            adjustVolume = _adjustVolume;
            mute         = _mute;
            EditorUtility.SetDirty(this);
        }
    }
示例#3
0
    public string OnInspectorGUI(SoundTableEditor p_editor, int p_index)
    {
        string _action = "";

        switch (p_editor.tool)
        {
        case E_SOUND_TOOL.ITEM:
            DrawItem(p_editor, p_index, out _action);
            break;

        case E_SOUND_TOOL.DATA:
            DrawData(p_editor, p_index, out _action);
            break;

        case E_SOUND_TOOL.WATCH:
            DrawWatch(p_editor, p_index, out _action);
            break;
        }

        return(_action);
    }
示例#4
0
    void DrawWatch(SoundTableEditor p_editor, int p_index, out string p_action)
    {
        GUILayout.BeginHorizontal();

        p_action = "";
        GUILayout.Label("key : " + key, GUILayout.Width(180));

        if (GUILayout.Button("Play Once", GUILayout.Width(90)))
        {
            SoundManager.Play(table.name, key, false);
        }
        if (GUILayout.Button("Play Loop", GUILayout.Width(90)))
        {
            SoundManager.Play(table.name, key, true);
        }
        if (GUILayout.Button("Stop All", GUILayout.Width(90)))
        {
            SoundManager.Stop(table.name, key);
        }

        GUILayout.EndHorizontal();

        if (soundObjDict != null)
        {
            foreach (SoundPlayObj _obj in soundObjDict.Values)
            {
                GUILayout.BeginHorizontal();

                GUILayout.Label("      Obj : " + _obj.id);
                if (GUILayout.Button("Close", GUILayout.Width(40)))
                {
                    _obj.Stop();
                }
                GUILayout.EndHorizontal();
            }
        }
    }
示例#5
0
    void DrawItem(SoundTableEditor p_editor, int p_index, out string p_action)
    {
        GUILayout.BeginHorizontal();

        p_action = "";
        GUILayout.Label("key", GUILayout.Width(30));

        EditorGUI.BeginChangeCheck();
        key = EditorGUILayout.TextField(key, GUILayout.Width(150));
        if (EditorGUI.EndChangeCheck())
        {
            p_editor.table.Init();
        }

        if (clip == null)
        {
            GUILayout.Label("clip[ null ]");
        }
        else
        {
            GUILayout.Label("clip[ " + clip.name + " ]");
        }
        if (GUILayout.Button("Del", GUILayout.Width(40)))
        {
            p_editor.table.DelSoundDataAt(p_index);
            p_action = "Del";
        }
        if (GUILayout.Button("Duplicate", GUILayout.Width(80)))
        {
            SoundData _data = new SoundData(this);
            _data.key += "(Duplicate)";
            p_editor.table.InsertSoundDataAt(p_index + 1, _data);
            p_action = "Duplicate";
        }

        GUILayout.EndHorizontal();
    }