public bool OnGUI(bool toolbar, params GUILayoutOption[] options)
 {
     return(FilterValue.Update(
                toolbar
             ? _searchField.OnToolbarGUI(FilterValue.RawValue)
             : _searchField.OnGUI(FilterValue.RawValue)));
 }
Example #2
0
            void DoSearchField(Rect rect)
            {
                searchField = searchField ?? new UnityEditor.IMGUI.Controls.SearchField();

                PreviousSearch = SearchString;
                SearchString   = searchField.OnGUI(rect, SearchString);

                if (HasSearchbarFocused())
                {
                    RepaintFocusedWindow();
                }
            }
Example #3
0
    public void OnGUI()
    {
        AkWwiseProjectInfo.DataSourceType ds;
        var buttonWidth = 150;

        using (new UnityEngine.GUILayout.HorizontalScope("box"))
        {
            ds = (AkWwiseProjectInfo.DataSourceType)UnityEditor.EditorGUILayout.EnumPopup(
                AkWwiseProjectInfo.GetData().currentDataSource, UnityEngine.GUILayout.Width(buttonWidth));
            UnityEngine.GUILayout.Space(5);

            var projectData = AkWwiseProjectInfo.GetData();

            if (ds != projectData.currentDataSource)
            {
                projectData.currentDataSource = ds;
                m_treeView.SetDataSource(AkWwiseProjectInfo.GetTreeData());
            }

            if (ds == AkWwiseProjectInfo.DataSourceType.FileSystem)
            {
                projectData.autoPopulateEnabled =
                    UnityEngine.GUILayout.Toggle(projectData.autoPopulateEnabled, "Auto populate");
            }
            else
            {
                projectData.AutoSyncSelection =
                    UnityEngine.GUILayout.Toggle(projectData.AutoSyncSelection, "Autosync selection");
                AkWwiseProjectInfo.WaapiPickerData.AutoSyncSelection = projectData.AutoSyncSelection;
            }

            UnityEngine.GUILayout.FlexibleSpace();

            if (UnityEngine.GUILayout.Button("Refresh Project", UnityEngine.GUILayout.Width(buttonWidth)))
            {
                if (ds == AkWwiseProjectInfo.DataSourceType.FileSystem)
                {
                    AkWwiseProjectInfo.Populate();
                }
                Refresh();
            }


            if (UnityEngine.GUILayout.Button("Generate SoundBanks", UnityEngine.GUILayout.Width(buttonWidth)))
            {
                if (AkUtilities.IsSoundbankGenerationAvailable())
                {
                    AkUtilities.GenerateSoundbanks();
                }
                else
                {
                    UnityEngine.Debug.LogError("Access to Wwise is required to generate the SoundBanks. Please go to Edit > Project Settings... and set the Wwise Application Path found in the Wwise Editor view.");
                }
            }

            if (projectData.autoPopulateEnabled && AkUtilities.IsWwiseProjectAvailable)
            {
                AkWwiseWWUBuilder.StartWWUWatcher();
            }
            else
            {
                AkWwiseWWUBuilder.StopWWUWatcher();
            }
        }

        using (new UnityEngine.GUILayout.HorizontalScope("box"))
        {
            var search_width = System.Math.Max(position.width / 3, buttonWidth * 2);

            if (ds == AkWwiseProjectInfo.DataSourceType.FileSystem)
            {
                m_treeView.StoredSearchString = m_SearchField.OnGUI(UnityEngine.GUILayoutUtility.GetRect(search_width, 20), m_treeView.StoredSearchString);
                UnityEngine.GUILayout.FlexibleSpace();
            }

            else
            {
                m_treeView.StoredSearchString = m_SearchField.OnGUI(UnityEngine.GUILayoutUtility.GetRect(search_width, 20), m_treeView.StoredSearchString);
                UnityEngine.GUILayout.FlexibleSpace();

                var labelStyle = new UnityEngine.GUIStyle();
                labelStyle.richText = true;
                UnityEngine.GUILayout.Label(AkWaapiUtilities.GetStatusString(), labelStyle);
            }
        }

        UnityEngine.GUILayout.Space(UnityEditor.EditorGUIUtility.standardVerticalSpacing);


        UnityEngine.GUILayout.FlexibleSpace();
        UnityEngine.Rect lastRect = UnityEngine.GUILayoutUtility.GetLastRect();
        m_treeView.OnGUI(new UnityEngine.Rect(lastRect.x, lastRect.y, position.width, lastRect.height));

        if (UnityEngine.GUI.changed && AkUtilities.IsWwiseProjectAvailable)
        {
            UnityEditor.EditorUtility.SetDirty(AkWwiseProjectInfo.GetData());
        }
    }
Example #4
0
        void ExtrusionUI()
        {
            LevelSegment segment = (LevelSegment)target;

            showProperties = EditorGUILayout.Foldout(showProperties, "Objects (" + segment.objectProperties.Length + ")");
            if (showProperties)
            {
                GUI.color = Color.clear;
                GUILayout.Box("", GUILayout.Width(Screen.width - 50));
                GUI.color = Color.white;
                if (searchField == null)
                {
                    searchField = new UnityEditor.IMGUI.Controls.SearchField();
                }
                string lastFilter = propertyFilter;
                propertyFilter = searchField.OnGUI(GUILayoutUtility.GetLastRect(), propertyFilter);
                if (lastFilter != propertyFilter)
                {
                    List <PropertyBinder> found = new List <PropertyBinder>();
                    for (int i = 0; i < segment.objectProperties.Length; i++)
                    {
                        if (segment.objectProperties[i].transform.name.ToLower().Contains(propertyFilter.ToLower()))
                        {
                            found.Add(new PropertyBinder(i, segment.objectProperties[i].transform.name));
                        }
                    }
                    properties = found.ToArray();
                }
                else if (propertyFilter == "")
                {
                    if (properties.Length != segment.objectProperties.Length)
                    {
                        properties = new PropertyBinder[segment.objectProperties.Length];
                    }
                    for (int i = 0; i < segment.objectProperties.Length; i++)
                    {
                        if (properties[i] == null)
                        {
                            properties[i] = new PropertyBinder(i, segment.objectProperties[i].transform.name);
                        }
                        else
                        {
                            properties[i].name  = segment.objectProperties[i].transform.name;
                            properties[i].index = i;
                        }
                    }
                }

                if (selectedProperties.Count > 0)
                {
                    if (propertyWindow == null)
                    {
                        propertyWindow                    = EditorWindow.GetWindow <PropertyEditWindow>(true);
                        propertyWindow.segment            = segment;
                        propertyWindow.selectedProperties = selectedProperties;
                        EditorWindow inspectorWindow = GetWindowByName("UnityEditor.InspectorWindow");
                        if (inspectorWindow != null)
                        {
                            propertyWindow.Init(new Vector2(inspectorWindow.position.x, inspectorWindow.position.y + 250));
                        }
                        else
                        {
                            propertyWindow.Init(new Vector2(2560 - Screen.width, 1080 / 2));
                        }
                    }
                }
                ObjectPropertiesUI(properties, segment.objectProperties);
                if (selectedProperties.Count > 0)
                {
                    if (Event.current.type == EventType.KeyDown)
                    {
                        if (Event.current.keyCode == KeyCode.DownArrow)
                        {
                            if (selectedProperties.Count > 1)
                            {
                                int temp = selectedProperties[selectedProperties.Count - 1];
                                selectedProperties.Clear();
                                selectedProperties.Add(temp);
                            }
                            selectedProperties[0]++;
                        }
                        if (Event.current.keyCode == KeyCode.UpArrow)
                        {
                            if (selectedProperties.Count > 1)
                            {
                                int temp = selectedProperties[0];
                                selectedProperties.Clear();
                                selectedProperties.Add(temp);
                            }
                            selectedProperties[0]--;
                        }
                        if (selectedProperties[0] < 0)
                        {
                            selectedProperties[0] = 0;
                        }
                        if (selectedProperties[0] >= segment.objectProperties.Length)
                        {
                            selectedProperties[0] = segment.objectProperties.Length - 1;
                        }
                        Repaint();
                        if (propertyWindow != null)
                        {
                            propertyWindow.Repaint();
                        }
                        SceneView.RepaintAll();
                        Event.current.Use();
                    }
                }
                else if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Space)
                {
                    selectedProperties.Clear();
                    selectedProperties.Add(0);
                }
                GUI.color = Color.white;
            }
        }