public override void Draw(PropertyData data)
        {
            //data.Attributes.ForEach(a => EditorGUILayout.LabelField(a.GetType().FullName));

            var attr = data.Attributes.FirstOrDefault() as StructDrawerAttribute;

            if (attr == null)
            {
                attr = new StructDrawerAttribute();
            }

            switch (data.Parent != null ? attr.ItemType : StructDrawerAttribute.ItemTypes.None)
            {
            case StructDrawerAttribute.ItemTypes.FadeGroup:
                //EditorGUILayout.GetControlRect(false, 10, GUILayout.Width(8));
                EditorGUILayout.BeginVertical();
                AnimBool animBool = Editor.GetAnimBool(data.Property.propertyPath, data.Property.isExpanded);
                //data.Property.isExpanded = EditorGUILayout.Foldout(data.Property.isExpanded, new GUIContent(data.Property.displayName));

                if (EditorGUILayout.DropdownButton(new GUIContent(data.Property.displayName), FocusType.Passive,
                                                   data.Property.isExpanded ? Style.FoldoutExpanded : Style.Foldout))
                {
                    data.Property.isExpanded = !data.Property.isExpanded;
                }

                animBool.target = data.Property.isExpanded;
                if (EditorGUILayout.BeginFadeGroup(animBool.faded))
                {
                    EditorGUI.indentLevel++;
                    DrawProperies(data);
                    EditorGUI.indentLevel--;
                }

                EditorGUILayout.EndFadeGroup();
                EditorGUILayout.EndVertical();
                break;

            case StructDrawerAttribute.ItemTypes.Box:
                EditorGUILayout.BeginVertical(Style.ListItemBox);
                DrawProperies(data);
                EditorGUILayout.EndVertical();
                break;

            case StructDrawerAttribute.ItemTypes.HorizontalGroup:
                EditorGUILayout.BeginHorizontal();
                DrawProperies(data);
                EditorGUILayout.EndHorizontal();
                break;

            default:
                EditorGUILayout.BeginVertical();
                DrawProperies(data);
                EditorGUILayout.EndVertical();
                break;
            }
        }
Exemple #2
0
        protected virtual void DrawEventHandlerGUI(Flowchart flowchart)
        {
            // Show available Event Handlers in a drop down list with type of current
            // event handler selected.
            Block block = target as Block;

            System.Type currentType = null;
            if (block._EventHandler != null)
            {
                currentType = block._EventHandler.GetType();
            }

            string currentHandlerName = "<None>";

            if (currentType != null)
            {
                EventHandlerInfoAttribute info = EventHandlerEditor.GetEventHandlerInfo(currentType);
                if (info != null)
                {
                    currentHandlerName = info.EventHandlerName;
                }
            }

            var pos = EditorGUILayout.GetControlRect(true, 0, EditorStyles.objectField);

            if (pos.x != 0)
            {
                lastEventPopupPos    = pos;
                lastEventPopupPos.x += EditorGUIUtility.labelWidth;
                lastEventPopupPos.y += EditorGUIUtility.singleLineHeight;
            }
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel(new GUIContent("Execute On Event"));
            if (EditorGUILayout.DropdownButton(new GUIContent(currentHandlerName), FocusType.Passive))
            {
                EventSelectorPopupWindowContent.DoEventHandlerPopUp(lastEventPopupPos, currentHandlerName, block, (int)(EditorGUIUtility.currentViewWidth - lastEventPopupPos.x), 200);
            }
            EditorGUILayout.EndHorizontal();

            if (block._EventHandler != null)
            {
                EventHandlerEditor eventHandlerEditor = Editor.CreateEditor(block._EventHandler) as EventHandlerEditor;
                if (eventHandlerEditor != null)
                {
                    EditorGUI.BeginChangeCheck();
                    eventHandlerEditor.DrawInspectorGUI();

                    if (EditorGUI.EndChangeCheck())
                    {
                        SelectedBlockDataStale = true;
                    }

                    DestroyImmediate(eventHandlerEditor);
                }
            }
        }
        private void DrawSpeechProperties()
        {
            //Voice field
            EditorGUILayout.BeginHorizontal();
            GUILayout.Label("Voice", GUILayout.Width(EditorGUIUtility.labelWidth - 2));
            if (EditorGUILayout.DropdownButton(new GUIContent(string.IsNullOrEmpty(speech.voiceName) ? "None" : speech.voiceName), FocusType.Passive))
            {
                VoicePopup.Show(voiceRect, (Voice voice) =>
                {
                    speech.voiceName = voice.name;
                    speech.voiceUUID = voice.uuid;
                    EditorUtility.SetDirty(speech);
                });
            }

            //Set rect for popup
            if (Event.current.type == EventType.Repaint)
            {
                voiceRect = GUIUtility.GUIToScreenRect(GUILayoutUtility.GetLastRect().Offset(0, 18, 0, 100));
            }
            EditorGUILayout.EndHorizontal();

            //Begin Change Check
            EditorGUI.BeginChangeCheck();

            //Include phonemes
            speech.includePhonemes = EditorGUILayout.Toggle("Include phonemes", speech.includePhonemes);

            //Phoneme table
            if (speech.includePhonemes)
            {
                PhonemeTable temp = EditorGUILayout.ObjectField(phonemeTableLabel, speech.phonemeTable, typeof(PhonemeTable), false) as PhonemeTable;

                //Update phoneme table on clip when change
                if (temp != speech.phonemeTable)
                {
                    speech.phonemeTable = temp;
                    for (int i = 0; i < speech.clips.Count; i++)
                    {
                        if (speech.clips[i].havePhonemes)
                        {
                            speech.clips[i].phonemes.UpdateTable(temp);
                        }
                    }
                }
            }

            //Apply change if any
            if (EditorGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(speech);
            }

            GUILayout.Space(5);
            Utils.DrawSeparator();
        }
Exemple #4
0
 public override void OnInspectorGUI()
 {
     base.OnInspectorGUI();
     EditorGUILayout.BeginVertical();
     if (EditorGUILayout.DropdownButton(new GUIContent("测试按钮"), FocusType.Passive))
     {
         //portal.ShouldCameraRender(Camera.main);
     }
     EditorGUILayout.EndVertical();
 }
 void DoSequenceSelectorGUI()
 {
     using (new EditorGUI.DisabledScope(currentMode.headerState.sequenceSelector == TimelineModeGUIState.Disabled))
     {
         if (EditorGUILayout.DropdownButton(DirectorStyles.timelineSelectorArrow, FocusType.Passive, DirectorStyles.Instance.sequenceSwitcher, GUILayout.Width(WindowConstants.selectorWidth)))
         {
             ShowSequenceSelector();
         }
     }
 }
Exemple #6
0
    private void OnGUI()
    {
        GUIContent gc = new GUIContent("11111");

        EditorGUILayout.DropdownButton(gc, FocusType.Keyboard);

        EditorGUI.SelectableLabel(r, "2222");

        //EditorGUI.SLider
    }
Exemple #7
0
        protected virtual void OnGUISearchAssetType()
        {
            if (m_IgnoreScearchAssetType)
            {
                return;
            }

            EditorGUILayout.DropdownButton(m_FilterByType, FocusType.Passive, EditorStyles.largeLabel, GUILayout.ExpandWidth(false));
            m_SearchAssetType = (SearchAssetType)EditorGUILayoutUtil.EnumPopup(m_SearchAssetType, m_PopupStyle, GUILayout.Width(m_FilterByTypeWith));
        }
Exemple #8
0
        public override void OnInspectorGUI()
        {
            target.CheckValid();

            serializedObject.Update();
            var type = target.TypeName;

            EditorGUILayout.PropertyField(serializedObject.FindProperty("_typeName"), new GUIContent("Target Type"));
            serializedObject.ApplyModifiedProperties();

            if (target.TypeName != type)
            {
                target.NotifyChanged();
            }

            if (target.Type == null)
            {
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Invalid Target Type", EditorStyles.boldLabel);
            }
            else
            {
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Value Overrides", EditorStyles.boldLabel);
                int toRemove = -1;
                headers.Clear();
                var indent = EditorGUI.indentLevel;
                for (int i = 0; i < target.Overrides.Length; i++)
                {
                    var prop = target.Overrides[i];
                    SerializedValueDrawing.UpdateHeading(prop, headers);
                    EditorGUILayout.BeginHorizontal();
                    SerializedValueDrawing.DrawLayout(target, prop);
                    if (GUILayout.Button("X", GUILayout.MaxWidth(20), GUILayout.MinWidth(20)))
                    {
                        toRemove = i;
                    }
                    EditorGUILayout.EndHorizontal();
                }

                EditorGUI.BeginDisabledGroup(!target.UnusedValidPaths.Any());
                EditorGUI.indentLevel = indent;
                EditorGUILayout.Space();
                if (EditorGUILayout.DropdownButton(new GUIContent("Add Override"), FocusType.Keyboard, GUILayout.MaxWidth(150)))
                {
                    ListDropdown();
                }
                EditorGUI.EndDisabledGroup();

                if (toRemove >= 0)
                {
                    RemoveOverride(toRemove);
                }
            }
        }
        private void ConnectionStateGUI()
        {
            if (HolographicEmulationWindow.s_ConnectedTexture == null)
            {
                HolographicEmulationWindow.s_ConnectedTexture    = EditorGUIUtility.LoadIconRequired("sv_icon_dot3_sml");
                HolographicEmulationWindow.s_ConnectingTexture   = EditorGUIUtility.LoadIconRequired("sv_icon_dot4_sml");
                HolographicEmulationWindow.s_DisconnectedTexture = EditorGUIUtility.LoadIconRequired("sv_icon_dot6_sml");
            }
            Texture2D  image;
            GUIContent label;
            GUIContent content;

            switch (this.m_ConnectionState)
            {
            case HolographicStreamerConnectionState.Disconnected:
IL_5E:
                image   = HolographicEmulationWindow.s_DisconnectedTexture;
                label   = HolographicEmulationWindow.s_ConnectionStateDisconnectedText;
                content = HolographicEmulationWindow.s_ConnectionButtonConnectText;
                goto IL_A3;

            case HolographicStreamerConnectionState.Connecting:
                image   = HolographicEmulationWindow.s_ConnectingTexture;
                label   = HolographicEmulationWindow.s_ConnectionStateConnectingText;
                content = HolographicEmulationWindow.s_ConnectionButtonDisconnectText;
                goto IL_A3;

            case HolographicStreamerConnectionState.Connected:
                image   = HolographicEmulationWindow.s_ConnectedTexture;
                label   = HolographicEmulationWindow.s_ConnectionStateConnectedText;
                content = HolographicEmulationWindow.s_ConnectionButtonDisconnectText;
                goto IL_A3;
            }
            goto IL_5E;
IL_A3:
            EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
            EditorGUILayout.PrefixLabel(HolographicEmulationWindow.s_ConnectionStatusText, "Button");
            float singleLineHeight = EditorGUIUtility.singleLineHeight;
            Rect  rect             = GUILayoutUtility.GetRect(singleLineHeight, singleLineHeight, new GUILayoutOption[]
            {
                GUILayout.ExpandWidth(false)
            });

            GUI.DrawTexture(rect, image);
            EditorGUILayout.LabelField(label, new GUILayoutOption[0]);
            EditorGUILayout.EndHorizontal();
            EditorGUI.BeginDisabledGroup(this.m_InPlayMode);
            bool flag = EditorGUILayout.DropdownButton(content, FocusType.Passive, EditorStyles.miniButton, new GUILayoutOption[0]);

            EditorGUI.EndDisabledGroup();
            if (flag)
            {
                this.HandleButtonPress();
            }
        }
Exemple #10
0
        public void OnGUI(bool showingPlayerLoop, string lastSelectedWorldName)
        {
            TryRestorePreviousSelection(showingPlayerLoop, lastSelectedWorldName);

            var worldName = getWorldSelection()?.Name ?? kPlayerLoopName;

            if (EditorGUILayout.DropdownButton(new GUIContent(worldName), FocusType.Passive))
            {
                Menu.ShowAsContext();
            }
        }
        public void OnGui()
        {
            //TryRestorePreviousSelection(lastSelectedWorldName);

            var worldName = Debugger.GetNameRoot(_getWorldSelection());

            if (EditorGUILayout.DropdownButton(new GUIContent(worldName), FocusType.Passive))
            {
                Menu.ShowAsContext();
            }
        }
        protected override void OnDraw()
        {
            bool      result = EditorGUILayout.DropdownButton(Content, Value, Option.Values);
            FocusType value  = result ? FocusType.Keyboard : FocusType.Passive;

            if (value != Value)
            {
                Value = value;
                this.DipatchEvent();
            }
        }
Exemple #13
0
    public virtual void OnGUI()
    {
        GUIContent guiContent;

        for (int i = 0; i < EditorSceneManager.sceneCountInBuildSettings; i++)
        {
            guiContent      = new GUIContent();
            guiContent.text = EditorSceneManager.GetSceneByBuildIndex(i).name;
            EditorGUILayout.DropdownButton(guiContent, FocusType.Passive);
        }
    }
Exemple #14
0
 /// <summary>
 /// 编辑器下拉框
 /// </summary>
 /// <param name="selItem">下拉框名</param>
 /// <param name="itemList">列表</param>
 /// <param name="selCallBack">选择回调</param>
 /// <param name="width">下拉框宽</param>
 public static void Dropdown(string selItem, List <string> itemList, Action <string> selCallBack, float width = 100)
 {
     if (EditorGUILayout.DropdownButton(new GUIContent(selItem), FocusType.Keyboard, GUILayout.Width(width)))
     {
         GenericMenu menu = new GenericMenu();
         foreach (string item in itemList)
         {
             AddMenuItem(menu, item, selItem, selCallBack);
         }
         menu.ShowAsContext();
     }
 }
Exemple #15
0
        void DrawImGUIButtonList(List <ToolbarButtonData> buttons)
        {
            foreach (var button in buttons.ToList())
            {
                if (!button.visible)
                {
                    continue;
                }

                switch (button.type)
                {
                case ElementType.Button:
                    if (GUILayout.Button(button.content,
                                         EditorGUIStyleHelper.GetGUIStyleByName(nameof(EditorStyles.toolbarButton))) &&
                        button.buttonCallback != null)
                    {
                        button.buttonCallback();
                    }
                    break;

                case ElementType.Toggle:
                    EditorGUI.BeginChangeCheck();
                    button.value = GUILayout.Toggle(button.value, button.content,
                                                    EditorGUIStyleHelper.GetGUIStyleByName(nameof(EditorStyles.toolbarButton)));
                    if (EditorGUI.EndChangeCheck() && button.toggleCallback != null)
                    {
                        button.toggleCallback(button.value);
                    }
                    break;

                case ElementType.DropDownButton:
                    if (EditorGUILayout.DropdownButton(button.content, FocusType.Passive,
                                                       EditorStyles.toolbarDropDown))
                    {
                        button.buttonCallback();
                    }
                    break;

                case ElementType.Separator:
                    EditorGUILayout.Separator();
                    EditorGUILayout.Space(button.size);
                    break;

                case ElementType.Custom:
                    button.customDrawFunction();
                    break;

                case ElementType.FlexibleSpace:
                    GUILayout.FlexibleSpace();
                    break;
                }
            }
        }
Exemple #16
0
        public void OnTargetSortingLayers(SerializedObject serializedObject, Object[] targets, GUIContent labelContent)
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel(labelContent);

            GUIContent selectedLayers;

            if (m_ApplyToSortingLayersList.Count == 1)
            {
                selectedLayers = new GUIContent(SortingLayer.IDToName(m_ApplyToSortingLayersList[0]));
            }
            else if (m_ApplyToSortingLayersList.Count == m_AllSortingLayers.Length)
            {
                selectedLayers = Styles.sortingLayerAll;
            }
            else if (m_ApplyToSortingLayersList.Count == 0)
            {
                selectedLayers = Styles.sortingLayerNone;
            }
            else
            {
                selectedLayers = Styles.sortingLayerMixed;
            }

            bool buttonDown = EditorGUILayout.DropdownButton(selectedLayers, FocusType.Keyboard, EditorStyles.popup);

            if (Event.current.type == EventType.Repaint)
            {
                m_SortingLayerDropdownRect = GUILayoutUtility.GetLastRect();
            }

            if (buttonDown)
            {
                GenericMenu menu = new GenericMenu();
                menu.allowDuplicateNames = true;

                LayerSelectionData layerSelectionData = new LayerSelectionData(serializedObject, 0, targets);
                menu.AddItem(Styles.sortingLayerNone, m_ApplyToSortingLayersList.Count == 0, OnNoSortingLayerSelected, layerSelectionData);
                menu.AddItem(Styles.sortingLayerAll, m_ApplyToSortingLayersList.Count == m_AllSortingLayers.Length, OnAllSortingLayersSelected, layerSelectionData);
                menu.AddSeparator("");

                for (int i = 0; i < m_AllSortingLayers.Length; ++i)
                {
                    var sortingLayer = m_AllSortingLayers[i];
                    layerSelectionData = new LayerSelectionData(serializedObject, sortingLayer.id, targets);
                    menu.AddItem(m_AllSortingLayerNames[i], m_ApplyToSortingLayersList.Contains(sortingLayer.id), OnSortingLayerSelected, layerSelectionData);
                }

                menu.DropDown(m_SortingLayerDropdownRect);
            }

            EditorGUILayout.EndHorizontal();
        }
Exemple #17
0
        public override void OnInspectorGUI()
        {
            if (EditorGUILayout.DropdownButton(new GUIContent("Dropdown Button"), FocusType.Keyboard))
            {
                Debug.Log("Dropdown Button Clicked");
            }

            if (GUILayout.Button("Common Button"))
            {
                Debug.Log("Common Button Clicked");
            }
        }
        public override void OnBodyGUI()
        {
            base.OnBodyGUI();

            if (node == null)
            {
                node = (MethodCallNode)target;
            }

            showSearchOptions = EditorGUILayout.Foldout(showSearchOptions, "Chooser Options");
            if (showSearchOptions)
            {
                hideUnityClasses = EditorGUILayout.Toggle("Hide Unity classes", hideUnityClasses);

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PrefixLabel("Search");
                searchString = EditorGUILayout.TextField(searchString);
                EditorGUILayout.EndHorizontal();
            }

            GUIContent label = (node.method.DeclaringType == null) ? new GUIContent("Select a type...") : new GUIContent(ObjectNames.NicifyVariableName(node.method.DeclaringType.Name));

            if (EditorGUILayout.DropdownButton(label, FocusType.Keyboard))
            {
                ShowTypeSelectMenu();
            }

            if (node.method.DeclaringType == null)
            {
                return;
            }

            label = (node.method.Method == null) ? new GUIContent("Select a method...") : new GUIContent(node.method.Method.Name);
            if (EditorGUILayout.DropdownButton(label, FocusType.Keyboard))
            {
                ShowMethodSelectMenu();
            }

            if (node.method.Method == null)
            {
                return;
            }

            //DrawInstanceDynamicPorts();

            if (node.methodArgs == null)
            {
                return;
            }

            //DrawParameterSection();
        }
        private void OnGUI()
        {
            _chosenType = EditorGUILayout.TextField("Chose type", _chosenType);

            var suggestions = _diplayNames.Where(s => s.ToLower().Contains(_chosenType.ToLower()) && !_classTypeNames.Contains($"{s}{_type}")).ToArray();

            if (suggestions.Length > 0)
            {
                _scrollPos = EditorGUILayout.BeginScrollView(_scrollPos);

                for (int i = 0; i < suggestions.Length; i++)
                {
                    if (EditorGUILayout.DropdownButton(new GUIContent(suggestions[i]), FocusType.Keyboard, GUI.skin.button))
                    {
                        _chosenType = suggestions[i];

                        using (var stream = new FileStream($"{_path}/{_chosenType}{_type}.cs", FileMode.CreateNew))
                        {
                            using (var writer = new StreamWriter(stream))
                            {
                                for (int t = 0; t < _classFile.Length; t++)
                                {
                                    if (_classFile[t].Contains("{0}"))
                                    {
                                        string formatingValue = _classFile[t].Contains("[CustomEditor(typeof(") ?
                                                                _typeNames[Array.IndexOf(_diplayNames, _chosenType)].Split(',')[0] : _chosenType;

                                        writer.WriteLine(string.Format(_classFile[t], formatingValue));
                                    }
                                    else
                                    {
                                        writer.WriteLine(_classFile[t]);
                                    }
                                }
                            }
                        }

                        Close();
                        AssetDatabase.SaveAssets();
                        AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);
                    }
                }

                EditorGUILayout.EndScrollView();
            }
            else
            {
                GUI.enabled = false;
                EditorGUILayout.TextField("No UnityEngine object classes are available.");
                GUI.enabled = true;
            }
        }
Exemple #20
0
        private void MakePointsDropdown(Rect pointsManager)
        {
            SetCurrentPointFromCurrentTime();
            string chosen = GetCurrentPointsTime();

            if (EditorGUILayout.DropdownButton(new GUIContent(chosen), FocusType.Keyboard))
            {
                if (map.points != null && pointsManager != null && currentPoint != null)
                {
                    ShowDropdown(pointsManager, map.points, currentPoint);
                }
            }
        }
Exemple #21
0
        protected virtual void OnGUISearchAssetFolder()
        {
            if (m_IgnoreSearchAssetFolder)
            {
                return;
            }

            EditorGUILayout.DropdownButton(m_FilterByFolder, FocusType.Passive, EditorStyles.largeLabel, GUILayout.ExpandWidth(false));

            m_SearchAssetFolder = (SearchAssetFolder)EditorGUILayoutUtil.EnumPopup(m_SearchAssetFolder, m_PopupStyle, GUILayout.Width(m_FilterByFolderWith));
            using (new EditorGUI.DisabledScope(m_SearchAssetFolder != SearchAssetFolder.Folder))
                m_Folder = EditorGUILayout.ObjectField(m_Folder, typeof(DefaultAsset), false, GUILayout.ExpandWidth(true)) as DefaultAsset;
        }
Exemple #22
0
        public static void CreateDropdown(string selItem, List <string> itemList, Action <int> selCallBack, float width = 100)
        {
            if (EditorGUILayout.DropdownButton(new GUIContent(selItem), FocusType.Keyboard, GUILayout.Width(width)))
            {
                GenericMenu menu = new GenericMenu();

                for (int i = 0; i < itemList.Count; i++)
                {
                    AddMenuItem(menu, itemList[i], selItem, i, selCallBack);
                }
                menu.ShowAsContext();
            }
        }
Exemple #23
0
 public override void OnInspectorGUI()
 {
     GUILayout.Space(3);
     // A drop-menu for conveniently adding one or more NetworkConfig objects (found in mediation adapters)
     // to the MoPubManager gameobject.
     if (EditorGUILayout.DropdownButton(new GUIContent("Add Network Configuration"),
                                        FocusType.Keyboard, GUILayout.ExpandWidth(false)))
     {
         ShowNetworksMenu();
     }
     GUILayout.Space(3);
     DrawDefaultInspector();
 }
Exemple #24
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            // export / import
            EditorGUILayout.BeginHorizontal(GUIStyle.none);
            if (GUILayout.Button("Export to JSON"))
            {
                ExportLocalizationJSON();
            }
            if (GUILayout.Button("Import from JSON"))
            {
                ImportLocalizationJSON();
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Separator();

            // language toggle
            GenericMenu ietfmenu = new GenericMenu
            {
                allowDuplicateNames = false
            };

            string selectedIetf = languageIdentifier.stringValue;

            string selectedDesc = languageDescriptor.stringValue;

            CultureInfo[] cultures = CultureInfo.GetCultures(CultureTypes.NeutralCultures);
            for (int i = 0; i < cultures.Length; ++i)
            {
                string key = cultures[i].IetfLanguageTag;
                ietfmenu.AddItem(new GUIContent(key), key == selectedIetf, OnIetfChanged, key);
            }

            EditorGUILayout.BeginHorizontal(GUIStyle.none);
            EditorGUILayout.PrefixLabel("Target Language");
            if (EditorGUILayout.DropdownButton(new GUIContent(selectedIetf), FocusType.Keyboard))
            {
                ietfmenu.ShowAsContext();
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.LabelField("ISO Language Descriptor", selectedDesc, "Textfield");

            EditorGUILayout.Separator();

            // bindings
            ManageIdentifierLocalizationBindings();

            serializedObject.ApplyModifiedProperties();
        }
        /// <summary>
        /// 展示驱动数据
        /// </summary>
        /// <param name="dataDrivenEditor">编辑器</param>
        /// <param name="ability">驱动</param>
        public static void OnGUI(DataDrivenEditor dataDrivenEditor, BaseDriven ability)
        {
            string _type = ability.GetType().ToString();

            _type = _type.Replace("DataDriven.", "");
            dtype = (DDConfig.DrivenType)System.Enum.Parse(typeof(DDConfig.DrivenType), _type);

            _editor = SwitchDrawDrivenEditor();

            EditorGUILayout.BeginVertical();
            if (EditorGUILayout.DropdownButton(new UnityEngine.GUIContent("保存"), UnityEngine.FocusType.Keyboard))
            {
                SaveAbility(dataDrivenEditor, ability);
            }
            // 文件名
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("文件名:");
            EditorGUILayout.LabelField(ability.Name);
            EditorGUILayout.EndHorizontal();
            // 驱动类型
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("驱动类型:");
            int iType = EditorGUILayout.Popup((int)dtype, DDConfig.DrivenTypeName);

            EditorGUILayout.EndHorizontal();
            if (_editor != null)
            {
                _editor.OnGUI(ability, dataDrivenEditor);
            }

            EditorGUILayout.EndVertical();

            if (iType != (int)dtype)
            {
                // 转换类型,可能会丢失数据
                if (EditorUtility.DisplayDialog("转换类型", "转换类型可能会引起数据丢失!!确定需要转换?", "确定", "取消"))
                {
                    // 关闭展示
                    if (_editor != null)
                    {
                        _editor.CloseDrawDriven();
                    }
                    dataDrivenEditor.ChangeDrivenTypeTo((DDConfig.DrivenType)iType);
                }
                else
                {
                    dataDrivenEditor.ShowNotification(new UnityEngine.GUIContent("取消转换"));
                }
            }
        }
Exemple #26
0
        public static void Dropdown(string title, IEnumerable <DropDownItem> items)
        {
            if (!EditorGUILayout.DropdownButton(new GUIContent(title), FocusType.Passive, EditorStyles.toolbarDropDown))
            {
                return;
            }
            var menu = new GenericMenu();

            foreach (var item in items)
            {
                menu.AddItem(new GUIContent(item.Name), item.On, item.Callback, item.Parameter);
            }
            menu.ShowAsContext();
        }
        public void OnGUI()
        {
            var r = EditorGUILayout.DropdownButton(new GUIContent("Select Texture"), FocusType.Passive);

            if (Event.current.type == EventType.Repaint)
            {
                lastRect = GUILayoutUtility.GetLastRect();
            }

            if (r)
            {
                dropdown.Show(lastRect);
            }
        }
Exemple #28
0
        private void DrawDeadGUIDEntry(ComponentGUID dead)
        {
            GUILayoutOption labelOption = GUILayout.Height(20);

            SpiralEditor.BeginPanel(GroupType.Vertical);

            EditorGUILayout.SelectableLabel($"GUID: {dead.guid}", GUILayout.MinWidth(250), labelOption);

            string strDeadCount = strDeadObjectsCount + $" {dead.oids.Count}";

            dead.showInfo = EditorGUILayout.Foldout(dead.showInfo, strDeadCount);
            if (dead.showInfo)
            {
                for (int i = 0; i < dead.gids.Count; i++)
                {
                    var dgid   = dead.gids[i];
                    var dgidID = dgid.fileID;

                    string strGID        = $"{dgidID}";
                    string strButtonName = $"#{i} MonoBehaviour ID: {strGID}";
                    if (EditorGUILayout.DropdownButton(new GUIContent(strButtonName), FocusType.Passive))
                    {
                        dgid.showInfo = !dgid.showInfo;
                    }
                    if (dgid.showInfo)
                    {
                        SpiralEditor.BeginPanel(GroupType.Vertical);
                        EditorGUILayout.SelectableLabel(strGID);
                        if (SpiralEditor.Button(strSelectObject))
                        {
                            Selection.objects = new Object[1] {
                                dead.oids[i].gameObject
                            };
                        }
                        GUI.enabled = false;
                        EditorGUILayout.TextArea(dgid.fileEntry);
                        GUI.enabled = true;
                        EditorGUILayout.Space();
                        SpiralEditor.EndPanel();
                    }
                }
            }

            if (SpiralEditor.Button(strSelectObjects))
            {
                ObjectID.Select(dead.oids);
            }

            EditorGUILayout.EndVertical();
        }
        public void OnInspectorGUI()
        {
            var r = EditorGUILayout.DropdownButton(guiContent.Content, FocusType.Passive);

            if (Event.current.type == EventType.Repaint)
            {
                lastRect = GUILayoutUtility.GetLastRect();
            }

            if (r)
            {
                selector.Show(lastRect);
            }
        }
Exemple #30
0
        private void DrawSettingsButton()
        {
            if (EditorGUILayout.DropdownButton(EditorGUIUtility.IconContent("SettingsIcon"), FocusType.Passive, EditorStyles.toolbarButton))
            {
                GenericMenu menu = new GenericMenu();

                menu.AddItem(BrowseConfigFolderContent, false, () =>
                {
                    m_MainWindow.ConfigFolder = EditorUtility.SaveFolderPanel(BrowseConfigFolderContent.text, Application.dataPath, string.Empty);
                });

                menu.ShowAsContext();
            }
        }