Ejemplo n.º 1
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            EditorGUI.BeginChangeCheck();

            // LOGO
            GUILayout.Space(10);
            OSCEditorLayout.DrawLogo();
            GUILayout.Space(5);

            GUILayout.BeginVertical("box");

            // SETTINGS BLOCK
            EditorGUILayout.LabelField(_transmitterComponentSettingsContent, EditorStyles.boldLabel);
            OSCEditorLayout.TransmitterSettings(_transmitterProperty, _addressProperty);

            DrawSettings();

            EditorGUILayout.EndVertical();

            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
            }
        }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            EditorGUI.BeginChangeCheck();

            // LOGO
            GUILayout.Space(10);
            OSCEditorLayout.DrawLogo();
            GUILayout.Space(5);

            GUILayout.BeginVertical("box");

            EditorGUILayout.LabelField(_settingsTitleContent, EditorStyles.boldLabel);
            GUILayout.BeginVertical("box");

            EditorGUILayout.PropertyField(_addressProperty, _addressContent);

            OSCEditorLayout.TransmittersPopup(_transmitterProperty, _transmitterContent);

            OSCEditorLayout.ReceiversPopup(_receiverProperty, _receiverContent);

            EditorGUILayout.EndVertical();

            EditorGUILayout.EndVertical();

            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
            }
        }
Ejemplo n.º 3
0
        public override void OnInspectorGUI()
        {
            GUILayout.Space(10);
            OSCEditorLayout.DrawLogo();
            GUILayout.Space(5);

            GUILayout.Label(string.Format("Value: {0}", _valueProperty.floatValue), EditorStyles.boldLabel);
            GUILayout.BeginVertical("box");

            GUILayout.Label(_settingsContent, EditorStyles.boldLabel);
            GUILayout.BeginVertical("box");
            base.OnInspectorGUI();
            GUILayout.EndVertical();

            serializedObject.Update();

            GUILayout.Label(_rotartySettingsContent, EditorStyles.boldLabel);
            GUILayout.BeginVertical("box");
            EditorGUILayout.PropertyField(_handleImageProperty);
            EditorGUILayout.PropertyField(_reverseProperty);

            GUILayout.EndVertical();

            GUILayout.Label(_valueSettingsContent, EditorStyles.boldLabel);
            GUILayout.BeginVertical("box");

            EditorGUILayout.Space();

            EditorGUILayout.PropertyField(_minValueProperty);
            EditorGUILayout.PropertyField(_maxValueProperty);

            EditorGUILayout.Space();

            EditorGUILayout.PropertyField(_wholeNumbersProperty);

            EditorGUILayout.Space();

            EditorGUILayout.Slider(_valueProperty, _minValueProperty.floatValue, _maxValueProperty.floatValue);

            GUILayout.EndVertical();

            GUILayout.Label(_resetValueContent, EditorStyles.boldLabel);
            GUILayout.BeginVertical("box");
            EditorGUILayout.PropertyField(_resetValueProperty);
            EditorGUILayout.PropertyField(_resetValueTimeProperty);
            EditorGUILayout.PropertyField(_callbackOnResetProperty);
            GUILayout.EndVertical();

            EditorGUILayout.Space();

            EditorGUILayout.PropertyField(_onValueChangedProperty);

            GUILayout.EndVertical();
            serializedObject.ApplyModifiedProperties();
        }
Ejemplo n.º 4
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            EditorGUI.BeginChangeCheck();

            // LOGO
            GUILayout.Space(10);
            OSCEditorLayout.DrawLogo();
            GUILayout.Space(5);

            EditorGUILayout.LabelField(string.Format("{0} Settings:", target.GetType().Name), EditorStyles.boldLabel);
            GUILayout.BeginVertical("box");

            // RECEIVER SETTINGS BLOCK
            EditorGUILayout.LabelField(_receiverComponentSettingsContent, EditorStyles.boldLabel);
            OSCEditorLayout.ReceiverSettings(_receiverProperty, _receiverAddressProperty);

            // TRANSMITTER SETTINGS BLOCK
            EditorGUILayout.LabelField(_transmitterComponentSettingsContent, EditorStyles.boldLabel);
            GUILayout.BeginVertical("box");

            OSCEditorLayout.TransmittersPopup(_transmitterProperty, _transmitterContent);

            var transmitterAddress = "- None -";

            if (Application.isPlaying)
            {
                transmitterAddress = _ping.TransmitterAddress;
            }

            EditorGUILayout.LabelField(EditorGUIUtility.currentViewWidth > 410 ?
                                       _transmitterAddressContent.text : _transmitterAddressContentSmall.text,
                                       transmitterAddress);

            // SETTINGS BOX END
            EditorGUILayout.EndVertical();

            DrawSettings();

            EditorGUILayout.EndVertical();

            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
            }
        }
Ejemplo n.º 5
0
        public override void OnInspectorGUI()
        {
            GUILayout.Space(10);
            OSCEditorLayout.DrawLogo();
            GUILayout.Space(5);

            GUILayout.Label(string.Format("Value: {0}", _valueProperty.boolValue), EditorStyles.boldLabel);
            GUILayout.BeginVertical("box");

            GUILayout.Label(_settingsContent, EditorStyles.boldLabel);
            GUILayout.BeginVertical("box");
            base.OnInspectorGUI();
            GUILayout.EndVertical();

            serializedObject.Update();

            GUILayout.Label(_buttonSettingsContent, EditorStyles.boldLabel);
            GUILayout.BeginVertical("box");
            EditorGUILayout.PropertyField(_graphicProperty);
            EditorGUILayout.PropertyField(_graphicTransitionProperty);
            EditorGUILayout.PropertyField(_buttonTypeProperty);
            GUILayout.EndVertical();

            if ((OSCButton.Type)_buttonTypeProperty.enumValueIndex == OSCButton.Type.Toggle)
            {
                GUILayout.Label(_valueSettingsContent, EditorStyles.boldLabel);
                GUILayout.BeginVertical("box");
                EditorGUILayout.PropertyField(_valueProperty);
                GUILayout.EndVertical();
            }

            EditorGUILayout.Space();
            EditorGUILayout.PropertyField(_onValueChangedProperty);

            GUILayout.EndVertical();

            serializedObject.ApplyModifiedProperties();
        }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            EditorGUI.BeginChangeCheck();

            // LOGO
            GUILayout.Space(10);
            OSCEditorLayout.DrawLogo();
            GUILayout.Space(5);

            GUILayout.BeginVertical("box");

            // SETTINGS BLOCK
            EditorGUILayout.LabelField(_receiverComponentSettingsContent, EditorStyles.boldLabel);

            GUILayout.BeginVertical("box");
            OSCEditorLayout.ReceiverSettings(_receiverProperty, _addressProperty, false);
            EditorGUILayout.PropertyField(_mapBundleProperty, _mapBundleContent);

            if (_receiverComponent.Receiver != null && _receiverComponent.Receiver.MapBundle != null &&
                _receiverComponent.MapBundle != null)
            {
                EditorGUILayout.HelpBox("OSCReceiver already has MapBundle.", MessageType.Info);
            }

            EditorGUILayout.EndVertical();

            DrawSettings();

            EditorGUILayout.EndVertical();

            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
            }
        }
Ejemplo n.º 7
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            GUILayout.Space(10);
            OSCEditorLayout.DrawLogo();
            GUILayout.Space(5);

            GUILayout.Label(string.Format("Sliders: {0}", _slidersProperty.arraySize), EditorStyles.boldLabel);
            GUILayout.BeginVertical("box");

            GUILayout.Label("Settings:", EditorStyles.boldLabel);
            GUILayout.BeginVertical("box");
            base.OnInspectorGUI();
            GUILayout.EndVertical();

            GUILayout.Label("Multiply Sliders Settings:", EditorStyles.boldLabel);
            GUILayout.BeginVertical("box");
            EditorGUILayout.PropertyField(_layoutGroupProperty);

            if (_layoutGroupProperty.objectReferenceValue != null)
            {
                GUILayout.EndVertical();

                GUILayout.Label("Sliders Settings:", EditorStyles.boldLabel);
                GUILayout.BeginVertical("box");
                EditorGUILayout.PropertyField(_defaultColorProperty);
                EditorGUILayout.PropertyField(_addressProperty);
                OSCEditorLayout.TransmittersPopup(_transmitterProperty, new GUIContent("Transmitter"));
                GUILayout.EndVertical();

                var defaultColor = GUI.color;

                GUILayout.BeginHorizontal("box");
                GUILayout.BeginVertical("box");
                GUI.color = Color.red;
                var removeButton = GUILayout.Button("-", GUILayout.Width(20), GUILayout.Height(20));
                GUI.color = defaultColor;
                GUILayout.EndVertical();
                GUILayout.BeginVertical("box");
                EditorGUILayout.LabelField(_slidersProperty.arraySize.ToString(), OSCEditorStyles.CenterLabel, GUILayout.Height(20));
                GUILayout.EndVertical();
                GUILayout.BeginVertical("box");
                GUI.color = Color.green;
                var createButton = GUILayout.Button("+", GUILayout.Width(20), GUILayout.Height(20));
                GUI.color = defaultColor;
                GUILayout.EndVertical();
                GUILayout.EndHorizontal();

                GUILayout.Label("Value Settings:", EditorStyles.boldLabel);
                GUILayout.BeginVertical("box");
                EditorGUILayout.PropertyField(_minValueProperty);
                EditorGUILayout.PropertyField(_maxValueProperty);
                EditorGUILayout.PropertyField(_wholeNumbersProperty);
                GUILayout.EndVertical();

                GUILayout.EndVertical();

                if (createButton)
                {
                    AddSlider();
                }
                if (removeButton)
                {
                    RemoveSlider();
                }
            }
            else
            {
                EditorGUILayout.HelpBox("You need to set \"HorizontalOrVerticalLayoutGroup Group\" for correct work of the component.", MessageType.Warning);
                GUILayout.EndVertical();
            }

            serializedObject.ApplyModifiedProperties();
        }
Ejemplo n.º 8
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            GUILayout.Space(10);
            OSCEditorLayout.DrawLogo();
            GUILayout.Space(5);

            GUILayout.Label(string.Format("Value: {0}", _valueProperty.vector2Value), EditorStyles.boldLabel);
            GUILayout.BeginVertical("box");

            GUILayout.Label(_settingsContent, EditorStyles.boldLabel);
            GUILayout.BeginVertical("box");
            base.OnInspectorGUI();
            GUILayout.EndVertical();

            GUILayout.Label(_padSettingsContent, EditorStyles.boldLabel);
            GUILayout.BeginVertical("box");
            EditorGUILayout.PropertyField(_handleRectProperty);

            if (_handleRectProperty.objectReferenceValue != null)
            {
                EditorGUILayout.PropertyField(_handleAlignmentProperty);
                GUILayout.EndVertical();

                var minX = _minValueProperty.FindPropertyRelative("x");
                var maxX = _maxValueProperty.FindPropertyRelative("x");
                var minY = _minValueProperty.FindPropertyRelative("y");
                var maxY = _maxValueProperty.FindPropertyRelative("y");

                GUILayout.Label(_valueSettingsContent, EditorStyles.boldLabel);
                GUILayout.BeginVertical("box");
                EditorGUILayout.PropertyField(_xAxisRectProperty);
                EditorGUILayout.PropertyField(_yAxisRectProperty);

                EditorGUILayout.Space();

                EditorGUILayout.LabelField(_xAxisContent);
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(minX, _minContent);
                EditorGUILayout.PropertyField(maxX, _maxContent);
                EditorGUI.indentLevel--;

                EditorGUILayout.Space();

                EditorGUILayout.LabelField(_yAxisContent);
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(minY, _minContent);
                EditorGUILayout.PropertyField(maxY, _maxContent);
                EditorGUI.indentLevel--;

                EditorGUILayout.Space();

                EditorGUILayout.PropertyField(_wholeNumbersProperty);

                EditorGUILayout.Space();

                EditorGUILayout.LabelField(_valueContent);
                EditorGUI.indentLevel++;
                EditorGUILayout.Slider(_valueProperty.FindPropertyRelative("x"), minX.floatValue, maxX.floatValue);
                EditorGUILayout.Slider(_valueProperty.FindPropertyRelative("y"), minY.floatValue, maxY.floatValue);
                EditorGUI.indentLevel--;

                GUILayout.EndVertical();

                GUILayout.Label(_resetValueContent, EditorStyles.boldLabel);
                GUILayout.BeginVertical("box");
                EditorGUILayout.PropertyField(_resetValueProperty);
                EditorGUILayout.PropertyField(_resetValueTimeProperty);
                EditorGUILayout.PropertyField(_callbackOnResetProperty);
                GUILayout.EndVertical();

                EditorGUILayout.Space();

                EditorGUILayout.PropertyField(_onValueChangedProperty);
            }
            else
            {
                GUILayout.EndVertical();
                EditorGUILayout.HelpBox("You need to set \"RectTransform Group\" for correct work of the component.", MessageType.Info);
            }

            GUILayout.EndVertical();
            serializedObject.ApplyModifiedProperties();
        }
Ejemplo n.º 9
0
        protected override void DrawContent(Rect contentRect)
        {
            if (!_controlCreator.IsValid)
            {
                EditorGUILayout.LabelField(_errorCreateContent, OSCEditorStyles.CenterLabel, GUILayout.Height(contentRect.height));

                return;
            }

            var defaultColor = GUI.color;

            contentRect.x      += 2;
            contentRect.y      += 2;
            contentRect.width  -= 4;
            contentRect.height -= 4;

            GUILayout.BeginArea(contentRect);

            GUILayout.Space(10);
            OSCEditorLayout.DrawLogo();
            GUILayout.Space(5);

            GUILayout.Label(_controlSettingsContent, EditorStyles.boldLabel);
            EditorGUILayout.BeginVertical("box");

            _controlColor = EditorGUILayout.ColorField(_controlColorContent, _controlColor);

            EditorGUILayout.EndVertical();

            GUI.color = _addInformer ? Color.green : Color.red;
            if (GUILayout.Button(_addInformerContent))
            {
                _addInformer = !_addInformer;
            }
            GUI.color = defaultColor;

            if (_addInformer)
            {
                GUILayout.Label(_informerSettingsContent, EditorStyles.boldLabel);
                EditorGUILayout.BeginVertical("box");

                _informerAddress     = EditorGUILayout.TextField(_oscAddressContent, _informerAddress);
                _informerTransmitter = OSCEditorLayout.TransmittersPopup(_informerTransmitter, _oscTransmitterContent);

                GUI.color = _informOnChanged ? Color.green : Color.red;
                if (GUILayout.Button(_informOnChangedContent))
                {
                    _informOnChanged = !_informOnChanged;
                }
                GUI.color = defaultColor;

                if (!_informOnChanged)
                {
                    _informerInterval = EditorGUILayout.FloatField(_informerIntervalContent, _informerInterval);

                    if (_informerInterval < 0)
                    {
                        _informerInterval = 0;
                    }

                    EditorGUILayout.HelpBox("Set to 0 for send message with each frame.", MessageType.Info);
                }

                EditorGUILayout.EndVertical();
            }

            GUI.color = Color.green;
            if (GUILayout.Button(_createContent))
            {
                var data = new OSCWindowControlCreator.ControlData();
                data.ControlColor        = _controlColor;
                data.UseInformer         = _addInformer;
                data.InformAddress       = _informerAddress;
                data.InformInterval      = _informerInterval;
                data.InformOnChanged     = _informOnChanged;
                data.InformerTransmitter = _informerTransmitter;

                OSCWindowControlCreator.Invoke(data);
            }
            GUI.color = defaultColor;

            GUILayout.EndArea();
        }
Ejemplo n.º 10
0
        public override void OnInspectorGUI()
        {
            GUILayout.Space(10);
            OSCEditorLayout.DrawLogo();
            GUILayout.Space(5);

            GUILayout.Label(string.Format("Value: {0}", _valueProperty.floatValue), EditorStyles.boldLabel);
            GUILayout.BeginVertical("box");

            GUILayout.Label(_settingsContent, EditorStyles.boldLabel);
            GUILayout.BeginVertical("box");
            base.OnInspectorGUI();
            GUILayout.EndVertical();

            serializedObject.Update();

            GUILayout.Label(_sliderSettingsContent, EditorStyles.boldLabel);
            GUILayout.BeginVertical("box");
            EditorGUILayout.PropertyField(_fillRecrProperty);
            EditorGUILayout.PropertyField(_handleProperty);
            EditorGUILayout.PropertyField(_multiplyControllerProperty);

            if (_fillRecrProperty.objectReferenceValue != null || _handleProperty.objectReferenceValue != null)
            {
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(_directionProperty);
                if (EditorGUI.EndChangeCheck())
                {
                    Slider.Direction direction = (Slider.Direction)_directionProperty.enumValueIndex;
                    foreach (var obj in serializedObject.targetObjects)
                    {
                        Slider slider = obj as Slider;
                        slider.SetDirection(direction, true);
                    }
                }

                GUILayout.EndVertical();

                GUILayout.Label(_valueSettingsContent, EditorStyles.boldLabel);
                GUILayout.BeginVertical("box");
                EditorGUILayout.PropertyField(_minValueProperty);
                EditorGUILayout.PropertyField(_maxValueProperty);
                EditorGUILayout.PropertyField(_wholeNumbersProperty);
                EditorGUILayout.Slider(_valueProperty, _minValueProperty.floatValue, _maxValueProperty.floatValue);
                GUILayout.EndVertical();

                GUILayout.Label(_resetValueContent, EditorStyles.boldLabel);
                GUILayout.BeginVertical("box");
                EditorGUILayout.PropertyField(_resetValueProperty);
                EditorGUILayout.PropertyField(_resetValueTimeProperty);
                EditorGUILayout.PropertyField(_callbackOnResetProperty);
                GUILayout.EndVertical();

                bool warning = false;
                foreach (var obj in serializedObject.targetObjects)
                {
                    var slider           = obj as Slider;
                    Slider.Direction dir = slider.direction;
                    if (dir == Slider.Direction.LeftToRight || dir == Slider.Direction.RightToLeft)
                    {
                        warning = (slider.navigation.mode != Navigation.Mode.Automatic && (slider.FindSelectableOnLeft() != null || slider.FindSelectableOnRight() != null));
                    }
                    else
                    {
                        warning = (slider.navigation.mode != Navigation.Mode.Automatic && (slider.FindSelectableOnDown() != null || slider.FindSelectableOnUp() != null));
                    }
                }

                if (warning)
                {
                    EditorGUILayout.HelpBox("The selected slider direction conflicts with navigation. Not all navigation options may work.", MessageType.Warning);
                }


                EditorGUILayout.Space();
                EditorGUILayout.PropertyField(_onValueChangedProperty);
            }
            else
            {
                GUILayout.EndVertical();
                EditorGUILayout.HelpBox("Specify a RectTransform for the slider fill or the slider handle or both. Each must have a parent RectTransform that it can slide within.", MessageType.Info);
            }

            GUILayout.EndVertical();

            serializedObject.ApplyModifiedProperties();
        }