GetControlRect() protected static method

protected static GetControlRect ( int height ) : Rect
height int
return Rect
示例#1
0
        public static bool GUIToggle(GUIContent guiContent, SerializedProperty boolProp, params GUILayoutOption[] layoutOptions)
        {
            Rect rect = ModuleUI.GetControlRect(13, layoutOptions);

            rect = ModuleUI.PrefixLabel(rect, guiContent);
            return(ModuleUI.Toggle(rect, boolProp));
        }
示例#2
0
        public static float GUIFloat(GUIContent guiContent, SerializedProperty floatProp, string formatString, params GUILayoutOption[] layoutOptions)
        {
            Rect controlRect = ModuleUI.GetControlRect(13, layoutOptions);

            ModuleUI.PrefixLabel(controlRect, guiContent);
            return(ModuleUI.FloatDraggable(controlRect, floatProp, 1f, EditorGUIUtility.labelWidth, formatString));
        }
示例#3
0
        public static int GUIPopup(GUIContent label, SerializedProperty intProp, string[] options)
        {
            Rect position = ModuleUI.PrefixLabel(ModuleUI.GetControlRect(13), label);

            intProp.intValue = EditorGUI.Popup(position, intProp.intValue, options, ParticleSystemStyles.Get().popup);
            return(intProp.intValue);
        }
示例#4
0
        public static int GUIPopup(GUIContent label, int intValue, string[] options)
        {
            Rect rect = ModuleUI.GetControlRect(13);

            rect = ModuleUI.PrefixLabel(rect, label);
            return(EditorGUI.Popup(rect, intValue, options, ParticleSystemStyles.Get().popup));
        }
示例#5
0
        public static Vector3 GUIVector3Field(GUIContent guiContent, SerializedProperty vecProp)
        {
            Rect rect = ModuleUI.GetControlRect(13);

            rect = ModuleUI.PrefixLabel(rect, guiContent);
            GUIContent[] array = new GUIContent[]
            {
                new GUIContent("X"),
                new GUIContent("Y"),
                new GUIContent("Z")
            };
            float num = (rect.width - 8f) / 3f;

            rect.width = num;
            Vector3 vector3Value = vecProp.vector3Value;

            for (int i = 0; i < 3; i++)
            {
                ModuleUI.Label(rect, array[i]);
                vector3Value[i] = ModuleUI.FloatDraggable(rect, vector3Value[i], 1f, 25f, "g5");
                rect.x         += num + 4f;
            }
            vecProp.vector3Value = vector3Value;
            return(vector3Value);
        }
示例#6
0
        public static void GUILayerMask(GUIContent guiContent, SerializedProperty boolProp)
        {
            Rect rect = ModuleUI.GetControlRect(13);

            rect = ModuleUI.PrefixLabel(rect, guiContent);
            EditorGUI.LayerMaskField(rect, boolProp, GUIContent.none, ParticleSystemStyles.Get().popup);
        }
示例#7
0
        public static int GUIMask(GUIContent label, int intValue, string[] options, params GUILayoutOption[] layoutOptions)
        {
            Rect rect = ModuleUI.GetControlRect(13, layoutOptions);

            rect = ModuleUI.PrefixLabel(rect, label);
            return(EditorGUI.MaskField(rect, label, intValue, options, ParticleSystemStyles.Get().popup));
        }
示例#8
0
        public static void GUIObject(GUIContent label, SerializedProperty objectProp)
        {
            Rect rect = ModuleUI.GetControlRect(13);

            rect = ModuleUI.PrefixLabel(rect, label);
            EditorGUI.ObjectField(rect, objectProp, null, GUIContent.none, ParticleSystemStyles.Get().objectField);
        }
示例#9
0
        public static float GUIFloat(GUIContent guiContent, float floatValue, string formatString)
        {
            Rect controlRect = ModuleUI.GetControlRect(13);

            ModuleUI.PrefixLabel(controlRect, guiContent);
            return(ModuleUI.FloatDraggable(controlRect, floatValue, 1f, EditorGUIUtility.labelWidth, formatString));
        }
示例#10
0
        public static Enum GUIEnumMask(GUIContent label, Enum enumValue)
        {
            Rect rect = ModuleUI.GetControlRect(13);

            rect = ModuleUI.PrefixLabel(rect, label);
            return(EditorGUI.EnumMaskField(rect, enumValue, ParticleSystemStyles.Get().popup));
        }
示例#11
0
        public static bool GUIToggle(GUIContent guiContent, SerializedProperty boolProp)
        {
            Rect rect = ModuleUI.GetControlRect(13);

            rect = ModuleUI.PrefixLabel(rect, guiContent);
            return(ModuleUI.Toggle(rect, boolProp));
        }
示例#12
0
        public static bool GUIToggle(GUIContent guiContent, bool boolValue)
        {
            Rect rect = ModuleUI.GetControlRect(13);

            rect      = ModuleUI.PrefixLabel(rect, guiContent);
            boolValue = EditorGUI.Toggle(rect, boolValue, ParticleSystemStyles.Get().toggle);
            return(boolValue);
        }
示例#13
0
        public static int GUIPopup(GUIContent label, SerializedProperty intProp, string[] options, params GUILayoutOption[] layoutOptions)
        {
            Rect rect = ModuleUI.GetControlRect(13, layoutOptions);

            rect             = ModuleUI.PrefixLabel(rect, label);
            intProp.intValue = EditorGUI.Popup(rect, intProp.intValue, options, ParticleSystemStyles.Get().popup);
            return(intProp.intValue);
        }
示例#14
0
        private void DoBurstGUI(InitialModuleUI initial)
        {
            EditorGUILayout.Space();
            Rect controlRect = ModuleUI.GetControlRect(13, new GUILayoutOption[0]);

            GUI.Label(controlRect, EmissionModuleUI.s_Texts.burst, ParticleSystemStyles.Get().label);
            this.m_BurstList.displayAdd = (this.m_Bursts.arraySize < 8);
            this.m_BurstList.DoLayoutList();
        }
示例#15
0
        public static void GUIIntDraggableX2(GUIContent mainLabel, GUIContent label1, SerializedProperty intProp1, GUIContent label2, SerializedProperty intProp2)
        {
            Rect  rect1 = ModuleUI.PrefixLabel(ModuleUI.GetControlRect(13), mainLabel);
            float width = (float)(((double)rect1.width - 4.0) * 0.5);
            Rect  rect2 = new Rect(rect1.x, rect1.y, width, rect1.height);

            ModuleUI.IntDraggable(rect2, label1, intProp1, 10f);
            rect2.x += width + 4f;
            ModuleUI.IntDraggable(rect2, label2, intProp2, 10f);
        }
示例#16
0
        public static bool GUIBoolAsPopup(GUIContent label, SerializedProperty boolProp, string[] options)
        {
            Rect position      = ModuleUI.PrefixLabel(ModuleUI.GetControlRect(13), label);
            int  selectedIndex = !boolProp.boolValue ? 0 : 1;
            int  num           = EditorGUI.Popup(position, selectedIndex, options, ParticleSystemStyles.Get().popup);

            if (num != selectedIndex)
            {
                boolProp.boolValue = num > 0;
            }
            return(num > 0);
        }
示例#17
0
        public static void GUIIntDraggableX2(GUIContent mainLabel, GUIContent label1, SerializedProperty intProp1, GUIContent label2, SerializedProperty intProp2)
        {
            Rect totalPosition = ModuleUI.GetControlRect(13);

            totalPosition = ModuleUI.PrefixLabel(totalPosition, mainLabel);
            float num  = (totalPosition.width - 4f) * 0.5f;
            Rect  rect = new Rect(totalPosition.x, totalPosition.y, num, totalPosition.height);

            ModuleUI.IntDraggable(rect, label1, intProp1, 10f);
            rect.x += num + 4f;
            ModuleUI.IntDraggable(rect, label2, intProp2, 10f);
        }
示例#18
0
        public static void GUIMinMaxSlider(GUIContent label, SerializedProperty vec2Prop, float a, float b)
        {
            Rect controlRect = ModuleUI.GetControlRect(26);

            controlRect.height = 13f;
            controlRect.y     += 3f;
            ModuleUI.PrefixLabel(controlRect, label);
            Vector2 vector2Value = vec2Prop.vector2Value;

            controlRect.y += 13f;
            EditorGUI.MinMaxSlider(controlRect, ref vector2Value.x, ref vector2Value.y, a, b);
            vec2Prop.vector2Value = vector2Value;
        }
示例#19
0
        public static void GUIMinMaxSlider(GUIContent label, SerializedProperty vec2Prop, float a, float b, params GUILayoutOption[] layoutOptions)
        {
            Rect controlRect = ModuleUI.GetControlRect(26, layoutOptions);
            Rect rect        = controlRect;

            rect.height = 13f;
            rect.y     += 3f;
            ModuleUI.PrefixLabel(rect, label);
            Vector2 vector2Value = vec2Prop.vector2Value;

            rect.y += 13f;
            EditorGUI.MinMaxSlider(rect, ref vector2Value.x, ref vector2Value.y, a, b);
            vec2Prop.vector2Value = vector2Value;
        }
示例#20
0
        private void DoBurstGUI(InitialModuleUI initial)
        {
            while (this.m_BurstList.count > this.m_BurstCountCurves.Count)
            {
                SerializedProperty arrayElementAtIndex = this.m_Bursts.GetArrayElementAtIndex(this.m_BurstCountCurves.Count);
                this.m_BurstCountCurves.Add(new SerializedMinMaxCurve(this, EmissionModuleUI.s_Texts.burstCount, arrayElementAtIndex.propertyPath + ".countCurve", false, true));
            }
            EditorGUILayout.Space();
            Rect controlRect = ModuleUI.GetControlRect(13, new GUILayoutOption[0]);

            GUI.Label(controlRect, EmissionModuleUI.s_Texts.burst, ParticleSystemStyles.Get().label);
            this.m_BurstList.displayAdd = (this.m_Bursts.arraySize < 8);
            this.m_BurstList.DoLayoutList();
        }
示例#21
0
        public static bool GUIBoolAsPopup(GUIContent label, SerializedProperty boolProp, string[] options)
        {
            Rect rect = ModuleUI.GetControlRect(13);

            rect = ModuleUI.PrefixLabel(rect, label);
            int num  = (!boolProp.boolValue) ? 0 : 1;
            int num2 = EditorGUI.Popup(rect, num, options, ParticleSystemStyles.Get().popup);

            if (num2 != num)
            {
                boolProp.boolValue = (num2 > 0);
            }
            return(num2 > 0);
        }
示例#22
0
        public static void GUIMinMaxCurve(GUIContent label, SerializedMinMaxCurve mmCurve)
        {
            Rect             controlRect = ModuleUI.GetControlRect(13);
            Rect             popupRect   = ModuleUI.GetPopupRect(controlRect);
            Rect             rect1       = ModuleUI.SubtractPopupWidth(controlRect);
            Rect             position    = ModuleUI.PrefixLabel(rect1, label);
            MinMaxCurveState state       = mmCurve.state;

            switch (state)
            {
            case MinMaxCurveState.k_Scalar:
                float a = ModuleUI.FloatDraggable(rect1, mmCurve.scalar, mmCurve.m_RemapValue, EditorGUIUtility.labelWidth);
                if (!mmCurve.signedRange)
                {
                    mmCurve.scalar.floatValue = Mathf.Max(a, 0.0f);
                    break;
                }
                break;

            case MinMaxCurveState.k_TwoScalars:
                Rect rect2 = position;
                rect2.width = (float)(((double)position.width - 20.0) * 0.5);
                float minConstant = mmCurve.minConstant;
                float maxConstant = mmCurve.maxConstant;
                Rect  rect3       = rect2;
                rect3.xMin -= 20f;
                EditorGUI.BeginChangeCheck();
                float num1 = ModuleUI.FloatDraggable(rect3, minConstant, mmCurve.m_RemapValue, 20f, "g5");
                if (EditorGUI.EndChangeCheck())
                {
                    mmCurve.minConstant = num1;
                }
                rect3.x += rect2.width + 20f;
                EditorGUI.BeginChangeCheck();
                float num2 = ModuleUI.FloatDraggable(rect3, maxConstant, mmCurve.m_RemapValue, 20f, "g5");
                if (EditorGUI.EndChangeCheck())
                {
                    mmCurve.maxConstant = num2;
                    break;
                }
                break;

            default:
                Rect ranges = !mmCurve.signedRange ? ModuleUI.kUnsignedRange : ModuleUI.kSignedRange;
                SerializedProperty minCurve = state != MinMaxCurveState.k_TwoCurves ? (SerializedProperty)null : mmCurve.minCurve;
                ModuleUI.GUICurveField(position, mmCurve.maxCurve, minCurve, ModuleUI.GetColor(mmCurve), ranges, new ModuleUI.CurveFieldMouseDownCallback(mmCurve.OnCurveAreaMouseDown));
                break;
            }
            ModuleUI.GUIMMCurveStateList(popupRect, mmCurve);
        }
示例#23
0
        public static void GUIMinMaxCurve(GUIContent label, SerializedMinMaxCurve mmCurve)
        {
            Rect rect      = ModuleUI.GetControlRect(13);
            Rect popupRect = ModuleUI.GetPopupRect(rect);

            rect = ModuleUI.SubtractPopupWidth(rect);
            Rect             rect2 = ModuleUI.PrefixLabel(rect, label);
            MinMaxCurveState state = mmCurve.state;

            if (state == MinMaxCurveState.k_Scalar)
            {
                float a = ModuleUI.FloatDraggable(rect, mmCurve.scalar, mmCurve.m_RemapValue, EditorGUIUtility.labelWidth);
                if (!mmCurve.signedRange)
                {
                    mmCurve.scalar.floatValue = Mathf.Max(a, 0f);
                }
            }
            else
            {
                if (state == MinMaxCurveState.k_TwoScalars)
                {
                    Rect rect3 = rect2;
                    rect3.width = (rect2.width - 20f) * 0.5f;
                    float num   = mmCurve.minConstant;
                    float num2  = mmCurve.maxConstant;
                    Rect  rect4 = rect3;
                    rect4.xMin -= 20f;
                    EditorGUI.BeginChangeCheck();
                    num = ModuleUI.FloatDraggable(rect4, num, mmCurve.m_RemapValue, 20f, "g5");
                    if (EditorGUI.EndChangeCheck())
                    {
                        mmCurve.minConstant = num;
                    }
                    rect4.x += rect3.width + 20f;
                    EditorGUI.BeginChangeCheck();
                    num2 = ModuleUI.FloatDraggable(rect4, num2, mmCurve.m_RemapValue, 20f, "g5");
                    if (EditorGUI.EndChangeCheck())
                    {
                        mmCurve.maxConstant = num2;
                    }
                }
                else
                {
                    Rect ranges = (!mmCurve.signedRange) ? ModuleUI.kUnsignedRange : ModuleUI.kSignedRange;
                    SerializedProperty minCurve = (state != MinMaxCurveState.k_TwoCurves) ? null : mmCurve.minCurve;
                    ModuleUI.GUICurveField(rect2, mmCurve.maxCurve, minCurve, ModuleUI.GetColor(mmCurve), ranges, new ModuleUI.CurveFieldMouseDownCallback(mmCurve.OnCurveAreaMouseDown));
                }
            }
            ModuleUI.GUIMMCurveStateList(popupRect, mmCurve);
        }
示例#24
0
        public static void GUIObjectFieldAndToggle(GUIContent label, SerializedProperty objectProp, SerializedProperty boolProp)
        {
            Rect rect = ModuleUI.GetControlRect(13);

            rect       = ModuleUI.PrefixLabel(rect, label);
            rect.xMax -= 19f;
            EditorGUI.ObjectField(rect, objectProp, GUIContent.none);
            if (boolProp != null)
            {
                rect.x    += rect.width + 10f;
                rect.width = 9f;
                ModuleUI.Toggle(rect, boolProp);
            }
        }
示例#25
0
        public static void GUIToogleWithIntField(GUIContent guiContent, SerializedProperty boolProp, SerializedProperty intProp, bool invertToggle)
        {
            Rect rect = ModuleUI.GetControlRect(13);

            rect = ModuleUI.PrefixLabel(rect, guiContent);
            bool flag = ModuleUI.Toggle(rect, boolProp);

            flag = ((!invertToggle) ? flag : (!flag));
            if (flag)
            {
                float dragWidth = 25f;
                Rect  rect2     = new Rect(rect.x + EditorGUIUtility.labelWidth + 9f, rect.y, rect.width - 9f, rect.height);
                intProp.intValue = ModuleUI.IntDraggable(rect2, null, intProp.intValue, dragWidth);
            }
        }
示例#26
0
        public static void GUIMinMaxRange(GUIContent label, SerializedProperty vec2Prop)
        {
            Rect    rect         = ModuleUI.PrefixLabel(ModuleUI.SubtractPopupWidth(ModuleUI.GetControlRect(13)), label);
            float   num          = (float)(((double)rect.width - 20.0) * 0.5);
            Vector2 vector2Value = vec2Prop.vector2Value;

            rect.width            = num;
            rect.xMin            -= 20f;
            vector2Value.x        = ModuleUI.FloatDraggable(rect, vector2Value.x, 1f, 20f, "g7");
            vector2Value.x        = Mathf.Clamp(vector2Value.x, 0.0f, vector2Value.y - 0.01f);
            rect.x               += num + 20f;
            vector2Value.y        = ModuleUI.FloatDraggable(rect, vector2Value.y, 1f, 20f, "g7");
            vector2Value.y        = Mathf.Max(vector2Value.x + 0.01f, vector2Value.y);
            vec2Prop.vector2Value = vector2Value;
        }
示例#27
0
        public static void GUIToggleWithIntField(GUIContent guiContent, SerializedProperty boolProp, SerializedProperty intProp, bool invertToggle)
        {
            Rect rect1 = ModuleUI.PrefixLabel(ModuleUI.GetControlRect(13), guiContent);
            Rect rect2 = rect1;

            rect2.xMax = rect2.x + 9f;
            bool flag = ModuleUI.Toggle(rect2, boolProp);

            if (!(!invertToggle ? flag : !flag))
            {
                return;
            }
            float dragWidth = 25f;
            Rect  rect3     = new Rect((float)((double)rect1.x + (double)EditorGUIUtility.labelWidth + 9.0), rect1.y, rect1.width - 9f, rect1.height);

            intProp.intValue = ModuleUI.IntDraggable(rect3, (GUIContent)null, intProp.intValue, dragWidth);
        }
示例#28
0
        public static void GUIToggleWithIntField(GUIContent guiContent, SerializedProperty boolProp, SerializedProperty intProp, bool invertToggle, params GUILayoutOption[] layoutOptions)
        {
            Rect controlRect = ModuleUI.GetControlRect(13, layoutOptions);
            Rect rect        = ModuleUI.PrefixLabel(controlRect, guiContent);
            Rect rect2       = rect;

            rect2.xMax = rect2.x + 9f;
            bool flag = ModuleUI.Toggle(rect2, boolProp);

            flag = ((!invertToggle) ? flag : (!flag));
            if (flag)
            {
                float dragWidth = 25f;
                Rect  rect3     = new Rect(rect2.xMax, controlRect.y, controlRect.width - rect2.xMax + 9f, controlRect.height);
                intProp.intValue = ModuleUI.IntDraggable(rect3, null, intProp.intValue, dragWidth);
            }
        }
示例#29
0
        public void GUIMinMaxColor(GUIContent label, SerializedMinMaxColor minMaxColor)
        {
            Rect  rect1 = ModuleUI.PrefixLabel(ModuleUI.GetControlRect(13), label);
            float width = (float)((double)rect1.width - 13.0 - 5.0);

            if (!minMaxColor.minMax.boolValue)
            {
                ModuleUI.GUIColor(new Rect(rect1.x, rect1.y, width, rect1.height), minMaxColor.maxColor);
            }
            else
            {
                Rect rect2 = new Rect(rect1.x, rect1.y, (float)((double)width * 0.5 - 2.0), rect1.height);
                ModuleUI.GUIColor(rect2, minMaxColor.minColor);
                rect2.x += rect2.width + 4f;
                ModuleUI.GUIColor(rect2, minMaxColor.maxColor);
            }
            ModuleUI.GUIMMColorPopUp(new Rect(rect1.xMax - 13f, rect1.y, 13f, 13f), minMaxColor.minMax);
        }
示例#30
0
        public static void GUIMinMaxRange(GUIContent label, SerializedProperty vec2Prop, params GUILayoutOption[] layoutOptions)
        {
            Rect rect = ModuleUI.GetControlRect(13, layoutOptions);

            rect = ModuleUI.SubtractPopupWidth(rect);
            rect = ModuleUI.PrefixLabel(rect, label);
            float   num          = (rect.width - 20f) * 0.5f;
            Vector2 vector2Value = vec2Prop.vector2Value;

            rect.width            = num;
            rect.xMin            -= 20f;
            vector2Value.x        = ModuleUI.FloatDraggable(rect, vector2Value.x, 1f, 20f, "g7");
            vector2Value.x        = Mathf.Clamp(vector2Value.x, 0f, vector2Value.y - 0.01f);
            rect.x               += num + 20f;
            vector2Value.y        = ModuleUI.FloatDraggable(rect, vector2Value.y, 1f, 20f, "g7");
            vector2Value.y        = Mathf.Max(vector2Value.x + 0.01f, vector2Value.y);
            vec2Prop.vector2Value = vector2Value;
        }