UnityEditor.ModuleUI.GUIFloat C# (CSharp) Method

GUIFloat() public static method

public static GUIFloat ( GUIContent guiContent, UnityEditor.SerializedProperty floatProp ) : float
guiContent UnityEngine.GUIContent
floatProp UnityEditor.SerializedProperty
return float
        public static float GUIFloat(GUIContent guiContent, SerializedProperty floatProp, params GUILayoutOption[] layoutOptions)
        {
            return GUIFloat(guiContent, floatProp, "g7", layoutOptions);
        }

Same methods

ModuleUI::GUIFloat ( GUIContent guiContent, UnityEditor.SerializedProperty floatProp, string formatString ) : float
ModuleUI::GUIFloat ( GUIContent guiContent, float floatValue, string formatString ) : float
ModuleUI::GUIFloat ( string label, UnityEditor.SerializedProperty floatProp ) : float

Usage Example

示例#1
0
        public override void OnInspectorGUI(InitialModuleUI initial)
        {
            EditorGUI.showMixedValue = this.m_Type.hasMultipleDifferentValues;
            int num  = this.m_Type.intValue;
            int num2 = this.m_TypeToGuiTypeIndex[num];

            EditorGUI.BeginChangeCheck();
            int  num3 = ModuleUI.GUIPopup(ShapeModuleUI.s_Texts.shape, num2, ShapeModuleUI.s_Texts.shapeTypes, this.m_Type, new GUILayoutOption[0]);
            bool flag = EditorGUI.EndChangeCheck();

            EditorGUI.showMixedValue = false;
            ParticleSystemShapeType particleSystemShapeType = this.m_GuiTypes[num3];

            if (num3 != num2)
            {
                num = (int)particleSystemShapeType;
            }
            if (!this.m_Type.hasMultipleDifferentValues)
            {
                switch (particleSystemShapeType)
                {
                case ParticleSystemShapeType.Sphere:
                case ParticleSystemShapeType.Hemisphere:
                    ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radius, this.m_Radius.m_Value, new GUILayoutOption[0]);
                    ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radiusThickness, this.m_RadiusThickness, new GUILayoutOption[0]);
                    break;

                case ParticleSystemShapeType.Cone:
                {
                    ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.coneAngle, this.m_Angle, new GUILayoutOption[0]);
                    ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radius, this.m_Radius.m_Value, new GUILayoutOption[0]);
                    ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radiusThickness, this.m_RadiusThickness, new GUILayoutOption[0]);
                    this.m_Arc.OnInspectorGUI(ShapeModuleUI.s_ArcTexts);
                    bool disabled = num != 8;
                    using (new EditorGUI.DisabledScope(disabled))
                    {
                        ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.coneLength, this.m_Length, new GUILayoutOption[0]);
                    }
                    int num4 = this.ConvertConeTypeToConeEmitFrom((ParticleSystemShapeType)num);
                    num4 = ModuleUI.GUIPopup(ShapeModuleUI.s_Texts.emitFrom, num4, ShapeModuleUI.s_Texts.coneTypes, this.m_Type, new GUILayoutOption[0]);
                    num  = (int)this.ConvertConeEmitFromToConeType(num4);
                    break;
                }

                case ParticleSystemShapeType.Box:
                {
                    int num5 = this.ConvertBoxTypeToBoxEmitFrom((ParticleSystemShapeType)num);
                    num5 = ModuleUI.GUIPopup(ShapeModuleUI.s_Texts.emitFrom, num5, ShapeModuleUI.s_Texts.boxTypes, this.m_Type, new GUILayoutOption[0]);
                    num  = (int)this.ConvertBoxEmitFromToBoxType(num5);
                    if (num == 15 || num == 16)
                    {
                        ModuleUI.GUIVector3Field(ShapeModuleUI.s_Texts.boxThickness, this.m_BoxThickness, new GUILayoutOption[0]);
                    }
                    break;
                }

                case ParticleSystemShapeType.Mesh:
                case ParticleSystemShapeType.MeshRenderer:
                case ParticleSystemShapeType.SkinnedMeshRenderer:
                {
                    ModuleUI.GUIPopup(ShapeModuleUI.s_Texts.meshType, this.m_PlacementMode, ShapeModuleUI.s_Texts.meshTypes, new GUILayoutOption[0]);
                    Material material = null;
                    Mesh     mesh     = null;
                    if (particleSystemShapeType == ParticleSystemShapeType.Mesh)
                    {
                        ModuleUI.GUIObject(ShapeModuleUI.s_Texts.mesh, this.m_Mesh, new GUILayoutOption[0]);
                        mesh = (Mesh)this.m_Mesh.objectReferenceValue;
                    }
                    else if (particleSystemShapeType == ParticleSystemShapeType.MeshRenderer)
                    {
                        ModuleUI.GUIObject(ShapeModuleUI.s_Texts.meshRenderer, this.m_MeshRenderer, new GUILayoutOption[0]);
                        MeshRenderer meshRenderer = (MeshRenderer)this.m_MeshRenderer.objectReferenceValue;
                        if (meshRenderer)
                        {
                            material = meshRenderer.sharedMaterial;
                            if (meshRenderer.GetComponent <MeshFilter>())
                            {
                                mesh = meshRenderer.GetComponent <MeshFilter>().sharedMesh;
                            }
                        }
                    }
                    else
                    {
                        ModuleUI.GUIObject(ShapeModuleUI.s_Texts.skinnedMeshRenderer, this.m_SkinnedMeshRenderer, new GUILayoutOption[0]);
                        SkinnedMeshRenderer skinnedMeshRenderer = (SkinnedMeshRenderer)this.m_SkinnedMeshRenderer.objectReferenceValue;
                        if (skinnedMeshRenderer)
                        {
                            material = skinnedMeshRenderer.sharedMaterial;
                            mesh     = skinnedMeshRenderer.sharedMesh;
                        }
                    }
                    ModuleUI.GUIToggleWithIntField(ShapeModuleUI.s_Texts.meshMaterialIndex, this.m_UseMeshMaterialIndex, this.m_MeshMaterialIndex, false, new GUILayoutOption[0]);
                    bool flag2 = ModuleUI.GUIToggle(ShapeModuleUI.s_Texts.useMeshColors, this.m_UseMeshColors, new GUILayoutOption[0]);
                    if (flag2)
                    {
                        if (material != null && mesh != null)
                        {
                            int name  = Shader.PropertyToID("_Color");
                            int name2 = Shader.PropertyToID("_TintColor");
                            if (!material.HasProperty(name) && !material.HasProperty(name2) && !mesh.HasChannel(Mesh.InternalShaderChannel.Color))
                            {
                                GUIContent gUIContent = EditorGUIUtility.TrTextContent("To use mesh colors, your source mesh must either provide vertex colors, or its shader must contain a color property named \"_Color\" or \"_TintColor\".", null, null);
                                EditorGUILayout.HelpBox(gUIContent.text, MessageType.Warning, true);
                            }
                        }
                    }
                    ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.meshNormalOffset, this.m_MeshNormalOffset, new GUILayoutOption[0]);
                    break;
                }

                case ParticleSystemShapeType.Circle:
                    ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radius, this.m_Radius.m_Value, new GUILayoutOption[0]);
                    ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radiusThickness, this.m_RadiusThickness, new GUILayoutOption[0]);
                    this.m_Arc.OnInspectorGUI(ShapeModuleUI.s_ArcTexts);
                    break;

                case ParticleSystemShapeType.SingleSidedEdge:
                    this.m_Radius.OnInspectorGUI(ShapeModuleUI.s_RadiusTexts);
                    break;

                case ParticleSystemShapeType.Donut:
                    ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radius, this.m_Radius.m_Value, new GUILayoutOption[0]);
                    ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.donutRadius, this.m_DonutRadius, new GUILayoutOption[0]);
                    ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radiusThickness, this.m_RadiusThickness, new GUILayoutOption[0]);
                    this.m_Arc.OnInspectorGUI(ShapeModuleUI.s_ArcTexts);
                    break;
                }
            }
            if (flag || !this.m_Type.hasMultipleDifferentValues)
            {
                this.m_Type.intValue = num;
            }
            this.OnTextureInspectorGUI();
            this.OnTransformInspectorGUI();
            this.OnMiscInspectorGUI();
        }
All Usage Examples Of UnityEditor.ModuleUI::GUIFloat