MessageBox.cs - UF-CSSALT/SMARTS-SDK-Unity-Asset-Package GitHub Wiki
The Message Box system is used for creating message boxes with a yes button, no button, ok button, and/or cancel button. These message boxes can also have background images if desired and are designed to use a call back function whenever a button is pressed for processing user input.
The Type enumerator determines the type of the message. It has three possible states:
- ERROR
- WARNING
- MESSAGE
The Result enumerator determines the type of the result. It has five possible states:
- OK
- CANCEL
- YES
- NO
- DISMISSED
isActive will return the current status of the message box. True will be returned if the message box is active and false will be returned if the message box is not active.
Displays a message box with an OK button. The method parameters are as follows:
- Title: The message box title.
- Message: The content of the message.
- Type: The type of message box that will be created.
- Callback: The method to call when the user clicks a button.
public static void ShowOK(string title, string message, MessageBox.Type type, Action callback, string okText)
Displays a message box with an OK button. The method parameters are as follows:
- Title: The message box title.
- Message: The content of the message.
- Type: The type of message box that will be created.
- Callback: The method to call when the user clicks a button.
- Ok Text: Sets the text of the ok button for the message box.
public static void ShowOK(string title, string message, MessageBox.Type type, Action callback, Sprite img)
Displays a message box with an OK button. The method parameters are as follows:
- Title: The message box title.
- Message: The content of the message.
- Type: The type of message box that will be created.
- Callback: The method to call when the user clicks a button.
- Img: Sets image of message box.
public static void ShowOK(string title, string message, MessageBox.Type type, Action callback, Sprite img, string okText)
Displays a message box with an OK button. The method parameters are as follows:
- Title: The message box title.
- Message: The content of the message.
- Type: The type of message box that will be created.
- Callback: The method to call when the user clicks a button.
- Img: Sets image of message box.
- Ok Text: Sets the text of the ok button for the message box.
public static void ShowOKCancel(string title, string message, MessageBox.Type type, Action callback)
Displays a message box with an OK button and a cancel button. The method parameters are as follows:
- Title: The message box title.
- Message: The content of the message.
- Type: The type of message box that will be created.
- Callback: The method to call when the user clicks a button.
public static void ShowOKCancel(string title, string message, MessageBox.Type type, Action callback, string okText, string cancelText)
Displays a message box with an OK button and a cancel button. The method parameters are as follows:
- Title: The message box title.
- Message: The content of the message.
- Type: The type of message box that will be created.
- Callback: The method to call when the user clicks a button.
- Ok Text: Sets the text of the okay button.
- Cancel Text: Sets the text of the cancel button.
public static void ShowOKCancel(string title, string message, MessageBox.Type type, Action callback, Sprite img)
Displays a message box with an OK button and a cancel button. The method parameters are as follows:
- Title: The message box title.
- Message: The content of the message.
- Type: The type of message box that will be created.
- Callback: The method to call when the user clicks a button.
- Img: Sets image of message box.
public static void ShowOKCancel(string title, string message, MessageBox.Type type, Action callback, Sprite img, string okText, string cancelText)
Displays a message box with an OK button and a cancel button. The method parameters are as follows:
- Title: The message box title.
- Message: The content of the message.
- Type: The type of message box that will be created.
- Callback: The method to call when the user clicks a button.
- Ok Text: Sets the text of the okay button.
- Cancel Text: Sets the text of the cancel button.
- Img: Sets image of message box.
Displays a message box with a yes button and a no button. The method parameters are as follows:
- Title: The message box title.
- Message: The content of the message.
- Type: The type of message box that will be created.
- Callback: The method to call when the user clicks a button.
public static void ShowYesNo(string title, string message, MessageBox.Type type, Action callback, string yesText, string noText)
Displays a message box with a yes button and a no button. The method parameters are as follows:
- Title: The message box title.
- Message: The content of the message.
- Type: The type of message box that will be created.
- Callback: The method to call when the user clicks a button.
- Yes Text: Sets the text of the yes button.
- No Text: Sets the text of the no button.
public static void ShowYesNo(string title, string message, MessageBox.Type type, Action callback, Sprite img)
Displays a message box with a yes button and a no button. The method parameters are as follows:
- Title: The message box title.
- Message: The content of the message.
- Type: The type of message box that will be created.
- Callback: The method to call when the user clicks a button.
- Img: Sets image of message box.
public static void ShowYesNo(string title, string message, MessageBox.Type type, Action callback, Sprite img, string yesText, string noText)
Displays a message box with a yes button and a no button. The method parameters are as follows:
- Title: The message box title.
- Message: The content of the message.
- Type: The type of message box that will be created.
- Callback: The method to call when the user clicks a button.
- Img: Sets image of message box.
- Yes Text: Sets the text of the yes button.
- No Text: Sets the text of the no button.
public static void ShowYesNoCancel(string title, string message, MessageBox.Type type, Action callback)
Displays a message box with a yes button, a no button, and a cancel button. The method parameters are as follows:
- Title: The message box title.
- Message: The content of the message.
- Type: The type of message box that will be created.
- Callback: The method to call when the user clicks a button.
public static void ShowYesNoCancel(string title, string message, MessageBox.Type type, Action callback, string yesText, string noText, string cancelText)
Displays a message box with a yes button, a no button, and a cancel button. The method parameters are as follows:
- Title: The message box title.
- Message: The content of the message.
- Type: The type of message box that will be created.
- Callback: The method to call when the user clicks a button.
- Yes Text: Sets the text of the yes button.
- No Text: Sets the text of the no button.
- Cancel Text: Sets the text of the cancel button.
public static void ShowYesNoCancel(string title, string message, MessageBox.Type type, Action callback, Sprite img)
Displays a message box with a yes button, a no button, and a cancel button. The method parameters are as follows:
- Title: The message box title.
- Message: The content of the message.
- Type: The type of message box that will be created.
- Callback: The method to call when the user clicks a button.
- Img: Sets image of message box.
public static void ShowYesNoCancel(string title, string message, MessageBox.Type type, Action callback, Sprite img, string yesText, string noText, string cancelText)
Displays a message box with a yes button, a no button, and a cancel button. The method parameters are as follows:
- Title: The message box title.
- Message: The content of the message.
- Type: The type of message box that will be created.
- Callback: The method to call when the user clicks a button.
- Img: Sets image of message box.
- Yes Text: Sets the text of the yes button.
- No Text: Sets the text of the no button.
- Cancel Text: Sets the text of the cancel button.
This method dismisses any active message box in the scene. It returns true if the message box is dismissed succesfully or false if it was not dismissed succesfully.
This method sets the message result to Result.NO, isActive to false, and destroys the message box.
This method sets the message result to Result.YES, isActive to false, and destroys the message box.
This method sets the message result to Result.OK, isActive to false, and destroys the message box.
This method sets the message result to Result.CANCEL, isActive to false, and destroys the message box.