Skip to main content

ConfirmPopupPanel

A class in Root.Township, Alta.Meta.UI.

Client: menu popup with a message and confirm and cancel buttons. Call Setup with the text and callbacks, then show it; it hides itself after either button.

Constructors​

MemberWhat it is
ConfirmPopupPanel()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

5 private and internal fields
MemberWhat it is
private Action cancelActionCallback run on cancel. Cleared when the cancel button is hidden.
private Button cancelButtonThe cancel button.
private Action confirmActionCallback run on confirm.
private Button confirmButtonThe confirm button.
private TextRenderer messageTextText showing the popup's message.

Events​

MemberWhat it is
event Action<ConfirmPopupPanel> CancelledRaised after the cancel button runs its callback.
event Action<ConfirmPopupPanel> ConfirmedRaised after the confirm button runs its callback.

Methods​

MemberWhat it is
void Setup(string message, string confirm = "Confirm", string cancel = "Cancel", Action confirmAction = null, Action cancelAction = null)Sets the message, button labels and callbacks. Passing null for cancel hides the cancel button.
protected override void InternalSetState(bool state, Action onFinished = null)Shows or hides the panel, hooking the button handlers only while shown.
2 private and internal methods
MemberWhat it is
private void HandleCancelPressed(Button obj)Runs the cancel callback (logging any exception), raises Cancelled and hides the panel.
private void HandleConfirmPressed(Button obj)Runs the confirm callback (logging any exception), raises Confirmed and hides the panel.

Used in​

Members of other types that take, return or hold a ConfirmPopupPanel: