/// <summary>
        /// Enables the user to activate this processing method and define its parameters.
        /// </summary>
        /// <param name="isCompatible"></param> True if the method is compatible with the source data, false otherwise.
        public void SectionProcessingMethod(bool isCompatible)
        {
            bool isSelected = SectionShouldExecute(isCompatible);

            if (isSelected && HasAdditionalParameters())
            {
                using (var horizontalScope = new EditorGUILayout.HorizontalScope())
                {
                    GeneralToolkit.addedSpace = 20f * EditorGUI.indentLevel;
                    GUILayout.Space(GeneralToolkit.addedSpace);
                    using (var verticalScope = new EditorGUILayout.VerticalScope(EditorStyles.helpBox))
                    {
                        SectionAdditionalParameters();
                    }
                    GeneralToolkit.addedSpace = 0f;
                }
            }
            if (_nestedMethodsToDisplay != null && _nestedMethodsToDisplay.Length > 0)
            {
                using (var indentScope = new EditorGUI.IndentLevelScope())
                {
                    for (int iter = 0; iter < _nestedMethodsToDisplay.Length; iter++)
                    {
                        bool isNestedMethodCompatible = shouldExecute && _nestedMethodsToDisplay[iter].IsNestedGUIEnabled();
                        bool isGUIEnabled             = GUI.enabled;
                        GUI.enabled = isGUIEnabled && isNestedMethodCompatible;
                        _nestedMethodsToDisplay[iter].SectionProcessingMethod(isNestedMethodCompatible);
                        GUI.enabled = isGUIEnabled;
                    }
                }
            }
        }
Exemplo n.º 2
0
        public override void OnInspectorGUI()
        {
            serializedObject.DrawScript();
            m_setter.Clear();

            using (EditorGUILayout.VerticalScope box = new EditorGUILayout.VerticalScope(EditorStyles.helpBox))
            {
                switch (m_sdfOperation.Type)
                {
                case SDFOperationType.Elongate:
                    m_setter.DrawVector3Setting(Labels.Elongation, m_serializedProperties.Data, min: 0f);
                    break;

                case SDFOperationType.Onion:
                    m_setter.DrawVectorSettingX(Labels.Rounding, m_serializedProperties.Data, min: 0f);
                    m_setter.DrawVectorSettingYInt(Labels.Layers, m_serializedProperties.Data, min: 0);
                    break;

                case SDFOperationType.Round:
                    m_setter.DrawVectorSettingX(Labels.Rounding, m_serializedProperties.Data, min: 0f);
                    break;
                }
            }

            m_setter.Update();
        }
 public override void Render(GUISkin skin)
 {
     using (var scope = new EditorGUILayout.VerticalScope(EditorStyles.textArea))
     {
         EditorGUILayout.LabelField(m_code, skin.FindStyle("code")); //, GUILayout.Height(m_code.Split('\n').Length * EditorGUIUtility.singleLineHeight)
     }
 }
Exemplo n.º 4
0
 private void OnGUI()
 {
     using (var verticalScope = new EditorGUILayout.ScrollViewScope(scrollPosition))
     {
         scrollPosition = verticalScope.scrollPosition;
         for (int i = 0; i < currentClips.Count; i++)
         {
             if (currentClips[i] == null)
             {
                 continue;
             }
             using (var propertyScope = new EditorGUILayout.VerticalScope(EditorStyles.helpBox))
             {
                 EditorGUILayout.LabelField(CONTENT_NAME, new GUIContent(currentClips[i].name));
                 for (int j = 0; j < currentClips[i].events.Length; j++)
                 {
                     using (var eventScope = new EditorGUILayout.VerticalScope(EditorStyles.helpBox))
                     {
                         var time       = TimeSpan.FromSeconds(currentClips[i].events[j].time);
                         var timeString = string.Format("{0:0}:{1:00}", time.Seconds, time.Milliseconds / 1000.0f * 60.0f);
                         EditorGUILayout.LabelField(CONTENT_EVENT_FUNCTION_NAME, new GUIContent(currentClips[i].events[j].functionName));
                         EditorGUILayout.LabelField(CONTENT_EVENT_TIME, new GUIContent(timeString));
                         EditorGUILayout.LabelField(CONTENT_EVENT_PARAMETER_STRING, new GUIContent(currentClips[i].events[j].stringParameter));
                         EditorGUILayout.LabelField(CONTENT_EVENT_PARAMETER_FLOAT, new GUIContent(currentClips[i].events[j].floatParameter.ToString()));
                         EditorGUILayout.LabelField(CONTENT_EVENT_PARAMETER_INT, new GUIContent(currentClips[i].events[j].intParameter.ToString()));
                         currentClips[i].events[j].objectReferenceParameter = EditorGUILayout.ObjectField(CONTENT_EVENT_PARAMETER_OBJECT, currentClips[i].events[j].objectReferenceParameter, typeof(UnityEngine.Object), false);
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 5
0
		private static bool DrawSection(HEU_SettingsWindow settingsWindow, string sectionLabel, DrawDetailsDelegate drawDetailsDelegate, ref bool foldoutState)
		{
			bool bChanged = false;

			HEU_EditorUI.BeginSection();
			{
				foldoutState = HEU_EditorUI.DrawFoldOut(foldoutState, sectionLabel);
				if (foldoutState)
				{
					HEU_EditorUI.DrawSeparator();
					EditorGUI.indentLevel++;

					using (var hs = new EditorGUILayout.HorizontalScope())
					{
						using (var vs = new EditorGUILayout.VerticalScope())
						{
							bChanged |= drawDetailsDelegate();
						}
					}

					EditorGUI.indentLevel--;
				}
			}
			HEU_EditorUI.EndSection();

			HEU_EditorUI.DrawSeparator();

			return bChanged;
		}
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            if (events != null)
            {
                EditorGUILayout.LabelField(string.Format("{0} active event(s)", events.Count),
                                           EditorStyles.largeLabel);

                EditorGUILayout.Separator();
                DrawTableHeader();

                using (var vertical = new EditorGUILayout.VerticalScope()) {
                    foreach (var element in events)
                    {
                        var del = element.Value;

                        if (del != null)
                        {
                            using (var horizontal = new EditorGUILayout.HorizontalScope()) {
                                EditorGUILayout.LabelField(element.Key);
                                EditorGUILayout.LabelField(string.Format("{0}", element.Value.GetInvocationList().Length), GUILayout.Width(100f));
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 7
0
            public override void DrawWindow()
            {
                base.DrawWindow();

                //X
                using (var frequencyContainer = new EditorGUILayout.VerticalScope("box"))
                {
                    GUILayout.Label("X", "fieldHeader");
                    X = EditorGUILayout.FloatField(" ", X, "floatField");
                }

                GUILayout.Space(5);

                //Y
                using (var frequencyContainer = new EditorGUILayout.VerticalScope("box"))
                {
                    GUILayout.Label("Y", "fieldHeader");
                    Y = EditorGUILayout.FloatField(" ", Y, "floatField");
                }

                GUILayout.Space(5);

                //Z
                using (var frequencyContainer = new EditorGUILayout.VerticalScope("box"))
                {
                    GUILayout.Label("Z", "fieldHeader");
                    Z = EditorGUILayout.FloatField(" ", Z, "floatField");
                }

                GUILayout.Space(5);
            }
Exemplo n.º 8
0
    public void SerializedObjectExample()
    {
        using (var v = new EditorGUILayout.VerticalScope("box"))
        {
            EditorGUILayout.LabelField("Example1 (no undo)");
            if (GUILayout.Button("Reset (Set local position of selected objects to origin"))
            {
                foreach (var go in Selection.gameObjects)
                {
                    go.transform.localPosition = Vector3.zero;
                }
            }
        }
        EditorGUILayout.Space();

        using (var v = new EditorGUILayout.VerticalScope("box"))
        {
            EditorGUILayout.LabelField("Example2 ");
            if (GUILayout.Button("Reset (Set local position of selected objects to origin", EditorStyles.miniButton))
            {
                var transforms = Selection.gameObjects.Select(go => go.transform).ToArray();
                var so         = new SerializedObject(transforms);
                so.FindProperty("m_LocalPosition").vector3Value = new Vector3(Random.Range(-3, 3), 0, Random.Range(-3, 3));
                so.ApplyModifiedProperties();
            }
        }
    }
Exemplo n.º 9
0
        /// <summary>
        /// GUI のカスタム描画
        /// </summary>
        public override void OnInspectorGUI()
        {
            Language self = target as Language;

            string[] symbols = System.Enum.GetNames(typeof(WordIndex));

            if (self.wordList.Count != symbols.Length)
            {
                using (EditorGUILayout.VerticalScope v = new EditorGUILayout.VerticalScope())
                {
                    EditorGUILayout.LabelField("Error: WordIndex or Language#wordList is broken");
                    EditorGUILayout.LabelField("Number of WordIndex         : " + symbols.Length);
                    EditorGUILayout.LabelField("Number of Language#wordList : " + self.wordList.Count);
                }
                return;
            }

            using (EditorGUILayout.VerticalScope v = new EditorGUILayout.VerticalScope())
            {
                for (int index = 0; index < symbols.Length; index++)
                {
                    using (EditorGUILayout.HorizontalScope h = new EditorGUILayout.HorizontalScope())
                    {
                        EditorGUILayout.LabelField(symbols[index], GUILayout.ExpandWidth(true), GUILayout.MaxWidth(160));
                        self.wordList[index] = EditorGUILayout.TextArea(self.wordList[index], GUILayout.ExpandWidth(true));
                    }
                }
            }
        }
Exemplo n.º 10
0
            public override void DrawWindow()
            {
                base.DrawWindow();

                //Minimum
                using (var frequencyContainer = new EditorGUILayout.VerticalScope("box"))
                {
                    GUILayout.Label("Minimum", "fieldHeader");
                    Minimum = EditorGUILayout.FloatField(" ", Minimum, "floatField");
                }

                GUILayout.Space(5);

                //Maximum
                using (var frequencyContainer = new EditorGUILayout.VerticalScope("box"))
                {
                    GUILayout.Label("Maximum", "fieldHeader");
                    Maximum = EditorGUILayout.FloatField(" ", Maximum, "floatField");
                }

                GUILayout.Space(5);

                //FallOff
                using (var frequencyContainer = new EditorGUILayout.VerticalScope("box"))
                {
                    GUILayout.Label("FallOff", "fieldHeader");
                    FallOff = EditorGUILayout.FloatField(" ", FallOff, "floatField");
                }

                GUILayout.Space(5);
            }
        public void LegacyIconSectionGUI()
        {
            // Both default icon and Legacy icons are serialized to the same map
            // That's why m_LegacyPlatformIcons can be excluded in two places (other place in IconSectionGUI())
            using (var vertical = new EditorGUILayout.VerticalScope())
                using (new EditorGUI.PropertyScope(vertical.rect, GUIContent.none, m_LegacyPlatformIcons))
                {
                    // Get icons and icon sizes for selected platform (or default)
                    EditorGUI.BeginChangeCheck();
                    string      platformName = "";
                    Texture2D[] icons        = PlayerSettings.GetPlatformIconsForTargetIcons(platformName, IconKind.Any, m_AllLegacyIcons);
                    int[]       widths       = PlayerSettings.GetIconWidthsForPlatform(platformName, IconKind.Any);

                    // Ensure the default icon list is always populated correctly
                    if (icons.Length != widths.Length)
                    {
                        icons = new Texture2D[widths.Length];
                    }

                    icons[0] = (Texture2D)EditorGUILayout.ObjectField(SettingsContent.defaultIcon, icons[0], typeof(Texture2D), false);
                    // Save changes
                    if (EditorGUI.EndChangeCheck())
                    {
                        Undo.RecordObjects(m_Owner.targets, SettingsContent.undoChangedIconString);
                        SetLegacyPlatformIcons(platformName, icons, IconKind.Any, ref m_AllLegacyIcons);
                    }
                }
        }
Exemplo n.º 12
0
        public void Draw()
        {
            using (var v = new EditorGUILayout.VerticalScope())
            {
                EditorGUI.DrawRect(v.rect, new Color(0.5f, 0.5f, 0.5f, 0.5f));

                using (var h = new EditorGUILayout.HorizontalScope())
                {
                    times = EditorGUILayout.IntField("Times", times);
                    using (var t = new EditorGUILayout.ToggleGroupScope("Random", randomTimes))
                    {
                        randomTimes = t.enabled;
                        minTimes    = EditorGUILayout.DelayedIntField("Min Times", minTimes);
                        maxTimes    = EditorGUILayout.DelayedIntField("Max Times", maxTimes);
                        if (minTimes >= maxTimes)
                        {
                            maxTimes = minTimes + 1;
                        }
                    }
                }

                timeSpan = EditorGUILayout.FloatField("Time Span", timeSpan);
                if (timeSpan < 0)
                {
                    timeSpan = 0;
                }

                if (GUILayout.Button("Send"))
                {
                    OnSendBtnClick();
                }
            }
        }
Exemplo n.º 13
0
 void OnGUI()
 {
     serializedObj.Update();
     if (window == null)
     {
         window = GetWindow <CodeGenWindow>();
     }
     EditorGUILayout.PropertyField(script);
     using (var h = new EditorGUILayout.HorizontalScope())
     {
         using (var v = new EditorGUILayout.VerticalScope(GUILayout.Width(window.position.width * 0.3f)))
         {
             GUI.backgroundColor = Color.green;
             var rect = v.rect;
             rect.height = window.position.height - EditorGUIUtility.singleLineHeight;
             GUI.Box(rect, "");
             GUI.backgroundColor = Color.white;
             DrawAutoImport();
             DrawGraphis();
             DrawSelectables();
         }
         using (var v = new EditorGUILayout.VerticalScope(GUILayout.Width(window.position.width * 0.7f)))
         {
             DrawObjectItem();
             DrawToolButtons();
         }
     }
     serializedObj.ApplyModifiedProperties();
 }
Exemplo n.º 14
0
    private void DrawObjectItem()
    {
        using (var hor = new EditorGUILayout.HorizontalScope(GUILayout.Height(EditorGUIUtility.singleLineHeight)))
        {
            EditorGUILayout.SelectableLabel("[目标对象:]");
            target = EditorGUILayout.ObjectField(target, typeof(GameObject), true) as GameObject;
            if (GUILayout.Button("加载脚本"))
            {
                if (target != null)
                {
                    scripts = new List <MonoBehaviour>();
                    var allscripts = target.GetComponents <MonoBehaviour>();
                    for (int i = 0; i < allscripts.Length; i++)
                    {
                        var namesp = allscripts[i].GetType().Namespace;
                        if (namesp == null || !namesp.Contains("UnityEngine"))
                        {
                            scripts.Add(allscripts[i]);
                        }
                    }
                    scriptgroup = new bool[scripts.Count];
                }
            }
        }
        using (var ver = new EditorGUILayout.VerticalScope(GUILayout.Height(window.position.height * 0.7f - 2 * EditorGUIUtility.singleLineHeight)))
        {
            GUI.backgroundColor = Color.yellow;
            GUI.Box(ver.rect, "");
            GUI.backgroundColor = Color.white;
            if (!(scripts == null || scriptgroup == null || scripts.Count != scriptgroup.Length))
            {
                using (var hor = new EditorGUILayout.ToggleGroupScope("选择脚本", true))
                {
                    for (int i = 0; i < scripts.Count; i++)
                    {
                        scriptgroup[i] = EditorGUILayout.ToggleLeft(scripts[i].GetType().Name, scriptgroup[i]);
                    }
                }
            }

            using (var scr = new EditorGUILayout.ScrollViewScope(scrollPos))
            {
                scrollPos = scr.scrollPosition;
                EditorGUILayout.LabelField(new GUIContent("[Text格式]:" + btnFormat));
                EditorGUILayout.LabelField(new GUIContent("[Image格式]:" + btnFormat));
                EditorGUILayout.LabelField(new GUIContent("[Button格式]:" + btnFormat));
                EditorGUILayout.LabelField(new GUIContent("[Toggle格式]:" + btnFormat));
                EditorGUILayout.LabelField(new GUIContent("[Slider格式]:" + btnFormat));
                EditorGUILayout.LabelField(new GUIContent("[InputField格式]:" + btnFormat));

                EditorGUILayout.LabelField(new GUIContent("[OnClick格式]:" + onClickFormat));
                EditorGUILayout.LabelField(new GUIContent("[OnValueChange格式]:" + onValueChangeFormat));

                EditorGUILayout.LabelField(new GUIContent("[Button事件]:" + btnFuncFormat));
                EditorGUILayout.LabelField(new GUIContent("[Toggle事件]:" + togFuncFormat));
                EditorGUILayout.LabelField(new GUIContent("[Slider事件]:" + sliderFuncFormat));
                EditorGUILayout.LabelField(new GUIContent("[InputField事件]:" + inputFuncFormat));
            }
        }
    }
 private void DrawObjOptions()
 {
     using (var ver = new EditorGUILayout.VerticalScope())
     {
         using (var hor = new EditorGUILayout.HorizontalScope())
         {
             EditorGUILayout.LabelField("[导出路径]:", GUILayout.Width(100));
             localPath_prop.stringValue = EditorGUILayout.TextField(localPath_prop.stringValue);
             if (GUILayout.Button("选择"))
             {
                 var path = EditorUtility.OpenFolderPanel("选择文件路径", localPath_prop.stringValue, "");
                 if (!string.IsNullOrEmpty(path))
                 {
                     localPath_prop.stringValue = path;
                 }
             }
         }
         using (var hor = new EditorGUILayout.HorizontalScope())
         {
             EditorGUILayout.LabelField("[菜单名]:", GUILayout.Width(100));
             menuName_prop.stringValue = EditorGUILayout.TextField(menuName_prop.stringValue);
             EditorGUILayout.LabelField("(文件夹独立)");
         }
     }
 }
 private void OnGUI()
 {
     GUI.enabled = !UnityEditor.BuildPipeline.isBuildingPlayer;
     EditorGUILayout.LabelField("Folder name formatting", EditorStyles.boldLabel);
     using (var changeScope = new EditorGUI.ChangeCheckScope())
     {
         settings.nameFormat = EditorGUILayout.TextField(settings.nameFormat);
         if (changeScope.changed)
         {
             settings.Save();
         }
     }
     EditorGUILayout.HelpBox(HELPBOX_NAME_FORMATTING_INFO, MessageType.Info, true);
     EditorGUILayout.LabelField("Formatted name", settings.GetFolderName(), EditorStyles.helpBox);
     using (var changeScope = new EditorGUI.ChangeCheckScope())
     {
         settings.dateTimeFormat       = EditorGUILayout.TextField("Date time format", settings.dateTimeFormat);
         settings.stripMobileWarning   = EditorGUILayout.Toggle("Strip mobile warning", settings.stripMobileWarning);
         settings.fixMacOSVersionRegex = EditorGUILayout.Toggle("Fix Mac OS Version Regex", settings.fixMacOSVersionRegex);
         settings.createNewFolder      = EditorGUILayout.Toggle("Create new folder", settings.createNewFolder);
         settings.linkerTarget         = (WebGLLinkerTarget)EditorGUILayout.EnumPopup("Linker target", settings.linkerTarget);
         settings.memorySize           = EditorGUILayout.IntField("Memory size", settings.memorySize);
         settings.compressionFormat    = (WebGLCompressionFormat)EditorGUILayout.EnumPopup("Compression", settings.compressionFormat);
         settings.wasmStreaming        = EditorGUILayout.Toggle("WASM Streaming", settings.wasmStreaming);
         settings.buildOptions         = (BuildOptions)EditorGUILayout.EnumFlagsField("Build options", settings.buildOptions);
         string templateName = PlayerSettings.WebGL.template.Substring(PlayerSettings.WebGL.template.IndexOf(':') + 1);
         EditorGUILayout.LabelField("Template", templateName, EditorStyles.helpBox);
         if (changeScope.changed)
         {
             settings.Save();
         }
     }
     using (var verticalScope = new EditorGUILayout.VerticalScope())
     {
         using (var horizontalScope = new EditorGUILayout.HorizontalScope())
         {
             EditorGUILayout.LabelField("Build location", string.IsNullOrWhiteSpace(settings.buildPath) ? "<No location>" : settings.buildPath);
             if (GUILayout.Button("Change...", GUILayout.Width(96.0f)))
             {
                 var path = OpenBuildSavePanel(settings.buildPath);
                 if (!string.IsNullOrEmpty(path))
                 {
                     settings.buildPath = path;
                 }
             }
         }
         using (var horizontalScope = new EditorGUILayout.HorizontalScope())
         {
             GUILayout.FlexibleSpace();
             bool cacheEnable = GUI.enabled;
             GUI.enabled = !string.IsNullOrWhiteSpace(settings.buildPath);
             if (GUILayout.Button("Open Build Location", GUILayout.MaxWidth(256.0f)))
             {
                 Application.OpenURL(settings.buildPath);
             }
             GUI.enabled = cacheEnable;
             GUILayout.FlexibleSpace();
         }
     }
 }
Exemplo n.º 17
0
        void OnGUI()
        {
            using (var v = new EditorGUILayout.VerticalScope())
            {
                using (var scrollView = new EditorGUILayout.ScrollViewScope(_scrollPos))
                {
                    _scrollPos = scrollView.scrollPosition;
                    for (int i = 0; i < _whiteList.Count; ++i)
                    {
                        _checkList[i] = EditorGUILayout.ToggleLeft(_whiteList[i], _checkList[i]);
                    }
                }
            }

            // float w = maxSize[0];
            // float h = maxSize[1];
            int bh = 30;

            // GUILayout.BeginArea(new Rect(0, h-bh, w, bh));
            // if(GUILayout.Button("添加", GUILayout.Width(w), GUILayout.Height(bh)))
            //     OnAddButtonClick();
            // GUILayout.EndArea();
            if (GUILayout.Button("添加", GUILayout.Height(bh)))
            {
                OnAddButtonClick();
            }
        }
Exemplo n.º 18
0
        public override void Render(GUISkin skin)
        {
            using (var scope = new EditorGUILayout.VerticalScope())
            {
                for (int i = 0; i < m_items.Count; i++)
                {
                    EditorGUI.indentLevel++;
                    EditorGUILayout.BeginHorizontal();
                    switch (m_listType)
                    {
                    case ListType.Ordered:
                        EditorGUILayout.LabelField((i + 1).ToString(), skin.GetStyle("listNumber"));
                        break;

                    case ListType.Unordered:
                        EditorGUILayout.LabelField("\x2022", skin.GetStyle("listNumber"));
                        break;
                    }
                    EditorGUILayout.LabelField(m_items[i], skin.label);
                    GUILayout.FlexibleSpace();
                    EditorGUILayout.EndHorizontal();
                    EditorGUI.indentLevel--;
                }
            }
        }
Exemplo n.º 19
0
 private void OnGUI()
 {
     using (var toolBarScope = new EditorGUILayout.HorizontalScope(EditorStyles.toolbar))
     {
         using (var changeCheckScope = new EditorGUI.ChangeCheckScope())
         {
             type = (AssembliesType)EditorGUILayout.EnumPopup(type, EditorStyles.toolbarPopup);
             if (changeCheckScope.changed)
             {
                 EditorPrefs.SetInt(EDITOR_PREFS_TYPE, (int)type);
                 UpdateAssembliesList();
             }
         }
         GUILayout.FlexibleSpace();
     }
     using (var scrollScope = new EditorGUILayout.ScrollViewScope(scrollPositionViewAssemblies))
     {
         scrollPositionViewAssemblies = scrollScope.scrollPosition;
         using (var verticalScope = new EditorGUILayout.VerticalScope())
         {
             foreach (var property in assemblyPropertyList)
             {
                 property.Render();
             }
         }
     }
 }
    // END inspector_onenable

    // Called to draw the GUI in the Inspector
    // BEGIN inspector_ongui
    public override void OnInspectorGUI()
    {
        // Ensure that the serializedObject is up to date
        serializedObject.Update();
        // END inspector_ongui

        // Start a vertical list of controls
        // BEGIN inspector_controls
        using (var area = new EditorGUILayout.VerticalScope()) {
            // For each color in the preset list..
            foreach (var preset in colorPresets)
            {
                // Show a button
                var clicked = GUILayout.Button(preset.Key);

                // If it was clicked, update the property
                if (clicked)
                {
                    colorProperty.colorValue = preset.Value;
                }
            }

            // Finally, show a field that allows for setting the color directly
            EditorGUILayout.PropertyField(colorProperty);
        }
        // END inspector_controls

        // BEGIN inspector_apply
        // Apply any property that was changed
        serializedObject.ApplyModifiedProperties();
        // END inspector_apply
    }
Exemplo n.º 21
0
        private void DrawFeedbackFooter()
        {
            if (!feedbackListProp.isExpanded)
            {
                return;
            }
            using (var r = new EditorGUILayout.VerticalScope()) {
                GUILayout.Space(EditorGUIUtility.singleLineHeight + 10);

                float rightEdge = r.rect.xMax - 10f;
                float leftEdge  = rightEdge - 36f;

                Rect buttonBackgroundRect =
                    new Rect(leftEdge, r.rect.y, rightEdge - leftEdge, r.rect.height);

                Rect addButtonRect =
                    new Rect(leftEdge + 2, r.rect.y,
                             rightEdge - leftEdge - 5, r.rect.height);

                if (Event.current.type == EventType.Repaint)
                {
                    JuicyStyles.RlFooterBackground.Draw(buttonBackgroundRect,
                                                        false, false,
                                                        false, false);
                }

                if (GUI.Button(addButtonRect, JuicyStyles.IconToolbarPlusMore,
                               JuicyStyles.RlPreButton))
                {
                    addFeedbackMenu.DropDown(
                        new Rect(Event.current.mousePosition, Vector2.zero));
                }
            }
        }
Exemplo n.º 22
0
        public override void OnInspectorGUI()
        {
            serializedObject.DrawScript();

            EditorGUILayout.PropertyField(m_serializedProperties.IsRunning, Labels.IsRunning);

            if (m_isSettingsOpen = EditorGUILayout.Foldout(m_isSettingsOpen, Labels.Settings, true))
            {
                using (EditorGUILayout.VerticalScope box = new EditorGUILayout.VerticalScope(EditorStyles.helpBox))
                {
                    using (EditorGUI.IndentLevelScope indent = new EditorGUI.IndentLevelScope())
                    {
                        if (this.DrawFloatField(Labels.Smoothing, m_serializedProperties.Smoothing, out float val, min: SDFGroup.MIN_SMOOTHING))
                        {
                            m_sdfGroup.SetSmoothing(val);
                        }

                        if (this.DrawFloatField(Labels.NormalSmoothing, m_serializedProperties.NormalSmoothing, out val, min: SDFGroup.MIN_SMOOTHING))
                        {
                            m_sdfGroup.SetNormalSmoothing(val);
                        }
                    }
                }
            }

            serializedObject.ApplyModifiedProperties();
        }
Exemplo n.º 23
0
        private void DrawCodeGenTitle()
        {
            EditorGUILayout.Space();
            using (var vScope = new EditorGUILayout.VerticalScope(GUILayout.Height(EditorGUIUtility.singleLineHeight * 100)))
            {
                GUI.backgroundColor = new Color32(0, 0, 0, 30);
                Rect rect = vScope.rect;
                GUI.Box(rect, "");

                GUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("代码预览", GUILayout.Width(halfViewWidth / 4));
                if (GUILayout.Button("刷新", GUILayout.Width(halfViewWidth / 4)))
                {
                    InitCodeText();
                }

                if (GUILayout.Button("生成代码", GUILayout.Width(halfViewWidth / 4)))
                {
                    InitCodeText();
                    // 创建.cs文件
                }
                GUILayout.EndHorizontal();

                float width  = halfViewWidth - 15;
                float height = halfViewHeight * 2 - 55;
                codeScrollPos       = EditorGUILayout.BeginScrollView(codeScrollPos, GUILayout.Width(width), GUILayout.Height(height));
                GUI.backgroundColor = new Color32(0, 146, 255, 100);
                GUILayout.TextArea(codeText);

                EditorGUILayout.EndScrollView();

                EditorGUILayout.Space();
            }
        }
        public void Draw(ScalableBlurConfig config)
        {
            Undo.RecordObject(target, "Modify Blur Config");

            using (var v = new EditorGUILayout.VerticalScope())
            {
                EditorGUILayout.Space();
                DrawTabBar();
                EditorGUILayout.Space();

                using (var changes = new EditorGUI.ChangeCheckScope())
                {
                    DrawTabsContent(config);
                    EditorGUILayout.Space();

                    config.MaxDepth = EditorGUILayout.IntField(depthLabel, config.MaxDepth);
                    EditorGUILayout.Space();

                    if (changes.changed)
                    {
                        EditorUtility.SetDirty(target);
                    }
                }
            }
        }
Exemplo n.º 25
0
		public void OnGUI()
		{
			bool guiEnabled = GUI.enabled;

			_scrollPosition = EditorGUILayout.BeginScrollView(_scrollPosition);

			using (var vs = new EditorGUILayout.VerticalScope(GUI.skin.box))
			{
				DrawSection(this, "GENERAL", this.DrawDetailsGeneral, ref _showGeneral);
				DrawSection(this, "ENVIRONMENT", this.DrawDetailsEnvironment, ref _showEnvironment);
				DrawSection(this, "COOKING", this.DrawDetailsCooking, ref _showCooking);
				DrawSection(this, "GEOMETRY", this.DrawDetailsGeometry, ref _showGeometry);
				DrawSection(this, "SESSION", this.DrawSessionSettings, ref _showSession);
				DrawSection(this, "TOOLS", this.DrawToolSettings, ref _showTools);
				DrawSection(this, "ADVANCED", this.DrawAdvancedSettings, ref _showAdvanced);

				float buttonHeight = 25;
				float buttonWidth = 200;

				GUIStyle yellowButtonStyle = new GUIStyle(GUI.skin.button);
				yellowButtonStyle.normal.textColor = HEU_EditorUI.GetUISafeTextColorYellow();
				yellowButtonStyle.fontStyle = FontStyle.Bold;
				yellowButtonStyle.fontSize = 12;
				yellowButtonStyle.fixedHeight = buttonHeight;
				yellowButtonStyle.fixedWidth = buttonWidth;

				using (var hs = new EditorGUILayout.HorizontalScope())
				{
					GUILayout.FlexibleSpace();
					if (GUILayout.Button(HEU_EditorStrings.RELOAD_SETTINGS, yellowButtonStyle))
					{
						if (HEU_EditorUtility.DisplayDialog(HEU_EditorStrings.REVERT_SETTINGS + "?",
							"Are you sure you want to reload plugin settings from heu_settings.ini file?",
							"Yes", "No"))
						{
							HEU_PluginStorage.LoadFromSavedFile();
							ResetStateAndRepaint();
						}
					}

					GUILayout.Space(10);

					if (GUILayout.Button(HEU_EditorStrings.REVERT_SETTINGS, yellowButtonStyle))
					{
						if (HEU_EditorUtility.DisplayDialog(HEU_EditorStrings.REVERT_SETTINGS + "?", 
							"Are you sure you want to revert all " + HEU_Defines.HEU_PRODUCT_NAME + " plugin settings?",
							"Yes", "No"))
						{
							HEU_PluginStorage.ClearPluginData();
							ResetStateAndRepaint();
						}
					}
					GUILayout.FlexibleSpace();
				}
			}

			EditorGUILayout.EndScrollView();

			GUI.enabled = guiEnabled;
		}
        void OnGUI()
        {
            serializedObj.Update();

            if (codeWindow == null)
            {
                codeWindow = GetWindow <GenerateCodeWindow>();
            }
            halfViewWidth  = EditorGUIUtility.currentViewWidth / 2f;
            halfViewHeight = codeWindow.position.height / 2f;

            using (new EditorGUILayout.HorizontalScope())
            {
                //左半部分
                using (EditorGUILayout.VerticalScope vScope = new EditorGUILayout.VerticalScope(GUILayout.Width(EditorGUIUtility.currentViewWidth * 0.5f)))
                {
                    GUI.backgroundColor = Color.white;
                    Rect rect = vScope.rect;
                    rect.height = codeWindow.position.height;
                    GUI.Box(rect, "");

                    DrawSelectUI();
                    DrawFindWidget();
                    DrawWidgetList();
                    DrawCustomObjectList();
                }
                //右半部分
                using (new EditorGUILayout.VerticalScope(GUILayout.Width(EditorGUIUtility.currentViewWidth * 0.5f)))
                {
                    DrawCodeGenTitle();
                    DrawCodeGenToolBar();
                }
            }
            serializedObj.ApplyModifiedProperties();
        }
Exemplo n.º 27
0
        void OnGUI()
        {
            using (var assetWindow = new EditorGUILayout.VerticalScope())
            {
                using (var assetPanel = new EditorGUILayout.HorizontalScope())
                {
                    assetsExpanded = EditorGUILayout.Foldout(assetsExpanded, "Assets");

                    if (assetsExpanded)
                    {
                        if (GUILayout.Button("Refresh", GUILayout.Width(ASSET_BUTTON_WIDTH)))
                        {
                            Core.RestAPI.SpacesPlatformServicesSettings.Refresh();
                            RefreshAssetList();
                        }
                    }

                    Color guiColor = GUI.color;
                    GUI.color = Color.green;
                    if (GUILayout.Button("Create Asset", GUILayout.Width(ASSET_WIDE_BUTTON_WIDTH)))
                    {
                        CreateAssetDialog.CreateAsset(1);
                    }
                    GUI.color = guiColor;
                }

                if (assetsExpanded)
                {
                    DrawAssetsPanel();
                }

                DrawStatus();
            }
        }
            private void DrawInfoColumn()
            {
                StringBuilder builder = new StringBuilder();

                using (EditorGUILayout.VerticalScope verticalScope = new EditorGUILayout.VerticalScope(InfoWidth))
                {
                    GUIContent tooltip = EditorGUIUtility.IconContent("_Help");
                    EditorGUILayout.LabelField("?", EditorStyles.boldLabel, InfoWidth);
                    foreach (TMP_FontAsset font in allFonts)
                    {
                        builder.Clear();
                        builder.Append(PrependInfo);
                        foreach (string language in allMetaData[font].Languages)
                        {
                            if (builder.Length > PrependInfo.Length)
                            {
                                builder.Append(", ");
                            }
                            builder.Append(language);
                        }
                        tooltip.tooltip = builder.ToString();

                        EditorGUILayout.LabelField(tooltip, InfoHeight, InfoWidth);
                    }
                }
            }
Exemplo n.º 29
0
        /// <summary>
        /// 当前操作生成的代码预览
        /// </summary>
        private void DrawPreviewText()
        {
            EditorGUILayout.Space();

            using (var ver = new EditorGUILayout.VerticalScope())
            {
                GUI.backgroundColor = Color.white;
                GUI.Box(ver.rect, "");

                EditorGUILayout.HelpBox("代码预览:", MessageType.None);
                using (var scr = new EditorGUILayout.ScrollViewScope(scrollTextPos))
                {
                    scrollTextPos = scr.scrollPosition;

                    if (codeStateText != null && !string.IsNullOrEmpty(codeStateText.ToString()) && selectedBar == 0)
                    {
                        //GUILayout.TextArea(codeStateText.ToString());
                        GUILayout.Label(codeStateText.ToString());
                    }

                    if (codeAssignText != null && !string.IsNullOrEmpty(codeAssignText.ToString()))
                    {
                        GUILayout.Label(codeAssignText.ToString());
                    }

                    if (codeEventText != null && !string.IsNullOrEmpty(codeEventText.ToString()))
                    {
                        //GUILayout.TextArea(codeEventText.ToString());
                        GUILayout.Label(codeEventText.ToString());
                    }
                }
            }
        }
        private void DrawBodyContent()
        {
            var height = this.position.height - 3 * EditorGUIUtility.singleLineHeight;
            var width  = this.position.width - 1 * EditorGUIUtility.singleLineHeight;

            using (var hor = new EditorGUILayout.HorizontalScope(GUILayout.Width(width), GUILayout.Height(height)))
            {
                using (var ver = new EditorGUILayout.VerticalScope(GUILayout.Width(width * 0.3f), GUILayout.Height(height)))
                {
                    WidgetUtility.DrawContentColor(ver.rect, Color.green);

                    using (var scroll = new EditorGUILayout.ScrollViewScope(scroll_left, false, true))
                    {
                        scroll_left = scroll.scrollPosition;
                        DrawWidghtsOptions(width * 0.3f);
                    }
                }

                using (var ver = new EditorGUILayout.VerticalScope(GUILayout.Width(width * 0.7f), GUILayout.Height(height)))
                {
                    WidgetUtility.DrawContentColor(ver.rect, Color.green);

                    DrawScrollViewObjs(width * 0.7f, height * 0.9f);

                    using (var hor0 = new EditorGUILayout.HorizontalScope(GUILayout.Width(width * 0.7f), GUILayout.Height(height * 0.1f)))
                    {
                        WidgetUtility.DrawContentColor(hor0.rect, Color.green);

                        DrawToolButtons();
                    }
                }
            }
        }