UnityEngine.GUILayout.EndHorizontal()

Here are the examples of the csharp api UnityEngine.GUILayout.EndHorizontal() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

906 Examples 7

19 View Source File : InputSetupEditor.cs
License : MIT License
Project Creator : Interactml

protected override void ShowBodyFields()
        {
            GUILayout.Space(10);
            ShowEnableUniversalInterfaceToggle();
            GUILayout.Space(20);

            GUILayout.BeginHorizontal();
            GUILayout.Label("Choose Input Device", Resources.Load<GUISkin>("GUIStyles/InteractMLGUISkin").GetStyle("Port Label"), GUILayout.MinWidth(200));
            // sets the device
            ShowDeviceOptions();
            GUILayout.EndHorizontal();

            //sets the controller side for the training examples whether left right or both 
            GUI.changed = false;

            GUILayout.Space(20);
            GUILayout.Label("Teach The Machine Controls", Resources.Load<GUISkin>("GUIStyles/InteractMLGUISkin").GetStyle("Port Label"));
            GUILayout.Space(10);

            
            // if the input is from vr controllers or hands show choice for training examples related buttons to be on the left hand or right hand or both
           /* if (m_InputSetUp.device == IMLInputDevices.VRControllers)
            {
                GUILayout.BeginHorizontal();
                GUILayout.Label("Hand", Resources.Load<GUISkin>("GUIStyles/InteractMLGUISkin").GetStyle("Port Label"), GUILayout.MinWidth(200));
                m_InputSetUp.trainingHand = (IMLSides)EditorGUILayout.EnumPopup(m_InputSetUp.trainingHand);
                GUILayout.EndHorizontal();
                GUILayout.Space(10);
            }
            if (GUI.changed)
            {
                m_InputSetUp.OnHandChange(m_InputSetUp.trainingHand, "trainingSide");
                EditorUtility.SetDirty(m_InputSetUp);
            }8/
            // choose delete last button
            GUI.changed = false;
            // set button choice for delete last
           /* // delete last
            Debug.Log(m_InputSetUp);
            GUILayout.BeginHorizontal();
            GUILayout.Label("Delete Last", Resources.Load<GUISkin>("GUIStyles/InteractMLGUISkin").GetStyle("Port Label"), GUILayout.MinWidth(200));
            ShowButtonChoice(m_InputSetUp.DeleteLast.buttonName, m_InputSetUp.deleteLastButtonNo, out m_InputSetUp.deleteLastButtonNo, m_InputSetUp.deleteLastButtonTT, out m_InputSetUp.deleteLastButtonTT);
            GUILayout.EndHorizontal();*/

            // choose delete all button
            GUILayout.Space(10);
            GUILayout.BeginHorizontal();
            GUILayout.Label("Delete All", Resources.Load<GUISkin>("GUIStyles/InteractMLGUISkin").GetStyle("Port Label"), GUILayout.MinWidth(200));
            ShowButtonChoice(m_InputSetUp.deleteAllName, deleteAllButtonNo, out deleteAllButtonNo, deleteAllButtonTT, out deleteAllButtonTT);
            GUILayout.EndHorizontal();

            // record one
          /*  GUILayout.Space(10);
            GUILayout.BeginHorizontal();
            GUILayout.Label("Record One", Resources.Load<GUISkin>("GUIStyles/InteractMLGUISkin").GetStyle("Port Label"), GUILayout.MinWidth(200));
            ShowButtonChoice(m_InputSetUp.recordOneName, m_InputSetUp.recordOneButtonNo, out m_InputSetUp.recordOneButtonNo, m_InputSetUp.recordOneButtonTT, out m_InputSetUp.recordOneButtonTT);
            GUILayout.EndHorizontal();

            // choose toggle record button 
            GUILayout.Space(10);
            GUILayout.BeginHorizontal();
            GUILayout.Label("Toggle Record", Resources.Load<GUISkin>("GUIStyles/InteractMLGUISkin").GetStyle("Port Label"), GUILayout.MinWidth(200));
            ShowButtonChoice(m_InputSetUp.toggleRecordName, m_InputSetUp.toggleRecordButtonNo, out m_InputSetUp.toggleRecordButtonNo, m_InputSetUp.toggleRecordButtonTT, out m_InputSetUp.toggleRecordButtonTT);
            GUILayout.EndHorizontal();

            GUILayout.Space(30);
            GUILayout.Label("Machine Learning System Controls", Resources.Load<GUISkin>("GUIStyles/InteractMLGUISkin").GetStyle("Port Label"));
            GUILayout.Space(10);

            // sets the controller side for the training
            GUI.changed = false;
            // if the input is from vr controllers or hands show choice for training examples related buttons to be on the left hand or right hand or both
           /* if (m_InputSetUp.device == IMLInputDevices.VRControllers)
            {
                GUILayout.BeginHorizontal();
                GUILayout.Label("Hand", Resources.Load<GUISkin>("GUIStyles/InteractMLGUISkin").GetStyle("Port Label"), GUILayout.MinWidth(200));
                m_InputSetUp.mlsHand = (IMLSides)EditorGUILayout.EnumPopup(m_InputSetUp.mlsHand);
                GUILayout.EndHorizontal();
            }
            if (GUI.changed)
            {
                m_InputSetUp.OnHandChange(m_InputSetUp.mlsHand, "mlsSide");
                EditorUtility.SetDirty(m_InputSetUp);
            }*/
            // sets the button for training
           /* GUILayout.Space(10);
            GUILayout.BeginHorizontal();
            GUILayout.Label("Train", Resources.Load<GUISkin>("GUIStyles/InteractMLGUISkin").GetStyle("Port Label"), GUILayout.MinWidth(200));
            ShowButtonChoice(m_InputSetUp.trainName, m_InputSetUp.trainButtonNo, out m_InputSetUp.trainButtonNo, m_InputSetUp.trainButtonTT, out m_InputSetUp.trainButtonTT);
            GUILayout.EndHorizontal();


            // sets the button for running
            GUILayout.Space(10);
            GUILayout.BeginHorizontal();
            GUILayout.Label("Toggle Run", Resources.Load<GUISkin>("GUIStyles/InteractMLGUISkin").GetStyle("Port Label"), GUILayout.MinWidth(200));
            ShowButtonChoice(m_InputSetUp.toggleRunName, m_InputSetUp.toggleRunButtonNo, out m_InputSetUp.toggleRunButtonNo, m_InputSetUp.toggleRunButtonTT, out m_InputSetUp.toggleRunButtonTT);
            GUILayout.EndHorizontal();*/


        }

19 View Source File : DataTypeNodeEditorMethods.cs
License : MIT License
Project Creator : Interactml

public static void DrawFeatureValueToggleAndLabel<T>(this IMLNodeEditor nodeEditor, BaseDataTypeNode<T> node)
        {
            // for each of the features in the data type
            for (int i = 0; i < node.FeatureValues.Values.Length; i++)
            {
                // Draw each feature on a single line
                GUILayout.BeginHorizontal();
                GUILayout.Space(nodeEditor.bodySpace);

                //draw toggle
                node.ToggleSwitches[i] = EditorGUILayout.Toggle(node.ToggleSwitches[i], IMLNodeEditorMethods.DataInToggle(nodeEditor, node.FeatureValueReceivingData[i]));

                //draw label
                EditorGUILayout.LabelField(nodeEditor.feature_labels[i] + System.Math.Round(node.FeatureValues.Values[i], 3).ToString(), nodeEditor.m_NodeSkin.GetStyle("Node Body Label Axis"));

                GUILayout.EndHorizontal();
                EditorGUILayout.Space();
            }
        }

19 View Source File : CustomControllerEditor.cs
License : MIT License
Project Creator : Interactml

protected override void ShowBodyFields()
        {
            GUILayout.Space(50);
            GUILayout.BeginHorizontal();
            // show hand choice method from inputsetupeditor using m_controller.hand
            GUI.changed = false;
            GUILayout.Space(10);
            GUILayout.Label("Button", Resources.Load<GUISkin>("GUIStyles/InteractMLGUISkin").GetStyle("Port Label"), GUILayout.MinWidth(100));
            // set button choice for delete last
            m_controller.inputNo = EditorGUILayout.Popup(m_controller.inputNo, m_controller.buttonOptions);
            //Event.current.type == EventType.Repaint
            if (GUI.changed)
            {
                m_controller.OnButtonChange();
                //mark as changed
                EditorUtility.SetDirty(m_controller);
            }
            GUI.changed = false;
            GUILayout.Space(10);
            m_controller.trigger = (IMLTriggerTypes)EditorGUILayout.EnumPopup(m_controller.trigger);
            if (GUI.changed)
            {
                m_controller.OnTriggerChange();
                EditorUtility.SetDirty(m_controller);
            }
            GUILayout.EndHorizontal();
            GUILayout.Space(100);
            //show button method from InputSetUpEditor using m_controller.triggerButton*/

        }

19 View Source File : IMLNodeEditor.cs
License : MIT License
Project Creator : Interactml

public void ShowHelptip(Rect hoveredRect, string tip)
        {
            GUIStyle style = m_NodeSkin.GetStyle("TooltipHelp");
            // calculates the height of the tooltip 
            var x = style.CalcHeight(new GUIContent(tip), hoveredRect.width);
            m_ToolRect.x = hoveredRect.x;
            m_ToolRect.y = hoveredRect.y + hoveredRect.height;
            m_ToolRect.width = hoveredRect.width;
            m_ToolRect.height = 200;

            // scroll if helptip long 
            GUILayout.BeginArea(m_ToolRect);
            scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition, GUILayout.Width(GetWidth() - 10), GUILayout.Height(GetWidth() - 50));
            GUILayout.BeginHorizontal();

            GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MinWidth(hoveredRect.width), GUILayout.MaxHeight(x) };
            GUILayout.TextArea(tip, style, options);
            GUILayout.EndHorizontal();
            EditorGUILayout.EndScrollView();
            GUILayout.EndArea();


        }

19 View Source File : IMGUIExtensions.cs
License : GNU General Public License v3.0
Project Creator : jalil49

public static void ColorValue(string label,
                                      Color color,
#if HS
									  UI_ColorInfo.UpdateColor onChanged,
#else
                                      Action<Color> onChanged,
#endif
                                      bool simplePicker = false,
                                      bool simplePickerShowAlpha = true,
                                      bool simplePickerHSV = false)
        {
            if (simplePicker == false)
            {
                GUILayout.BeginHorizontal();
                if (label != null)
                    GUILayout.Label(label, GUILayout.ExpandWidth(false));
                if (GUILayout.Button(GUIContent.none, GUILayout.Height(60f)))
                {
#if HS
					if (Studio.Studio.Instance.colorMenu.updateColorFunc == onChanged)
						Studio.Studio.Instance.colorPaletteCtrl.visible = !Studio.Studio.Instance.colorPaletteCtrl.visible;
					else
						Studio.Studio.Instance.colorPaletteCtrl.visible = true;
					if (Studio.Studio.Instance.colorPaletteCtrl.visible)
					{
						Studio.Studio.Instance.colorMenu.updateColorFunc = onChanged;
						Studio.Studio.Instance.colorMenu.SetColor(color, UI_ColorInfo.ControlType.PresetsSample);
					}
#else
                    if (Studio.Studio.Instance.colorPalette.visible)
                        Studio.Studio.Instance.colorPalette.visible = false;
                    else
                        Studio.Studio.Instance.colorPalette.Setup(label, color, onChanged, true);
#endif
                }
                var layoutRectangle = GUILayoutUtility.GetLastRect();
                layoutRectangle.xMin += 6;
                layoutRectangle.xMax -= 6;
                layoutRectangle.yMin += 6;
                layoutRectangle.yMax -= 6;
                _simpleTexture.SetPixel(0, 0, color);
                _simpleTexture.Apply(false);
                GUI.DrawTexture(layoutRectangle, _simpleTexture, ScaleMode.StretchToFill, true);
                GUILayout.EndHorizontal();
            }
            else
            {
                GUILayout.BeginVertical();
                if (label != null)
                    GUILayout.Label(label, GUILayout.ExpandWidth(false));

                var newColor = color;
                if (simplePickerHSV)
                {
                    Color.RGBToHSV(newColor, out var h, out var s, out var v);
                    h *= 360;

                    GUILayout.BeginHorizontal();
                    GUILayout.Label("H", GUILayout.ExpandWidth(false));
                    h = GUILayout.HorizontalSlider(h, 0f, 359.99f);
                    if (float.TryParse(GUILayout.TextField(h.ToString("0.0"), GUILayout.Width(50)), out var newValue))
                        h = newValue;
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    GUILayout.Label("S", GUILayout.ExpandWidth(false));
                    s = GUILayout.HorizontalSlider(s, 0f, 1f);
                    if (float.TryParse(GUILayout.TextField(s.ToString("0.000"), GUILayout.Width(50)), out newValue))
                        s = newValue;
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    GUILayout.Label("V", GUILayout.ExpandWidth(false));
                    v = GUILayout.HorizontalSlider(v, 0f, 1f);
                    if (float.TryParse(GUILayout.TextField(v.ToString("0.000"), GUILayout.Width(50)), out newValue))
                        v = newValue;
                    GUILayout.EndHorizontal();

                    newColor = Color.HSVToRGB(Mathf.Clamp01(h / 360), Mathf.Clamp01(s), v);
                    newColor.a = color.a;
                }
                else
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Label("R", GUILayout.ExpandWidth(false));
                    newColor.r = GUILayout.HorizontalSlider(newColor.r, 0f, 1f);
                    if (float.TryParse(GUILayout.TextField(newColor.r.ToString("0.000"), GUILayout.Width(50)), out var newValue))
                        newColor.r = newValue;
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    GUILayout.Label("G", GUILayout.ExpandWidth(false));
                    newColor.g = GUILayout.HorizontalSlider(newColor.g, 0f, 1f);
                    if (float.TryParse(GUILayout.TextField(newColor.g.ToString("0.000"), GUILayout.Width(50)), out newValue))
                        newColor.g = newValue;
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    GUILayout.Label("B", GUILayout.ExpandWidth(false));
                    newColor.b = GUILayout.HorizontalSlider(newColor.b, 0f, 1f);
                    if (float.TryParse(GUILayout.TextField(newColor.b.ToString("0.000"), GUILayout.Width(50)), out newValue))
                        newColor.b = newValue;
                    GUILayout.EndHorizontal();
                }

                if (simplePickerShowAlpha)
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Label("A", GUILayout.ExpandWidth(false));
                    newColor.a = GUILayout.HorizontalSlider(newColor.a, 0f, 1f);
                    if (float.TryParse(GUILayout.TextField(newColor.a.ToString("0.000"), GUILayout.Width(50)), out var newValue))
                        newColor.a = newValue;
                    GUILayout.EndHorizontal();
                }

                GUILayout.Box("", GUILayout.Height(40));
                _simpleTexture.SetPixel(0, 0, color);
                _simpleTexture.Apply(false);
                GUI.DrawTexture(GUILayoutUtility.GetLastRect(), _simpleTexture, ScaleMode.StretchToFill, true);

                if (color != newColor)
                    onChanged(newColor);
                GUILayout.EndVertical();
            }
        }

19 View Source File : IMGUIExtensions.cs
License : GNU General Public License v3.0
Project Creator : jalil49

public static void FloatValue(string label, float value, float left, float right, string valueFormat = "", Action<float> onChanged = null)
        {
            GUILayout.BeginHorizontal();
            if (label != null)
                GUILayout.Label(label, GUILayout.ExpandWidth(false));
            var newValue = GUILayout.HorizontalSlider(value, left, right);
            var valueString = newValue.ToString(valueFormat);
            var newValueString = GUILayout.TextField(valueString, GUILayout.Width(50f));

            if (newValueString != valueString)
            {
                if (float.TryParse(newValueString, out var parseResult))
                    newValue = parseResult;
            }
            GUILayout.EndHorizontal();

            if (onChanged != null && !Mathf.Approximately(value, newValue))
                onChanged(newValue);
        }

19 View Source File : IMGUIExtensions.cs
License : GNU General Public License v3.0
Project Creator : jalil49

public static void FloatValue(string label, float value, string valueFormat = "", Action<float> onChanged = null)
        {
            GUILayout.BeginHorizontal();
            if (label != null)
                GUILayout.Label(label, GUILayout.ExpandWidth(false));
            var valueString = value.ToString(valueFormat);
            var newValueString = GUILayout.TextField(valueString, GUILayout.ExpandWidth(true));

            if (newValueString != valueString)
            {
                if (float.TryParse(newValueString, out var parseResult))
                {
                    onChanged?.Invoke(parseResult);
                }
            }
            GUILayout.EndHorizontal();

        }

19 View Source File : IMGUIExtensions.cs
License : GNU General Public License v3.0
Project Creator : jalil49

public static void IntValue(string label, int value, int left, int right, string valueFormat = "", Action<int> onChanged = null)
        {
            GUILayout.BeginHorizontal();
            if (label != null)
                GUILayout.Label(label, GUILayout.ExpandWidth(false));
            var newValue = Mathf.RoundToInt(GUILayout.HorizontalSlider(value, left, right));
            var valueString = newValue.ToString(valueFormat);
            var newValueString = GUILayout.TextField(valueString, GUILayout.Width(50f));

            if (newValueString != valueString)
            {
                if (int.TryParse(newValueString, out var parseResult))
                    newValue = parseResult;
            }
            GUILayout.EndHorizontal();

            if (onChanged != null && !Mathf.Approximately(value, newValue))
                onChanged(newValue);
        }

19 View Source File : IMGUIExtensions.cs
License : GNU General Public License v3.0
Project Creator : jalil49

public static void IntValue(string label, int value, string valueFormat = "", Action<int> onChanged = null)
        {
            GUILayout.BeginHorizontal();
            if (label != null)
                GUILayout.Label(label, GUILayout.ExpandWidth(false));
            var valueString = value.ToString(valueFormat);
            var newValueString = GUILayout.TextField(valueString, GUILayout.ExpandWidth(true));

            if (newValueString != valueString)
            {
                if (int.TryParse(newValueString, out var parseResult))
                {
                    onChanged?.Invoke(parseResult);
                }
            }
            GUILayout.EndHorizontal();

        }

19 View Source File : IMGUIExtensions.cs
License : GNU General Public License v3.0
Project Creator : jalil49

public static void ColorValue(string label,
                                      Color color,
                                      Color reset,
                                      string tooltip,
#if HS
									  UI_ColorInfo.UpdateColor onChanged,
#else
                                      Action<Color> onChanged,
#endif
                                      bool simplePicker = false,
                                      bool simplePickerShowAlpha = true,
                                      bool simplePickerHSV = false)
        {
            if (simplePicker == false)
            {
                GUILayout.BeginHorizontal();
                if (label != null)
                    GUILayout.Label(new GUIContent(label, tooltip), GUILayout.ExpandWidth(false));
                if (GUILayout.Button(GUIContent.none, GUILayout.Height(60f)))
                {
#if HS
					if (Studio.Studio.Instance.colorMenu.updateColorFunc == onChanged)
						Studio.Studio.Instance.colorPaletteCtrl.visible = !Studio.Studio.Instance.colorPaletteCtrl.visible;
					else
						Studio.Studio.Instance.colorPaletteCtrl.visible = true;
					if (Studio.Studio.Instance.colorPaletteCtrl.visible)
					{
						Studio.Studio.Instance.colorMenu.updateColorFunc = onChanged;
						Studio.Studio.Instance.colorMenu.SetColor(color, UI_ColorInfo.ControlType.PresetsSample);
					}
#else
                    if (Studio.Studio.Instance.colorPalette.visible)
                        Studio.Studio.Instance.colorPalette.visible = false;
                    else
                        Studio.Studio.Instance.colorPalette.Setup(label, color, onChanged, true);
#endif
                }
                var layoutRectangle = GUILayoutUtility.GetLastRect();
                layoutRectangle.xMin += 6;
                layoutRectangle.xMax -= 6;
                layoutRectangle.yMin += 6;
                layoutRectangle.yMax -= 6;
                _simpleTexture.SetPixel(0, 0, color);
                _simpleTexture.Apply(false);
                GUI.DrawTexture(layoutRectangle, _simpleTexture, ScaleMode.StretchToFill, true);
                if (GUILayout.Button("Reset", GUILayout.ExpandWidth(false)))
                {
#if HS
					if (onChanged == Studio.Studio.Instance.colorMenu.updateColorFunc)
						Studio.Studio.Instance.colorMenu.SetColor(reset, UI_ColorInfo.ControlType.PresetsSample);
#endif
                    onChanged(reset);
                }
                GUILayout.EndHorizontal();
            }
            else
            {
                GUILayout.BeginVertical();
                GUILayout.BeginHorizontal();
                if (label != null)
                    GUILayout.Label(new GUIContent(label, tooltip), GUILayout.ExpandWidth(false));
                GUILayout.FlexibleSpace();
                var shouldReset = GUILayout.Button("Reset", GUILayout.ExpandWidth(false));
                GUILayout.EndHorizontal();

                var newColor = color;
                if (simplePickerHSV)
                {
                    Color.RGBToHSV(color, out var h, out var s, out var v);
                    h *= 360;

                    GUILayout.BeginHorizontal();
                    GUILayout.Label("H", GUILayout.ExpandWidth(false));
                    h = GUILayout.HorizontalSlider(h, 0f, 359.99f);
                    if (float.TryParse(GUILayout.TextField(h.ToString("0.0"), GUILayout.Width(50)), out var newValue))
                        h = newValue;
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    GUILayout.Label("S", GUILayout.ExpandWidth(false));
                    s = GUILayout.HorizontalSlider(s, 0f, 1f);
                    if (float.TryParse(GUILayout.TextField(s.ToString("0.000"), GUILayout.Width(50)), out newValue))
                        s = newValue;
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    GUILayout.Label("V", GUILayout.ExpandWidth(false));
                    v = GUILayout.HorizontalSlider(v, 0f, 1f);
                    if (float.TryParse(GUILayout.TextField(v.ToString("0.000"), GUILayout.Width(50)), out newValue))
                        v = newValue;
                    GUILayout.EndHorizontal();

                    newColor = Color.HSVToRGB(Mathf.Clamp01(h / 360), Mathf.Clamp01(s), v);
                    newColor.a = color.a;
                }
                else
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Label("R", GUILayout.ExpandWidth(false));
                    newColor.r = GUILayout.HorizontalSlider(newColor.r, 0f, 1f);
                    if (float.TryParse(GUILayout.TextField(newColor.r.ToString("0.000"), GUILayout.Width(50)), out var newValue))
                        newColor.r = newValue;
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    GUILayout.Label("G", GUILayout.ExpandWidth(false));
                    newColor.g = GUILayout.HorizontalSlider(newColor.g, 0f, 1f);
                    if (float.TryParse(GUILayout.TextField(newColor.g.ToString("0.000"), GUILayout.Width(50)), out newValue))
                        newColor.g = newValue;
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    GUILayout.Label("B", GUILayout.ExpandWidth(false));
                    newColor.b = GUILayout.HorizontalSlider(newColor.b, 0f, 1f);
                    if (float.TryParse(GUILayout.TextField(newColor.b.ToString("0.000"), GUILayout.Width(50)), out newValue))
                        newColor.b = newValue;
                    GUILayout.EndHorizontal();
                }

                if (simplePickerShowAlpha)
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Label("A", GUILayout.ExpandWidth(false));
                    newColor.a = GUILayout.HorizontalSlider(newColor.a, 0f, 1f);
                    if (float.TryParse(GUILayout.TextField(newColor.a.ToString("0.000"), GUILayout.Width(50)), out var newValue))
                        newColor.a = newValue;
                    GUILayout.EndHorizontal();
                }

                GUILayout.Box("", GUILayout.Height(40));
                _simpleTexture.SetPixel(0, 0, color);
                _simpleTexture.Apply(false);
                GUI.DrawTexture(GUILayoutUtility.GetLastRect(), _simpleTexture, ScaleMode.StretchToFill, true);

                if (color != newColor)
                    onChanged(newColor);
                GUILayout.EndVertical();
                if (shouldReset)
                    onChanged(reset);
            }
        }

19 View Source File : IMGUIExtensions.cs
License : GNU General Public License v3.0
Project Creator : jalil49

public static void LayerMaskValue(string label, int value, SortedList<int, string> layerNames, int columns = 2, Action<int> onChanged = null)
        {
            GUILayout.BeginVertical();
            if (label != null)
                GUILayout.Label(label);
            var newValue = value;
            GUILayout.BeginHorizontal();
            GUILayout.BeginVertical();
            var columnSize = Mathf.CeilToInt((float)layerNames.Count / columns);
            var shown = 0;
            foreach (var kvp in layerNames)
            {
                if (shown != 0 && shown % columnSize == 0)
                {
                    GUILayout.EndVertical();
                    GUILayout.BeginVertical();
                }
                if (GUILayout.Toggle((newValue & (1 << kvp.Key)) != 0, $"{kvp.Key}: {kvp.Value}"))
                    newValue |= 1 << kvp.Key;
                else
                    newValue &= ~(1 << kvp.Key);
                ++shown;
            }
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();

            if (value != newValue && onChanged != null)
                onChanged(newValue);
        }

19 View Source File : Setting.cs
License : MIT License
Project Creator : JasonXuDeveloper

public static void MakeHorizontal(int space, Action act)
		{
			GUILayout.BeginHorizontal();
			GUILayout.Space(space);
			act();
			GUILayout.Space(space);
			GUILayout.EndHorizontal();
		}

19 View Source File : Proto2CSEditor.cs
License : MIT License
Project Creator : JasonXuDeveloper

protected void OnGUI()
		{
			//绘制标题
			GUILayout.Space(10);
			GUIStyle textStyle = new GUIStyle();
			textStyle.fontSize = 24;
			textStyle.normal.textColor = Color.white;
			textStyle.alignment = TextAnchor.MiddleCenter;
			GUILayout.Label("Proto文件转CS文件", textStyle);
			textStyle.fontSize = 18;
			GUILayout.Label("Proto file to CS file", textStyle);
			GUILayout.Space(10);

			/*
			 * 路径
			 */
			GUILayout.Label("Proto file folder Proto文件路径");
			GUILayout.BeginHorizontal();
			EditorGUI.BeginDisabledGroup(true);
			folder = EditorGUILayout.TextField(folder);
			EditorGUI.EndDisabledGroup();

			GUILayout.Space(10);
			if (GUILayout.Button("Select Path 选择路径", GUILayout.ExpandWidth(false)))
			{
				folder = EditorUtility.OpenFolderPanel("Select proto files destination 请选择proto文件路径",
					Application.dataPath + "/Dependencies/Protobuf/ProtoFiles", "");
			}

			GUILayout.EndHorizontal();

			/*
			 * 文件
			 */
			GUILayout.Space(10);
			GUILayout.Label("Files to convert 需转换文件");
			//更新
			_serializedObject.Update();
			//开始检查是否有修改
			EditorGUI.BeginChangeCheck();
			//显示属性
			EditorGUILayout.PropertyField(_fileListProperty, true);

			//结束检查是否有修改
			if (EditorGUI.EndChangeCheck())
			{
				//提交修改
				_serializedObject.ApplyModifiedProperties();
			}

			/*
			 * 按钮
			 */
			GUILayout.Space(50);
			if (GUILayout.Button("Match all files from folder 从文件夹中匹配全部文件"))
			{
				_fileList = Directory.GetFiles(folder,
					"*.proto", SearchOption.AllDirectories);
				var _fileListInstance = new string[_fileList.Length];
				for (int i = 0; i < _fileList.Length; i++)
					_fileListInstance[i] = Path.GetFileName(_fileList[i]);
				_fileList = _fileListInstance;
				_serializedObject.Update();
			}

			GUILayout.Space(10);
			if (GUILayout.Button("Generate 生成"))
			{
				Generate(folder, _fileList, Application.dataPath + "/../HotUpdateScripts/Proto2cs");
			}
		}

19 View Source File : RedisWindow.cs
License : MIT License
Project Creator : JasonXuDeveloper

void OnGUI()
        {
            //GUI样式
            GUIStyle header = new GUIStyle();
            header.fontSize = 20;
            header.normal.textColor = Color.white;

            GUIStyle body = new GUIStyle();
            body.fontSize = 13;
            body.normal.textColor = Color.red;
            GUILayout.BeginVertical();
            EditorStyles.textArea.wordWrap = true;

            if (Language == Language.中文)
            {
                //全部Key区域
                GUILayout.BeginArea(new Rect(25, 10, this.position.width / 3, this.position.height - 10));

                EditorGUILayout.LabelField("Db" + SQL_DB + "中的Keys", header);
                GUILayout.Space(5);
                EditorGUILayout.LabelField("共" + Keys.Count + "Keys", body);
                if (GUILayout.Button("新增"))
                {
                    CurrentValue = "";
                    CurrentKey = "";
                    SelectedKey = "";
                    this.Repaint();
                }
                GUILayout.Space(10);

                m_ScrollPosition = EditorGUILayout.BeginScrollView(m_ScrollPosition);
                foreach (var key in Keys)
                {
                    if (GUILayout.Button(key))
                    {
                        GetValue(key);
                    }
                }
                GUILayout.Space(10);
                GUILayout.EndScrollView();
                GUILayout.EndArea();


                //配置+数据区域
                GUILayout.BeginArea(new Rect(this.position.width / 3 + 50, 10, this.position.width / 3 * 2 - 75, this.position.height - 110));
                EditorGUILayout.HelpBox("Unity GUI Redis\n" +
               "作者: 傑", MessageType.Info);
                Language = (Language)EditorGUILayout.EnumPopup("语言(Language)", Language);
                //配置区域
                m_ScrollPosition2 = EditorGUILayout.BeginScrollView(m_ScrollPosition2);
                this.fadeGroup.target = EditorGUILayout.Foldout(this.fadeGroup.target, "基础设置", true);
                if (EditorGUILayout.BeginFadeGroup(this.fadeGroup.faded))
                {
                    EditorGUILayout.HelpBox("注意:\n如果Redis服务器外网没访问权,请使用SSH连接\n如果通过SSH连接,数据库IP为Redis配置文件中绑定的地址(理论上为127.0.0.1)\n如果不通过SSH连接,数据库IP为服务器IP\nRedis数据库端口默认是6379\n数据库如果没密码就留空\n数据库默认为0", MessageType.Warning);
                    SQL_IP = EditorGUILayout.TextField("数据库IP", SQL_IP);
                    SQL_Port = (uint)EditorGUILayout.IntField("数据库端口", (int)SQL_Port);
                    SQL_Preplacedword = EditorGUILayout.PreplacedwordField("数据库密码", SQL_Preplacedword);
                    SQL_DB = EditorGUILayout.IntField("数据库", (int)SQL_DB);
                    Debug = EditorGUILayout.Toggle("调试模式", Debug);
                    GUILayout.Space(10);
                    ConnectThroughSSH = EditorGUILayout.BeginToggleGroup("使用SSH连接(建议开启)", ConnectThroughSSH);
                    EditorGUILayout.HelpBox("注意:\nSSH服务器必须具有数据库访问权(即数据库在该服务器内或该服务器IP有权限访问数据库)\nSSH端口默认22\nSSH用户为服务器登入用户名,CentOS的机子一般是root,Ubuntu机子是ubuntu,Windows机子是Administrator\nSSH密码为你登入服务器的密码", MessageType.Warning);
                    SSH_Host = EditorGUILayout.TextField("SSH服务器IP", SSH_Host);
                    SSH_Port = EditorGUILayout.IntField("端口", SSH_Port);
                    SSH_User = EditorGUILayout.TextField("用户", SSH_User);
                    SSH_Preplacedword = EditorGUILayout.PreplacedwordField("密码", SSH_Preplacedword);
                    EditorGUILayout.EndToggleGroup();
                    GUILayout.Space(10);
                }
                EditorGUILayout.EndFadeGroup();
                //数据处理区域
                GUILayout.Space(5);
                CurrentKey = EditorGUILayout.TextField("Key", CurrentKey);
                EditorGUILayout.LabelField("Value");
                m_ScrollPosition3 = EditorGUILayout.BeginScrollView(m_ScrollPosition3);
                CurrentValue = EditorGUILayout.TextArea(CurrentValue, GUILayout.MinHeight(150), GUILayout.ExpandHeight(true));
                GUILayout.EndScrollView();
                GUILayout.Space(10);
                GUILayout.BeginHorizontal();
                if (CurrentKey != "" && CurrentValue != "" && SelectedKey!= "")
                {
                    if (GUILayout.Button("保存"))
                    {
                        SetValue();
                    }
                    if (GUILayout.Button("删除"))
                    {
                        DeleteValue();
                    }
                }
                else
                {
                    if (GUILayout.Button("新增"))
                    {
                        SetValue();
                    }
                }
                GUILayout.EndHorizontal();
                GUILayout.EndScrollView();
                GUILayout.EndArea();
                //按钮区域
                GUILayout.BeginArea(new Rect(this.position.width / 3 + 25 + ((this.position.width / 3 * 2) - 275) / 2, this.position.height - 90, 250, 80));
                m_ScrollPosition4 = EditorGUILayout.BeginScrollView(m_ScrollPosition4);
                if (GUILayout.Button("刷新Keys"))
                {
                    GetKeys();
                }
                if (GUILayout.Button("测试连接"))
                {
                    TestConnection();
                }
                EditorGUILayout.HelpBox("测试连接会阻塞主线程,建议不要在游戏运行时点击测试,慎用!", MessageType.Error);
                GUILayout.EndScrollView();
                GUILayout.EndArea();
                EditorGUILayout.EndVertical();
            }

            #region 如果不需要英文版可以把下面的删了

            else//英文版本
            {
                //全部Key区域
                GUILayout.BeginArea(new Rect(25, 10, this.position.width / 3, this.position.height - 10));

                EditorGUILayout.LabelField("Keys in Db" + SQL_DB + "", header);
                GUILayout.Space(5);
                EditorGUILayout.LabelField(Keys.Count + " Keys in total", body);
                if (GUILayout.Button("Add new key"))
                {
                    CurrentValue = "";
                    CurrentKey = "";
                    this.Repaint();
                }
                GUILayout.Space(10);

                m_ScrollPosition = EditorGUILayout.BeginScrollView(m_ScrollPosition);
                foreach (var key in Keys)
                {
                    if (GUILayout.Button(key))
                    {
                        GetValue(key);
                    }
                }
                GUILayout.Space(10);
                GUILayout.EndScrollView();
                GUILayout.EndArea();


                //配置+数据区域
                GUILayout.BeginArea(new Rect(this.position.width / 3 + 50, 10, this.position.width / 3 * 2 - 75, this.position.height - 110));
                EditorGUILayout.HelpBox("Unity GUI Redis\n" +
                "Author: JasonXuDeveloper", MessageType.Info);
                Language = (Language)EditorGUILayout.EnumPopup("语言(Language)", Language);
                //配置区域
                m_ScrollPosition2 = EditorGUILayout.BeginScrollView(m_ScrollPosition2);
                this.fadeGroup.target = EditorGUILayout.Foldout(this.fadeGroup.target, "Basics", true);
                if (EditorGUILayout.BeginFadeGroup(this.fadeGroup.faded))
                {
                    EditorGUILayout.HelpBox("Note:\nPlease use SSH if your Redis service refuses to connect from your ip\nWhen you are using SSH, please change the SQL IP to bind IP in your redis configuration (usually is 127.0.0.1)\nIf you are not using SSH, change the SQL IP to you Server IP\nDefault port for Redis is 6379\nRemain SQL Preplacedword empty when there is no preplacedword\nDefault database is 9", MessageType.Warning);
                    SQL_IP = EditorGUILayout.TextField("SQL IP", SQL_IP);
                    SQL_Port = (uint)EditorGUILayout.IntField("SQL Port", (int)SQL_Port);
                    SQL_Preplacedword = EditorGUILayout.PreplacedwordField("SQL Preplacedword", SQL_Preplacedword);
                    SQL_DB = EditorGUILayout.IntField("Database", (int)SQL_DB);
                    Debug = EditorGUILayout.Toggle("Debug mode", Debug);
                    GUILayout.Space(10);
                    ConnectThroughSSH = EditorGUILayout.BeginToggleGroup("Use SSH (Highly recommended)", ConnectThroughSSH);
                    EditorGUILayout.HelpBox("Note:\nSSH must be avaliable to connect to Redis\nDefault port for SSH is 22\nSSH Username is usually root on CentOS Machines, ubuntu on Ubuntu Machines, Administrator on Windows\nSSH Preplacedword is the preplacedword which you access to your machine", MessageType.Warning);
                    SSH_Host = EditorGUILayout.TextField("SSH IP", SSH_Host);
                    SSH_Port = EditorGUILayout.IntField("SSH Port", SSH_Port);
                    SSH_User = EditorGUILayout.TextField("SSH User", SSH_User);
                    SSH_Preplacedword = EditorGUILayout.PreplacedwordField("SSH Preplacedword", SSH_Preplacedword);
                    EditorGUILayout.EndToggleGroup();
                    GUILayout.Space(10);
                }
                EditorGUILayout.EndFadeGroup();
                //数据处理区域
                GUILayout.Space(5);
                CurrentKey = EditorGUILayout.TextField("Key", CurrentKey);
                EditorGUILayout.LabelField("Value");
                m_ScrollPosition3 = EditorGUILayout.BeginScrollView(m_ScrollPosition3);
                CurrentValue = EditorGUILayout.TextArea(CurrentValue, GUILayout.MinHeight(150), GUILayout.ExpandHeight(true));
                GUILayout.EndScrollView();
                GUILayout.Space(10);
                GUILayout.BeginHorizontal();
                if (CurrentKey != "" && CurrentValue != "")
                {
                    if (GUILayout.Button("Save"))
                    {
                        SetValue();
                    }
                    if (GUILayout.Button("Delete"))
                    {
                        DeleteValue();
                    }
                }
                else
                {
                    if (GUILayout.Button("Add New"))
                    {
                        SetValue();
                    }
                }
                GUILayout.EndHorizontal();
                GUILayout.EndScrollView();
                GUILayout.EndArea();
                //按钮区域
                GUILayout.BeginArea(new Rect(this.position.width / 3 + 25 + ((this.position.width / 3 * 2) - 275) / 2, this.position.height - 90, 250, 80));
                m_ScrollPosition4 = EditorGUILayout.BeginScrollView(m_ScrollPosition4);
                if (GUILayout.Button("Refresh Keys"))
                {
                    GetKeys();
                }
                if (GUILayout.Button("Test Connection"))
                {
                    TestConnection();
                }
                EditorGUILayout.HelpBox("Test connection will be running on main thread,\nThus it is not recommended to try it while the game is playing,\nPlease be aware before you use this feature", MessageType.Error);
                GUILayout.EndScrollView();
                GUILayout.EndArea();
                EditorGUILayout.EndVertical();
            }
            #endregion
            //删到这里就够了
        }

19 View Source File : UiTemplate.cs
License : GNU General Public License v3.0
Project Creator : k0np4ku

private static void BeginSelectingMod()
        {
            var isInitialized = false;
            GUILayout.BeginVertical(UiStyle.Style[0]);
            for (var i = 0; i < Ui.Functions.Count; i++)
            {
                if (i == 0) GUILayout.BeginHorizontal();
                if (i == 0 || i == 3) GUILayout.BeginVertical();

                if (!isInitialized)
                {
                    if (GUILayout.Button("I'm not a cheater!", UiStyle.Style[5]))
                    {
                        Main.SelectedMod = 0;
                        Progress.CurrentState = Progress.States.EndSelectingMod;
                    }
                    isInitialized = true;
                }

                var isToggleAble = Directory.Exists(PathMgr.Raw(((Mods[])Enum.GetValues(typeof(Mods)))[i + 1].ToString().ToLower().Replace("_", "-")));
                if (GUILayout.Button(Ui.Functions[i], UiStyle.Style[isToggleAble ? 5 : 6]))
                {
                    if (!isToggleAble)
                        break;

                    Main.SelectedMod = ((Mods[])Enum.GetValues(typeof(Mods)))[i + 1];
                    Progress.CurrentState = Progress.States.EndSelectingMod;
                }

                if (i == 2 || i == 6) GUILayout.EndVertical();
                if (i == 6) GUILayout.EndVertical();
            }
            GUILayout.EndVertical();
            GUILayout.BeginHorizontal(UiStyle.Style[0]);
            if (GUILayout.Button("Replace Skin", UiStyle.Style[Main.ReplaceSkin ? 7 : 8]))
            {
                Main.ReplaceSkin = !Main.ReplaceSkin;
                File.WriteAllText(PathMgr.WorkingDirectory("prefs"), Main.ReplaceSkin ? "1" : "0");
            }
            GUILayout.EndHorizontal();
        }

19 View Source File : NewMapPopupWindow.cs
License : MIT License
Project Creator : k1lly0u

private void OnGUI()
    {
        EditorGUILayout.LabelField("Create New Map", EditorStyles.boldLabel);

        GUILayout.Space(10f);

        GUILayout.BeginHorizontal();
        GUILayout.Label("Map Size");
        mapSize = Mathf.Clamp(EditorGUILayout.IntField(mapSize), 1000, 6000);
        GUILayout.EndHorizontal();

        GUILayout.Space(5f);

        splat = EditorGUILayout.IntPopup("Splat", splat, splats, splatInts);
        GUILayout.Space(5f);

        biome = EditorGUILayout.IntPopup("Biome", biome, biomes, biomeInts);
        GUILayout.Space(10f);

        if (GUILayout.Button("Create"))
        {
            worldManager.Create(mapSize, splat, biome);
            this.Close();
            return;
        }
        if (GUILayout.Button("Cancel"))
            this.Close();
    }

19 View Source File : PluginSettings.cs
License : MIT License
Project Creator : k1lly0u

[SettingsProvider]
    private static SettingsProvider RiderPreferencesItem()
    {
      var provider = new SettingsProvider("Preferences/Rider", SettingsScope.User)
      {
        label = "Rider",
        keywords = new[] { "Rider" },
        guiHandler = (searchContext) =>
        {
          EditorGUIUtility.labelWidth = 200f;
          EditorGUILayout.BeginVertical();

          GUI.enabled = RiderScriptEditor.IsRiderInstallation(CodeEditor.CurrentEditorInstallation);

          GUILayout.BeginVertical();
          LogEventsCollectorEnabled =
            EditorGUILayout.Toggle(new GUIContent("Preplaced Console to Rider:"), LogEventsCollectorEnabled);

          OverrideTargetFrameworkVersionOldMono =
            EditorGUILayout.Toggle(new GUIContent("Override TargetFrameworkVersion:"),
              OverrideTargetFrameworkVersionOldMono);
          if (OverrideTargetFrameworkVersionOldMono)
          {
            var helpOldMono = @"TargetFramework = 3.5 is recommended.
 - With 4.5 Rider may show ambiguous references in UniRx.";

            TargetFrameworkVersionOldMono =
              EditorGUILayout.TextField(
                new GUIContent("For Active profile NET 3.5:",
                  helpOldMono), TargetFrameworkVersionOldMono);
            EditorGUILayout.HelpBox(helpOldMono, MessageType.None);
          }

          // Unity 2018.1 doesn't require installed dotnet framework, it references everything from Unity installation
          if (SystemInfo.operatingSystemFamily == OperatingSystemFamily.Windows &&
              UnityUtils.UnityVersion < new Version(2018, 1))
          {
            var detectedDotnetText = string.Empty;
            var installedFrameworks = GetInstalledNetFrameworks();
            if (installedFrameworks.Any())
              detectedDotnetText = installedFrameworks.OrderBy(v => new Version(v)).Aggregate((a, b) => a + "; " + b);
            EditorGUILayout.HelpBox($"Installed dotnet versions: {detectedDotnetText}", MessageType.None);
          }

          GUILayout.EndVertical();

          OverrideLangVersion = EditorGUILayout.Toggle(new GUIContent("Override LangVersion:"), OverrideLangVersion);
          if (OverrideLangVersion)
          {
            var workaroundUrl = "https://gist.github.com/van800/875ce55eaf88d65b105d010d7b38a8d4";
            var workaroundText = "Use this <color=#0000FF>workaround</color> if overriding doesn't work.";
            var helpLangVersion = @"Avoid overriding, unless there is no particular need.";

            LangVersion =
              EditorGUILayout.TextField(
                new GUIContent("LangVersion:",
                  helpLangVersion), LangVersion);
            LinkButton(caption: workaroundText, url: workaroundUrl);
            EditorGUILayout.HelpBox(helpLangVersion, MessageType.None);
          }

          GUILayout.Label("");

          if (!string.IsNullOrEmpty(EditorPluginInterop.LogPath))
          {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel("Log file:");
            var previous = GUI.enabled;
            GUI.enabled = previous && SelectedLoggingLevel != LoggingLevel.OFF;
            var button = GUILayout.Button(new GUIContent("Open log"));
            if (button)
            {
              //UnityEditorInternal.InternalEditorUtility.OpenFileAtLineExternal(PluginEntryPoint.LogPath, 0);
              // works much faster than the commented code, when Rider is already started
              CodeEditor.CurrentEditor.OpenProject(EditorPluginInterop.LogPath, 0, 0);
            }

            GUI.enabled = previous;
            GUILayout.EndHorizontal();
          }

          var loggingMsg =
            @"Sets the amount of Rider Debug output. If you are about to report an issue, please select Verbose logging level and attach Unity console output to the issue.";
          SelectedLoggingLevel =
            (LoggingLevel) EditorGUILayout.EnumPopup(new GUIContent("Logging Level:", loggingMsg),
              SelectedLoggingLevel);


          EditorGUILayout.HelpBox(loggingMsg, MessageType.None);

          var githubRepo = "https://github.com/JetBrains/resharper-unity";
          var caption = $"<color=#0000FF>{githubRepo}</color>";
          LinkButton(caption: caption, url: githubRepo);

          GUILayout.FlexibleSpace();
          GUILayout.BeginHorizontal();

          GUILayout.FlexibleSpace();
          var version = replacedembly.GetExecutingreplacedembly().GetName().Version;
          GUILayout.Label("Plugin version: " + version, ourVersionInfoStyle);

          GUILayout.EndHorizontal();

          // left for testing purposes
/*      if (GUILayout.Button("reset RiderInitializedOnce = false"))
      {
        RiderInitializedOnce = false;
      }*/

          EditorGUILayout.EndVertical();
        }
      };
      return provider;
    }

19 View Source File : ConfigEditorSchema.cs
License : Apache License 2.0
Project Creator : KeyleXiao

public virtual void RenderRawColumn(ConfigEditorLineFieldCache column,ConfigEditorLineCache<T> lineData)
        {
            if (column.RawData == null) return;

            var columnSchema = column.CurrentSchema;
            var lineRawData = lineData.RawData;
            var columnRawData = column.RawData = columnSchema.field_info.GetValue(lineRawData);
          
            // ---- Chache ----

            if (column.IsGenericType)
            {
                GUILayout.BeginVertical(GUIStyle.none,
                    new GUILayoutOption[]
                    {
                        GUILayout.Width(GetResizeWidth(columnSchema.config_editor_setting.Width,
                            columnSchema.config_editor_setting.MaxWidth))
                    });

                int deleteIndex = -1;

                //Open Editor
                if (columnSchema.config_editor_setting.OutCodeGenEditorID != 0)
                {
                    //处理外联添加逻辑
                    var temp = columnRawData as List<int>;

                    for (int i = 0; i < temp.Count; i++)
                    {
                        GUILayout.BeginHorizontal();

                        //显示外联数据
                        GUILayout.Label(GetOutLinkDisplayField(
                                temp[i],
                                columnSchema.config_editor_setting.OutCodeGenEditorID,
                                columnSchema.config_editor_setting.OutLinkDisplay),
                            GUILayout.Width(
                                GetResizeWidth(
                                    columnSchema.config_editor_setting.Width,
                                    columnSchema.config_editor_setting.MaxWidth,
                                    Data.currentEditorSetting.KitButtonWidth + Data.currentEditorSetting.ColumnSpan
                                )
                            )
                        );

                        //删除子类型数据
                        if (GUILayout.Button(Language.Delete, GUILayout.Width(Data.currentEditorSetting.KitButtonWidth)))
                            deleteIndex = i;

                        GUILayout.EndHorizontal();
                    }
                    //处理外联添加逻辑

                    // -- 打开面板 --
                    if (GUILayout.Button(Language.Add))
                    {
                        //var test = data.config_editor_setting;
                        var e = OpenOutlinkWindow(columnSchema.config_editor_setting.OutCodeGenEditorID);
                        if (e == null)
                        {
                            ShowNotification(new GUIContent(Language.OutLinkIsNull));
                        }
                        else
                        {
                            e.UpdateSelectModel(columnRawData as List<int>, SetLisreplacedemValue);
                            e.ShowUtility();
                        }
                    }
                    // -- 打开面板 --
                    
                    

                    if (deleteIndex != -1)
                    {
                        temp.RemoveAt(deleteIndex);
                        //TODO 此处应该处理联动列需求
                        
                    }
                }
                else
                {
                    //添加数据
                    if (GUILayout.Button(Language.Add))
                    {
                        column.Invoke_Add(
                            column.AttributeType == typeof(string)
                                ? string.Empty
                                : Activator.CreateInstance(column.AttributeType));
                    }

                    //添加数据
                    
                    
                    //处理数组逻辑
                    int count = column.Invoke_Count();

                    int removeIndex = -1;

                    for (int i = 0; i < count; i++)
                    {
                        object lisreplacedem = column.Invoke_Gereplacedem(i); //.Item.GetValue(value, new object[] {i});


                        GUILayout.BeginHorizontal();
                        //alignment
                        RenderBaseControl(
                            GetResizeWidth(columnSchema.config_editor_setting.Width, columnSchema.config_editor_setting.MaxWidth,
                                Data.currentEditorSetting.KitButtonWidth + Data.currentEditorSetting.ColumnSpan),
                            columnSchema.config_editor_setting.CanEditor,
                            lisreplacedem,
                            v => { column.Invoke_Sereplacedem(v,i); });

                        if (GUILayout.Button(Language.Delete,
                            new GUILayoutOption[] {GUILayout.Width(Data.currentEditorSetting.KitButtonWidth)}))
                        {
                            removeIndex = i;
                        }

                        GUILayout.EndHorizontal();
                    }

                    if (removeIndex != -1)
                    {
                        column.Invoke_RemoveAt(removeIndex);
                    }
                    //处理数组逻辑

                }

                GUILayout.EndVertical();
            }
            else
            {
                //Open Editor
                if (columnSchema.config_editor_setting.OutCodeGenEditorID != 0)
                {
//                    data.field_info.SetValue(raw,GetSelectValueByFlag(raw.ID, data.field_info.Name, (int) value));
                    
                    string buttonName = GetOutLinkDisplayField((int) columnRawData,
                        columnSchema.config_editor_setting.OutCodeGenEditorID,
                        columnSchema.config_editor_setting.OutLinkDisplay);

                    if (GUILayout.Button(buttonName,
                        new GUILayoutOption[]
                        {
                            GUILayout.Width(GetResizeWidth(columnSchema.config_editor_setting.Width,
                                columnSchema.config_editor_setting.MaxWidth))
                        }))
                    {
                        var e = OpenOutlinkWindow(columnSchema.config_editor_setting.OutCodeGenEditorID);

                        if (e == null)
                            ShowNotification(new GUIContent(Language.OutLinkIsNull));
                        else
                        {
                            e.UpdateSelectModel(lineRawData,columnSchema.field_info, SetLisreplacedemValue);
                            e.ShowUtility();
                        }
                    }
                }
                else
                {
                    RenderBaseControl(
                        GetResizeWidth(columnSchema.config_editor_setting.Width, columnSchema.config_editor_setting.MaxWidth),
                        columnSchema.config_editor_setting.CanEditor, columnRawData,
                        v => { columnSchema.field_info.SetValue(lineRawData, v);  });
                }
            }

            //更新search key
            if (column.CurrentSchema.CurrentFiledProperty == FiledProperty.SEARCH_KEY)
            {
                lineData.SearchKey = columnRawData.ToString();
            }
        }

19 View Source File : ConfigEditorSchema.cs
License : Apache License 2.0
Project Creator : KeyleXiao

protected virtual void RenderHead()
        {
            GUILayout.BeginScrollView(new Vector2(posv.x, 0), false, false, GUIStyle.none, GUIStyle.none,
                new GUILayoutOption[] {GUILayout.Height(Data.currentEditorSetting.TableHeadHeight)});

            GUILayout.BeginHorizontal(EditorGUIStyle.GetGroupBoxStyle(),
                new GUILayoutOption[] {GUILayout.Width(position.width)});

            //TODO Set Order
            foreach (var item in Data.CurrentClreplacedFieldsCache)
            {
                if (GUILayout.Button(
                    string.IsNullOrEmpty(item.config_editor_setting.Display)
                        ? item.field_info.Name
                        : item.config_editor_setting.Display, EditorGUIStyle.GetTagButtonStyle(),
                    new GUILayoutOption[]
                    {
                        GUILayout.Width(GetResizeWidth(item.config_editor_setting.Width,
                            item.config_editor_setting.MaxWidth))
                    }))
                    HeadButton_Click(item.field_info.Name);

                GUILayout.Space(Data.currentEditorSetting.ColumnSpan);
            }

            RenderExtensionHead();

            if (current_windowType == WindowType.CALLBACK)
                GUILayout.Label(Language.Select, EditorGUIStyle.GetTagButtonStyle(),
                    GUILayout.Width(Data.currentEditorSetting.ExtensionHeadTagWith));
            else if (current_windowType == WindowType.INPUT)
                GUILayout.Label(Language.Operation, EditorGUIStyle.GetTagButtonStyle(),
                    GUILayout.Width(Data.currentEditorSetting.ExtensionHeadTagWith));
            else
                GUILayout.Label(Language.Operation, EditorGUIStyle.GetTagButtonStyle(),
                    GUILayout.Width(Data.currentEditorSetting.ExtensionHeadTagWith));

            GUILayout.EndHorizontal();
            GUILayout.EndScrollView();
        }

19 View Source File : ConfigEditorSchema.cs
License : Apache License 2.0
Project Creator : KeyleXiao

protected virtual void RenderTable()
        {
            posv = GUILayout.BeginScrollView(posv, false, false, EditorGUIStyle.GetHorizontalScrollbarStyle(),
                GUIStyle.none, EditorGUIStyle.GetTableGroupBoxStyle());

            if (!string.IsNullOrEmpty(Data.currentEditorSetting.SearchResourceName))
            {
                Data.currentEditorSetting.ItemMaxCount = Data.LinesCache.Count(x =>
                    x.SearchKey.ToLower().Contains(Data.currentEditorSetting.SearchResourceName.ToLower().Trim()));
                
                Finallylist = Data.LinesCache
                    .Where(x => x.SearchKey.ToLower().Contains(Data.currentEditorSetting.SearchResourceName.ToLower().Trim()))
                    .Skip(Data.currentEditorSetting.PageIndex * Data.currentEditorSetting.PageAmount)
                    .Take(Data.currentEditorSetting.PageAmount).ToList();
            }
            else
            {
                Data.currentEditorSetting.ItemMaxCount = Data.LinesCache.Count;
                Finallylist = Data.LinesCache
                    .Skip(Data.currentEditorSetting.PageIndex * Data.currentEditorSetting.PageAmount)
                    .Take(Data.currentEditorSetting.PageAmount).ToList();
            }

            //遍历搜索结果
            for (int i = 0; i < Finallylist.Count; i++)
            {
                var lineData = Finallylist[i];

                if (deleteList.Contains(lineData.HashCode))
                    continue;

                //Select effect diaplay
                if (current_windowType == WindowType.CALLBACK && SelectDisplayEffectList.Contains(lineData.HashCode))
                    GUI.backgroundColor = Color.green;
                else GUI.backgroundColor = Color.white;


                GUILayout.BeginHorizontal(EditorGUIStyle.GetGroupBoxStyle());

                foreach (var column in lineData.ColumnInfo)
                {
                    if (ErrorLine.Contains(lineData.HashCode)) GUI.color = Color.red;
                    RenderRawColumn(column,lineData);
                    GUI.color = Color.white;
                    
                    GUILayout.Space(Data.currentEditorSetting.ColumnSpan);
                }

                RenderExtensionButton(lineData.RawData);
                GUILayout.Space(Data.currentEditorSetting.ColumnSpan);

                RenderFunctionButton(lineData.RawData);
                GUILayout.Space(Data.currentEditorSetting.ColumnSpan);

                GUILayout.EndHorizontal();
                GUILayout.Space(5);
            }

            GUILayout.Space(15);
            GUILayout.EndScrollView();
        }

19 View Source File : ConfigEditorSchema.cs
License : Apache License 2.0
Project Creator : KeyleXiao

protected virtual void RenderMenu()
        {
            GUILayout.BeginHorizontal(GUIStyle.none, new GUILayoutOption[] {GUILayout.Height(25)});

            if (GUILayout.Button(Language.DiscardChange, GUI.skin.GetStyle("ButtonLeft")))
                Reload();


            if (!Data.currentEditorSetting.DisableCreate && current_windowType != WindowType.CALLBACK)
                NewLineButton();

            if (!Data.currentEditorSetting.DisableSave && current_windowType != WindowType.CALLBACK)
                SaveButton();

            GUILayout.EndHorizontal();


            if (!Data.currentEditorSetting.DisableSearch)
                SearchField();
        }

19 View Source File : ConfigEditorSchema.cs
License : Apache License 2.0
Project Creator : KeyleXiao

public void OnGUI()
        {
            if (Event.current.isKey && Event.current.keyCode == KeyCode.Escape)
            {
                Close();
                return;
            }

            if (!initialized || Data == null)
            {
                Initialize();
                if (current_windowType == WindowType.CALLBACK) SelectDisplayEffectList = new List<int>(); //init select display
            }


            if (!FirstLoadFlag)
            {
                FirstLoadFlag = true;
                Reload();
            }

            //TODO: 有一种情况 生成需要unity编译的脚本 这时候打开编辑器会报错(存留在内存的数据被clear) 这时候需要先关闭编辑器
            if (Data.currentEditorSetting == null)
            {
                Close();
                return;
            }

            EditorGUILayout.Space();

            //--- 顶部 功能按钮 ---
            RenderMenu();
            //--- 顶部 功能按钮 ---

            //--- 表头 ---
            RenderHead();
            //--- 表头 ---

            //--- 主表 ---
            RenderTable();
            //--- 主表 ---

            //--- 分页 ---
            Page();
            //--- 分页 ---

            //-- 版权信息 --
            GUILayout.BeginHorizontal();
            GUILayout.Label(Language.Contract);
            GUILayout.EndHorizontal();
        }

19 View Source File : ConfigEditorSchema.cs
License : Apache License 2.0
Project Creator : KeyleXiao

protected virtual void Page()
        {
            GUILayout.BeginHorizontal(EditorGUIStyle.GetGroupBoxStyle(),
                new GUILayoutOption[] {GUILayout.Width(position.width)});
            int maxIndex =
                Mathf.FloorToInt((Data.currentEditorSetting.ItemMaxCount - 1) / (float) Data.currentEditorSetting.PageAmount);
            if (maxIndex < Data.currentEditorSetting.PageIndex)
                Data.currentEditorSetting.PageIndex = 0;

            GUILayout.Label(string.Format(Language.PageInfoFormate, Data.currentEditorSetting.PageIndex + 1, maxIndex + 1),
                GUILayout.Width(100));
            GUILayout.Label(Language.OnePageMaxNumber, EditorGUIStyle.GetPageLabelGuiStyle(), GUILayout.Width(80));
            int.TryParse(GUILayout.TextField(Data.currentEditorSetting.PageAmount.ToString(), GUILayout.Width(40)),
                out Data.currentEditorSetting.PageAmount);


            if (GUILayout.Button(Language.Jump, EditorGUIStyle.GetJumpButtonGuiStyle(), GUILayout.Width(40)))
            {
                if (jumpTo - 1 < 0)
                    jumpTo = 0;

                if (jumpTo - 1 > maxIndex)
                    jumpTo = maxIndex;

                Data.currentEditorSetting.PageIndex = jumpTo - 1;
            }

            jumpTo = EditorGUILayout.IntField(jumpTo, GUILayout.Width(40));

            if (GUILayout.Button(Language.Previous, GUI.skin.GetStyle("ButtonLeft"), GUILayout.Height(16)))
            {
                if (Data.currentEditorSetting.PageIndex - 1 < 0)
                    Data.currentEditorSetting.PageIndex = 0;
                else
                    Data.currentEditorSetting.PageIndex -= 1;
            }

            if (GUILayout.Button(Language.Next, GUI.skin.GetStyle("ButtonRight"), GUILayout.Height(16)))
            {
                if (Data.currentEditorSetting.PageIndex + 1 > maxIndex)
                    Data.currentEditorSetting.PageIndex = maxIndex;
                else
                    Data.currentEditorSetting.PageIndex++;
            }

            //处理缩放
            if (!Data.currentEditorSetting.HideResizeSlider)
                Data.currentEditorSetting.Resize =
                    (int) GUILayout.HorizontalSlider(Data.currentEditorSetting.Resize, 1, 5, GUILayout.Width(70));

            GUILayout.EndHorizontal();
        }

19 View Source File : ConfigEditorSchema.cs
License : Apache License 2.0
Project Creator : KeyleXiao

protected virtual void SearchField()
        {
            GUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(Language.NickName, GUILayout.Width(70));
            Data.currentEditorSetting.SearchResourceName =
                EditorGUILayout.TextField(Data.currentEditorSetting.SearchResourceName,
                    GUI.skin.GetStyle("ToolbarSeachTextField"));
            GUILayout.EndHorizontal();
        }

19 View Source File : EditorGUIStyle.cs
License : Apache License 2.0
Project Creator : KeyleXiao

public static void DrawLine(GUIStyle rLineStyle)
        {
            GUILayout.BeginHorizontal(rLineStyle);
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
        }

19 View Source File : ZConsole.cs
License : GNU General Public License v2.0
Project Creator : lauw

void ConsoleWindow (int windowID)
		{
			scrollPosition = GUILayout.BeginScrollView(scrollPosition);
			
			// Iterate through the recorded logs.
			for (int i = 0; i < logs.Count; i++) {
				var log = logs[i];
				
				// Combine identical messages if collapse option is chosen.
				if (collapse) {
					var messageSameAsPrevious = i > 0 && log.message == logs[i - 1].message;
					
					if (messageSameAsPrevious) {
						continue;
					}
				}
				
				GUI.contentColor = logTypeColors[log.type];
				GUILayout.Label(log.message);
			}
			
			GUILayout.EndScrollView();
			
			GUI.contentColor = Color.white;
			
			GUILayout.BeginHorizontal();
			
			if (GUILayout.Button(clearLabel)) {
				logs.Clear();
			}
			
			collapse = GUILayout.Toggle(collapse, collapseLabel, GUILayout.ExpandWidth(false));
			
			GUILayout.EndHorizontal();
			
			// Allow the window to be dragged by its replacedle bar.
			GUI.DragWindow(replacedleBarRect);
		}

19 View Source File : ResKitEditorWindow.cs
License : MIT License
Project Creator : liangxiegame

private void OnGUI()
		{
			scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Height(400));
			GUILayout.BeginVertical();
			GUILayout.BeginHorizontal();
			GUILayout.Label("PersistanePath:");
			GUILayout.TextField(Application.persistentDataPath);
			GUILayout.EndHorizontal();
			if (GUILayout.Button("Go To Persistance"))
			{
				EditorUtility.RevealInFinder(Application.persistentDataPath);
			}

			DrawMenu();

			isEnableGenerateClreplaced = GUILayout.Toggle(isEnableGenerateClreplaced, "auto generate clreplaced when build");
			ResKitreplacedetsMenu.SimulatereplacedetBundleInEditor =
				GUILayout.Toggle(ResKitreplacedetsMenu.SimulatereplacedetBundleInEditor, "Simulation Mode");

			GUILayout.BeginHorizontal();
			GUILayout.Label("ResVersion:");
			resVersion = GUILayout.TextField(resVersion);
			GUILayout.EndHorizontal();

			if (GUILayout.Button("Generate Clreplaced"))
			{
				BuildScript.WriteClreplaced();
				replacedetDatabase.Refresh();
			}

			if (GUILayout.Button("Build"))
			{
				BuildWithTarget(EditorUserBuildSettings.activeBuildTarget);
				Close();
				return;
			}

			if (GUILayout.Button("ForceClear"))
			{
				ForceClear();
			}

			GUILayout.EndVertical();
			GUILayout.Space(50);

			EditorGUILayout.EndScrollView();

			GUILayout.BeginHorizontal();
			GUILayout.Label("Url:");
			mHttpUrl = GUILayout.TextField(mHttpUrl);
			GUILayout.EndHorizontal();

			if (GUILayout.Button("Http Get"))
			{
				ObservableWWW.Get(mHttpUrl).Subscribe(response => { Log.E(response); });
			}

			if (GUILayout.Button("Http Post"))
			{	
				ObservableWWW.Get("http://127.0.0.1:8000/demo/save/?content=" + new OK().ToJson()).Subscribe(response => { Log.E(response); });
			}
		}

19 View Source File : RectTransformInspector.cs
License : MIT License
Project Creator : liangxiegame

public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();
            if (s_Contents == null)
            {
                s_Contents = new Contents();
            }

            serializedObject.Update();
            Event e = Event.current;
            if (e != null)
            {
                if (image) //Auto set Image's native size if Image.sprite is not null
                {
                    if (e.type == EventType.DragPerform || e.type == EventType.MouseDown)
                    {
                        autoSetNativeSize = !image.sprite;
                    }

                    if (autoSetNativeSize && image.sprite && image.type == Image.Type.Simple)
                    {
                        autoSetNativeSize = false;
                        RectTransform tf = target as RectTransform;
                        float x = image.sprite.rect.width/image.pixelsPerUnit;
                        float y = image.sprite.rect.height/image.pixelsPerUnit;
                        tf.anchorMax = tf.anchorMin;
                        tf.sizeDelta = new Vector2(x, y);
                    }
                }

                //Keyboard control move by pixel style like Photoshop's move tool
                if (e.type == EventType.KeyDown && e.control)
                {
                    int nUnit = e.shift ? 10 : 1;
                    switch (e.keyCode)
                    {
                        case KeyCode.UpArrow:
                            Undo.RecordObjects(targets, "UpArrow");
                            MoveTargetAncreplaceddPosition(Vector2.up*nUnit);
                            e.Use();
                            break;
                        case KeyCode.DownArrow:
                            Undo.RecordObjects(targets, "DownArrow");
                            MoveTargetAncreplaceddPosition(Vector2.down*nUnit);
                            e.Use();
                            break;
                        case KeyCode.LeftArrow:
                            Undo.RecordObjects(targets, "LeftArrow");
                            MoveTargetAncreplaceddPosition(Vector2.left*nUnit);
                            e.Use();
                            break;
                        case KeyCode.RightArrow:
                            Undo.RecordObjects(targets, "RightArrow");
                            MoveTargetAncreplaceddPosition(Vector2.right*nUnit);
                            e.Use();
                            break;
                    }
                }
            }

            const float fButtonWidth = 21;
            if (stylePivotSetup == null)
            {
                stylePivotSetup = new GUIStyle("PreButton")
                                  {
                                      normal = new GUIStyle("CN Box").normal,
                                      active = new GUIStyle("AppToolbar").normal,
                                      overflow = new RectOffset(),
                                      padding = new RectOffset(0, 0, -1, 0),
                                      fixedWidth = 19
                                  };

                styleMove = new GUIStyle(stylePivotSetup)
                            {
                                padding = new RectOffset(0, 0, -2, 0)
                            };
            }

            GUILayout.BeginHorizontal();
            {
                GUILayout.BeginVertical();
                {
                    #region Tools
                    GUILayout.BeginHorizontal();
                    {
                        EditorGUIUtility.labelWidth = 64;
                        float newScale = EditorGUILayout.FloatField(s_Contents.scaleContent, scaleAll);
                        if (!Mathf.Approximately(scaleAll, newScale))
                        {
                            scaleAll = newScale;
                            spLocalScale.vector3Value = Vector3.one*scaleAll;
                        }
                    }

                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    {
                        if (GUILayout.Button(s_Contents.ancreplaceddPosition0Content, strButtonLeft, GUILayout.Width(fButtonWidth)))
                        {
                            foreach (Object item in targets)
                            {
                                RectTransform rtf = item as RectTransform;
                                rtf.LocalPositionIdenreplacedy();
                            }
                        }

                        if (GUILayout.Button(s_Contents.deltaSize0Content, strButtonMid, GUILayout.Width(fButtonWidth)))
                        {
                            spSizeDelta.vector2Value = Vector2.zero;
                        }

                        if (GUILayout.Button(s_Contents.rotation0Content, strButtonMid, GUILayout.Width(fButtonWidth)))
                        {
                            spLocalRotation.quaternionValue = Quaternion.idenreplacedy;
                        }

                        if (GUILayout.Button(s_Contents.scale0Content, strButtonRight, GUILayout.Width(fButtonWidth)))
                        {
                            spLocalScale.vector3Value = Vector3.one;
                            scaleAll = spLocalScale.FindPropertyRelative("x").floatValue;
                        }

                        if (GUILayout.Button(s_Contents.roundContent))
                        {
                            Vector2 v2 = spAncreplaceddPosition.vector2Value;
                            spAncreplaceddPosition.vector2Value = new Vector2(Mathf.Round(v2.x), Mathf.Round(v2.y));
                            v2 = spSizeDelta.vector2Value;
                            spSizeDelta.vector2Value = new Vector2(Mathf.Round(v2.x), Mathf.Round(v2.y));
                        }
                    }
                    GUILayout.EndHorizontal();
                    #endregion

                    #region Copy Paste
                    GUILayout.BeginHorizontal();
                    Color c = GUI.color;
                    GUI.color = new Color(1f, 1f, 0.5f, 1f);
                    if (GUILayout.Button(s_Contents.copyContent, strButtonLeft, GUILayout.Width(fButtonWidth)))
                    {
                        ComponentUtility.CopyComponent(target as RectTransform);
                    }

                    GUI.color = new Color(1f, 0.5f, 0.5f, 1f);
                    if (GUILayout.Button(s_Contents.pasteContent, strButtonMid, GUILayout.Width(fButtonWidth)))
                    {
                        foreach (Object item in targets)
                        {
                            ComponentUtility.PasteComponentValues(item as RectTransform);
                        }
                    }

                    GUI.color = c;
                    if (GUILayout.Button(s_Contents.fillParentContent, strButtonMid, GUILayout.Width(fButtonWidth)))
                    {
                        Undo.RecordObjects(targets, "F");
                        foreach (Object item in targets)
                        {
                            RectTransform rtf = item as RectTransform;
                            rtf.anchorMax = Vector2.one;
                            rtf.anchorMin = Vector2.zero;
                            rtf.offsetMax = Vector2.zero;
                            rtf.offsetMin = Vector2.zero;
                        }
                    }

                    if (GUILayout.Button(s_Contents.normalSizeDeltaContent, strButtonRight, GUILayout.Width(fButtonWidth)))
                    {
                        Undo.RecordObjects(targets, "N");
                        foreach (Object item in targets)
                        {
                            RectTransform rtf = item as RectTransform;
                            Rect rect = rtf.rect;
                            rtf.anchorMax = new Vector2(0.5f, 0.5f);
                            rtf.anchorMin = new Vector2(0.5f, 0.5f);
                            rtf.sizeDelta = rect.size;
                        }
                    }

                    GUILayout.Label(s_Contents.readmeContent);
                    GUILayout.EndHorizontal();
                    #endregion
                }
                GUILayout.EndVertical();

                GUILayout.BeginVertical();
                {
                    #region Pivot
                    GUILayout.Label("Pivot", "ProfilerPaneSubLabel"); //┌─┐
                    GUILayout.BeginHorizontal(); //│┼│
                    {
                        //└─┘
                        if (GUILayout.Button("◤", stylePivotSetup))
                        {
                            spPivot.vector2Value = new Vector2(0, 1);
                        }

                        if (GUILayout.Button("", stylePivotSetup))
                        {
                            spPivot.vector2Value = new Vector2(0.5f, 1);
                        }

                        if (GUILayout.Button("◥", stylePivotSetup))
                        {
                            spPivot.vector2Value = new Vector2(1, 1);
                        }
                    }

                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    {
                        if (GUILayout.Button("", stylePivotSetup))
                        {
                            spPivot.vector2Value = new Vector2(0, 0.5f);
                        }

                        if (GUILayout.Button("+", styleMove))
                        {
                            spPivot.vector2Value = new Vector2(0.5f, 0.5f);
                        }

                        if (GUILayout.Button("", stylePivotSetup))
                        {
                            spPivot.vector2Value = new Vector2(1, 0.5f);
                        }
                    }

                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    {
                        if (GUILayout.Button("◣", stylePivotSetup))
                        {
                            spPivot.vector2Value = new Vector2(0, 0);
                        }

                        if (GUILayout.Button("", stylePivotSetup))
                        {
                            spPivot.vector2Value = new Vector2(0.5f, 0);
                        }

                        if (GUILayout.Button("◢", stylePivotSetup))
                        {
                            spPivot.vector2Value = new Vector2(1, 0);
                        }
                    }

                    GUILayout.EndHorizontal();
                }
                #endregion

                GUILayout.EndVertical();
            }
            GUILayout.EndHorizontal();

            TransformInspector.DrawBottomPanel(target, targets);
            serializedObject.ApplyModifiedProperties();
        }

19 View Source File : PixelKit.cs
License : MIT License
Project Creator : liangxiegame

void OnGUI () 
		{

			this.wantsMouseMove = true;

			if (waitingFile) return; // we are waiting for save
			if (needsUpdate) {Repaint(); needsUpdate=false;} // we need to update
			if (!isInitialized) InitializeCanvas();



			// ** GUI **
			GUIToolbar();

			if (toolbarMode==6)
			{
				GUISettingsTab();
				return;
			}

			GUILayout.Space(19);
			GUICurrentImageInfo();


			// background canvas
			GUI.DrawTextureWithTexCoords(new Rect(leftOffsetX,topOffsetY,imageSize*pixelSizeAdjust,imageSize*pixelSizeAdjust), canvasBackground, new Rect(0f,0f,1f,1f),true);

			// drawing canvas
			GUI.DrawTextureWithTexCoords(new Rect(leftOffsetX,topOffsetY,imageSize*pixelSizeAdjust,imageSize*pixelSizeAdjust), canvas, new Rect(0f,0f,1f,1f),true);

			// outline canvas
			if (automaticOutline)
			{
				GUI.DrawTextureWithTexCoords(new Rect(leftOffsetX,topOffsetY,imageSize*pixelSizeAdjust,imageSize*pixelSizeAdjust), canvasOutlineBG, new Rect(0f,0f,1f,1f),true);
			}
	
			// parts of the GUI
			GUIMouseInfo();
			GUIDrawPreviews();
			GUICurrentColors();

			GUILayout.BeginHorizontal();
			GUILayout.BeginVertical();
			//GUIUndoRedo(); // not working properly yet
			//GUILayout.Space(8);
			GUILayout.EndVertical();
			GUILayout.EndHorizontal();

			GUILayout.BeginHorizontal();
			GUILayout.BeginVertical(GUILayout.Width(leftOffsetX-4));
			GUILayout.Space(0); // dummy
			GUILayout.EndVertical();
			GUILayout.BeginVertical();
			GUILoadBuffer();
			GUILayout.EndVertical();
			GUIPalette();
			GUILayout.EndHorizontal();

			GUILayout.BeginArea(new Rect(527,585,182,73));
			GUIAutomaticOutlines();
			GUIMirrorToggles();
			GUIMovePanTools();
			GUILayout.EndArea();

			GUIInfoAndStatus();

			GUIEvents();

		}

19 View Source File : PIAEditorWindow.cs
License : MIT License
Project Creator : liangxiegame

private void DrawToolbar()
    {
        float iconWidth = 36;
        int spaceBetweenIcons = 8;

        Rect firstColorRect;
        Rect secondColorRect;

        GUILayout.FlexibleSpace();

        GUILayout.BeginHorizontal();
        {
            // SELECTED TOOL BOX 
            switch (drawer.ToolType) {
                case PIAToolType.Paint:
                    selectedToolRect = new Rect(15, 4, iconWidth, iconWidth);
                    break;
                case PIAToolType.Erase:
                    selectedToolRect = new Rect(15 + iconWidth + spaceBetweenIcons, 4, iconWidth, iconWidth);

                    break;
                case PIAToolType.Selection:
                    selectedToolRect = new Rect(15 + iconWidth * 2 + spaceBetweenIcons * 2, 4, iconWidth, iconWidth);
                    break;
                case PIAToolType.Rectangle:
                    selectedToolRect = new Rect(15 + iconWidth * 3 + spaceBetweenIcons * 3 , 4, iconWidth, iconWidth);
                    break;
                case PIAToolType.RectangleFilled:
                    selectedToolRect = new Rect(15 + iconWidth * 4 + spaceBetweenIcons * 4, 4, iconWidth, iconWidth);
                    break;
                
                case PIAToolType.Dithering:
                    selectedToolRect = new Rect(15 + iconWidth * 5 + spaceBetweenIcons * 5, 4, iconWidth, iconWidth);
                    break;

            }

            GUI.DrawTexture(selectedToolRect, selectedToolBG);

            // PAINT TOOL
            GUILayout.Space(15);
            if (GUILayout.Button(pen, skin.GetStyle("toolbarbutton"), GUILayout.MaxWidth(iconWidth), GUILayout.MaxHeight(iconWidth)))
            {
                drawer.ToolType = PIAToolType.Paint;
            }

            Rect penGlobalRect = PIATooltipUtility.ChildToGlobalRect(GUILayoutUtility.GetLastRect());
            Rect penTooltipRect = new Rect(0, 0, 75, 22.5f);
            PIATooltip penTooltip = new PIATooltip(penTooltipRect, "Paint (Q)");
            PIATooltip.SetPositionPreset(ref penTooltip, penGlobalRect, PIATooltip.PIATooltipPreset.Down);
            PIATooltipUtility.AddTooltip(penGlobalRect, penTooltip);

            GUILayout.Space(spaceBetweenIcons);

            // ERASER TOOL
            if (GUILayout.Button(eraser, skin.GetStyle("toolbarbutton"), GUILayout.MaxWidth(iconWidth), GUILayout.MaxHeight(iconWidth)))
            {
                drawer.ToolType = PIAToolType.Erase;
            }

            Rect eraseGlobalRect = PIATooltipUtility.ChildToGlobalRect(GUILayoutUtility.GetLastRect());
            Rect eraseTooltipRect = new Rect(0, 0, 75, 22.5f);
            PIATooltip eraseTooltip = new PIATooltip(eraseTooltipRect, "Erase (E)");
            PIATooltip.SetPositionPreset(ref eraseTooltip, eraseGlobalRect, PIATooltip.PIATooltipPreset.Down);
            PIATooltipUtility.AddTooltip(eraseGlobalRect, eraseTooltip);

            GUILayout.Space(spaceBetweenIcons);

            // SELECTION TOOL
            if (GUILayout.Button(selectionBox, skin.GetStyle("toolbarbutton"), GUILayout.MaxWidth(iconWidth), GUILayout.MaxHeight(iconWidth)))
            {
                drawer.ToolType = PIAToolType.Selection;
            }
            Rect selectionBoxGlobalRect = PIATooltipUtility.ChildToGlobalRect(GUILayoutUtility.GetLastRect());
            Rect selectionBoxTooltipRect = new Rect(0, 0, 150, 22.5f);
            PIATooltip selectionBoxTooltip = new PIATooltip(selectionBoxTooltipRect, "Filled Erase (Shift+E)");
            PIATooltip.SetPositionPreset(ref selectionBoxTooltip, selectionBoxGlobalRect, PIATooltip.PIATooltipPreset.Down);
            PIATooltipUtility.AddTooltip(selectionBoxGlobalRect, selectionBoxTooltip);

            GUILayout.Space(spaceBetweenIcons);

            // RECTANGLE TOOL
            if (GUILayout.Button(squareTool, skin.GetStyle("toolbarbutton"), GUILayout.MaxWidth(iconWidth), GUILayout.MaxHeight(iconWidth)))
            {
                drawer.ToolType = PIAToolType.Rectangle;
            }

            Rect squareGlobalRect = PIATooltipUtility.ChildToGlobalRect(GUILayoutUtility.GetLastRect());
            Rect squareTooltipRect = new Rect(0, 0, 105, 22.5f);
            PIATooltip squareTooltip = new PIATooltip(squareTooltipRect, "Rectangle (R)");
            PIATooltip.SetPositionPreset(ref squareTooltip, squareGlobalRect, PIATooltip.PIATooltipPreset.Down);
            PIATooltipUtility.AddTooltip(squareGlobalRect, squareTooltip);

            GUILayout.Space(spaceBetweenIcons);

            // FILLED RECTANGLE TOOL
            if (GUILayout.Button(filledSquareTool, skin.GetStyle("toolbarbutton"), GUILayout.MaxWidth(iconWidth), GUILayout.MaxHeight(iconWidth)))
            {
                drawer.ToolType = PIAToolType.RectangleFilled;
            }

            Rect filledSquareGlobalRect = PIATooltipUtility.ChildToGlobalRect(GUILayoutUtility.GetLastRect());
            Rect filledSquareTooltipRect = new Rect(0, 0, 175, 22.5f);
            PIATooltip filledSquareTooltip = new PIATooltip(filledSquareTooltipRect, "Filled Rectangle (Shift+R)");
            PIATooltip.SetPositionPreset(ref filledSquareTooltip, filledSquareGlobalRect, PIATooltip.PIATooltipPreset.Down);
            PIATooltipUtility.AddTooltip(filledSquareGlobalRect, filledSquareTooltip);

            GUILayout.Space(spaceBetweenIcons);

            // DITHERING TOOL
            if (GUILayout.Button(ditheringTool, skin.GetStyle("toolbarbutton"), GUILayout.MaxWidth(iconWidth), GUILayout.MaxHeight(iconWidth)))
            {
                drawer.ToolType = PIAToolType.Dithering;
            }
            Rect ditheringToolGlobalRect = PIATooltipUtility.ChildToGlobalRect(GUILayoutUtility.GetLastRect());
            Rect ditheringToolTooltipRect = new Rect(0, 0, 120, 22.5f);
            PIATooltip ditheringToolTooltip = new PIATooltip(ditheringToolTooltipRect, "Dithering tool (T)");
            PIATooltip.SetPositionPreset(ref ditheringToolTooltip, ditheringToolGlobalRect, PIATooltip.PIATooltipPreset.Down);
            PIATooltipUtility.AddTooltip(ditheringToolGlobalRect, ditheringToolTooltip);

            // COLORS FIELDS RECT
            firstColorRect = new Rect(GUILayoutUtility.GetLastRect().x + 40 + spaceBetweenIcons, 8, 60, 20);
            secondColorRect = new Rect(firstColorRect.x + 35, 18, 60, 20);

        }
        GUILayout.EndHorizontal();

        GUILayout.FlexibleSpace();


        

        // DRAWING COLORS FIELDS
        drawer.FirstColor = EditorGUI.ColorField(firstColorRect, new GUIContent(""), drawer.FirstColor, false, true, false, null);
        drawer.SecondColor = EditorGUI.ColorField(secondColorRect, new GUIContent(""), drawer.SecondColor, false, true, false, null);

    }

19 View Source File : PIAEditorWindow.cs
License : MIT License
Project Creator : liangxiegame

private void DrawLayers(Rect verticalParent) {

        Vector2 offset = new Vector2(10, 20);

        // INIT LAYER RECT
        float layerRectPositionX = verticalParent.x + offset.x;
        float layerRectPositionY = verticalParent.yMax + offset.y;
        float layerRectWidth = verticalParent.width-offset.x*2;
        float layerRectHeight = 40;
        float spaceBetweenLayers = 10;

        // SCROLL VIEW STUFF
        Rect viewRect = new Rect(layerRectPositionX, layerRectPositionY, layerRectWidth+ offset.x, (layerRectHeight + spaceBetweenLayers) * (PIASession.Instance.ImageData.Layers.Count + 1) + offset.y*2);
        Rect sliderRect = new Rect(layerRectPositionX, layerRectPositionY, layerRectWidth+offset.x, leftSide.GetRect().height - verticalParent.height - offset.y);

        // caching and changing default gui skins for scroll view 
        GUIStyle nativeVerticalScrollbarThumb = GUI.skin.verticalScrollbarThumb;
        GUI.skin.verticalScrollbarThumb.normal.background = PIATextureDatabase.Instance.GetTexture("empty");
        GUIStyle nativeVerticalScrollbarDownButton = GUI.skin.verticalScrollbarDownButton;
        GUI.skin.verticalScrollbarDownButton.normal.background = PIATextureDatabase.Instance.GetTexture("empty");
        GUIStyle nativeVerticalScrollbarUpButton = GUI.skin.verticalScrollbarUpButton;
        GUI.skin.verticalScrollbarUpButton.normal.background = PIATextureDatabase.Instance.GetTexture("empty");

        // DRAWING LAYERS 
        layersSlider = GUI.BeginScrollView(sliderRect, layersSlider, viewRect, false, false, skin.GetStyle("horizontalscrollbar"), skin.GetStyle("verticalscrollbar"));
        {
            for (int i = 0; i < PIASession.Instance.ImageData.Layers.Count; i++)
            {
                var item = PIASession.Instance.ImageData.Layers[i];
                Rect layerRect = new Rect(layerRectPositionX, layerRectPositionY, layerRectWidth, layerRectHeight);

                GUI.DrawTexture(layerRect, blackBarBG);
                GUILayout.BeginArea(layerRect);
                {
                    GUILayout.FlexibleSpace();

                    GUILayout.BeginHorizontal();
                    {
                        // LABEL
                        GUILayout.BeginVertical();
                        {
                            GUILayout.FlexibleSpace();

                            GUILayout.BeginHorizontal();
                            {
                                GUILayout.Space(15);
                                GUILayout.Label(item.Name, skin.GetStyle("editorbutton2"));
                                GUILayout.FlexibleSpace();

                            }
                            GUILayout.EndHorizontal();
                            GUILayout.FlexibleSpace();
                        }
                        GUILayout.EndVertical();

                        // EYE & DELETE & TOOLTIP
                        GUILayout.BeginVertical();
                        {
                            GUILayout.FlexibleSpace();

                            GUILayout.BeginHorizontal();
                            {
                                item.Hidden = GUILayout.Toggle(item.Hidden, GUIContent.none, skin.GetStyle("layereye"), GUILayout.MaxWidth(30), GUILayout.MaxHeight(30));
                                Rect layerEyeGlobalRect = PIATooltipUtility.ChildToGlobalRect(GUILayoutUtility.GetLastRect(), layerRect, new Rect(-5, 40, 1, 1));
                                Rect layerEyeTooltipRect = new Rect(0, 0, 150, 22.5f);
                                PIATooltip layerEyeTooltip = new PIATooltip(layerEyeTooltipRect, "Show layer On / Off");
                                PIATooltip.SetPositionPreset(ref layerEyeTooltip, layerEyeGlobalRect, PIATooltip.PIATooltipPreset.Down);
                                PIATooltipUtility.AddTooltip(layerEyeGlobalRect, layerEyeTooltip);
                                GUILayout.Space(5);
                                if (i != 0)
                                {
                                    if (GUILayout.Button(GUIContent.none, skin.GetStyle("deletelayer"), GUILayout.MaxWidth(30), GUILayout.MaxHeight(30)))
                                    {
                                        PIASession.Instance.ImageData.RemoveLayer(i);
                                        return;
                                    }
                                    Rect deleteLayerGlobalRect = PIATooltipUtility.ChildToGlobalRect(GUILayoutUtility.GetLastRect(), layerRect, new Rect(-5, 40, 1, 1));
                                    Rect deleteLayerTooltipRect = new Rect(0, 0, 50, 22.5f);
                                    PIATooltip deleteLayerTooltip = new PIATooltip(deleteLayerTooltipRect, "Delete");
                                    PIATooltip.SetPositionPreset(ref deleteLayerTooltip, deleteLayerGlobalRect, PIATooltip.PIATooltipPreset.Down);
                                    PIATooltipUtility.AddTooltip(deleteLayerGlobalRect, deleteLayerTooltip);


                                }
                                GUILayout.Space(5);
                            }
                            GUILayout.EndHorizontal();
                            GUILayout.FlexibleSpace();


                        }
                        GUILayout.EndVertical();

                    }
                    GUILayout.EndHorizontal();

                    GUILayout.FlexibleSpace();


                }
                GUILayout.EndArea();

                // LAYER SELECTION BUTTON
                if (GUI.Button(layerRect, GUIContent.none, skin.GetStyle("bglayerbutton")))
                {
                    PIASession.Instance.ImageData.CurrentLayer = i;
                }
                layerRectPositionY += layerRectHeight + spaceBetweenLayers;

                // SELECTED LAYER OVERLAY
                if (i == PIASession.Instance.ImageData.CurrentLayer)
                {
                    GUI.Label(layerRect, GUIContent.none, skin.GetStyle("selectedlayeroverlay"));
                }

                PIASession.Instance.ImageData.Layers[i] = item;
            }

            // ADD LAYER 
            Rect addLayerRect = new Rect(layerRectPositionX, layerRectPositionY, layerRectWidth, layerRectHeight);
            GUI.DrawTexture(addLayerRect, blackBarBG);
            GUILayout.BeginArea(addLayerRect);
            {
                GUILayout.FlexibleSpace();

                GUILayout.BeginHorizontal();
                {
                    // ICON
                    GUILayout.BeginVertical();
                    {
                        GUILayout.FlexibleSpace();

                        GUILayout.BeginHorizontal();
                        {
                            GUILayout.Space(15);
                            GUILayout.Label("", skin.GetStyle("addlayerlabelicon"), GUILayout.MaxWidth(30), GUILayout.MaxHeight(30));
                        }
                        GUILayout.EndHorizontal();
                        GUILayout.FlexibleSpace();


                    }
                    GUILayout.EndVertical();

                    // LABEL
                    GUILayout.BeginVertical();
                    {
                        GUILayout.FlexibleSpace();

                        GUILayout.BeginHorizontal();
                        {
                            GUILayout.Space(15);
                            GUILayout.Label("Add layer", skin.GetStyle("editorbutton2"));
                            GUILayout.FlexibleSpace();

                        }
                        GUILayout.EndHorizontal();
                        GUILayout.FlexibleSpace();

                    }
                    GUILayout.EndVertical();

                }
                GUILayout.EndHorizontal();

                GUILayout.FlexibleSpace();

            }
            GUILayout.EndArea();

            // ADD LAYER BUTTON
            if (GUI.Button(addLayerRect, "", skin.GetStyle("bglayerbutton")))
            {
                PIASession.Instance.ImageData.AddLayer();
            }
        }
        GUI.EndScrollView();

        // resetting scroll view gui skin
        GUI.skin.verticalScrollbarThumb = nativeVerticalScrollbarThumb;
        GUI.skin.verticalScrollbarDownButton = nativeVerticalScrollbarDownButton;
        GUI.skin.verticalScrollbarUpButton = nativeVerticalScrollbarUpButton;
    }

19 View Source File : PIAExportSettingsWindow.cs
License : MIT License
Project Creator : liangxiegame

private void OnGUI()
    {
        GUILayout.BeginHorizontal();
        {
            if (GUILayout.Button("Export This Frame"))
            {
                PIASession.Instance.ExportImage(PIASession.Instance.ImageData.CurrentFrame.GetFrameTexture());
            }
            if (GUILayout.Button("Export All Frames"))
            {
                PIASession.Instance.ExportAll();
            }
            if (GUILayout.Button("Export Sprite Sheet"))
            {
                PIASession.Instance.ExportSpriteSheet();
            }
        }
        GUILayout.EndHorizontal();
        
    }

19 View Source File : HorizontalLayout.cs
License : MIT License
Project Creator : liangxiegame

public override void OnGUI()
        {
            if (!enabled)
            {
                return;
            }

            if (mText.IsNotNullAndEmpty())
            {
                GUILayout.BeginHorizontal(mText);
            }
            else
            {
                GUILayout.BeginHorizontal();
            }
            base.OnGUI();
            GUILayout.EndHorizontal();
        }

19 View Source File : GUIHorizontalView.cs
License : MIT License
Project Creator : liangxiegame

public override void OnGUI()
        {
            if (Visible) GUILayout.BeginHorizontal();
            base.OnGUI();
            if (Visible) GUILayout.EndHorizontal();
        }

19 View Source File : FrameworkPMView.cs
License : MIT License
Project Creator : liangxiegame

public void OnGUI()
        {
            GUILayout.Label("Framework:");
            GUILayout.BeginVertical("box");

            GUILayout.BeginHorizontal();
            GUILayout.Label(string.Format("QFramework:{0}",
                mPackageDatas.Find(packageData => packageData.Name == "Framework").Version), GUILayout.Width(150));

            VersionCheck = GUILayout.Toggle(VersionCheck, "Version Check");

            GUILayout.EndHorizontal();

            mToolbarIndex = GUILayout.Toolbar(mToolbarIndex, ToolbarNames);

            // 这里开始具体的内容
            GUILayout.BeginHorizontal("box");
            GUILayout.Label("Package", GUILayout.Width(150));
            GUILayout.Label("Server", GUILayout.Width(80));
            GUILayout.Label("Local", GUILayout.Width(80));
            GUILayout.Label("Access Right", GUILayout.Width(80));
            GUILayout.Label("Doc", new GUIStyle {alignment = TextAnchor.MiddleCenter, fixedWidth = 40f});
            GUILayout.Label("Action", new GUIStyle {alignment = TextAnchor.MiddleCenter, fixedWidth = 100f});
            GUILayout.Label("Release Note", new GUIStyle {alignment = TextAnchor.MiddleCenter, fixedWidth = 100f});
            GUILayout.EndHorizontal();

            GUILayout.BeginVertical("box");

            mScrollPos = GUILayout.BeginScrollView(mScrollPos, false, true, GUILayout.Height(240));

            foreach (var packageData in SelectedPackageType)
            {
                GUILayout.Space(2);
                GUILayout.BeginHorizontal();
                GUILayout.Label(packageData.Name, GUILayout.Width(150));
                GUILayout.Label(packageData.Version, GUILayout.Width(80));
                var installedPackage = InstalledPackageVersions.FindVersionByName(packageData.Name);
                GUILayout.Label(installedPackage != null ? installedPackage.Version : " ", GUILayout.Width(80));
                GUILayout.Label(packageData.AccessRight.ToString(), GUILayout.Width(80));

                if (GUILayout.Button("Doc", GUILayout.Width(40)))
                {                    
                    DocsWindow.Init(packageData.InstallPath);
                }
                
                if (installedPackage == null)
                {
                    if (GUILayout.Button("Import", GUILayout.Width(90)))
                    {
                        EditorActionKit.ExecuteNode(new InstallPackage(packageData));

                        mMainWindow.Close();
                        mMainWindow = null;
                    }
                }
                else if (installedPackage != null && packageData.VersionNumber > installedPackage.VersionNumber)
                {
                    if (GUILayout.Button("Update", GUILayout.Width(90)))
                    {
                        var path = Application.dataPath.Replace("replacedets", packageData.InstallPath);

                        if (Directory.Exists(path))
                        {
                            Directory.Delete(path, true);
                        }

                        EditorActionKit.ExecuteNode(new InstallPackage(packageData));

                        mMainWindow.Close();
                        mMainWindow = null;
                    }
                }
                else if (installedPackage.IsNotNull() && packageData.VersionNumber == installedPackage.VersionNumber)
                {
                    if (GUILayout.Button("Reimport", GUILayout.Width(90)))
                    {
                        var path = Application.dataPath.Replace("replacedets", packageData.InstallPath);

                        if (Directory.Exists(path))
                        {
                            Directory.Delete(path, true);
                        }
                        
                        EditorActionKit.ExecuteNode(new InstallPackage(packageData));

                        mMainWindow.Close();
                        mMainWindow = null;
                    }
                }
                else if (installedPackage != null)
                {
                    // maybe support upload? 
                    GUILayout.Space(94);
                }

                if (GUILayout.Button("Release Notes", GUILayout.Width(100)))
                {
                    ReadmeWindow.Init(packageData.readme, packageData.PackageVersions.First());
                }

                GUILayout.EndHorizontal();
            }

            GUILayout.EndScrollView();

            GUILayout.Space(2);

            GUILayout.EndVertical();

            GUILayout.EndVertical();


            GUILayout.Space(50);
        }

19 View Source File : ReadmeWindow.cs
License : MIT License
Project Creator : liangxiegame

public void OnGUI()
        {
            mScrollPos = GUILayout.BeginScrollView(mScrollPos, true, true, GUILayout.Width(580), GUILayout.Height(300));

            GUILayout.Label("类型:" + mPackageVersion.Type);
            
            mReadme.items.ForEach(item =>
            {
                GUILayout.BeginHorizontal(EditorStyles.helpBox);
                GUILayout.BeginVertical();
                GUILayout.BeginHorizontal();

                GUILayout.Label("version: " + item.version, GUILayout.Width(130));
                GUILayout.Label("author: " + item.author);
                GUILayout.Label("date: " + item.date);

                GUILayout.EndHorizontal();
                GUILayout.Label(item.content);
                GUILayout.EndVertical();

                GUILayout.EndHorizontal();
            });

            GUILayout.EndScrollView();
        }

19 View Source File : PixelKit.cs
License : MIT License
Project Creator : liangxiegame

void GUIUndoRedo()
		{
			GUILayout.BeginHorizontal();
			GUILayout.BeginVertical(GUILayout.Width(leftOffsetX-4));
			GUILayout.Space(0); // dummy
			GUILayout.EndVertical();

			if (GUILayout.Button(new GUIContent("<U", "Undo"),GUILayout.Width(32)))
			{
				//Undo.PerformUndo(); // TODO: fixme some error due to this?
			}

			if (GUILayout.Button(new GUIContent("R>", "Redo"),GUILayout.Width(32)))
			{
				//Undo.PerformRedo();
			}
			GUILayout.EndHorizontal();
		}

19 View Source File : PixelKit.cs
License : MIT License
Project Creator : liangxiegame

void GUICurrentColors()
		{
			GUILayout.Space(topOffsetY+imageSize*pixelSizeAdjust+14);
			GUILayout.BeginHorizontal();
			paintColor1 = EditorGUI.ColorField(new Rect(400,topOffsetY+imageSize*pixelSizeAdjust+10,60,24),paintColor1);
			paintColor2 = EditorGUI.ColorField(new Rect(406+62,topOffsetY+imageSize*pixelSizeAdjust+10,60,24),paintColor2);
			GUILayout.EndHorizontal();
		}

19 View Source File : PixelKit.cs
License : MIT License
Project Creator : liangxiegame

void GUIMirrorToggles()
		{
			GUILayout.BeginHorizontal();
			mirrorX = GUILayout.Toggle(mirrorX, "MirrorX");
			mirrorXFix = GUILayout.Toggle(mirrorXFix, "FixX");
			mirrorXOffset = mirrorXFix?0:1;
			GUILayout.EndHorizontal();

			mirrorY = GUILayout.Toggle(mirrorY, "MirrorY");
		}

19 View Source File : PixelKit.cs
License : MIT License
Project Creator : liangxiegame

void GUIMovePanTools()
		{
			// TODO: move/pan/rot/flip
			GUILayout.BeginHorizontal();
			/*

			GUILayout.BeginVertical(GUILayout.Width(leftOffsetX-4));
			GUILayout.Space(0); // dummy
			GUILayout.EndVertical();*/

			if (GUILayout.Button(new GUIContent("<", ""),GUILayout.ExpandWidth(false)))	panImage(-1,0);
			if (GUILayout.Button(new GUIContent(">", ""),GUILayout.ExpandWidth(false)))	panImage(1,0);
			if (GUILayout.Button(new GUIContent("/\\", ""),GUILayout.ExpandWidth(false))) panImage(0,1);
			if (GUILayout.Button(new GUIContent("\\/", ""),GUILayout.ExpandWidth(false))) panImage(0,-1);


			//GUILayout.Space(8);
			GUILayout.EndHorizontal();
		}

19 View Source File : PIAEditorWindow.cs
License : MIT License
Project Creator : liangxiegame

private void DrawProjectName(Rect parent)
    {
        float projectNameRectHeight = 40;
        Rect projectNameRect = new Rect(0, parent.height - projectNameRectHeight, parent.width, projectNameRectHeight);

        // DRAWING BACKGROUND
        GUI.DrawTexture(projectNameRect, blackBarBG);

        // DRAWING PROJECT NAME LABEL
        GUILayout.BeginArea(projectNameRect);
        {
            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal();
            {
                GUILayout.FlexibleSpace();
                GUILayout.Label(PIASession.Instance.ProjectName, skin.GetStyle("projectname"));
                GUILayout.FlexibleSpace();


            }
            GUILayout.EndHorizontal();
            GUILayout.FlexibleSpace();

        }
        GUILayout.EndArea();
        

    }

19 View Source File : PIAEditorWindow.cs
License : MIT License
Project Creator : liangxiegame

private void DrawGridInfo(Rect parent)
    {
        PIAImageData imageData = PIASession.Instance.ImageData;

        //GRID INFO RECT
        float gridInfoRectHeight = 40;
        Rect gridInfoRect = new Rect(0, parent.height - gridInfoRectHeight, parent.width, gridInfoRectHeight);

        //DRAWING STUFF
      
        GUI.DrawTexture(gridInfoRect, blackBarBG);

        GUILayout.BeginArea(gridInfoRect);
        {
            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal();
            {
                GUILayout.FlexibleSpace();
                GUILayout.BeginVertical();
                {
                    GUILayout.Label("[" + imageData.Width + "x" + imageData.Height + "]", skin.GetStyle("editorbutton2"));
                    GUILayout.Label(mouseCellCoordinate.ToString(), skin.GetStyle("editorbutton2"));
                }
                GUILayout.EndVertical();
                GUILayout.FlexibleSpace();


            }
            GUILayout.EndHorizontal();
            GUILayout.FlexibleSpace();

        }
        GUILayout.EndArea();


    }

19 View Source File : AstarUpdateWindow.cs
License : MIT License
Project Creator : m969

void OnGUI () {
			if (largeStyle == null) {
				largeStyle = new GUIStyle(EditorStyles.largeLabel);
				largeStyle.fontSize = 32;
				largeStyle.alignment = TextAnchor.UpperCenter;
				largeStyle.richText = true;

				normalStyle = new GUIStyle(EditorStyles.label);
				normalStyle.wordWrap = true;
				normalStyle.richText = true;
			}

			if (version == null) {
				return;
			}

			GUILayout.Label("New Update Available!", largeStyle);
			GUILayout.Label("There is a new version of the <b>A* Pathfinding Project</b> available for download.\n" +
				"The new version is <b>" + version + "</b> you have <b>" + AstarPath.Version + "</b>\n\n"+
				"<i>Summary:</i>\n"+summary, normalStyle
				);

			GUILayout.FlexibleSpace();

			GUILayout.BeginHorizontal();
			GUILayout.FlexibleSpace();

			GUILayout.BeginVertical();

			Color col = GUI.color;
			GUI.backgroundColor *= new Color(0.5f,  1f, 0.5f);
			if (GUILayout.Button("Take me to the download page!", GUILayout.Height(30), GUILayout.MaxWidth(300))) {
				Application.OpenURL(AstarUpdateChecker.GetURL("download"));
			}
			GUI.backgroundColor = col;


			if (GUILayout.Button("What's new? (full changelog)")) {
				Application.OpenURL(AstarUpdateChecker.GetURL("changelog"));
			}

			GUILayout.EndVertical();

			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();

			GUILayout.FlexibleSpace();

			GUILayout.BeginHorizontal();

			if (GUILayout.Button("Skip this version", GUILayout.MaxWidth(100))) {
				EditorPrefs.SetString("AstarSkipUpToVersion", version.ToString());
				setReminder = true;
				Close();
			}

			if (GUILayout.Button("Remind me later ( 1 week )", GUILayout.MaxWidth(200))) {
				EditorPrefs.SetString("AstarRemindUpdateDate", DateTime.UtcNow.AddDays(7).ToString(System.Globalization.CultureInfo.InvariantCulture));
				EditorPrefs.SetString("AstarRemindUpdateVersion", version.ToString());
				setReminder = true;
				Close();
			}

			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
		}

19 View Source File : DOTweenAnimationInspector.cs
License : MIT License
Project Creator : m969

void GUIEndValueV3(GameObject targetGO, bool optionalTransform = false)
        {
            GUILayout.BeginHorizontal();
            GUIToFromButton();
            if (_src.useTargetAsV3) {
                Transform prevT = _src.endValueTransform;
                _src.endValueTransform = EditorGUILayout.ObjectField(_src.endValueTransform, typeof(Transform), true) as Transform;
                if (_src.endValueTransform != prevT && _src.endValueTransform != null) {
#if true // UI_MARKER
                    // Check that it's a Transform for a Transform or a RectTransform for a RectTransform
                    if (targetGO.GetComponent<RectTransform>() != null) {
                        if (_src.endValueTransform.GetComponent<RectTransform>() == null) {
                            EditorUtility.DisplayDialog("DOTween Pro", "For Unity UI elements, the target must also be a UI element", "Ok");
                            _src.endValueTransform = null;
                        }
                    } else if (_src.endValueTransform.GetComponent<RectTransform>() != null) {
                        EditorUtility.DisplayDialog("DOTween Pro", "You can't use a UI target for a non UI object", "Ok");
                        _src.endValueTransform = null;
                    }
#endif
                }
            } else {
                _src.endValueV3 = EditorGUILayout.Vector3Field("", _src.endValueV3, GUILayout.Height(16));
            }
            if (optionalTransform) {
                if (GUILayout.Button(_src.useTargetAsV3 ? "target" : "value", EditorGUIUtils.sideBtStyle, GUILayout.Width(44))) _src.useTargetAsV3 = !_src.useTargetAsV3;
            }
            GUILayout.EndHorizontal();
#if true // UI_MARKER
            if (_src.useTargetAsV3 && _src.endValueTransform != null && _src.target is RectTransform) {
                EditorGUILayout.HelpBox("NOTE: when using a UI target, the tween will be created during Start instead of Awake", MessageType.Info);
            }
#endif
        }

19 View Source File : DOTweenPreviewManager.cs
License : MIT License
Project Creator : m969

public static bool PreviewGUI(DOTweenAnimation src)
        {
            if (EditorApplication.isPlaying) return false;

            Styles.Init();

            bool isPreviewing = _AnimationToTween.Count > 0;
            bool isPreviewingThis = isPreviewing && _AnimationToTween.ContainsKey(src);

            // Preview in editor
            GUI.backgroundColor = isPreviewing
                ? new DeSkinColor(new Color(0.49f, 0.8f, 0.86f), new Color(0.15f, 0.26f, 0.35f))
                : new DeSkinColor(Color.white, new Color(0.13f, 0.13f, 0.13f));
            GUILayout.BeginVertical(Styles.previewBox);
            DeGUI.ResetGUIColors();
            GUILayout.BeginHorizontal();
            GUILayout.Label("Preview Mode - Experimental", Styles.previewLabel);
            _previewOnlyIfSetToAutoPlay = DeGUILayout.ToggleButton(
                _previewOnlyIfSetToAutoPlay,
                new GUIContent("AutoPlay only", "If toggled only previews animations that have AutoPlay turned ON"),
                Styles.btOption
            );
            GUILayout.EndHorizontal();
            GUILayout.Space(1);
            // Preview - Play
            GUILayout.BeginHorizontal();
            EditorGUI.BeginDisabledGroup(
                isPreviewingThis || src.animationType == DOTweenAnimation.AnimationType.None
                || !src.isActive || _previewOnlyIfSetToAutoPlay && !src.autoPlay
            );
            if (GUILayout.Button("► Play", Styles.btPreview)) {
                if (!isPreviewing) StartupGlobalPreview();
                AddAnimationToGlobalPreview(src);
            }
            EditorGUI.EndDisabledGroup();
            EditorGUI.BeginDisabledGroup(isPreviewing);
            if (GUILayout.Button("► Play All <i>on GameObject</i>", Styles.btPreview)) {
                if (!isPreviewing) StartupGlobalPreview();
                DOTweenAnimation[] anims = src.gameObject.GetComponents<DOTweenAnimation>();
                foreach (DOTweenAnimation anim in anims) AddAnimationToGlobalPreview(anim);
            }
            if (GUILayout.Button("► Play All <i>in Scene</i>", Styles.btPreview)) {
                if (!isPreviewing) StartupGlobalPreview();
                DOTweenAnimation[] anims = Object.FindObjectsOfType<DOTweenAnimation>();
                foreach (DOTweenAnimation anim in anims) AddAnimationToGlobalPreview(anim);
            }
            EditorGUI.EndDisabledGroup();
            GUILayout.EndHorizontal();
            // Preview - Stop
            GUILayout.BeginHorizontal();
            EditorGUI.BeginDisabledGroup(!isPreviewingThis);
            if (GUILayout.Button("■ Stop", Styles.btPreview)) {
                if (_AnimationToTween.ContainsKey(src)) StopPreview(_AnimationToTween[src].tween);
            }
            EditorGUI.EndDisabledGroup();
            EditorGUI.BeginDisabledGroup(!isPreviewing);
            if (GUILayout.Button("■ Stop All <i>on GameObject</i>", Styles.btPreview)) {
                StopPreview(src.gameObject);
            }
            if (GUILayout.Button("■ Stop All <i>in Scene</i>", Styles.btPreview)) {
                StopAllPreviews();
            }
            EditorGUI.EndDisabledGroup();
            GUILayout.EndHorizontal();
            if (isPreviewing) {
                int playingTweens = 0;
                int completedTweens = 0;
                int pausedTweens = 0;
                foreach (KeyValuePair<DOTweenAnimation, TweenInfo> kvp in _AnimationToTween) {
                    Tween t = kvp.Value.tween;
                    if (t.IsPlaying()) playingTweens++;
                    else if (t.IsComplete()) completedTweens++;
                    else pausedTweens++;
                }
                GUILayout.Label("Playing Tweens: " + playingTweens, Styles.previewStatusLabel);
                GUILayout.Label("Completed Tweens: " + completedTweens, Styles.previewStatusLabel);
//                GUILayout.Label("Paused Tweens: " + playingTweens);
            }
            GUILayout.EndVertical();

            return isPreviewing;
        }

19 View Source File : ServerCommandLineEditor.cs
License : MIT License
Project Creator : m969

public bool OnGUI()
		{
            StartConfig startConfig = this.GetParent<StartConfig>();
			GUILayout.BeginHorizontal(GUILayout.Height(16));

			if (this.level > 0)
			{
				string s = "";
				for (int i = 1; i < this.level; ++i)
				{
					s += $"    ";
				}
				GUILayout.Label(s, GUILayout.Width(20 * this.level));
			}
			
			{
				GUILayout.BeginHorizontal(GUILayout.Width(240), GUILayout.Height(16));
				this.isFold = EditorGUILayout.Foldout(isFold, $"子配置数量:{startConfig.List.Count}");
				
				if (GUILayout.Button("添加子配置", GUILayout.Height(16), GUILayout.Width(75)))
				{
					StartConfig s = new StartConfig();
					startConfig.Add(s);
					s.AddComponentNoPool<StartConfigDrawer, int>(this.level + 1);
					
					for (int i = 0; i < startConfig.List.Count; ++i)
					{
						startConfig.List[i].Id = i + 1;
					}

					this.isFold = true;
					return false;
				}
				if (GUILayout.Button("上", GUILayout.Height(16), GUILayout.Width(30)))
				{
					StartConfig parentStartConfig = startConfig.GetParent<StartConfig>();
					int index = parentStartConfig.List.IndexOf(startConfig);
					if (index == 0)
					{
						return true;
					}

					parentStartConfig.List.Remove(startConfig);
					parentStartConfig.List.Insert(index - 1, startConfig);
					for (int i = 0; i < parentStartConfig.List.Count; ++i)
					{
						parentStartConfig.List[i].Id = i + 1;
					}

					return false;
				}
				if (GUILayout.Button("下", GUILayout.Height(16), GUILayout.Width(30)))
				{
					StartConfig parentStartConfig = startConfig.GetParent<StartConfig>();
					int index = parentStartConfig.List.IndexOf(startConfig);
					if (index == parentStartConfig.List.Count - 1)
					{
						return true;
					}
					parentStartConfig.List.Remove(startConfig);
					parentStartConfig.List.Insert(index + 1, startConfig);
					for (int i = 0; i < parentStartConfig.List.Count; ++i)
					{
						parentStartConfig.List[i].Id = i + 1;
					}
					return false;
				}
				GUILayout.EndHorizontal();
			}

			{
				GUILayout.BeginHorizontal(GUILayout.Width(50));
				GUILayout.Label($"Id: ");
				startConfig.Id = EditorGUILayout.LongField(startConfig.Id, GUILayout.Width(30));
				GUILayout.EndHorizontal();
			}
			
			{
				GUILayout.BeginHorizontal(GUILayout.Width(200));
				ProcessConfig processConfig = startConfig.GetComponent<ProcessConfig>();
				if (processConfig != null)
				{
					GUILayout.Label($"  ProcessConfig(", this.style);
					GUILayout.Label($"服务器IP: ");
					processConfig.ServerIP = EditorGUILayout.TextField(processConfig.ServerIP, GUILayout.Width(100));
					GUILayout.Label($"),", this.style);
				}
				GUILayout.EndHorizontal();
			}
			
			{
				GUILayout.BeginHorizontal(GUILayout.Width(200));
				SceneConfig sceneConfig = startConfig.GetComponent<SceneConfig>();
				if (sceneConfig != null)
				{
					GUILayout.Label($"  SceneConfig(", this.style);
					GUILayout.Label($"SceneType: ");
					sceneConfig.SceneType = (SceneType)EditorGUILayout.EnumPopup(sceneConfig.SceneType, GUILayout.Width(100));
					GUILayout.Label($"Name: ");
					sceneConfig.Name = EditorGUILayout.TextField(sceneConfig.Name, GUILayout.Width(100));
					GUILayout.Label($"),", this.style);
				}
				GUILayout.EndHorizontal();
			}
			
			{
				GUILayout.BeginHorizontal(GUILayout.Width(150));
				InnerConfig innerConfig = startConfig.GetComponent<InnerConfig>();
				if (innerConfig != null)
				{
					GUILayout.Label($"  InnerConfig(", this.style);
					GUILayout.Label($"内网地址:");
					innerConfig.Address = EditorGUILayout.TextField(innerConfig.Address, GUILayout.Width(120));
					GUILayout.Label($"),", this.style);
				}

				GUILayout.EndHorizontal();
			}
			{
				GUILayout.BeginHorizontal(GUILayout.Width(350));
				OuterConfig outerConfig = startConfig.GetComponent<OuterConfig>();
				if (outerConfig != null)
				{
					GUILayout.Label($"  OuterConfig(", this.style);
					GUILayout.Label($"外网地址:");
					outerConfig.Address = EditorGUILayout.TextField(outerConfig.Address, GUILayout.Width(120));
					GUILayout.Label($"外网地址2:");
					outerConfig.Address2 = EditorGUILayout.TextField(outerConfig.Address2, GUILayout.Width(120));
					GUILayout.Label($"),", this.style);
				}

				GUILayout.EndHorizontal();
			}
			
			{
            	GUILayout.BeginHorizontal(GUILayout.Width(50));
                CopyConfig copyConfig = startConfig.GetComponent<CopyConfig>();
            	if (copyConfig != null)
            	{
            		GUILayout.Label($"  CopyConfig(", this.style);
            		GUILayout.Label($"),", this.style);
            	}
            
            	GUILayout.EndHorizontal();
            }
			
			{
				GUILayout.BeginHorizontal(GUILayout.Width(50));
				MapConfig mapConfig = startConfig.GetComponent<MapConfig>();
				if (mapConfig != null)
				{
					GUILayout.Label($"  MapConfig(", this.style);
					GUILayout.Label($"MapType: ");
					mapConfig.MapType = (MapType)EditorGUILayout.EnumPopup(mapConfig.MapType, GUILayout.Width(100));
					GUILayout.Label($"),", this.style);
				}
            
				GUILayout.EndHorizontal();
			}
			
			{
				GUILayout.BeginHorizontal(GUILayout.Width(350));
				ClientConfig clientConfig = startConfig.GetComponent<ClientConfig>();
				if (clientConfig != null)
				{
					GUILayout.Label($"  ClientConfig(", this.style);
					GUILayout.Label($"连接地址:");
					clientConfig.Address = EditorGUILayout.TextField(clientConfig.Address, GUILayout.Width(120));
					GUILayout.Label($"),", this.style);
				}

				DBConfig dbConfig = startConfig.GetComponent<DBConfig>();
				if (dbConfig != null)
				{
					GUILayout.Label($"  DBConfig(", this.style);
					GUILayout.Label($"连接串:");
					dbConfig.ConnectionString = EditorGUILayout.TextField(dbConfig.ConnectionString);

					GUILayout.Label($"DBName:");
					dbConfig.DBName = EditorGUILayout.TextField(dbConfig.DBName);
					GUILayout.Label($"),", this.style);
				}
				GUILayout.EndHorizontal();
			}

			{
				GUILayout.BeginHorizontal(GUILayout.Width(200), GUILayout.Height(16));
				this.st = (StartConfigComponentType) EditorGUILayout.EnumPopup(this.st, GUILayout.Width(100));
                
				if (GUILayout.Button("添加组件", GUILayout.Height(16)))
				{
					replacedembly replacedembly = replacedembly.Getreplacedembly(typeof(Init));
					Type type = replacedembly.GetType($"ETModel.{this.st.ToString()}");
					startConfig.AddComponent(type);
				}
				
				if (GUILayout.Button("删除组件", GUILayout.Height(16)))
				{
					replacedembly replacedembly = replacedembly.Getreplacedembly(typeof(Init));
					Type type = replacedembly.GetType($"ETModel.{this.st.ToString()}");
					startConfig.RemoveComponent(type);
				}
				
				if (GUILayout.Button("删除该行配置", GUILayout.Height(16)))
				{
					startConfig.GetParent<StartConfig>().Remove(startConfig);
					return false;
				}
				
				GUILayout.EndHorizontal();
			}

			GUILayout.EndHorizontal();
			
			if (this.isFold)
			{
				foreach (StartConfig child in startConfig.List)
				{
					if (child.GetComponent<StartConfigDrawer>()?.OnGUI() == false)
					{
						return false;
					}
				}
			}

			return true;
		}

19 View Source File : ServerManagerEditor.cs
License : MIT License
Project Creator : m969

private void OnGUI()
		{
			GUILayout.BeginHorizontal();
			
			GUILayout.Label("Manager外网地址:");
			managerAddress = EditorGUILayout.TextField(this.managerAddress);
			managerAddress = "127.0.0.1:10001";
			GUILayout.Label("帐号:");
			this.account = GUILayout.TextField(this.account);
			account = "panda";
			GUILayout.Label("密码:");
			this.preplacedword = GUILayout.TextField(this.preplacedword);
			preplacedword = "panda";

			if (GUILayout.Button("Reload"))
			{
				if (!Application.isPlaying)
				{
					Log.Error($"Reload必须先启动客户端!");
					return;
				}

				ReloadAsync(this.managerAddress, this.account, this.preplacedword).Coroutine();
			}
			
			GUILayout.EndHorizontal();
		}

19 View Source File : GraphEditor.cs
License : MIT License
Project Creator : m969

public static bool FixLabel (string label, string buttonLabel = "Fix", int buttonWidth = 40) {
			GUILayout.BeginHorizontal();
			GUILayout.Space(14*EditorGUI.indentLevel);
			GUILayout.BeginHorizontal(AstarPathEditor.helpBox);
			GUILayout.Label(label, EditorGUIUtility.isProSkin ? EditorStyles.whiteMiniLabel : EditorStyles.miniLabel, GUILayout.ExpandWidth(true));
			var returnValue = GUILayout.Button(buttonLabel, EditorStyles.miniButton, GUILayout.Width(buttonWidth));
			GUILayout.EndHorizontal();
			GUILayout.EndHorizontal();
			return returnValue;
		}

19 View Source File : GraphEditor.cs
License : MIT License
Project Creator : m969

public static bool ToggleGroup (GUIContent label, bool value) {
			GUILayout.BeginHorizontal();
			GUILayout.Space(13*EditorGUI.indentLevel);
			value = GUILayout.Toggle(value, "", GUILayout.Width(10));
			GUIStyle boxHeader = AstarPathEditor.astarSkin.FindStyle("CollisionHeader");
			if (GUILayout.Button(label, boxHeader, GUILayout.Width(100))) {
				value = !value;
			}

			GUILayout.EndHorizontal();
			return value;
		}

19 View Source File : DOTweenAnimationInspector.cs
License : MIT License
Project Creator : m969

override public void OnInspectorGUI()
        {
        	base.OnInspectorGUI();

            GUILayout.Space(3);
            EditorGUIUtils.SetGUIStyles();

            bool playMode = Application.isPlaying;
            _runtimeEditMode = _runtimeEditMode && playMode;

            GUILayout.BeginHorizontal();
            EditorGUIUtils.InspectorLogo();
            GUILayout.Label(_src.animationType.ToString() + (string.IsNullOrEmpty(_src.id) ? "" : " [" + _src.id + "]"), EditorGUIUtils.sideLogoIconBoldLabelStyle);
            // Up-down buttons
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("▲", DeGUI.styles.button.toolIco)) UnityEditorInternal.ComponentUtility.MoveComponentUp(_src);
            if (GUILayout.Button("▼", DeGUI.styles.button.toolIco)) UnityEditorInternal.ComponentUtility.MoveComponentDown(_src);
            GUILayout.EndHorizontal();

            if (playMode) {
                if (_runtimeEditMode) {
                    
                } else {
                    GUILayout.Space(8);
                    GUILayout.Label("Animation Editor disabled while in play mode", EditorGUIUtils.wordWrapLabelStyle);
                    if (!_src.isActive) {
                        GUILayout.Label("This animation has been toggled as inactive and won't be generated", EditorGUIUtils.wordWrapLabelStyle);
                        GUI.enabled = false;
                    }
                    if (GUILayout.Button(new GUIContent("Activate Edit Mode", "Switches to Runtime Edit Mode, where you can change animations values and restart them"))) {
                        _runtimeEditMode = true;
                    }
                    GUILayout.Label("NOTE: when using DOPlayNext, the sequence is determined by the DOTweenAnimation Components order in the target GameObject's Inspector", EditorGUIUtils.wordWrapLabelStyle);
                    GUILayout.Space(10);
                    if (!_runtimeEditMode) return;
                }
            }

            Undo.RecordObject(_src, "DOTween Animation");
            Undo.RecordObject(_settings, "DOTween Animation");

//            _src.isValid = Validate(); // Moved down

            EditorGUIUtility.labelWidth = 110;

            if (playMode) {
                GUILayout.Space(4);
                DeGUILayout.Toolbar("Edit Mode Commands");
                DeGUILayout.BeginVBox(DeGUI.styles.box.stickyTop);
                    GUILayout.BeginHorizontal();
                    if (GUILayout.Button("TogglePause")) _src.tween.TogglePause();
                    if (GUILayout.Button("Rewind")) _src.tween.Rewind();
                    if (GUILayout.Button("Restart")) _src.tween.Restart();
                    GUILayout.EndHorizontal();
                    if (GUILayout.Button("Commit changes and restart")) {
                        _src.tween.Rewind();
                        _src.tween.Kill();
                        if (_src.isValid) {
                            _src.CreateTween();
                            _src.tween.Play();
                        }
                    }
                    GUILayout.Label("To apply your changes when exiting Play mode, use the Component's upper right menu and choose \"Copy Component\", then \"Paste Component Values\" after exiting Play mode", DeGUI.styles.label.wordwrap);
                DeGUILayout.EndVBox();
            } else {
                GUILayout.BeginHorizontal();
                bool hasManager = _src.GetComponent<DOTweenVisualManager>() != null;
                EditorGUI.BeginChangeCheck();
                _settings.showPreviewPanel = hasManager
                    ? DeGUILayout.ToggleButton(_settings.showPreviewPanel, "Preview Controls", styles.custom.inlineToggle)
                    : DeGUILayout.ToggleButton(_settings.showPreviewPanel, "Preview Controls", styles.custom.inlineToggle, GUILayout.Width(120));
                if (EditorGUI.EndChangeCheck()) {
                    EditorUtility.SetDirty(_settings);
                    DOTweenPreviewManager.StopAllPreviews();
                }
                if (!hasManager) {
                    if (GUILayout.Button(new GUIContent("Add Manager", "Adds a manager component which allows you to choose additional options for this gameObject"))) {
                        _src.gameObject.AddComponent<DOTweenVisualManager>();
                    }
                }
                GUILayout.EndHorizontal();
            }

            // Preview in editor
            bool isPreviewing = _settings.showPreviewPanel ? DOTweenPreviewManager.PreviewGUI(_src) : false;

            EditorGUI.BeginDisabledGroup(isPreviewing);
            // Choose target
            GUILayout.BeginHorizontal();
                _src.isActive = EditorGUILayout.Toggle(new GUIContent("", "If unchecked, this animation will not be created"), _src.isActive, GUILayout.Width(14));
                EditorGUI.BeginChangeCheck();
                    EditorGUI.BeginChangeCheck();
                        _src.targetIsSelf = DeGUILayout.ToggleButton(
                            _src.targetIsSelf, _src.targetIsSelf ? _GuiC_selfTarget_true : _GuiC_selfTarget_false,
                            new Color(1f, 0.78f, 0f), DeGUI.colors.bg.toggleOn, new Color(0.33f, 0.14f, 0.02f), DeGUI.colors.content.toggleOn,
                            null, GUILayout.Width(47)
                        );
                    bool innerChanged = EditorGUI.EndChangeCheck();
                    if (innerChanged) {
                        _src.targetGO = null;
                        GUI.changed = true;
                    }
                    if (_src.targetIsSelf) GUILayout.Label(_GuiC_selfTarget_true.tooltip);
                    else {
                        using (new DeGUI.ColorScope(null, null, _src.targetGO == null ? Color.red : Color.white)) {
                            _src.targetGO = (GameObject)EditorGUILayout.ObjectField(_src.targetGO, typeof(GameObject), true);
                        }
                        _src.tweenTargetIsTargetGO = DeGUILayout.ToggleButton(
                            _src.tweenTargetIsTargetGO, _src.tweenTargetIsTargetGO ? _GuiC_tweenTargetIsTargetGO_true : _GuiC_tweenTargetIsTargetGO_false,
                            GUILayout.Width(131)
                        );
                    }
                bool check = EditorGUI.EndChangeCheck();
                if (check) _refreshRequired = true;
            GUILayout.EndHorizontal();

            GameObject targetGO = _src.targetIsSelf ? _src.gameObject : _src.targetGO;

            if (targetGO == null) {
                // Uses external target gameObject but it's not set
                if (_src.targetGO != null || _src.target != null) {
                    _src.targetGO = null;
                    _src.target = null;
                    GUI.changed = true;
                }
            } else {
                GUILayout.BeginHorizontal();
                DOTweenAnimation.AnimationType prevAnimType = _src.animationType;
//                _src.animationType = (DOTweenAnimation.AnimationType)EditorGUILayout.EnumPopup(_src.animationType, EditorGUIUtils.popupButton);
                GUI.enabled = GUI.enabled && _src.isActive;
                _src.animationType = AnimationToDOTweenAnimationType(_AnimationType[EditorGUILayout.Popup(DOTweenAnimationTypeToPopupId(_src.animationType), _AnimationType)]);
                _src.autoPlay = DeGUILayout.ToggleButton(_src.autoPlay, new GUIContent("AutoPlay", "If selected, the tween will play automatically"));
                _src.autoKill = DeGUILayout.ToggleButton(_src.autoKill, new GUIContent("AutoKill", "If selected, the tween will be killed when it completes, and won't be reusable"));
                GUILayout.EndHorizontal();
                if (prevAnimType != _src.animationType) {
                    // Set default optional values based on animation type
                    _src.endValueTransform = null;
                    _src.useTargetAsV3 = false;
                    switch (_src.animationType) {
                    case DOTweenAnimation.AnimationType.Move:
                    case DOTweenAnimation.AnimationType.LocalMove:
                    case DOTweenAnimation.AnimationType.Rotate:
                    case DOTweenAnimation.AnimationType.LocalRotate:
                    case DOTweenAnimation.AnimationType.Scale:
                        _src.endValueV3 = Vector3.zero;
                        _src.endValueFloat = 0;
                        _src.optionalBool0 = _src.animationType == DOTweenAnimation.AnimationType.Scale;
                        break;
                    case DOTweenAnimation.AnimationType.UIWidthHeight:
                        _src.endValueV3 = Vector3.zero;
                        _src.endValueFloat = 0;
                        _src.optionalBool0 = _src.animationType == DOTweenAnimation.AnimationType.UIWidthHeight;
                        break;
                    case DOTweenAnimation.AnimationType.Color:
                    case DOTweenAnimation.AnimationType.Fade:
                        _isLightSrc = targetGO.GetComponent<Light>() != null;
                        _src.endValueFloat = 0;
                        break;
                    case DOTweenAnimation.AnimationType.Text:
                        _src.optionalBool0 = true;
                        break;
                    case DOTweenAnimation.AnimationType.PunchPosition:
                    case DOTweenAnimation.AnimationType.PunchRotation:
                    case DOTweenAnimation.AnimationType.PunchScale:
                        _src.endValueV3 = _src.animationType == DOTweenAnimation.AnimationType.PunchRotation ? new Vector3(0, 180, 0) : Vector3.one;
                        _src.optionalFloat0 = 1;
                        _src.optionalInt0 = 10;
                        _src.optionalBool0 = false;
                        break;
                    case DOTweenAnimation.AnimationType.ShakePosition:
                    case DOTweenAnimation.AnimationType.ShakeRotation:
                    case DOTweenAnimation.AnimationType.ShakeScale:
                        _src.endValueV3 = _src.animationType == DOTweenAnimation.AnimationType.ShakeRotation ? new Vector3(90, 90, 90) : Vector3.one;
                        _src.optionalInt0 = 10;
                        _src.optionalFloat0 = 90;
                        _src.optionalBool0 = false;
                        break;
                    case DOTweenAnimation.AnimationType.CameraAspect:
                    case DOTweenAnimation.AnimationType.CameraFieldOfView:
                    case DOTweenAnimation.AnimationType.CameraOrthoSize:
                        _src.endValueFloat = 0;
                        break;
                    case DOTweenAnimation.AnimationType.CameraPixelRect:
                    case DOTweenAnimation.AnimationType.CameraRect:
                        _src.endValueRect = new Rect(0, 0, 0, 0);
                        break;
                    }
                }
                if (_src.animationType == DOTweenAnimation.AnimationType.None) {
                    _src.isValid = false;
                    if (GUI.changed) EditorUtility.SetDirty(_src);
                    return;
                }

                if (_refreshRequired || prevAnimType != _src.animationType || ComponentsChanged()) {
                    _refreshRequired = false;
                    _src.isValid = Validate(targetGO);
                    // See if we need to choose between multiple targets
#if true // UI_MARKER
                    if (_src.animationType == DOTweenAnimation.AnimationType.Fade && targetGO.GetComponent<CanvasGroup>() != null && targetGO.GetComponent<Image>() != null) {
                        _chooseTargetMode = ChooseTargetMode.BetweenCanvasGroupAndImage;
                        // Rereplacedign target and forcedTargetType if lost
                        if (_src.forcedTargetType == DOTweenAnimation.TargetType.Unset) _src.forcedTargetType = _src.targetType;
                        switch (_src.forcedTargetType) {
                        case DOTweenAnimation.TargetType.CanvasGroup:
                            _src.target = targetGO.GetComponent<CanvasGroup>();
                            break;
                        case DOTweenAnimation.TargetType.Image:
                            _src.target = targetGO.GetComponent<Image>();
                            break;
                        }
                    } else {
#endif
                        _chooseTargetMode = ChooseTargetMode.None;
                        _src.forcedTargetType = DOTweenAnimation.TargetType.Unset;
#if true // UI_MARKER
                    }
#endif
                }

                if (!_src.isValid) {
                    GUI.color = Color.red;
                    GUILayout.BeginVertical(GUI.skin.box);
                    GUILayout.Label("No valid Component was found for the selected animation", EditorGUIUtils.wordWrapLabelStyle);
                    GUILayout.EndVertical();
                    GUI.color = Color.white;
                    if (GUI.changed) EditorUtility.SetDirty(_src);
                    return;
                }

#if true // UI_MARKER
                // Special cases in which multiple target types could be used (set after validation)
                if (_chooseTargetMode == ChooseTargetMode.BetweenCanvasGroupAndImage && _src.forcedTargetType != DOTweenAnimation.TargetType.Unset) {
                    FadeTargetType fadeTargetType = (FadeTargetType)Enum.Parse(typeof(FadeTargetType), _src.forcedTargetType.ToString());
                    DOTweenAnimation.TargetType prevTargetType = _src.forcedTargetType;
                    _src.forcedTargetType = (DOTweenAnimation.TargetType)Enum.Parse(typeof(DOTweenAnimation.TargetType), EditorGUILayout.EnumPopup(_src.animationType + " Target", fadeTargetType).ToString());
                    if (_src.forcedTargetType != prevTargetType) {
                        // Target type change > replacedign correct target
                        switch (_src.forcedTargetType) {
                        case DOTweenAnimation.TargetType.CanvasGroup:
                            _src.target = targetGO.GetComponent<CanvasGroup>();
                            break;
                        case DOTweenAnimation.TargetType.Image:
                            _src.target = targetGO.GetComponent<Image>();
                            break;
                        }
                    }
                }
#endif

                GUILayout.BeginHorizontal();
                _src.duration = EditorGUILayout.FloatField("Duration", _src.duration);
                if (_src.duration < 0) _src.duration = 0;
                _src.isSpeedBased = DeGUILayout.ToggleButton(_src.isSpeedBased, new GUIContent("SpeedBased", "If selected, the duration will count as units/degree x second"), DeGUI.styles.button.tool, GUILayout.Width(75));
                GUILayout.EndHorizontal();
                _src.delay = EditorGUILayout.FloatField("Delay", _src.delay);
                if (_src.delay < 0) _src.delay = 0;
                _src.isIndependentUpdate = EditorGUILayout.Toggle("Ignore TimeScale", _src.isIndependentUpdate);
                _src.easeType = EditorGUIUtils.FilteredEasePopup(_src.easeType);
                if (_src.easeType == Ease.INTERNAL_Custom) {
                    _src.easeCurve = EditorGUILayout.CurveField("   Ease Curve", _src.easeCurve);
                }
                _src.loops = EditorGUILayout.IntField(new GUIContent("Loops", "Set to -1 for infinite loops"), _src.loops);
                if (_src.loops < -1) _src.loops = -1;
                if (_src.loops > 1 || _src.loops == -1)
                    _src.loopType = (LoopType)EditorGUILayout.EnumPopup("   Loop Type", _src.loopType);
                _src.id = EditorGUILayout.TextField("ID", _src.id);

                bool canBeRelative = true;
                // End value and eventual specific options
                switch (_src.animationType) {
                case DOTweenAnimation.AnimationType.Move:
                case DOTweenAnimation.AnimationType.LocalMove:
                    GUIEndValueV3(targetGO, _src.animationType == DOTweenAnimation.AnimationType.Move);
                    _src.optionalBool0 = EditorGUILayout.Toggle("    Snapping", _src.optionalBool0);
                    canBeRelative = !_src.useTargetAsV3;
                    break;
                case DOTweenAnimation.AnimationType.Rotate:
                case DOTweenAnimation.AnimationType.LocalRotate:
                    bool isRigidbody2D = DOTweenModuleUtils.Physics.HasRigidbody2D(_src);
                    if (isRigidbody2D) GUIEndValueFloat();
                    else {
                        GUIEndValueV3(targetGO);
                        _src.optionalRotationMode = (RotateMode)EditorGUILayout.EnumPopup("    Rotation Mode", _src.optionalRotationMode);
                    }
                    break;
                case DOTweenAnimation.AnimationType.Scale:
                    if (_src.optionalBool0) GUIEndValueFloat();
                    else GUIEndValueV3(targetGO);
                    _src.optionalBool0 = EditorGUILayout.Toggle("Uniform Scale", _src.optionalBool0);
                    break;
                case DOTweenAnimation.AnimationType.UIWidthHeight:
                    if (_src.optionalBool0) GUIEndValueFloat();
                    else GUIEndValueV2();
                    _src.optionalBool0 = EditorGUILayout.Toggle("Uniform Scale", _src.optionalBool0);
                    break;
                case DOTweenAnimation.AnimationType.Color:
                    GUIEndValueColor();
                    canBeRelative = false;
                    break;
                case DOTweenAnimation.AnimationType.Fade:
                    GUIEndValueFloat();
                    if (_src.endValueFloat < 0) _src.endValueFloat = 0;
                    if (!_isLightSrc && _src.endValueFloat > 1) _src.endValueFloat = 1;
                    canBeRelative = false;
                    break;
                case DOTweenAnimation.AnimationType.Text:
                    GUIEndValueString();
                    _src.optionalBool0 = EditorGUILayout.Toggle("Rich Text Enabled", _src.optionalBool0);
                    _src.optionalScrambleMode = (ScrambleMode)EditorGUILayout.EnumPopup("Scramble Mode", _src.optionalScrambleMode);
                    _src.optionalString = EditorGUILayout.TextField(new GUIContent("Custom Scramble", "Custom characters to use in case of ScrambleMode.Custom"), _src.optionalString);
                    break;
                case DOTweenAnimation.AnimationType.PunchPosition:
                case DOTweenAnimation.AnimationType.PunchRotation:
                case DOTweenAnimation.AnimationType.PunchScale:
                    GUIEndValueV3(targetGO);
                    canBeRelative = false;
                    _src.optionalInt0 = EditorGUILayout.IntSlider(new GUIContent("    Vibrato", "How much will the punch vibrate"), _src.optionalInt0, 1, 50);
                    _src.optionalFloat0 = EditorGUILayout.Slider(new GUIContent("    Elasticity", "How much the vector will go beyond the starting position when bouncing backwards"), _src.optionalFloat0, 0, 1);
                    if (_src.animationType == DOTweenAnimation.AnimationType.PunchPosition) _src.optionalBool0 = EditorGUILayout.Toggle("    Snapping", _src.optionalBool0);
                    break;
                case DOTweenAnimation.AnimationType.ShakePosition:
                case DOTweenAnimation.AnimationType.ShakeRotation:
                case DOTweenAnimation.AnimationType.ShakeScale:
                    GUIEndValueV3(targetGO);
                    canBeRelative = false;
                    _src.optionalInt0 = EditorGUILayout.IntSlider(new GUIContent("    Vibrato", "How much will the shake vibrate"), _src.optionalInt0, 1, 50);
                    _src.optionalFloat0 = EditorGUILayout.Slider(new GUIContent("    Randomness", "The shake randomness"), _src.optionalFloat0, 0, 90);
                    if (_src.animationType == DOTweenAnimation.AnimationType.ShakePosition) _src.optionalBool0 = EditorGUILayout.Toggle("    Snapping", _src.optionalBool0);
                    break;
                case DOTweenAnimation.AnimationType.CameraAspect:
                case DOTweenAnimation.AnimationType.CameraFieldOfView:
                case DOTweenAnimation.AnimationType.CameraOrthoSize:
                    GUIEndValueFloat();
                    canBeRelative = false;
                    break;
                case DOTweenAnimation.AnimationType.CameraBackgroundColor:
                    GUIEndValueColor();
                    canBeRelative = false;
                    break;
                case DOTweenAnimation.AnimationType.CameraPixelRect:
                case DOTweenAnimation.AnimationType.CameraRect:
                    GUIEndValueRect();
                    canBeRelative = false;
                    break;
                }

                // Final settings
                if (canBeRelative) _src.isRelative = EditorGUILayout.Toggle("    Relative", _src.isRelative);

                // Events
                AnimationInspectorGUI.AnimationEvents(this, _src);
            }
            EditorGUI.EndDisabledGroup();

            if (GUI.changed) EditorUtility.SetDirty(_src);
        }

See More Examples