first commit
This commit is contained in:
36
NitroxClient/MonoBehaviours/Gui/Modals/ConfirmModal.cs
Normal file
36
NitroxClient/MonoBehaviours/Gui/Modals/ConfirmModal.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
|
||||
namespace NitroxClient.MonoBehaviours.Gui.Modals;
|
||||
|
||||
public class ConfirmModal : Modal
|
||||
{
|
||||
private Action yesCallback;
|
||||
|
||||
public ConfirmModal() : base(yesButtonText: "Confirm", hideNoButton: false, noButtonText: "Cancel", isAvoidable: true, transparency: 0.93f)
|
||||
{ }
|
||||
|
||||
public void Show(string actionText, Action yesCallback)
|
||||
{
|
||||
ModalText = actionText;
|
||||
this.yesCallback = yesCallback;
|
||||
Show();
|
||||
}
|
||||
|
||||
public override void ClickYes()
|
||||
{
|
||||
yesCallback?.Invoke();
|
||||
Hide();
|
||||
OnDeselect();
|
||||
}
|
||||
|
||||
public override void ClickNo()
|
||||
{
|
||||
Hide();
|
||||
OnDeselect();
|
||||
}
|
||||
|
||||
public override void OnDeselect()
|
||||
{
|
||||
yesCallback = null;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user