﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

namespace Arugula.Audio
{
    [RequireComponent(typeof(Button))]
    public class PhonicUIButton : PhonicUIHandlerBase
    {
#if UNITY_EDITOR
        [ContextMenu("CopyJSON")]
        void copyjson()
        {
            UnityEditor.EditorGUIUtility.systemCopyBuffer = UnityEditor.EditorJsonUtility.ToJson(this, true);
        }

        [ContextMenu("PasteJSON")]
        void pastejson()
        {
            UnityEditor.EditorJsonUtility.FromJsonOverwrite(UnityEditor.EditorGUIUtility.systemCopyBuffer, this);
        }
#endif
        [PhonicSound] public string onClick;

        private void Awake() => GetComponent<Button>().onClick.AddListener( () => Play(onClick));
    }

}
