Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using UnityEditor;
- public class ChosenStyleEditor : EditorWindow
- {
- bool styles = true;
- bool baseStyle, woodenStyle, stoneStyle;
- private string style;
- public delegate void ChangeStyle(int num);
- public static ChangeStyle OnStyleChange;
- // Add menu named "My Window" to the Window menu
- [MenuItem("Window/Choose Tiles Style")]
- static void Init()
- {
- // Get existing open window or if none, make a new one:
- ChosenStyleEditor window = (ChosenStyleEditor)EditorWindow.GetWindow(typeof(ChosenStyleEditor));
- window.Show();
- }
- void OnGUI()
- {
- GUILayout.Label("Choose Tile Style", EditorStyles.boldLabel);
- styles = EditorGUILayout.BeginToggleGroup("Style Settings", styles);
- if (baseStyle = EditorGUILayout.Toggle("Base Style", baseStyle))
- {
- GUILayout.Label("Base Style Is Now Applied", EditorStyles.boldLabel);
- if (OnStyleChange != null)
- OnStyleChange(0);
- woodenStyle = stoneStyle = false;
- }
- else if (stoneStyle = EditorGUILayout.Toggle("Stone Style", stoneStyle))
- {
- GUILayout.Label("Stone Style Is Now Applied", EditorStyles.boldLabel);
- if (OnStyleChange != null)
- OnStyleChange(1);
- baseStyle = woodenStyle = false;
- }
- else if (woodenStyle = EditorGUILayout.Toggle("Wooden Style", woodenStyle))
- {
- GUILayout.Label("Wooden Style Is Now Applied", EditorStyles.boldLabel);
- if (OnStyleChange != null)
- OnStyleChange(2);
- baseStyle = stoneStyle = false;
- }
- EditorGUILayout.EndToggleGroup();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement