12345678910111213141516171819202122232425262728 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using Sirenix.OdinInspector;
- namespace KairoEngine.UI.InteractionHandler
- {
- [HideMonoScript]
- public class ClickHandler : MonoBehaviour
- {
- [InfoBox("Control this button dynamicly thru a parent object that implements the ClickHandler interface. Trigger the OnClick function on this script thru the Button Component.")]
- public string title = "";
- [ShowInInspector, ReadOnly, ShowIf("@receiver != null")] public IClickHandler receiver;
- public void OnClick()
- {
- if(receiver != null) receiver.OnClick(title);
- //else Debug.LogError("ClickHandler has no receiver!", this.gameObject);
- }
- public void Setup(string title, IClickHandler receiver)
- {
- this.title = title;
- this.receiver = receiver;
- }
- }
- }
|