protected override void Init() { if (this.m_Type != null) { return; } if (ShapeModuleUI.s_Texts == null) { ShapeModuleUI.s_Texts = new ShapeModuleUI.Texts(); } this.m_Type = base.GetProperty("type"); this.m_Radius = base.GetProperty("radius"); this.m_Angle = base.GetProperty("angle"); this.m_Length = base.GetProperty("length"); this.m_BoxX = base.GetProperty("boxX"); this.m_BoxY = base.GetProperty("boxY"); this.m_BoxZ = base.GetProperty("boxZ"); this.m_Arc = base.GetProperty("arc"); this.m_PlacementMode = base.GetProperty("placementMode"); this.m_Mesh = base.GetProperty("m_Mesh"); this.m_MeshRenderer = base.GetProperty("m_MeshRenderer"); this.m_SkinnedMeshRenderer = base.GetProperty("m_SkinnedMeshRenderer"); this.m_MeshMaterialIndex = base.GetProperty("m_MeshMaterialIndex"); this.m_UseMeshMaterialIndex = base.GetProperty("m_UseMeshMaterialIndex"); this.m_UseMeshColors = base.GetProperty("m_UseMeshColors"); this.m_MeshNormalOffset = base.GetProperty("m_MeshNormalOffset"); this.m_RandomDirection = base.GetProperty("randomDirection"); this.m_Material = (EditorGUIUtility.GetBuiltinExtraResource(typeof(Material), "Default-Material.mat") as Material); this.m_BoxEditor.SetAlwaysDisplayHandles(true); }
protected override void Init() { if (this.m_Type == null) { if (ShapeModuleUI.s_Texts == null) { ShapeModuleUI.s_Texts = new ShapeModuleUI.Texts(); } this.m_Type = base.GetProperty("type"); this.m_Radius = ShapeModuleUI.MultiModeParameter.GetProperty(this, "radius", ShapeModuleUI.s_RadiusTexts.speed); this.m_RadiusThickness = base.GetProperty("radiusThickness"); this.m_Angle = base.GetProperty("angle"); this.m_Length = base.GetProperty("length"); this.m_BoxThickness = base.GetProperty("boxThickness"); this.m_Arc = ShapeModuleUI.MultiModeParameter.GetProperty(this, "arc", ShapeModuleUI.s_ArcTexts.speed); this.m_DonutRadius = base.GetProperty("donutRadius"); this.m_PlacementMode = base.GetProperty("placementMode"); this.m_Mesh = base.GetProperty("m_Mesh"); this.m_MeshRenderer = base.GetProperty("m_MeshRenderer"); this.m_SkinnedMeshRenderer = base.GetProperty("m_SkinnedMeshRenderer"); this.m_MeshMaterialIndex = base.GetProperty("m_MeshMaterialIndex"); this.m_UseMeshMaterialIndex = base.GetProperty("m_UseMeshMaterialIndex"); this.m_UseMeshColors = base.GetProperty("m_UseMeshColors"); this.m_MeshNormalOffset = base.GetProperty("m_MeshNormalOffset"); this.m_RandomDirectionAmount = base.GetProperty("randomDirectionAmount"); this.m_SphericalDirectionAmount = base.GetProperty("sphericalDirectionAmount"); this.m_RandomPositionAmount = base.GetProperty("randomPositionAmount"); this.m_AlignToDirection = base.GetProperty("alignToDirection"); this.m_Position = base.GetProperty("m_Position"); this.m_Scale = base.GetProperty("m_Scale"); this.m_Rotation = base.GetProperty("m_Rotation"); this.m_Material = (EditorGUIUtility.GetBuiltinExtraResource(typeof(Material), "Default-Material.mat") as Material); } }
protected override void Init() { if (this.m_Type != null) return; if (ShapeModuleUI.s_Texts == null) ShapeModuleUI.s_Texts = new ShapeModuleUI.Texts(); this.m_Type = this.GetProperty("type"); this.m_Radius = this.GetProperty("radius"); this.m_Angle = this.GetProperty("angle"); this.m_Length = this.GetProperty("length"); this.m_BoxX = this.GetProperty("boxX"); this.m_BoxY = this.GetProperty("boxY"); this.m_BoxZ = this.GetProperty("boxZ"); this.m_Arc = this.GetProperty("arc"); this.m_PlacementMode = this.GetProperty("placementMode"); this.m_Mesh = this.GetProperty("m_Mesh"); this.m_MeshRenderer = this.GetProperty("m_MeshRenderer"); this.m_SkinnedMeshRenderer = this.GetProperty("m_SkinnedMeshRenderer"); this.m_MeshMaterialIndex = this.GetProperty("m_MeshMaterialIndex"); this.m_UseMeshMaterialIndex = this.GetProperty("m_UseMeshMaterialIndex"); this.m_UseMeshColors = this.GetProperty("m_UseMeshColors"); this.m_MeshNormalOffset = this.GetProperty("m_MeshNormalOffset"); this.m_RandomDirection = this.GetProperty("randomDirection"); this.m_Material = EditorGUIUtility.GetBuiltinExtraResource(typeof (Material), "Default-Material.mat") as Material; this.m_BoxEditor.SetAlwaysDisplayHandles(true); }
public override void OnInspectorGUI(ParticleSystem s) { if (ShapeModuleUI.s_Texts == null) { ShapeModuleUI.s_Texts = new ShapeModuleUI.Texts(); } int num = this.m_Type.intValue; int num2 = this.m_TypeToGuiTypeIndex[num]; bool usesShell = this.GetUsesShell((ShapeModuleUI.ShapeTypes)num); int num3 = ModuleUI.GUIPopup(ShapeModuleUI.s_Texts.shape, num2, this.m_GuiNames); ShapeModuleUI.ShapeTypes shapeTypes = this.m_GuiTypes[num3]; if (num3 != num2) { num = (int)shapeTypes; } switch (shapeTypes) { case ShapeModuleUI.ShapeTypes.Sphere: { ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radius, this.m_Radius); bool flag = ModuleUI.GUIToggle(ShapeModuleUI.s_Texts.emitFromShell, usesShell); num = ((!flag) ? 0 : 1); break; } case ShapeModuleUI.ShapeTypes.Hemisphere: { ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radius, this.m_Radius); bool flag2 = ModuleUI.GUIToggle(ShapeModuleUI.s_Texts.emitFromShell, usesShell); num = ((!flag2) ? 2 : 3); break; } case ShapeModuleUI.ShapeTypes.Cone: { ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.coneAngle, this.m_Angle); ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radius, this.m_Radius); bool disabled = num != 8 && num != 9; using (new EditorGUI.DisabledScope(disabled)) { ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.coneLength, this.m_Length); } string[] options = new string[] { "Base", "Base Shell", "Volume", "Volume Shell" }; int num4 = this.ConvertConeTypeToConeEmitFrom((ShapeModuleUI.ShapeTypes)num); num4 = ModuleUI.GUIPopup(ShapeModuleUI.s_Texts.emitFrom, num4, options); num = (int)this.ConvertConeEmitFromToConeType(num4); break; } case ShapeModuleUI.ShapeTypes.Box: ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.boxX, this.m_BoxX); ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.boxY, this.m_BoxY); ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.boxZ, this.m_BoxZ); break; case ShapeModuleUI.ShapeTypes.Mesh: case ShapeModuleUI.ShapeTypes.MeshRenderer: case ShapeModuleUI.ShapeTypes.SkinnedMeshRenderer: { string[] options2 = new string[] { "Vertex", "Edge", "Triangle" }; ModuleUI.GUIPopup(string.Empty, this.m_PlacementMode, options2); Material material = null; Mesh mesh = null; if (shapeTypes == ShapeModuleUI.ShapeTypes.Mesh) { ModuleUI.GUIObject(ShapeModuleUI.s_Texts.mesh, this.m_Mesh); } else if (shapeTypes == ShapeModuleUI.ShapeTypes.MeshRenderer) { ModuleUI.GUIObject(ShapeModuleUI.s_Texts.meshRenderer, this.m_MeshRenderer); 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); 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); bool flag3 = ModuleUI.GUIToggle(ShapeModuleUI.s_Texts.useMeshColors, this.m_UseMeshColors); if (flag3 && material != null && mesh != null) { int nameID = Shader.PropertyToID("_Color"); int nameID2 = Shader.PropertyToID("_TintColor"); if (!material.HasProperty(nameID) && !material.HasProperty(nameID2) && !mesh.HasChannel(Mesh.InternalShaderChannel.Color)) { GUIContent gUIContent = 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\"."); EditorGUILayout.HelpBox(gUIContent.text, MessageType.Warning, true); } } ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.meshNormalOffset, this.m_MeshNormalOffset); break; } case ShapeModuleUI.ShapeTypes.Circle: { ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radius, this.m_Radius); ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.arc, this.m_Arc); bool flag4 = ModuleUI.GUIToggle(ShapeModuleUI.s_Texts.emitFromEdge, usesShell); num = ((!flag4) ? 10 : 11); break; } case ShapeModuleUI.ShapeTypes.SingleSidedEdge: ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radius, this.m_Radius); break; } this.m_Type.intValue = num; ModuleUI.GUIToggle(ShapeModuleUI.s_Texts.randomDirection, this.m_RandomDirection); }
public override void OnInspectorGUI(ParticleSystem s) { if (ShapeModuleUI.s_Texts == null) { ShapeModuleUI.s_Texts = new ShapeModuleUI.Texts(); } int num = this.m_Type.intValue; int num2 = this.m_TypeToGuiTypeIndex[num]; bool usesShell = this.GetUsesShell((ShapeModuleUI.ShapeTypes)num); int num3 = ModuleUI.GUIPopup(ShapeModuleUI.s_Texts.shape, num2, this.m_GuiNames); ShapeModuleUI.ShapeTypes shapeTypes = this.m_GuiTypes[num3]; if (num3 != num2) { num = (int)shapeTypes; } switch (shapeTypes) { case ShapeModuleUI.ShapeTypes.Sphere: { ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radius, this.m_Radius); bool flag = ModuleUI.GUIToggle(ShapeModuleUI.s_Texts.emitFromShell, usesShell); num = ((!flag) ? 0 : 1); break; } case ShapeModuleUI.ShapeTypes.Hemisphere: { ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radius, this.m_Radius); bool flag2 = ModuleUI.GUIToggle(ShapeModuleUI.s_Texts.emitFromShell, usesShell); num = ((!flag2) ? 2 : 3); break; } case ShapeModuleUI.ShapeTypes.Cone: { ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.coneAngle, this.m_Angle); ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radius, this.m_Radius); bool disabled = num != 8 && num != 9; EditorGUI.BeginDisabledGroup(disabled); ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.coneLength, this.m_Length); EditorGUI.EndDisabledGroup(); string[] options = new string[] { "Base", "Base Shell", "Volume", "Volume Shell" }; int num4 = this.ConvertConeTypeToConeEmitFrom((ShapeModuleUI.ShapeTypes)num); num4 = ModuleUI.GUIPopup(ShapeModuleUI.s_Texts.emitFrom, num4, options); num = (int)this.ConvertConeEmitFromToConeType(num4); break; } case ShapeModuleUI.ShapeTypes.Box: ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.boxX, this.m_BoxX); ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.boxY, this.m_BoxY); ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.boxZ, this.m_BoxZ); break; case ShapeModuleUI.ShapeTypes.Mesh: case ShapeModuleUI.ShapeTypes.MeshRenderer: case ShapeModuleUI.ShapeTypes.SkinnedMeshRenderer: { string[] options2 = new string[] { "Vertex", "Edge", "Triangle" }; ModuleUI.GUIPopup(string.Empty, this.m_PlacementMode, options2); if (shapeTypes == ShapeModuleUI.ShapeTypes.Mesh) { ModuleUI.GUIObject(ShapeModuleUI.s_Texts.mesh, this.m_Mesh); } else if (shapeTypes == ShapeModuleUI.ShapeTypes.MeshRenderer) { ModuleUI.GUIObject(ShapeModuleUI.s_Texts.meshRenderer, this.m_MeshRenderer); } else { ModuleUI.GUIObject(ShapeModuleUI.s_Texts.skinnedMeshRenderer, this.m_SkinnedMeshRenderer); } ModuleUI.GUIToggleWithIntField(ShapeModuleUI.s_Texts.meshMaterialIndex, this.m_UseMeshMaterialIndex, this.m_MeshMaterialIndex, false); ModuleUI.GUIToggle(ShapeModuleUI.s_Texts.useMeshColors, this.m_UseMeshColors); ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.meshNormalOffset, this.m_MeshNormalOffset); break; } case ShapeModuleUI.ShapeTypes.Circle: { ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radius, this.m_Radius); ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.arc, this.m_Arc); bool flag3 = ModuleUI.GUIToggle(ShapeModuleUI.s_Texts.emitFromEdge, usesShell); num = ((!flag3) ? 10 : 11); break; } case ShapeModuleUI.ShapeTypes.SingleSidedEdge: ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radius, this.m_Radius); break; } this.m_Type.intValue = num; ModuleUI.GUIToggle(ShapeModuleUI.s_Texts.randomDirection, this.m_RandomDirection); }
protected override void Init() { if (this.m_Type == null) { if (ShapeModuleUI.s_Texts == null) { ShapeModuleUI.s_Texts = new ShapeModuleUI.Texts(); } this.m_Type = base.GetProperty("type"); this.m_Radius = ShapeModuleUI.MultiModeParameter.GetProperty(this, "radius", ShapeModuleUI.s_RadiusTexts.speed); this.m_RadiusThickness = base.GetProperty("radiusThickness"); this.m_Angle = base.GetProperty("angle"); this.m_Length = base.GetProperty("length"); this.m_BoxThickness = base.GetProperty("boxThickness"); this.m_Arc = ShapeModuleUI.MultiModeParameter.GetProperty(this, "arc", ShapeModuleUI.s_ArcTexts.speed); this.m_DonutRadius = base.GetProperty("donutRadius"); this.m_PlacementMode = base.GetProperty("placementMode"); this.m_Mesh = base.GetProperty("m_Mesh"); this.m_MeshRenderer = base.GetProperty("m_MeshRenderer"); this.m_SkinnedMeshRenderer = base.GetProperty("m_SkinnedMeshRenderer"); this.m_MeshMaterialIndex = base.GetProperty("m_MeshMaterialIndex"); this.m_UseMeshMaterialIndex = base.GetProperty("m_UseMeshMaterialIndex"); this.m_UseMeshColors = base.GetProperty("m_UseMeshColors"); this.m_MeshNormalOffset = base.GetProperty("m_MeshNormalOffset"); this.m_Texture = base.GetProperty("m_Texture"); this.m_TextureClipChannel = base.GetProperty("m_TextureClipChannel"); this.m_TextureClipThreshold = base.GetProperty("m_TextureClipThreshold"); this.m_TextureColorAffectsParticles = base.GetProperty("m_TextureColorAffectsParticles"); this.m_TextureAlphaAffectsParticles = base.GetProperty("m_TextureAlphaAffectsParticles"); this.m_TextureBilinearFiltering = base.GetProperty("m_TextureBilinearFiltering"); this.m_TextureUVChannel = base.GetProperty("m_TextureUVChannel"); this.m_RandomDirectionAmount = base.GetProperty("randomDirectionAmount"); this.m_SphericalDirectionAmount = base.GetProperty("sphericalDirectionAmount"); this.m_RandomPositionAmount = base.GetProperty("randomPositionAmount"); this.m_AlignToDirection = base.GetProperty("alignToDirection"); this.m_Position = base.GetProperty("m_Position"); this.m_Scale = base.GetProperty("m_Scale"); this.m_Rotation = base.GetProperty("m_Rotation"); if (!ShapeModuleUI.s_Material) { ShapeModuleUI.s_Material = (EditorGUIUtility.GetBuiltinExtraResource(typeof(Material), "Default-Material.mat") as Material); } if (!ShapeModuleUI.s_TextureMaterial) { ShapeModuleUI.s_TextureMaterial = new Material((Shader)EditorGUIUtility.Load("SceneView/ParticleShapeGizmo.shader")); } if (!ShapeModuleUI.s_SphereTextureMaterial) { ShapeModuleUI.s_SphereTextureMaterial = new Material((Shader)EditorGUIUtility.Load("SceneView/ParticleShapeGizmoSphere.shader")); } if (!ShapeModuleUI.s_CircleMesh) { ShapeModuleUI.s_CircleMesh = ((GameObject)EditorGUIUtility.Load("SceneView/Circle.fbx")).transform.GetComponent <MeshFilter>().sharedMesh; } if (!ShapeModuleUI.s_QuadMesh) { ShapeModuleUI.s_QuadMesh = (Resources.GetBuiltinResource(typeof(Mesh), "Quad.fbx") as Mesh); } if (!ShapeModuleUI.s_SphereMesh) { ShapeModuleUI.s_SphereMesh = (Resources.GetBuiltinResource(typeof(Mesh), "New-Sphere.fbx") as Mesh); } if (!ShapeModuleUI.s_HemisphereMesh) { ShapeModuleUI.s_HemisphereMesh = ((GameObject)EditorGUIUtility.Load("SceneView/Hemisphere.fbx")).transform.GetComponent <MeshFilter>().sharedMesh; } } }
public override void OnInspectorGUI(ParticleSystem s) { if (ShapeModuleUI.s_Texts == null) { ShapeModuleUI.s_Texts = new ShapeModuleUI.Texts(); } int index1 = this.m_Type.intValue; int intValue = this.m_TypeToGuiTypeIndex[index1]; bool usesShell = this.GetUsesShell((ShapeModuleUI.ShapeTypes)index1); int index2 = ModuleUI.GUIPopup(ShapeModuleUI.s_Texts.shape, intValue, this.m_GuiNames); ShapeModuleUI.ShapeTypes guiType = this.m_GuiTypes[index2]; if (index2 != intValue) { index1 = (int)guiType; } switch (guiType) { case ShapeModuleUI.ShapeTypes.Sphere: double num1 = (double)ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radius, this.m_Radius); index1 = !ModuleUI.GUIToggle(ShapeModuleUI.s_Texts.emitFromShell, usesShell) ? 0 : 1; break; case ShapeModuleUI.ShapeTypes.Hemisphere: double num2 = (double)ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radius, this.m_Radius); index1 = !ModuleUI.GUIToggle(ShapeModuleUI.s_Texts.emitFromShell, usesShell) ? 2 : 3; break; case ShapeModuleUI.ShapeTypes.Cone: double num3 = (double)ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.coneAngle, this.m_Angle); double num4 = (double)ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radius, this.m_Radius); EditorGUI.BeginDisabledGroup((index1 == 8 ? 1 : (index1 == 9 ? 1 : 0)) == 0); double num5 = (double)ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.coneLength, this.m_Length); EditorGUI.EndDisabledGroup(); string[] options1 = new string[4] { "Base", "Base Shell", "Volume", "Volume Shell" }; int coneEmitFrom = this.ConvertConeTypeToConeEmitFrom((ShapeModuleUI.ShapeTypes)index1); index1 = (int)this.ConvertConeEmitFromToConeType(ModuleUI.GUIPopup(ShapeModuleUI.s_Texts.emitFrom, coneEmitFrom, options1)); break; case ShapeModuleUI.ShapeTypes.Box: double num6 = (double)ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.boxX, this.m_BoxX); double num7 = (double)ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.boxY, this.m_BoxY); double num8 = (double)ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.boxZ, this.m_BoxZ); break; case ShapeModuleUI.ShapeTypes.Mesh: case ShapeModuleUI.ShapeTypes.MeshRenderer: case ShapeModuleUI.ShapeTypes.SkinnedMeshRenderer: string[] options2 = new string[3] { "Vertex", "Edge", "Triangle" }; ModuleUI.GUIPopup(string.Empty, this.m_PlacementMode, options2); if (guiType == ShapeModuleUI.ShapeTypes.Mesh) { ModuleUI.GUIObject(ShapeModuleUI.s_Texts.mesh, this.m_Mesh); } else if (guiType == ShapeModuleUI.ShapeTypes.MeshRenderer) { ModuleUI.GUIObject(ShapeModuleUI.s_Texts.meshRenderer, this.m_MeshRenderer); } else { ModuleUI.GUIObject(ShapeModuleUI.s_Texts.skinnedMeshRenderer, this.m_SkinnedMeshRenderer); } ModuleUI.GUIToggleWithIntField(ShapeModuleUI.s_Texts.meshMaterialIndex, this.m_UseMeshMaterialIndex, this.m_MeshMaterialIndex, false); ModuleUI.GUIToggle(ShapeModuleUI.s_Texts.useMeshColors, this.m_UseMeshColors); double num9 = (double)ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.meshNormalOffset, this.m_MeshNormalOffset); break; case ShapeModuleUI.ShapeTypes.Circle: double num10 = (double)ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radius, this.m_Radius); double num11 = (double)ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.arc, this.m_Arc); index1 = !ModuleUI.GUIToggle(ShapeModuleUI.s_Texts.emitFromEdge, usesShell) ? 10 : 11; break; case ShapeModuleUI.ShapeTypes.SingleSidedEdge: double num12 = (double)ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radius, this.m_Radius); break; } this.m_Type.intValue = index1; ModuleUI.GUIToggle(ShapeModuleUI.s_Texts.randomDirection, this.m_RandomDirection); }
public override void OnInspectorGUI(InitialModuleUI initial) { if (ShapeModuleUI.s_Texts == null) { ShapeModuleUI.s_Texts = new ShapeModuleUI.Texts(); } int num = this.m_Type.intValue; int num2 = this.m_TypeToGuiTypeIndex[num]; EditorGUI.BeginChangeCheck(); int num3 = ModuleUI.GUIPopup(ShapeModuleUI.s_Texts.shape, num2, this.m_GuiNames, new GUILayoutOption[0]); bool flag = EditorGUI.EndChangeCheck(); ParticleSystemShapeType particleSystemShapeType = this.m_GuiTypes[num3]; if (num3 != num2) { num = (int)particleSystemShapeType; } switch (particleSystemShapeType) { case ParticleSystemShapeType.Sphere: 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.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]); } string[] options = new string[] { "Base", "Volume" }; int num4 = this.ConvertConeTypeToConeEmitFrom((ParticleSystemShapeType)num); num4 = ModuleUI.GUIPopup(ShapeModuleUI.s_Texts.emitFrom, num4, options, new GUILayoutOption[0]); num = (int)this.ConvertConeEmitFromToConeType(num4); break; } case ParticleSystemShapeType.Box: { string[] options2 = new string[] { "Volume", "Shell", "Edge" }; int num5 = this.ConvertBoxTypeToBoxEmitFrom((ParticleSystemShapeType)num); num5 = ModuleUI.GUIPopup(ShapeModuleUI.s_Texts.emitFrom, num5, options2, 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: { string[] options3 = new string[] { "Vertex", "Edge", "Triangle" }; ModuleUI.GUIPopup(ShapeModuleUI.s_Texts.meshType, this.m_PlacementMode, options3, 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]); } 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 nameID = Shader.PropertyToID("_Color"); int nameID2 = Shader.PropertyToID("_TintColor"); if (!material.HasProperty(nameID) && !material.HasProperty(nameID2) && !mesh.HasChannel(Mesh.InternalShaderChannel.Color)) { GUIContent gUIContent = 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\"."); 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; } EditorGUILayout.Space(); ModuleUI.GUIVector3Field(ShapeModuleUI.s_Texts.position, this.m_Position, new GUILayoutOption[0]); ModuleUI.GUIVector3Field(ShapeModuleUI.s_Texts.rotation, this.m_Rotation, new GUILayoutOption[0]); ModuleUI.GUIVector3Field(ShapeModuleUI.s_Texts.scale, this.m_Scale, new GUILayoutOption[0]); EditorGUILayout.Space(); ModuleUI.GUIToggle(ShapeModuleUI.s_Texts.alignToDirection, this.m_AlignToDirection, new GUILayoutOption[0]); ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.randomDirectionAmount, this.m_RandomDirectionAmount, new GUILayoutOption[0]); ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.sphericalDirectionAmount, this.m_SphericalDirectionAmount, new GUILayoutOption[0]); ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.randomPositionAmount, this.m_RandomPositionAmount, new GUILayoutOption[0]); }
public override void OnInspectorGUI(ParticleSystem s) { if (ShapeModuleUI.s_Texts == null) ShapeModuleUI.s_Texts = new ShapeModuleUI.Texts(); int index1 = this.m_Type.intValue; int intValue = this.m_TypeToGuiTypeIndex[index1]; bool usesShell = this.GetUsesShell((ShapeModuleUI.ShapeTypes) index1); int index2 = ModuleUI.GUIPopup(ShapeModuleUI.s_Texts.shape, intValue, this.m_GuiNames); ShapeModuleUI.ShapeTypes guiType = this.m_GuiTypes[index2]; if (index2 != intValue) index1 = (int) guiType; switch (guiType) { case ShapeModuleUI.ShapeTypes.Sphere: double num1 = (double) ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radius, this.m_Radius); index1 = !ModuleUI.GUIToggle(ShapeModuleUI.s_Texts.emitFromShell, usesShell) ? 0 : 1; break; case ShapeModuleUI.ShapeTypes.Hemisphere: double num2 = (double) ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radius, this.m_Radius); index1 = !ModuleUI.GUIToggle(ShapeModuleUI.s_Texts.emitFromShell, usesShell) ? 2 : 3; break; case ShapeModuleUI.ShapeTypes.Cone: double num3 = (double) ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.coneAngle, this.m_Angle); double num4 = (double) ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radius, this.m_Radius); EditorGUI.BeginDisabledGroup((index1 == 8 ? 1 : (index1 == 9 ? 1 : 0)) == 0); double num5 = (double) ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.coneLength, this.m_Length); EditorGUI.EndDisabledGroup(); string[] options1 = new string[4]{ "Base", "Base Shell", "Volume", "Volume Shell" }; int coneEmitFrom = this.ConvertConeTypeToConeEmitFrom((ShapeModuleUI.ShapeTypes) index1); index1 = (int) this.ConvertConeEmitFromToConeType(ModuleUI.GUIPopup(ShapeModuleUI.s_Texts.emitFrom, coneEmitFrom, options1)); break; case ShapeModuleUI.ShapeTypes.Box: double num6 = (double) ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.boxX, this.m_BoxX); double num7 = (double) ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.boxY, this.m_BoxY); double num8 = (double) ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.boxZ, this.m_BoxZ); break; case ShapeModuleUI.ShapeTypes.Mesh: case ShapeModuleUI.ShapeTypes.MeshRenderer: case ShapeModuleUI.ShapeTypes.SkinnedMeshRenderer: string[] options2 = new string[3]{ "Vertex", "Edge", "Triangle" }; ModuleUI.GUIPopup(string.Empty, this.m_PlacementMode, options2); if (guiType == ShapeModuleUI.ShapeTypes.Mesh) ModuleUI.GUIObject(ShapeModuleUI.s_Texts.mesh, this.m_Mesh); else if (guiType == ShapeModuleUI.ShapeTypes.MeshRenderer) ModuleUI.GUIObject(ShapeModuleUI.s_Texts.meshRenderer, this.m_MeshRenderer); else ModuleUI.GUIObject(ShapeModuleUI.s_Texts.skinnedMeshRenderer, this.m_SkinnedMeshRenderer); ModuleUI.GUIToggleWithIntField(ShapeModuleUI.s_Texts.meshMaterialIndex, this.m_UseMeshMaterialIndex, this.m_MeshMaterialIndex, false); ModuleUI.GUIToggle(ShapeModuleUI.s_Texts.useMeshColors, this.m_UseMeshColors); double num9 = (double) ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.meshNormalOffset, this.m_MeshNormalOffset); break; case ShapeModuleUI.ShapeTypes.Circle: double num10 = (double) ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radius, this.m_Radius); double num11 = (double) ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.arc, this.m_Arc); index1 = !ModuleUI.GUIToggle(ShapeModuleUI.s_Texts.emitFromEdge, usesShell) ? 10 : 11; break; case ShapeModuleUI.ShapeTypes.SingleSidedEdge: double num12 = (double) ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radius, this.m_Radius); break; } this.m_Type.intValue = index1; ModuleUI.GUIToggle(ShapeModuleUI.s_Texts.randomDirection, this.m_RandomDirection); }
protected override void Init() { if (this.m_Type != null) { return; } if (ShapeModuleUI.s_Texts == null) { ShapeModuleUI.s_Texts = new ShapeModuleUI.Texts(); } this.m_Type = base.GetProperty("type"); this.m_Radius = base.GetProperty("radius"); this.m_Angle = base.GetProperty("angle"); this.m_Length = base.GetProperty("length"); this.m_BoxX = base.GetProperty("boxX"); this.m_BoxY = base.GetProperty("boxY"); this.m_BoxZ = base.GetProperty("boxZ"); this.m_Arc = base.GetProperty("arc"); this.m_PlacementMode = base.GetProperty("placementMode"); this.m_Mesh = base.GetProperty("m_Mesh"); this.m_RandomDirection = base.GetProperty("randomDirection"); this.m_Material = (EditorGUIUtility.GetBuiltinExtraResource(typeof(Material), "Default-Material.mat") as Material); this.m_BoxEditor.SetAlwaysDisplayHandles(true); }
public override void OnInspectorGUI(ParticleSystem s) { if (ShapeModuleUI.s_Texts == null) { ShapeModuleUI.s_Texts = new ShapeModuleUI.Texts(); } int num = this.m_Type.intValue; int num2 = this.m_TypeToGuiTypeIndex[num]; bool usesShell = this.GetUsesShell((ShapeModuleUI.ShapeTypes)num); int num3 = ModuleUI.GUIPopup(ShapeModuleUI.s_Texts.shape, num2, this.m_GuiNames); ShapeModuleUI.ShapeTypes shapeTypes = this.m_GuiTypes[num3]; if (num3 != num2) { num = (int)shapeTypes; } switch (shapeTypes) { case ShapeModuleUI.ShapeTypes.Sphere: { ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radius, this.m_Radius); bool flag = ModuleUI.GUIToggle(ShapeModuleUI.s_Texts.emitFromShell, usesShell); num = ((!flag) ? 0 : 1); break; } case ShapeModuleUI.ShapeTypes.HemiSphere: { ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radius, this.m_Radius); bool flag2 = ModuleUI.GUIToggle(ShapeModuleUI.s_Texts.emitFromShell, usesShell); num = ((!flag2) ? 2 : 3); break; } case ShapeModuleUI.ShapeTypes.Cone: { ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.coneAngle, this.m_Angle); ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radius, this.m_Radius); bool disabled = num != 8 && num != 9; EditorGUI.BeginDisabledGroup(disabled); ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.coneLength, this.m_Length); EditorGUI.EndDisabledGroup(); string[] options = new string[] { "Base", "Base Shell", "Volume", "Volume Shell" }; int num4 = this.ConvertConeTypeToConeEmitFrom((ShapeModuleUI.ShapeTypes)num); num4 = ModuleUI.GUIPopup(ShapeModuleUI.s_Texts.emitFrom, num4, options); num = (int)this.ConvertConeEmitFromToConeType(num4); break; } case ShapeModuleUI.ShapeTypes.Box: ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.boxX, this.m_BoxX); ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.boxY, this.m_BoxY); ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.boxZ, this.m_BoxZ); break; case ShapeModuleUI.ShapeTypes.Mesh: { string[] options2 = new string[] { "Vertex", "Edge", "Triangle" }; ModuleUI.GUIPopup(string.Empty, this.m_PlacementMode, options2); ModuleUI.GUIObject(ShapeModuleUI.s_Texts.mesh, this.m_Mesh); break; } case ShapeModuleUI.ShapeTypes.Circle: { ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radius, this.m_Radius); ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.arc, this.m_Arc); bool flag3 = ModuleUI.GUIToggle(ShapeModuleUI.s_Texts.emitFromEdge, usesShell); num = ((!flag3) ? 10 : 11); break; } case ShapeModuleUI.ShapeTypes.SingleSidedEdge: ModuleUI.GUIFloat(ShapeModuleUI.s_Texts.radius, this.m_Radius); break; } this.m_Type.intValue = num; ModuleUI.GUIToggle(ShapeModuleUI.s_Texts.randomDirection, this.m_RandomDirection); }