Show / Hide Table of Contents

    Class AlertDialogBuilder

    Builder class for AlertDialog objects. Provides a convenient way to set the various fields of a AlertDialog.

    Inheritance
    System.Object
    AlertDialogBuilder
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ToString()
    System.Object.ReferenceEquals(System.Object, System.Object)
    Namespace: VoxelBusters.EssentialKit
    Assembly: cs.temp.dll.dll
    Syntax
    public class AlertDialogBuilder
    Examples

    The following code example shows how to configure and present an alert dialog using builder.

    using UnityEngine;
    using System.Collections;
    using VoxelBusters.EssentialKit;
    
    public class ExampleClass : MonoBehaviour 
    {
        public void Start()
        {
            AlertDialog newDialog   = new Builder()
                .SetTitle(title);
                .SetMessage(message);
                .AddButton(button, OnAlertButtonClicked);
                .Build();
            newDialog.Show();
        }
    
        private void OnAlertButtonClicked()
        {
            // add your code
        }
    }

    Constructors

    AlertDialogBuilder(AlertDialogStyle)

    Initializes a new instance of the class.

    Declaration
    public AlertDialogBuilder(AlertDialogStyle alertStyle = AlertDialogStyle.Default)
    Parameters
    Type Name Description
    AlertDialogStyle alertStyle

    The alert style to be used.

    Methods

    AddButton(String, Callback)

    Adds an action button to the alert. Here, the default style is used.

    Declaration
    public AlertDialogBuilder 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.

    Returns
    Type Description
    AlertDialogBuilder

    AddCancelButton(String, Callback)

    Adds action button to the alert. This style type indicates the action cancels the operation and leaves things unchanged.

    Declaration
    public AlertDialogBuilder 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.

    Returns
    Type Description
    AlertDialogBuilder

    Build()

    Combines all of the options that have been set and return a new AlertDialog object.

    Declaration
    public AlertDialog Build()
    Returns
    Type Description
    AlertDialog

    The build.

    SetMessage(String)

    Sets the message of the alert.

    Declaration
    public AlertDialogBuilder SetMessage(string value)
    Parameters
    Type Name Description
    System.String value

    The descriptive text that provides more details about the reason for the alert.

    Returns
    Type Description
    AlertDialogBuilder

    SetTitle(String)

    Sets the title of the alert.

    Declaration
    public AlertDialogBuilder SetTitle(string value)
    Parameters
    Type Name Description
    System.String value

    The title of the alert.

    Returns
    Type Description
    AlertDialogBuilder
    Back to top Cross Platform Native Plugins 2.0 : Essential Kit from Voxel Busters