Exemplo n.º 1
0
 void Formation(SerializedProperty formation)
 {
     EditorGUILayout.ObjectField(formation.FindPropertyRelative("graphStart"), noOptions);
     EditorGUILayout.ObjectField(formation.FindPropertyRelative("shipPrefab"), noOptions);
     EditorGUILayout.DelayedIntField(formation.FindPropertyRelative("shipCount"), noOptions);
     EditorGUILayout.DelayedFloatField(formation.FindPropertyRelative("spawnCooldown"), noOptions);
 }
Exemplo n.º 2
0
        public override bool OnGUI(SerializedProperty property, GUIContent label, Attribute attribute)
        {
            var attr = (MinMaxAttribute)attribute;

            if (property.propertyType == SerializedPropertyType.Float)
            {
                float v = EditorGUILayout.DelayedFloatField(label, property.floatValue);
                property.floatValue = Mathf.Clamp(v, attr.min, attr.max);
                return(true);
            }

            if (property.propertyType == SerializedPropertyType.Integer)
            {
                int v = EditorGUILayout.DelayedIntField(label, property.intValue);
                property.intValue = Mathf.Clamp(v, (int)attr.min, (int)attr.max);
                return(true);
            }

            if (property.propertyType == SerializedPropertyType.Vector2)
            {
                var v = property.vector2Value;
                EditorGUILayout.MinMaxSlider(label, ref v.x, ref v.y, attr.min, attr.max);
                property.vector2Value = v;
                return(true);
            }

            return(false);
        }
Exemplo n.º 3
0
    public override void OnInspectorGUI()
    {
        Damageable curDam = (Damageable)target;

        showResistances = EditorGUILayout.Foldout(showResistances, "Susceptabilites");

        if (curDam.susceptability == null)
        {
            curDam.susceptability = new Dictionary <DamageType, float>();
            for (int i = 0; i <= (int)DamageType.True; i++)
            {
                curDam.susceptability.Add((DamageType)i, 1);
            }
        }

        if (showResistances)
        {
            for (int i = 0; i < (int)DamageType.True; i++)
            {
                curDam.susceptability[(DamageType)i] = EditorGUILayout.FloatField(((DamageType)i).ToString() + " Susceptability", curDam.susceptability[(DamageType)i]);
            }
            EditorGUILayout.LabelField("");
        }
        curDam.MaxHealth = EditorGUILayout.DelayedFloatField("Max Health", curDam.MaxHealth);
        curDam.Health    = EditorGUILayout.DelayedFloatField("Current Health", curDam.Health);

        DrawDefaultInspector();
    }
Exemplo n.º 4
0
        //----- property -----

        //----- method -----

        public override void OnInspectorGUI()
        {
            instance = target as TextOutline;

            var color = Reflection.GetPrivateField <TextOutline, Color>(instance, "color");

            EditorGUI.BeginChangeCheck();

            color = EditorGUILayout.ColorField("Color", color);

            if (EditorGUI.EndChangeCheck())
            {
                SetValue(instance, "color", color);
            }

            var distance = Reflection.GetPrivateField <TextOutline, float>(instance, "distance");

            EditorGUI.BeginChangeCheck();

            distance = EditorGUILayout.DelayedFloatField("Distance", distance);

            if (EditorGUI.EndChangeCheck())
            {
                SetValue(instance, "distance", distance);
            }

            DrawMaterialSelector(instance);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Draw Animation Action Runner editor
        /// </summary>
        /// <param name="aar"></param>
        /// <param name="s"></param>
        /// <returns>Whether "delete" was pressed</returns>
        bool DrawAAR(AnimationActionRunner aar, AnimationStep s)
        {
            //EditorGUILayout.LabelField("Element visibility: S=" + ae.unhideDelay.ToString("0.0") + " E= " + ae.hideDelay.ToString("0.0"));
            GUILayout.Space(8);
            EditorGUILayout.BeginHorizontal();
            GUILayout.Label(aar.animationAction.name);
            bool delete = GUILayout.Button("Delete");

            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();
            GUILayout.Label("Repeating");
            aar.repeating = EditorGUILayout.Toggle(aar.repeating);
            EditorGUILayout.EndHorizontal();


            EditorGUILayout.BeginHorizontal();
            {
                EditorGUILayout.BeginVertical();
                GUILayout.Label("Start");
                aar.startTime = EditorGUILayout.DelayedFloatField(aar.startTime);

                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical();
                GUILayout.Label("Length");
                aar.SetLength(EditorGUILayout.DelayedFloatField(aar.length));
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical();
                GUILayout.Label("End");
                aar.SetEndTime(EditorGUILayout.DelayedFloatField(aar.endTime));
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndHorizontal();
            return(delete);
        }
Exemplo n.º 6
0
    void OnGUI()
    {
        EditorGUI.BeginChangeCheck();
        GUI.enabled = false;
        EditorGUILayout.Vector3Field("位置:", m_position, null);
        EditorGUILayout.Space();

        if (null == m_unitSpawner || null == m_unitSpawner.spawns)
        {
            return;
        }
        if (m_index >= m_unitSpawner.spawns.Count)
        {
            m_unitSpawner.spawns.Add(new SpawnData(m_position, null, 1, 0.1f));
        }
        SpawnData sd = m_unitSpawner.spawns[m_index];

        GUI.enabled = true;
        m_unitSpawner.spawns[m_index].maxCount        = EditorGUILayout.DelayedIntField("生产最大数:", sd.maxCount);
        m_unitSpawner.spawns[m_index].interval        = EditorGUILayout.DelayedFloatField("敌人产生间隔:", sd.interval);
        m_unitSpawner.spawns[m_index].rateOfSpawn     = EditorGUILayout.Slider("敌人产生概率(0~1):", sd.rateOfSpawn, 0, 1, null);
        m_unitSpawner.spawns[m_index].EnemeyToProduce = (GameObject)EditorGUILayout.ObjectField("预制体:", sd.EnemeyToProduce, typeof(GameObject), false, null);

        EditorGUILayout.Space();

        if (EditorGUI.EndChangeCheck())
        {
        }
        ;
    }
        public static bool EditorDrawFloatSliderProperty(SerializedProperty parentProperty, string propertyName, string label, string tooltip)
        {
            bool bChanged = false;
            SerializedProperty itemProperty = parentProperty.FindPropertyRelative(propertyName);

            if (itemProperty != null)
            {
                using (new EditorGUILayout.HorizontalScope())
                {
                    GUIContent labelContent = new GUIContent(label, tooltip);

                    float value    = itemProperty.floatValue;
                    float newValue = EditorGUILayout.DelayedFloatField(labelContent, value, GUILayout.ExpandWidth(false));
                    if (newValue == value)
                    {
                        newValue = GUILayout.HorizontalSlider(itemProperty.floatValue, 0f, 1f);
                    }
                    if (newValue != value)
                    {
                        itemProperty.floatValue = newValue;
                        bChanged = true;
                    }
                }
            }
            return(bChanged);
        }
        public static void EditorDrawFloatArray(ref float[] floatFields, string label = null)
        {
            // Arrays are drawn with a label, and rows of values.

            GUILayout.BeginHorizontal();
            {
                if (!string.IsNullOrEmpty(label))
                {
                    EditorGUILayout.PrefixLabel(label);
                }

                GUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    int numElements       = floatFields.Length;
                    int maxElementsPerRow = 4;

                    GUILayout.BeginHorizontal();
                    {
                        for (int i = 0; i < numElements; ++i)
                        {
                            if (i > 0 && i % maxElementsPerRow == 0)
                            {
                                GUILayout.EndHorizontal();
                                GUILayout.BeginHorizontal();
                            }

                            floatFields[i] = EditorGUILayout.DelayedFloatField(floatFields[i]);
                        }
                    }
                    GUILayout.EndHorizontal();
                }
                GUILayout.EndVertical();
            }
            GUILayout.EndHorizontal();
        }
        static void Drawer_SectionDynamicResolutionSettings(SerializedHDRenderPipelineAsset serialized, Editor owner)
        {
            EditorGUILayout.PropertyField(serialized.renderPipelineSettings.dynamicResolutionSettings.enabled, k_Enabled);

            ++EditorGUI.indentLevel;
            using (new EditorGUI.DisabledScope(!serialized.renderPipelineSettings.dynamicResolutionSettings.enabled.boolValue))
            {
                EditorGUILayout.PropertyField(serialized.renderPipelineSettings.dynamicResolutionSettings.dynamicResType, k_DynResType);
                if ((DynamicResolutionType)serialized.renderPipelineSettings.dynamicResolutionSettings.dynamicResType.intValue == DynamicResolutionType.Software)
                {
                    EditorGUILayout.PropertyField(serialized.renderPipelineSettings.dynamicResolutionSettings.softwareUpsamplingFilter, k_UpsampleFilter);
                }
                if (!serialized.renderPipelineSettings.dynamicResolutionSettings.forcePercentage.boolValue)
                {
                    SerializedProperty minPercentage = serialized.renderPipelineSettings.dynamicResolutionSettings.minPercentage;
                    SerializedProperty maxPercentage = serialized.renderPipelineSettings.dynamicResolutionSettings.maxPercentage;

                    maxPercentage.floatValue = Mathf.Clamp(maxPercentage.floatValue, 0.0f, 100.0f);
                    minPercentage.floatValue = Mathf.Clamp(minPercentage.floatValue, 0.0f, maxPercentage.floatValue);

                    EditorGUILayout.DelayedFloatField(minPercentage, k_MinPercentage);
                    EditorGUILayout.DelayedFloatField(maxPercentage, k_MaxPercentage);
                }

                EditorGUILayout.PropertyField(serialized.renderPipelineSettings.dynamicResolutionSettings.forcePercentage, k_ForceScreenPercentage);
                if (serialized.renderPipelineSettings.dynamicResolutionSettings.forcePercentage.boolValue)
                {
                    SerializedProperty forcePercentage = serialized.renderPipelineSettings.dynamicResolutionSettings.forcedPercentage;
                    forcePercentage.floatValue = Mathf.Clamp(forcePercentage.floatValue, 0.0f, 100.0f);
                    EditorGUILayout.DelayedFloatField(forcePercentage, k_ForcedScreenPercentage);
                }
            }
            --EditorGUI.indentLevel;
        }
Exemplo n.º 10
0
    void OnGUI()
    {
        Color    myColor = new Color(0.933f, 0, 0, 1);
        GUIStyle s       = new GUIStyle(EditorStyles.boldLabel);

        s.normal.textColor = myColor;

        saveTime = EditorGUILayout.DelayedFloatField("Sauvegarder toutes les: ", saveTime);

        if (GUI.changed)
        {
            nextSave = saveTime;
        }
        float timeToSave = nextSave - (float)EditorApplication.timeSinceStartup;

        EditorGUILayout.LabelField("Prochaine sauvegarde:", Mathf.Round(timeToSave).ToString() + " sec");
        EditorGUILayout.LabelField("  /!\\Ne pas fermer cette fenêtre/!\\", s);
        Repaint();
        if (EditorApplication.timeSinceStartup > nextSave)
        {
            string[] path   = EditorSceneManager.GetActiveScene().path.Split(char.Parse("/"));
            bool     saveOK = EditorSceneManager.SaveScene(EditorSceneManager.GetActiveScene(), string.Join("/", path));
            Debug.Log("Etat de la sauvegarde" + (saveOK ? "Succès !" : "Erreur !"));
            nextSave = (float)EditorApplication.timeSinceStartup + saveTime;
        }
    }
Exemplo n.º 11
0
		private bool DrawDetailsGeometry()
		{
			bool bChanged = false;

			EditorGUIUtility.labelWidth = 250;

			// TODO
			{
				bool oldValue = HEU_PluginSettings.Curves_ShowInSceneView;
				bool newValue = HEU_EditorUI.DrawToggleLeft(oldValue, "Show Curves in Scene View");
				if (newValue != oldValue)
				{
					HEU_PluginSettings.Curves_ShowInSceneView = newValue;
					HEU_HoudiniAsset.SetCurvesVisibilityInScene(newValue);
					bChanged = true;
				}
			}
			HEU_EditorUI.DrawSeparator();
			{
				float oldValue = HEU_PluginSettings.NormalGenerationThresholdAngle;
				float newValue = EditorGUILayout.DelayedFloatField("Normal Generation Threshold Angle", oldValue);
				if (newValue != oldValue)
				{
					HEU_PluginSettings.NormalGenerationThresholdAngle = newValue;
					bChanged = true;
				}
			}
			HEU_EditorUI.DrawSeparator();

			EditorGUIUtility.labelWidth = 0;

			return bChanged;
		}
        public override void OnInspectorGUI()
        {
            UITabNavigator b = style as UITabNavigator;

            _picker.Draw(style);
            EditorGUI.BeginChangeCheck();
            b.alignment      = (UITabNavigagor_Dll.TabAlignment)EditorGUILayout.EnumPopup("Aligment", b.alignment);
            b.interval       = EditorGUILayout.DelayedFloatField("Interval", b.interval);
            b.unselectMargin = EditorGUILayout.DelayedFloatField("UnSelected Margin", b.unselectMargin);
            b.multiLang      = EditorGUILayout.Toggle("Multi Lang", b.multiLang);
            b.langKey        = EditorGUILayout.TextField("Lang Key", b.langKey);
            DrawSeperator();
            GUILayout.Space(5);
            _listDrawer.Draw(serializedObject);
            if (EditorGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(b);
            }
            _showText = EditorGUILayout.Foldout(_showText, "Text Style", true);
            if (_showText)
            {
                EditorGUI.BeginChangeCheck();
                if (b.textStyle.owner == null)
                {
                    b.textStyle.owner = b;
                }
                _textEditor.Draw(b.textStyle);
                if (EditorGUI.EndChangeCheck())
                {
                    EditorUtility.SetDirty(b);
                }
            }
            DrawSolovView();
            GUILayout.Space(10);
        }
Exemplo n.º 13
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            var   obj = fieldInfo.GetValue(property.serializedObject.targetObject);
            Range r   = obj as Range;

            if (obj.GetType().IsArray)
            {
                var index = Convert.ToInt32(new string(property.propertyPath.Where(c => char.IsDigit(c)).ToArray()));
                r = ((Range[])obj)[index];
            }

            float valueA = (float)r.GetType().GetField("valueA", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetValue(r);
            float valueB = (float)r.GetType().GetField("valueB", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetValue(r);

            float min = (float)r.GetType().GetProperty("Min", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance).GetValue(r, null);
            float max = (float)r.GetType().GetProperty("Max", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance).GetValue(r, null);

            string minMaxLabelString = string.Format("[{0},{1}]", min, max);

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(label.text, GUILayout.MaxWidth(label.text.Length * 8));
            EditorGUILayout.LabelField(minMaxLabelString, GUILayout.MaxWidth(20 + minMaxLabelString.Length * 7));
            EditorGUILayout.LabelField("ValueA", GUILayout.MaxWidth(58));
            r.ValueA = EditorGUILayout.DelayedFloatField(valueA, GUILayout.MaxWidth(58));
            EditorGUILayout.LabelField("ValueB", GUILayout.MaxWidth(58));
            r.ValueB = EditorGUILayout.DelayedFloatField(valueB, GUILayout.MaxWidth(58));
            EditorGUILayout.EndHorizontal();
        }
Exemplo n.º 14
0
        public static void DrawValueWrapperField(NodeValueWrapper valueWrapper)
        {
            var fieldValue = valueWrapper.ToString();

            const string prefix = "Value";

            if (valueWrapper.ValueType == typeof(float))
            {
                var variableAsType = valueWrapper as NodeValueWrapper <float>;
                variableAsType.Set(EditorGUILayout.DelayedFloatField(prefix, variableAsType.Value));
            }
            else if (valueWrapper.ValueType == typeof(int))
            {
                var variableAsType = valueWrapper as NodeValueWrapper <int>;
                variableAsType.Set(EditorGUILayout.DelayedIntField(prefix, variableAsType.Value));
            }
            else if (valueWrapper.ValueType == typeof(bool))
            {
                var variableAsType = valueWrapper as NodeValueWrapper <bool>;
                variableAsType.Set(EditorGUILayout.Toggle(prefix, variableAsType.Value));
            }
            else if (valueWrapper.ValueType == typeof(string))
            {
                var variableAsType = valueWrapper as NodeValueWrapper <string>;
                variableAsType.Set(EditorGUILayout.DelayedTextField(prefix, variableAsType.Value));
            }
        }
Exemplo n.º 15
0
        public override void OnInspectorGUI()
        {
            UTween o = this.target as UTween;

            EGUIUtility.EnumPop(ProMode, "Mode");
            DrawCounter(o);
            DrawGroupNumber(o);
            OnDrawChildren();
            EditorGUILayout.DelayedFloatField(ProDuration, NAME_DURATION);
            EditorGUILayout.DelayedFloatField(ProDelayTime, NAME_DELAYTIME);
            if (ProDuration.floatValue <= 0)
            {
                ProDuration.floatValue = 1f;
            }
            if (ProDelayTime.floatValue < 0)
            {
                ProDelayTime.floatValue = 0;
            }
            //Rect rect = new Rect(Vector2.zero, Vector2.one);
            //rect.xMin = -100;
            //rect.xMax = 100;
            //rect.yMin = -100;
            //rect.yMax = 100;
            //rect.center = new Vector2(0.5f,0.5f);
            //rect.x = 0;
            //rect.y = 0;
            //EditorGUILayout.CurveField(ProCurve, Color.green, rect, NAME_CURVE, GUILayout.Height(80));
            ProCurve.animationCurveValue = EditorGUILayout.CurveField(ProCurve.animationCurveValue, GUILayout.Height(80));
            DrawToggle();

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

        SerializedProperty movementType = serializedObject.FindProperty("TypeOfMovement");

        movementType.enumValueIndex = (int)(MovementType)EditorGUILayout.EnumPopup("Type Of Movement", (MovementType)movementType.enumValueIndex);

        switch ((MovementType)movementType.enumValueIndex)
        {
        case MovementType.RotateAroundPivot:
            SerializedProperty flipped = serializedObject.FindProperty("Flipped");
            flipped.boolValue = EditorGUILayout.Toggle("Is Flipped", flipped.boolValue);

            SerializedProperty pivot = serializedObject.FindProperty("Pivot");
            pivot.objectReferenceValue = EditorGUILayout.ObjectField("Pivot", pivot.objectReferenceValue, typeof(GameObject), true) as GameObject;

            SerializedProperty endAngle = serializedObject.FindProperty("EndAngle");
            endAngle.floatValue = EditorGUILayout.FloatField("End Angle", endAngle.floatValue);
            break;

        case MovementType.LookDirectional:
            SerializedProperty DistanceToMoveCollider = serializedObject.FindProperty("DistanceToMoveCollider");
            DistanceToMoveCollider.floatValue = EditorGUILayout.DelayedFloatField("Distance To Move Collider", DistanceToMoveCollider.floatValue);

            //SerializedProperty StartingAction = serializedObject.FindProperty("StartingAction");
            //StartingAction.enumValueIndex = (int)(Actions)EditorGUILayout.EnumPopup("Starting Action", (Actions)StartingAction.enumValueIndex);
            break;
        }

        serializedObject.ApplyModifiedProperties();
    }
Exemplo n.º 17
0
        public override void OnInspectorGUI()
        {
            _picker.Draw(style);
            GUILayout.Space(5);
            UISlider b = style as UISlider;

            if (b != null)
            {
                EditorGUI.BeginChangeCheck();
                b.direction = (Slider.Direction)EditorGUILayout.EnumPopup("Direction", b.direction);
                b.minValue  = b.wholeNumbers
                    ? EditorGUILayout.DelayedIntField("Min Value", (int)b.minValue)
                    : EditorGUILayout.DelayedFloatField("Min Value", b.minValue);
                b.maxValue = b.wholeNumbers
                    ? EditorGUILayout.DelayedIntField("Max Value", (int)b.maxValue)
                    : EditorGUILayout.DelayedFloatField("Max Value", b.maxValue);
                b.wholeNumbers = EditorGUILayout.Toggle("Whole Numbers", b.wholeNumbers);
                b.value        = EditorGUILayout.Slider("Value", b.value, b.minValue, b.maxValue);
                if (EditorGUI.EndChangeCheck())
                {
                    EditorUtility.SetDirty(b);
                }
            }

            GUILayout.Space(10);
        }
        public override void OnInspectorGUI()
        {
            _picker.Draw(style);
            GUILayout.Space(5);
            UIResourceField b = style as UIResourceField;

            if (b != null)
            {
                EditorGUI.BeginChangeCheck();
                b.resourceType = EditorGUILayout.DelayedIntField("ResourceType", b.resourceType);
                b.value        = EditorGUILayout.DelayedFloatField("Value", b.value);
                EditorGUI.indentLevel++;
                _drawTextSetting = EditorGUILayout.Foldout(_drawTextSetting, "Caption Text", true);
                if (_drawTextSetting)
                {
                    EditorGUI.indentLevel++;
                    _textStyle.Draw(b.textStyle);
                    EditorGUI.indentLevel--;
                }

                if (EditorGUI.EndChangeCheck())
                {
                    EditorUtility.SetDirty(b);
                }
                EditorGUI.indentLevel--;
            }
            DrawSolovView();
            GUILayout.Space(10);
        }
Exemplo n.º 19
0
    public override void DrawInspector()
    {
        GUILayout.BeginVertical("box");

        GUILayout.BeginHorizontal();
        GUILayout.Space(40);
        GUILayout.Label("Range");
        amountMin = EditorGUILayout.DelayedFloatField(amountMin, GUILayout.Width(42));
        if (amountMin < 0)
        {
            amountMin = 0;
        }
        GUILayout.Label("-");
        amountMax = EditorGUILayout.DelayedFloatField(amountMax, GUILayout.Width(42));
        if (amountMax < amountMin)
        {
            amountMax = amountMin;
        }
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        if (exposeTimeControls)
        {
            GUILayout.BeginHorizontal();
            GUILayout.Space(40);
            GUILayout.Label("Pulse Every ");
            pulse = EditorGUILayout.DelayedFloatField(pulse, GUILayout.Width(42));
            GUILayout.Label("Seconds");
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
        }

        GUILayout.EndVertical();
    }
        public static bool EditorDrawVector2RelativeProperty(SerializedProperty parentProperty, string parameterName, string label, string tooltip)
        {
            bool bChanged = false;
            SerializedProperty valueProperty = parentProperty.FindPropertyRelative(parameterName);

            if (valueProperty != null)
            {
                Vector2 vec2Value = valueProperty.vector2Value;
                using (new EditorGUILayout.HorizontalScope())
                {
                    GUIContent labelContent = new GUIContent(label, tooltip);
                    EditorGUILayout.PrefixLabel(labelContent);

                    // To align with rest of UI due to prefix
                    GUILayout.Space(-30);

                    vec2Value.x = EditorGUILayout.DelayedFloatField(vec2Value.x);
                    GUILayout.Space(-20);
                    vec2Value.y = EditorGUILayout.DelayedFloatField(vec2Value.y);
                }

                if (vec2Value != valueProperty.vector2Value)
                {
                    valueProperty.vector2Value = vec2Value;
                    bChanged = true;
                }
            }
            return(bChanged);
        }
Exemplo n.º 21
0
        public static bool editDelayed(ref float val, int width)
        {
            BeginCheckLine();
            val = EditorGUILayout.DelayedFloatField(val, GUILayout.MaxWidth(width));
            return(EndCheckLine());

            /* if (KeyCode.Return.IsDown() && (_elementIndex == _editedFloatIndex))
             * {
             *   checkLine();
             *   EditorGUILayout.FloatField(val, GUILayout.Width(width));
             *   val = _editedFloat;
             *   _elementIndex++;
             *   _editedFloatIndex = -1;
             *   return change;
             * }
             *
             * var tmp = val;
             * if (edit(ref tmp, width).ignoreChanges())
             * {
             *   _editedFloat = tmp;
             *   _editedFloatIndex = _elementIndex;
             * }
             *
             * _elementIndex++;
             *
             * return false;*/
        }
Exemplo n.º 22
0
 public override void OnInspectorGUI()
 {
     EditorGUI.BeginDisabledGroup(true);
     EditorGUILayout.ObjectField(new GUIContent("Script"), MonoScript.FromMonoBehaviour((EventConditions)target), typeof(EventConditions), true);
     EditorGUI.EndDisabledGroup();
     serializedObject.Update();
     EditorGUILayout.PropertyField(constantCheck);
     if (GUI.changed && EditorApplication.isPlaying)
     {
         serializedObject.ApplyModifiedProperties();
         (serializedObject.targetObject as EventConditions).constantCheck = constantCheck.boolValue;
         GUI.changed = false;
     }
     EditorGUILayout.DelayedFloatField(checkRate);
     if (GUI.changed && EditorApplication.isPlaying)
     {
         serializedObject.ApplyModifiedProperties();
         (serializedObject.targetObject as EventConditions).checkRate = checkRate.floatValue;
         GUI.changed = false;
     }
     GUILayout.Space(2);
     conditionList.DoLayoutList();
     EditorTool.AddSpecialSpace(0);
     EditorGUILayout.PropertyField(satisfiedEvent);
     EditorGUILayout.PropertyField(unsatisfiedEvent);
     serializedObject.ApplyModifiedProperties();
 }
Exemplo n.º 23
0
        public static Vector2 DelayedVector2Field(Vector2 vectorValue, int width)
        {
            Vector2 result = vectorValue;

            EditorGUILayout.BeginHorizontal(GUILayout.Width(width));
            if (width > 100)
            {
                int widthLabel = 15;
                int widthData  = ((width - ((15 + 2) * 2)) / 2) - 2;
                EditorGUILayout.LabelField("X", GUILayout.Width(widthLabel));
                result.x = EditorGUILayout.DelayedFloatField(vectorValue.x, GUILayout.Width(widthData));

                EditorGUILayout.LabelField("Y", GUILayout.Width(widthLabel));
                result.y = EditorGUILayout.DelayedFloatField(vectorValue.y, GUILayout.Width(widthData));
            }
            else
            {
                int widthData = (width / 2) - 2;
                result.x = EditorGUILayout.DelayedFloatField(vectorValue.x, GUILayout.Width(widthData));
                result.y = EditorGUILayout.DelayedFloatField(vectorValue.y, GUILayout.Width(widthData));
            }



            EditorGUILayout.EndHorizontal();

            return(result);
        }
Exemplo n.º 24
0
		private bool DrawToolSettings()
		{
			bool bChanged = false;

			HEU_EditorUI.DrawSeparator();
			{
				float oldValue = HEU_PluginSettings.ImageGamma;
				float newValue = EditorGUILayout.DelayedFloatField("Texture Gamma", oldValue);
				if (newValue != oldValue)
				{
					HEU_PluginSettings.ImageGamma = newValue;
					bChanged = true;
				}
			}
			HEU_EditorUI.DrawSeparator();
			{
				Color oldValue = HEU_PluginSettings.LineColor;
				Color newValue = EditorGUILayout.ColorField("Line Color", oldValue);
				if (newValue != oldValue)
				{
					HEU_PluginSettings.LineColor = newValue;
					bChanged = true;
				}
			}
			HEU_EditorUI.DrawSeparator();

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

        EditorGUILayout.PropertyField(prefab, new GUIContent("Prefab"), true);
        layerMask.intValue    = EditorGUILayout.LayerField(new GUIContent("Layer Mask"), layerMask.intValue);
        prefabTag.stringValue = EditorGUILayout.TagField(new GUIContent("Prefab Tag"), prefabTag.stringValue);
        EditorGUILayout.PropertyField(randomizePrefab, new GUIContent("Randomize Prefab"));

        if (!randomizePrefab.boolValue)
        {
            EditorGUILayout.DelayedIntField(toInstantiate, new GUIContent("Prefab Index"));
        }
        else
        {
            EditorGUILayout.DelayedIntField(minRage, new GUIContent("minRage"));
            EditorGUILayout.DelayedIntField(maxRage, new GUIContent("maxRage"));
        }

        EditorGUILayout.PropertyField(canPlaceOver, new GUIContent("Override"));
        EditorGUILayout.Slider(spread, 1, 10, new GUIContent("Spread"));
        EditorGUILayout.Slider(radius, 1, 10, new GUIContent("Radius"));
        EditorGUILayout.IntSlider(amount, 1, 50, new GUIContent("Amount"));
        EditorGUILayout.Slider(size, 0.1f, 10, new GUIContent("Size"));
        EditorGUILayout.PropertyField(canAling, new GUIContent("Aling with normal"));
        EditorGUILayout.DelayedFloatField(positionOffset, new GUIContent("yOffset"));
        EditorGUILayout.PropertyField(isRandomS, new GUIContent("Randomize Size"));
        EditorGUILayout.PropertyField(isRandomR, new GUIContent("Randomize Rotation"));
        EditorGUILayout.PropertyField(hideInHierarchy, new GUIContent("Hide in Hierarchy"));

        serializedObject.ApplyModifiedProperties();
    }
Exemplo n.º 26
0
 protected override void OnGUI()
 {
     base.OnGUI();
     if (GUILayout.Button("Refresh"))
     {
         Refresh();
     }
     EditorGUILayout.Space();
     scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition);
     for (int i = 0; i < pairList.Count; i++)
     {
         EditorGUILayout.BeginHorizontal();
         string    key  = pairList[i].key;
         ValueType type = pairList[i].type;
         if (type == ValueType.String)
         {
             EditorGUILayout.LabelField("string", new GUILayoutOption[] { GUILayout.Width(40), });
             string input = EditorGUILayout.DelayedTextField(key, PlayerPrefs.GetString(key));
             if (input != PlayerPrefs.GetString(key))
             {
                 PlayerPrefs.SetString(key, input);
             }
         }
         else if (type == ValueType.Int)
         {
             EditorGUILayout.LabelField("int", new GUILayoutOption[] { GUILayout.Width(40), });
             int input = EditorGUILayout.DelayedIntField(key, PlayerPrefs.GetInt(key));
             if (input != PlayerPrefs.GetInt(key))
             {
                 PlayerPrefs.SetInt(key, input);
             }
         }
         else if (type == ValueType.Float)
         {
             EditorGUILayout.LabelField("float", new GUILayoutOption[] { GUILayout.Width(40), });
             float input = EditorGUILayout.DelayedFloatField(key, PlayerPrefs.GetFloat(key));
             if (input != PlayerPrefs.GetFloat(key))
             {
                 PlayerPrefs.SetFloat(key, input);
             }
         }
         else
         {
             EditorGUILayout.TextField(key, "Unknown Type");
         }
         if (GUILayout.Button("Delete", new GUILayoutOption[] { GUILayout.Width(80), }))
         {
             PlayerPrefs.DeleteKey(key);
             Refresh();
         }
         EditorGUILayout.EndHorizontal();
     }
     if (GUILayout.Button("Delete All"))
     {
         PlayerPrefs.DeleteAll();
         Refresh();
     }
     EditorGUILayout.EndScrollView();
 }
 public override void OnInspectorGUI()
 {
     serializedObject.Update();
     controlPointList.DoLayoutList();
     EditorGUILayout.Space();
     periodProp.floatValue = Mathf.Max(EditorGUILayout.DelayedFloatField("Period", periodProp.floatValue), 0.001f);
     serializedObject.ApplyModifiedProperties();
 }
Exemplo n.º 28
0
 void GenLvlGenFunctionsUI(int mappingIndex)
 {
     EditorGUILayout.BeginVertical();
     functionIndices[mappingIndex] = EditorGUILayout.Popup("Function to Call", functionIndices[mappingIndex], methodSigs);
     ParameterInfo[] parameters = methods[functionIndices[mappingIndex]].GetParameters();
     ResizeList(functionArguments[mappingIndex], parameters.Length);
     EditorGUILayout.BeginHorizontal();
     for (int i = 0; i < parameters.Length; ++i)
     {
         System.Type type = parameters[i].ParameterType;
         if (type.IsSubclassOf(typeof(Object)))
         {
             if (functionArguments[mappingIndex][i] != null && !functionArguments[mappingIndex][i].GetType().IsSubclassOf(typeof(Object)))
             {
                 functionArguments[mappingIndex][i] = null;
             }
             functionArguments[mappingIndex][i] = EditorGUILayout.ObjectField((Object)functionArguments[mappingIndex][i], type, false);
         }
         else if (type.IsEnum)
         {
             if (functionArguments[mappingIndex][i] != null && !functionArguments[mappingIndex][i].GetType().IsEnum)
             {
                 functionArguments[mappingIndex][i] = null;
             }
             if (functionArguments[mappingIndex][i] == null)
             {
                 functionArguments[mappingIndex][i] = (System.Enum)System.Activator.CreateInstance(type);
             }
             functionArguments[mappingIndex][i] = EditorGUILayout.EnumPopup((System.Enum)functionArguments[mappingIndex][i]);
         }
         else if (type.Equals(typeof(int)))
         {
             if (functionArguments[mappingIndex][i] != null && !functionArguments[mappingIndex][i].GetType().Equals(typeof(int)))
             {
                 functionArguments[mappingIndex][i] = null;
             }
             if (functionArguments[mappingIndex][i] == null)
             {
                 functionArguments[mappingIndex][i] = 0;
             }
             functionArguments[mappingIndex][i] = EditorGUILayout.DelayedIntField((int)functionArguments[mappingIndex][i]);
         }
         else if (type.Equals(typeof(float)))
         {
             if (functionArguments[mappingIndex][i] != null && !functionArguments[mappingIndex][i].GetType().Equals(typeof(float)))
             {
                 functionArguments[mappingIndex][i] = null;
             }
             if (functionArguments[mappingIndex][i] == null)
             {
                 functionArguments[mappingIndex][i] = 0.0f;
             }
             functionArguments[mappingIndex][i] = EditorGUILayout.DelayedFloatField((float)functionArguments[mappingIndex][i]);
         }
     }
     EditorGUILayout.EndHorizontal();
     EditorGUILayout.EndVertical();
 }
        void LayoutInfoPanel(Rect rect)
        {
            GUILayout.BeginArea(rect, EditorStyles.inspectorFullWidthMargins);
            GUILayout.Space(20);

            // Animation length
            EditorGUILayout.LabelField(string.Format("Length: {0:0.00} sec  {1:D} samples", m_clip.length, Mathf.RoundToInt(m_clip.length / GetMinFrameTime())), new GUIStyle(EditorStyles.miniLabel)
            {
                normal = { textColor = Color.gray }
            });

            // Speed/Framerate
            GUI.SetNextControlName("Framerate");
            float newFramerate = EditorGUILayout.DelayedFloatField("Sample Rate", m_clip.frameRate);

            if (Mathf.Approximately(newFramerate, m_clip.frameRate) == false)
            {
                ChangeFrameRate(newFramerate, true);
            }
            GUI.SetNextControlName("Length");
            float oldLength = Utils.Snap(m_clip.length, 0.05f);
            float newLength = Utils.Snap(EditorGUILayout.FloatField("Length (sec)", oldLength), 0.05f);

            if (Mathf.Approximately(newLength, oldLength) == false && newLength > 0)
            {
                newFramerate = Mathf.Max(Utils.Snap((m_clip.frameRate * (m_clip.length / newLength)), 1), 1);
                ChangeFrameRate(newFramerate, false);
            }

            // Looping tickbox
            bool looping = EditorGUILayout.Toggle("Looping", m_clip.isLooping);

            if (looping != m_clip.isLooping)
            {
                ChangeLooping(looping);
            }

            // UI Image option- Done as an enum to be clearer
            eAnimSpriteType animSpriteType = (eAnimSpriteType)EditorGUILayout.EnumPopup("Animated Sprite Type", m_uiImage ? eAnimSpriteType.UIImage : eAnimSpriteType.Sprite);

            SetIsUIImage(animSpriteType == eAnimSpriteType.UIImage);

            GUILayout.Space(10);

            // Frames list
            m_scrollPosition = EditorGUILayout.BeginScrollView(m_scrollPosition, false, false);
            EditorGUI.BeginChangeCheck();
            m_framesReorderableList.DoLayoutList();
            if (EditorGUI.EndChangeCheck())
            {
                RecalcFrameTimes();
                Repaint();
                ApplyChanges();
            }
            EditorGUILayout.EndScrollView();

            GUILayout.EndArea();
        }
Exemplo n.º 30
0
        // GUI
        //------------------------------------------------------------------
        void OnGUI()
        {
            int width  = (int)position.width;
            int height = (int)position.height;

            if (_editor == null || _targetPortrait == null)
            {
                CloseDialog();
                return;
            }

            //만약 Portriat가 바뀌었거나 Editor가 리셋되면 닫자
            if (_editor != apEditor.CurrentEditor || _targetPortrait != apEditor.CurrentEditor._portrait)
            {
                CloseDialog();
                return;
            }

            //Bake 설정
            EditorGUILayout.LabelField("Bake Setting");
            GUILayout.Space(5);

            EditorGUILayout.ObjectField("Portait", _targetPortrait, typeof(apPortrait), true);

            GUILayout.Space(5);

            float nextRootScale = EditorGUILayout.DelayedFloatField("Bake Scale", _targetPortrait._bakeScale);

            //GUILayout.Space(5);
            //float nextPhysicsScale = EditorGUILayout.DelayedFloatField("Physic Scale", _targetPortrait._physicBakeScale);


            CheckChangedProperties(nextRootScale);

            GUILayout.Space(10);


            if (GUILayout.Button("Bake", GUILayout.Height(30)))
            {
                GUI.FocusControl(null);

                CheckChangedProperties(nextRootScale);

                _editor.Controller.PortraitBake();
                _editor.Notification("[" + _targetPortrait.name + "] is Baked", false, false);
            }

            GUILayout.Space(5);
            if (GUILayout.Button("Optimized Bake", GUILayout.Height(30)))
            {
                GUI.FocusControl(null);

                CheckChangedProperties(nextRootScale);

                Debug.LogError("TODO : Opt Bake");
                _editor.Notification("[" + _targetPortrait.name + "] is Baked (Optimized)", false, false);
            }
        }