/// <summary> /// Handles the Click event of the Yes control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param> private void Yes_Click(object sender, RoutedEventArgs e) { if (OnYesClicked != null) { OnYesClicked.Invoke(sender, e); } }
public void ShowDialog(string msg, OnYesClicked yesCallback, OnNoClicked noCallback) { textMsg.text = msg; onYesCallback = yesCallback; onNoCallback = noCallback; gameObject.SetActive(true); }
/// <summary> /// Handles the Click event of the Yes control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param> private void Yes_Click(object sender, RoutedEventArgs e) { ResetPopup(); if (OnYesClicked != null) { OnYesClicked.Invoke(sender, e); } if (_currentControlFocus != null) { _currentControlFocus.Focus(); } }
/* Sets the assigned playerInterruption game object to active, sets method arguments as delegates, * stops time, and passes optional arguments representing new message text, left button text, and * right button text to the newly activated interruption prefab. */ public void activateInterrupt(OnYesClicked yesClicked, OnNoClicked noClicked, string message = null, string affirmativeText = null, string negativeText = null) { if (!playerInterruption.activeInHierarchy) { Debug.Log("playerInterruptionActivatorController - Interrupt Activated!"); // Activates interruption playerInterruption.SetActive(true); // Overwrites delegates for yes and no buttons playerInterruption.GetComponent <playerInterruptionController>().onYesClicked = yesClicked; playerInterruption.GetComponent <playerInterruptionController>().onNoClicked = noClicked; // Adds continueGame to the button delegates playerInterruption.GetComponent <playerInterruptionController>().onYesClicked += continueGame; playerInterruption.GetComponent <playerInterruptionController>().onNoClicked += continueGame; // Sets text if arguments are not default if (message != null) { playerInterruption.GetComponent <playerInterruptionController>().setMessage(message); } if (affirmativeText != null) { playerInterruption.GetComponent <playerInterruptionController>().setAffirmativeText(affirmativeText); } if (negativeText != null) { playerInterruption.GetComponent <playerInterruptionController>().setNegativeText(negativeText); } // This "stops time" by disabling scripts that still work while timescale is set to 1 Time.timeScale = 0; } }
private void ProcessYes() { OnYesClicked?.Invoke(); }