UnityEditor.ShapeModuleUI.OnInspectorGUI C# (CSharp) Метод

OnInspectorGUI() публичный Метод

public OnInspectorGUI ( ParticleSystem s ) : void
s UnityEngine.ParticleSystem
Результат void
        public override void OnInspectorGUI(ParticleSystem s)
        {
            Material sharedMaterial;
            Mesh sharedMesh;
            if (s_Texts == null)
            {
                s_Texts = new Texts();
            }
            int intValue = this.m_Type.intValue;
            int num2 = this.m_TypeToGuiTypeIndex[intValue];
            bool usesShell = this.GetUsesShell((ShapeTypes) intValue);
            int index = ModuleUI.GUIPopup(s_Texts.shape, num2, this.m_GuiNames, new GUILayoutOption[0]);
            ShapeTypes types = this.m_GuiTypes[index];
            if (index != num2)
            {
                intValue = (int) types;
            }
            switch (types)
            {
                case ShapeTypes.Sphere:
                    ModuleUI.GUIFloat(s_Texts.radius, this.m_Radius, new GUILayoutOption[0]);
                    intValue = !ModuleUI.GUIToggle(s_Texts.emitFromShell, usesShell, new GUILayoutOption[0]) ? 0 : 1;
                    goto Label_0581;

                case ShapeTypes.Hemisphere:
                    ModuleUI.GUIFloat(s_Texts.radius, this.m_Radius, new GUILayoutOption[0]);
                    intValue = !ModuleUI.GUIToggle(s_Texts.emitFromShell, usesShell, new GUILayoutOption[0]) ? 2 : 3;
                    goto Label_0581;

                case ShapeTypes.Cone:
                {
                    ModuleUI.GUIFloat(s_Texts.coneAngle, this.m_Angle, new GUILayoutOption[0]);
                    ModuleUI.GUIFloat(s_Texts.radius, this.m_Radius, new GUILayoutOption[0]);
                    bool disabled = (intValue != 8) && (intValue != 9);
                    using (new EditorGUI.DisabledScope(disabled))
                    {
                        ModuleUI.GUIFloat(s_Texts.coneLength, this.m_Length, new GUILayoutOption[0]);
                    }
                    string[] options = new string[] { "Base", "Base Shell", "Volume", "Volume Shell" };
                    int num5 = this.ConvertConeTypeToConeEmitFrom((ShapeTypes) intValue);
                    num5 = ModuleUI.GUIPopup(s_Texts.emitFrom, num5, options, new GUILayoutOption[0]);
                    intValue = (int) this.ConvertConeEmitFromToConeType(num5);
                    goto Label_0581;
                }
                case ShapeTypes.Box:
                {
                    ModuleUI.GUIFloat(s_Texts.boxX, this.m_BoxX, new GUILayoutOption[0]);
                    ModuleUI.GUIFloat(s_Texts.boxY, this.m_BoxY, new GUILayoutOption[0]);
                    ModuleUI.GUIFloat(s_Texts.boxZ, this.m_BoxZ, new GUILayoutOption[0]);
                    string[] strArray = new string[] { "Volume", "Shell", "Edge" };
                    int num4 = this.ConvertBoxTypeToConeEmitFrom((ShapeTypes) intValue);
                    num4 = ModuleUI.GUIPopup(s_Texts.emitFrom, num4, strArray, new GUILayoutOption[0]);
                    intValue = (int) this.ConvertBoxEmitFromToConeType(num4);
                    goto Label_0581;
                }
                case ShapeTypes.Mesh:
                case ShapeTypes.MeshRenderer:
                case ShapeTypes.SkinnedMeshRenderer:
                {
                    string[] strArray3 = new string[] { "Vertex", "Edge", "Triangle" };
                    ModuleUI.GUIPopup("", this.m_PlacementMode, strArray3, new GUILayoutOption[0]);
                    sharedMaterial = null;
                    sharedMesh = null;
                    if (types != ShapeTypes.Mesh)
                    {
                        if (types == ShapeTypes.MeshRenderer)
                        {
                            ModuleUI.GUIObject(s_Texts.meshRenderer, this.m_MeshRenderer, new GUILayoutOption[0]);
                            MeshRenderer objectReferenceValue = (MeshRenderer) this.m_MeshRenderer.objectReferenceValue;
                            if (objectReferenceValue != null)
                            {
                                sharedMaterial = objectReferenceValue.sharedMaterial;
                                if (objectReferenceValue.GetComponent<MeshFilter>() != null)
                                {
                                    sharedMesh = objectReferenceValue.GetComponent<MeshFilter>().sharedMesh;
                                }
                            }
                        }
                        else
                        {
                            ModuleUI.GUIObject(s_Texts.skinnedMeshRenderer, this.m_SkinnedMeshRenderer, new GUILayoutOption[0]);
                            SkinnedMeshRenderer renderer2 = (SkinnedMeshRenderer) this.m_SkinnedMeshRenderer.objectReferenceValue;
                            if (renderer2 != null)
                            {
                                sharedMaterial = renderer2.sharedMaterial;
                                sharedMesh = renderer2.sharedMesh;
                            }
                        }
                        break;
                    }
                    ModuleUI.GUIObject(s_Texts.mesh, this.m_Mesh, new GUILayoutOption[0]);
                    break;
                }
                case ShapeTypes.Circle:
                    ModuleUI.GUIFloat(s_Texts.radius, this.m_Radius, new GUILayoutOption[0]);
                    ModuleUI.GUIFloat(s_Texts.arc, this.m_Arc, new GUILayoutOption[0]);
                    intValue = !ModuleUI.GUIToggle(s_Texts.emitFromEdge, usesShell, new GUILayoutOption[0]) ? 10 : 11;
                    goto Label_0581;

                case ShapeTypes.SingleSidedEdge:
                    ModuleUI.GUIFloat(s_Texts.radius, this.m_Radius, new GUILayoutOption[0]);
                    goto Label_0581;

                default:
                    goto Label_0581;
            }
            ModuleUI.GUIToggleWithIntField(s_Texts.meshMaterialIndex, this.m_UseMeshMaterialIndex, this.m_MeshMaterialIndex, false, new GUILayoutOption[0]);
            if (ModuleUI.GUIToggle(s_Texts.useMeshColors, this.m_UseMeshColors, new GUILayoutOption[0]) && ((sharedMaterial != null) && (sharedMesh != null)))
            {
                int nameID = Shader.PropertyToID("_Color");
                int num7 = Shader.PropertyToID("_TintColor");
                if ((!sharedMaterial.HasProperty(nameID) && !sharedMaterial.HasProperty(num7)) && !sharedMesh.HasChannel(Mesh.InternalShaderChannel.Color))
                {
                    EditorGUILayout.HelpBox(EditorGUIUtility.TextContent("To use mesh colors, your source mesh must either provide vertex colors, or its shader must contain a color property named \"_Color\" or \"_TintColor\".").text, MessageType.Warning, true);
                }
            }
            ModuleUI.GUIFloat(s_Texts.meshNormalOffset, this.m_MeshNormalOffset, new GUILayoutOption[0]);
            ModuleUI.GUIFloat(s_Texts.meshScale, this.m_MeshScale, new GUILayoutOption[0]);
        Label_0581:
            this.m_Type.intValue = intValue;
            ModuleUI.GUIToggle(s_Texts.alignToDirection, this.m_AlignToDirection, new GUILayoutOption[0]);
            ModuleUI.GUIFloat(s_Texts.randomDirectionAmount, this.m_RandomDirectionAmount, new GUILayoutOption[0]);
            ModuleUI.GUIFloat(s_Texts.sphericalDirectionAmount, this.m_SphericalDirectionAmount, new GUILayoutOption[0]);
        }