csShurikenEffectEditor.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using UnityEngine;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. #if UNITY_EDITOR
  5. using UnityEditor;
  6. [System.Serializable]
  7. public class csShurikenEffectEditor : EditorWindow
  8. {
  9. private float Scale = 1;
  10. public GameObject Effect;
  11. public Color ShurikenSystemColor = Color.white;
  12. static csShurikenEffectEditor myWindow;
  13. [MenuItem("Window/Shuriken System Effect Editor")]
  14. public static void Init()
  15. {
  16. myWindow = EditorWindow.GetWindowWithRect<csShurikenEffectEditor>(new Rect(100, 100, 300, 220)); //set Editor Position and Size
  17. myWindow.titleContent = new GUIContent("Scale Editor");
  18. }
  19. void OnGUI()
  20. {
  21. GUILayout.Box("Shuriken System Effect Scale Editor", GUILayout.Width(295));
  22. EditorGUILayout.Space();
  23. Effect = (GameObject)EditorGUILayout.ObjectField("Shuriken System Effect", Effect, typeof(GameObject), true);
  24. EditorGUILayout.Space();
  25. EditorGUILayout.Space();
  26. EditorGUILayout.Space();
  27. EditorGUILayout.Space();
  28. Scale = float.Parse(EditorGUILayout.TextField("Scale Change Value", Scale.ToString()));
  29. EditorGUILayout.Space();
  30. EditorGUILayout.Space();
  31. EditorGUILayout.Space();
  32. EditorGUILayout.Space();
  33. if (GUILayout.Button("Scale Apply", GUILayout.Height(70)))
  34. {
  35. if (Effect.GetComponent<csShurikenEffectChanger>() != null)
  36. Effect.GetComponent<csShurikenEffectChanger>().ShurikenParticleScaleChange(Scale);
  37. else
  38. {
  39. Effect.AddComponent<csShurikenEffectChanger>();
  40. Effect.GetComponent<csShurikenEffectChanger>().ShurikenParticleScaleChange(Scale);
  41. }
  42. DestroyImmediate(Effect.GetComponent<csShurikenEffectChanger>());
  43. }
  44. }
  45. }
  46. #endif