Exemplo n.º 1
0
        //----------------------------------------------------
        public override void OnInspectorGUI()
        {
            Melody melody = (Melody)target;

            UnityEditor.EditorGUILayout.LabelField("Add Notes To Melody", UnityEditor.EditorStyles.boldLabel);
            UnityEditor.EditorGUILayout.BeginHorizontal();

            foreach (Note note in Enum.GetValues(typeof(Note)))
            {
                if (GUILayout.Button(note.ToString().Replace("Sharp", "#")))
                {
                    //Debug.Log($"GUI button {note.ToString().Replace("Sharp", "#")} pressed.");
                    melody.Add(note);
                }
            }

            UnityEditor.EditorGUILayout.EndHorizontal();



            GUILayout.Box(melody.ToString());

            if (GUILayout.Button("Clear Notes"))
            {
                ConfirmationPopupWindow window = CreateInstance <ConfirmationPopupWindow>();
                window.Description = "You sure you want to clear this melody?";
                window.onResult   += HandlePopup;
                window.ToPosition();
                window.ShowPopup();
            }
        }