ResponseButtonWithConfirmation.cs
Code: Select all
using UnityEngine;
using UnityEngine.UI;
using PixelCrushers.DialogueSystem;
public class ResponseButtonWithConfirmation : StandardUIResponseButton
{
public GameObject confirmationPanel; //<-- Assign these in inspector.
public Button confirmButton;
public Button cancelButton;
public override void OnClick()
{
confirmationPanel.SetActive(true);
confirmButton.onClick.RemoveAllListeners();
cancelButton.onClick.RemoveAllListeners();
confirmButton.onClick.AddListener(() => { confirmationPanel.SetActive(false); base.OnClick(); });
cancelButton.onClick.AddListener(() => confirmationPanel.SetActive(false));
}
}
DS_ConfirmResponseExample_2024-06-27.unitypackage