Class AlertDialog
The AlertDialog class provides an interface to display an alert message to the user.
Inheritance
Namespace: VoxelBusters.EssentialKit
Assembly: cs.temp.dll.dll
Syntax
public class AlertDialog : NativeFeatureBehaviour
Examples
The following code example shows how to configure and present an alert dialog.
using UnityEngine;
using System.Collections;
using VoxelBusters.EssentialKit;
public class ExampleClass : MonoBehaviour
{
public void Start()
{
AlertDialog newDialog = AlertDialog.CreateInstance();
newDialog.SetTitle(title);
newDialog.SetMessage(message);
newDialog.AddButton(button, OnAlertButtonClicked);
newDialog.Show();
}
private void OnAlertButtonClicked()
{
// add your code
}
}
Properties
Message
The message of the alert.
Declaration
public string Message { get; set; }
Property Value
Type | Description |
---|---|
System.String | The message of the alert. |
Title
The title of the alert.
Declaration
public string Title { get; set; }
Property Value
Type | Description |
---|---|
System.String | The title of the alert. |
Methods
AddButton(String, Callback)
Adds an action button to the alert. Here, the default style is used.
Declaration
public void AddButton(string title, Callback callback)
Parameters
Type | Name | Description |
---|---|---|
System.String | title | The title of the button. |
Callback | callback | The method to execute when the user selects this button. |
AddCancelButton(String, Callback)
Adds action button to the alert. This style type indicates the action cancels the operation and leaves things unchanged.
Declaration
public void AddCancelButton(string title, Callback callback)
Parameters
Type | Name | Description |
---|---|---|
System.String | title | The title of the button. |
Callback | callback | The method to execute when the user selects this button. |
AwakeInternal(Object[])
Declaration
protected override void AwakeInternal(object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Object[] | args |
CreateInstance(AlertDialogStyle)
Creates a new instance of the AlertDialog class.
Declaration
public static AlertDialog CreateInstance(AlertDialogStyle alertStyle = AlertDialogStyle.Default)
Parameters
Type | Name | Description |
---|---|---|
AlertDialogStyle | alertStyle | The alert style to be used. |
Returns
Type | Description |
---|---|
AlertDialog |
DestroyInternal()
Declaration
protected override void DestroyInternal()
Dismiss()
Dismisses the alert dialog before user selects an action.
Declaration
public void Dismiss()
GetFeatureName()
Declaration
protected override string GetFeatureName()
Returns
Type | Description |
---|---|
System.String |
IsAvailable()
Declaration
public override bool IsAvailable()
Returns
Type | Description |
---|---|
System.Boolean |
Show()
Shows the alert dialog to the user.
Declaration
public void Show()