Skip to content

Commit

Permalink
refactor: remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
mob-sakai committed Feb 12, 2020
1 parent f5d3b6e commit 34fb123
Showing 1 changed file with 2 additions and 32 deletions.
34 changes: 2 additions & 32 deletions Packages/UIParticle/Scripts/Editor/UIParticleEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,7 @@ public static void AddMenu(GenericMenu menu, SerializedProperty sp, AnimatedProp
static readonly GUIContent s_ContentParticleMaterial = new GUIContent("Particle Material", "The material for rendering particles");
static readonly GUIContent s_ContentTrailMaterial = new GUIContent("Trail Material", "The material for rendering particle trails");
static readonly List<ParticleSystem> s_ParticleSystems = new List<ParticleSystem>();
static readonly Matrix4x4 s_ArcHandleOffsetMatrix = Matrix4x4.TRS(Vector3.zero, Quaternion.AngleAxis(90f, Vector3.right) * Quaternion.AngleAxis(90f, Vector3.up), Vector3.one);
static readonly Dictionary<string, MethodInfo> s_InternalMethods = new Dictionary<string, MethodInfo>();
static readonly Color s_GizmoColor = new Color(1f, 0.7f, 0.7f, 0.9f);
static readonly Color s_ShapeGizmoThicknessTint = new Color(0.7f, 0.7f, 0.7f, 1.0f);
static Material s_Material;

static readonly List<string> s_MaskablePropertyNames = new List<string>()
{
Expand All @@ -152,14 +148,7 @@ protected override void OnEnable()
_spScale = serializedObject.FindProperty("m_Scale");
_spIgnoreParent = serializedObject.FindProperty("m_IgnoreParent");
_spAnimatableProperties = serializedObject.FindProperty("m_AnimatableProperties");

if (!s_Material)
{
s_Material = Call<Material>(typeof(Material), "GetDefaultMaterial");
}

_particles = targets.Cast<UIParticle>().ToArray();

_shapeModuleUIs = null;

var targetsGos = targets.Cast<UIParticle>().Select(x => x.gameObject).ToArray();
Expand Down Expand Up @@ -244,10 +233,6 @@ public override void OnInspectorGUI()
}






//################################
// Private Members.
//################################
Expand All @@ -257,24 +242,9 @@ public override void OnInspectorGUI()
SerializedProperty _spIgnoreParent;
SerializedProperty _spAnimatableProperties;
UIParticle[] _particles;
ArcHandle _arcHandle = new ArcHandle();
BoxBoundsHandle _boxBoundsHandle = new BoxBoundsHandle();
SphereBoundsHandle _sphereBoundsHandle = new SphereBoundsHandle();
Mesh _spriteMesh;
ShapeModuleUI[] _shapeModuleUIs;
ParticleSystemInspector _inspector;

static T Call<T>(Type type, string method, params object[] args)
{
MethodInfo mi;
if (!s_InternalMethods.TryGetValue(method, out mi))
{
mi = type.GetMethod(method, BindingFlags.Static | BindingFlags.NonPublic);
s_InternalMethods.Add(method, mi);
}
return (T)mi.Invoke(null, args);
}

void OnSceneGUI()
{
_shapeModuleUIs ??= _inspector?.m_ParticleEffectUI?.m_Emitters?.SelectMany(x => x.m_Modules).OfType<ShapeModuleUI>()?.ToArray();
Expand All @@ -284,8 +254,8 @@ void OnSceneGUI()
Action postAction = () => { };
Color origin = ShapeModuleUI.s_GizmoColor.m_Color;
Color originDark = ShapeModuleUI.s_GizmoColor.m_Color;
ShapeModuleUI.s_GizmoColor.m_Color = new Color(1f, 0.7f, 0.7f, 0.9f);
ShapeModuleUI.s_GizmoColor.m_OptionalDarkColor = new Color(1f, 0.7f, 0.7f, 0.9f);
ShapeModuleUI.s_GizmoColor.m_Color = s_GizmoColor;
ShapeModuleUI.s_GizmoColor.m_OptionalDarkColor = s_GizmoColor;

_particles
.Select(x => new { canvas = x.canvas, ps = x.cachedParticleSystem, scale = x.scale })
Expand Down

0 comments on commit 34fb123

Please sign in to comment.