Exemplo n.º 1
0
    public void _eventHierarchyGUI(FmodEventGroup curGroup)
    {
        List <FmodEvent> events = curGroup.getEvents();

        if (m_style == null)
        {
            m_style = new GUIStyle(GUI.skin.label);
        }

        curGroup.showEventsInEditor = EditorGUILayout.Foldout(curGroup.showEventsInEditor, curGroup.getName());
        if (curGroup.showEventsInEditor)
        {
            EditorGUI.indentLevel += 1;
            foreach (FmodEvent e in events)
            {
                if (e.WasLoaded())
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField(e.getName(), m_style, GUILayout.ExpandWidth(true));
                    if (Event.current.type == EventType.Repaint)
                    {
                        Rect lastRect = GUILayoutUtility.GetLastRect();
                        m_eventsRectangle[m_curNbEvents].Set(lastRect.xMin, lastRect.yMin, lastRect.width, lastRect.height);
                        m_events[m_curNbEvents] = e;
                    }
                    EditorGUILayout.LabelField((e.getSourceType() == FmodEvent.SourceType.SOURCE_2D ? "2D" : "3D"));
                    EditorGUILayout.EndHorizontal();
                    m_curNbEvents++;
                }
                else
                {
                    EditorGUILayout.HelpBox("Could not load this event. Are you missing a .fsb ?", MessageType.Error);
                }
            }
            foreach (FmodEventGroup child in curGroup.getChildrenGroups())
            {
                _eventHierarchyGUI(child);
            }
            EditorGUI.indentLevel -= 1;
        }
    }
Exemplo n.º 2
0
    /// <summary>
    /// Gets an event based on the full path from the root of the asset. A starting slash is not required.
    /// Double slashes, i.e. "Group1//Group2/Event" are ignored.
    /// </summary>
    /// <returns>
    /// The event, or null if not found.
    /// </returns>
    /// <param name='fullName'>
    /// Full name of an event, meaning path from the root of the asset, e.g. "FeatureDemonstration/Basics/BasicSoundWithLooping"
    /// </param>
    public FmodEvent getEventWithFullName(string fullName)
    {
        List <FmodEventGroup> curChildrenGroups;
        List <FmodEvent>      curChildrenEvents;

        string[] explodedPath;

        explodedPath = fullName.Split(new char[1] {
            '/'
        });
        curChildrenGroups = m_eventGroups;
        curChildrenEvents = m_events;

        for (int i = 0; i < explodedPath.Length - 1; i++)
        {
            string pathElement = explodedPath[i];

            if (pathElement != "")               // we skip null paths in things such as "elem1/elem2//elem3". Also, enables not caring about a starting /
            {
                FmodEventGroup grp = _getChildGroupWithName(curChildrenGroups, pathElement);

                if (grp == null)
                {
                    Debug.LogWarning("FmodEventAsset (" + getName() + "): getEventWithFullName: Could not find event group with name '" + pathElement + "'");
                    return(null);
                }
                curChildrenGroups = grp.getChildrenGroups();
                curChildrenEvents = grp.getEvents();
            }
        }
        string    eventName = explodedPath[explodedPath.Length - 1];
        FmodEvent ret       = _getEventFromListWithName(curChildrenEvents, eventName);

        if (ret != null)
        {
            return(ret);
        }
        Debug.LogWarning("FmodEventAsset (" + getName() + "): getEventWithFullName: Could not find event with name '" + eventName + "'");
        return(null);
    }
Exemplo n.º 3
0
    public void _eventHierarchyGUI(FmodEventGroup curGroup)
    {
        List<FmodEvent> events = curGroup.getEvents();

        if (m_style == null) {
            m_style = new GUIStyle(GUI.skin.label);
        }

        curGroup.showEventsInEditor = EditorGUILayout.Foldout(curGroup.showEventsInEditor, curGroup.getName());
        if (curGroup.showEventsInEditor) {
            EditorGUI.indentLevel += 1;
            foreach (FmodEvent e in events) {
                if (e.WasLoaded()) {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField(e.getName(), m_style, GUILayout.ExpandWidth(true));
                    if (Event.current.type == EventType.Repaint) {
                        Rect lastRect = GUILayoutUtility.GetLastRect();
                        m_eventsRectangle[m_curNbEvents].Set(lastRect.xMin, lastRect.yMin, lastRect.width, lastRect.height);
                        m_events[m_curNbEvents] = e;
                    }
                    EditorGUILayout.LabelField((e.getSourceType() == FmodEvent.SourceType.SOURCE_2D ? "2D" : "3D"));
                    EditorGUILayout.EndHorizontal();
                    m_curNbEvents++;
                } else {
                    EditorGUILayout.HelpBox("Could not load this event. Are you missing a .fsb ?", MessageType.Error);
                }
            }
            foreach (FmodEventGroup child in curGroup.getChildrenGroups()) {
                _eventHierarchyGUI(child);
            }
            EditorGUI.indentLevel -= 1;
        }
    }