Advertisement
Guest User

Untitled

a guest
Nov 18th, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. using UnityEngine;
  2. using UnityEditor;
  3. public class ChosenStyleEditor : EditorWindow
  4. {
  5. bool styles = true;
  6. bool baseStyle, woodenStyle, stoneStyle;
  7. private string style;
  8. public delegate void ChangeStyle(int num);
  9. public static ChangeStyle OnStyleChange;
  10. // Add menu named "My Window" to the Window menu
  11. [MenuItem("Window/Choose Tiles Style")]
  12. static void Init()
  13. {
  14. // Get existing open window or if none, make a new one:
  15. ChosenStyleEditor window = (ChosenStyleEditor)EditorWindow.GetWindow(typeof(ChosenStyleEditor));
  16. window.Show();
  17. }
  18.  
  19. void OnGUI()
  20. {
  21. GUILayout.Label("Choose Tile Style", EditorStyles.boldLabel);
  22. styles = EditorGUILayout.BeginToggleGroup("Style Settings", styles);
  23. if (baseStyle = EditorGUILayout.Toggle("Base Style", baseStyle))
  24. {
  25. GUILayout.Label("Base Style Is Now Applied", EditorStyles.boldLabel);
  26. if (OnStyleChange != null)
  27. OnStyleChange(0);
  28. woodenStyle = stoneStyle = false;
  29. }
  30. else if (stoneStyle = EditorGUILayout.Toggle("Stone Style", stoneStyle))
  31. {
  32. GUILayout.Label("Stone Style Is Now Applied", EditorStyles.boldLabel);
  33. if (OnStyleChange != null)
  34. OnStyleChange(1);
  35. baseStyle = woodenStyle = false;
  36. }
  37. else if (woodenStyle = EditorGUILayout.Toggle("Wooden Style", woodenStyle))
  38. {
  39. GUILayout.Label("Wooden Style Is Now Applied", EditorStyles.boldLabel);
  40. if (OnStyleChange != null)
  41. OnStyleChange(2);
  42. baseStyle = stoneStyle = false;
  43. }
  44. EditorGUILayout.EndToggleGroup();
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement