Beispiel #1
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            EditorGUILayout.PropertyField(_widthProperty);
            EditorGUILayout.PropertyField(_heightProperty);

            if (GUILayout.Button("Bake scale to widget size"))
            {
                Undo.RecordObject(target, "leopotamgroup.gui.empty-widget.bake-scale-size");
                GuiWidget l;
                foreach (var item in targets)
                {
                    l = item as GuiWidget;
                    if (l != null)
                    {
                        l.BakeScale();
                    }
                }
                SceneView.RepaintAll();
            }

            if (serializedObject.ApplyModifiedProperties() || EditorIntegration.IsUndo())
            {
                EditorIntegration.UpdateVisuals(target);
            }
        }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            EditorGUILayout.PropertyField(_clipProperty, _clipTypeGuiContent);
            var clipType = (GuiPanelClipType)_clipProperty.enumValueIndex;

            if (clipType == GuiPanelClipType.Range)
            {
                EditorGUILayout.PropertyField(_clipWidthProperty);
                if (_clipWidthProperty.intValue < 0)
                {
                    _clipWidthProperty.intValue = 0;
                }

                EditorGUILayout.PropertyField(_clipHeightProperty);
                if (_clipHeightProperty.intValue < 0)
                {
                    _clipHeightProperty.intValue = 0;
                }
            }

            EditorGUILayout.IntSlider(_depthProperty, -10, 10);

            if (serializedObject.ApplyModifiedProperties() || EditorIntegration.IsUndo())
            {
                EditorIntegration.UpdateVisuals(target);
            }
        }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            EditorGUILayout.PropertyField(serializedObject.FindProperty("_clearFlags"), new GUIContent("Clear flags"));
            EditorGUILayout.PropertyField(serializedObject.FindProperty("_backgroundColor"));

            var cullingProp = serializedObject.FindProperty("_cullingMask");

            cullingProp.intValue = LayerMaskField("Culling mask", cullingProp.intValue);

            EditorGUILayout.PropertyField(serializedObject.FindProperty("_depth"));

            var heightProp = serializedObject.FindProperty("_screenHeight");

            EditorGUILayout.PropertyField(heightProp);
            if (heightProp.intValue <= 0)
            {
                heightProp.intValue = 1;
            }

            EditorGUILayout.PropertyField(serializedObject.FindProperty("IsInputLocked"));

            if (serializedObject.ApplyModifiedProperties() || EditorIntegration.IsUndo())
            {
                (target as GuiSystem).Validate();
                EditorIntegration.UpdateVisuals(target);
            }
        }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            EditorGUILayout.PropertyField(_fontProperty);
            EditorGUILayout.PropertyField(_fontSizeProperty);
            if (_fontSizeProperty.intValue < 4)
            {
                _fontSizeProperty.intValue = 4;
            }
            EditorGUILayout.PropertyField(_alignmentProperty);
            EditorGUILayout.PropertyField(_textProperty);
            EditorGUILayout.PropertyField(_widthProperty);
            EditorGUILayout.PropertyField(_heightProperty);
            EditorGUILayout.IntSlider(_depthProperty, -GuiWidget.DepthLimit, GuiWidget.DepthLimit);
            EditorGUILayout.PropertyField(_colorProperty);

            EditorGUILayout.PropertyField(_lineHeightProperty);
            if (_lineHeightProperty.floatValue <= 0.1f)
            {
                _lineHeightProperty.floatValue = 0.1f;
            }

            EditorGUILayout.PropertyField(_effectProperty);

            if ((GuiFontEffect)_effectProperty.enumValueIndex != GuiFontEffect.None)
            {
                _effectValueProperty.vector2Value = EditorGUILayout.Vector2Field("Effect Value", _effectValueProperty.vector2Value);
                EditorGUILayout.PropertyField(_effectColorProperty);
            }

            if (GUILayout.Button("Bake scale to widget size"))
            {
                Undo.RecordObject(target, "leopotamgroup.gui.label.bake-scale-size");
                GuiLabel l;
                foreach (var item in targets)
                {
                    l = item as GuiLabel;
                    if (l != null)
                    {
                        l.BakeScale();
                    }
                }
                SceneView.RepaintAll();
            }

            EditorGUILayout.HelpBox("Only strings with length <= 75 (except spaces) can be batched.\n\n" +
                                    "Only strings with length <= 37 and shadow effect (except spaces) can be batched.\n\n" +
                                    "Only strings with length <= 15 and outline effect (except spaces) can be batched.\n\n" +
                                    "Copy&paste labels for creating custom shading/glowing and keep batching.", MessageType.Warning);

            if (serializedObject.ApplyModifiedProperties() || EditorIntegration.IsUndo())
            {
                EditorIntegration.UpdateVisuals(target);
            }
        }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            EditorGUILayout.PropertyField(_backgroundProperty);
            EditorGUILayout.PropertyField(_foregroundProperty);
            EditorGUILayout.Slider(_valueProperty, 0f, 1f);

            if (serializedObject.ApplyModifiedProperties() || EditorIntegration.IsUndo())
            {
                (target as GuiSlider).UpdateVisuals();
                EditorIntegration.UpdateVisuals(target);
            }
        }
Beispiel #6
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            EditorGUILayout.PropertyField(_widthProperty);
            EditorGUILayout.PropertyField(_heightProperty);
            EditorGUILayout.IntSlider(_depthProperty, -49, 49);
            EditorGUILayout.PropertyField(_onPressProperty);
            EditorGUILayout.PropertyField(_onClickProperty);
            EditorGUILayout.PropertyField(_onDragProperty);

            if (serializedObject.ApplyModifiedProperties() || EditorIntegration.IsUndo())
            {
                EditorIntegration.UpdateVisuals(target);
            }
        }
        public override void OnInspectorGUI()
        {
            bool      isFound = false;
            Transform tr;

            foreach (var item in targets)
            {
                tr = item as Transform;
                if (tr.GetComponent <GuiWidget> () || tr.GetComponent <GuiPanel> () || tr.GetComponent <GuiEventReceiver> ())
                {
                    isFound = true;
                    break;
                }
            }

            serializedObject.Update();
            EditorIntegration.SetLabelWidth(15f);
            DrawPosition(isFound);
            DrawRotation(isFound);
            DrawScale(isFound);

            serializedObject.ApplyModifiedProperties();
        }
Beispiel #8
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            var sprite = target as GuiSprite;

            var atlasName = string.Format("Atlas: <{0}>", sprite.SpriteAtlas != null ? sprite.SpriteAtlas.name : "Empty");

            if (GUILayout.Button(atlasName))
            {
                SearchWindow.Open <GuiAtlas> ("Select atlas", "t:prefab", sprite.SpriteAtlas, assetPath => {
                    // If not canceled.
                    if (assetPath != null)
                    {
                        // None.
                        if (assetPath == string.Empty)
                        {
                            sprite.SpriteAtlas        = null;
                            _nameProperty.stringValue = null;
                        }
                        else
                        {
                            sprite.SpriteAtlas = AssetDatabase.LoadAssetAtPath <GuiAtlas> (assetPath);
                        }
                        _atlasProperty.objectReferenceValue = sprite.SpriteAtlas;
                    }
                });
            }

            if (sprite.SpriteAtlas != null)
            {
                var spriteList = sprite.SpriteAtlas.GetSpriteNames();
                var id         = Array.IndexOf(spriteList, sprite.SpriteName);
                id = EditorGUILayout.Popup("Sprite", id, spriteList);
                if (id >= 0 && id < spriteList.Length)
                {
                    _nameProperty.stringValue = spriteList[id];
                }
            }


            EditorGUILayout.PropertyField(_typeProperty, _typeGuiContent);

            var type = (GuiSpriteType)_typeProperty.enumValueIndex;

            if (type != GuiSpriteType.Simple && type != GuiSpriteType.RoundFilled)
            {
                EditorGUILayout.PropertyField(_fillCenterProperty, _fillCenterGuiContent);
            }

            if (type == GuiSpriteType.RoundFilled)
            {
                EditorGUILayout.Slider(_fillValueProperty, 0f, 1f);
            }

            EditorGUILayout.Separator();

            EditorGUILayout.PropertyField(_flipHorProperty, _flipHorGuiContent);
            EditorGUILayout.PropertyField(_flipVerProperty, _flipVerGuiContent);

            EditorGUILayout.Separator();

            EditorGUILayout.PropertyField(_widthProperty);
            if (_widthProperty.intValue < 0)
            {
                _widthProperty.intValue = 0;
            }

            EditorGUILayout.PropertyField(_heightProperty);
            if (_heightProperty.intValue < 0)
            {
                _heightProperty.intValue = 0;
            }

            bool needUpdate = false;

            if (GUILayout.Button("Reset size to original"))
            {
                Undo.RecordObject(sprite, "leopotamgroup.gui.sprite.set-original-size");
                sprite.ResetSize();
                needUpdate = true;
            }
            if (GUILayout.Button("Align tiled size to original"))
            {
                Undo.RecordObject(sprite, "leopotamgroup.gui.sprite.align-original-size");
                sprite.AlignTiledSizeToOriginal();
                needUpdate = true;
            }

            if (GUILayout.Button("Bake scale to widget size"))
            {
                Undo.RecordObject(sprite, "leopotamgroup.gui.sprite.bake-scale-size");
                GuiWidget s;
                foreach (var item in targets)
                {
                    s = item as GuiSprite;
                    if (s != null)
                    {
                        s.BakeScale();
                    }
                }
                needUpdate = true;
                SceneView.RepaintAll();
            }

            EditorGUILayout.Separator();

            EditorGUILayout.IntSlider(_depthProperty, -GuiWidget.DepthLimit, GuiWidget.DepthLimit);
            EditorGUILayout.PropertyField(_colorProperty);

            if (serializedObject.ApplyModifiedProperties() || needUpdate || EditorIntegration.IsUndo())
            {
                EditorIntegration.UpdateVisuals(target);
            }
        }