Cross Platform Native Plugins
A true cross platform tool for Unity which provides unique and unified way to access native functionality on mobile platforms.
Public Member Functions | List of all members
UI Class Reference

Provides a cross-platform interface for creating and presenting native user interfaces. More...

Public Member Functions

void ShowAlertDialogWithSingleButton (string _title, string _message, string _button, AlertDialogCompletion _onCompletion)
 Shows an alert dialog with single button. More...
 
void ShowAlertDialogWithMultipleButtons (string _title, string _message, string[] _buttonsList, AlertDialogCompletion _onCompletion)
 Shows an alert dialog with multiple buttons. More...
 
delegate void AlertDialogCompletion (string _buttonPressed)
 Delegate that will be called after user clicks a button from alert dialog. More...
 
virtual void ShowToast (string _message, eToastMessageLength _length)
 Shows the toast. A toast is a view containing a quick little message for the user. More...
 
virtual void SetPopoverPoint (Vector2 _position)
 Sets position of popover controller to specified position. More...
 
void SetPopoverPointAtLastTouchPosition ()
 Sets position of popover controller to last touch position. More...
 
void ShowSingleFieldPromptDialogWithPlainText (string _title, string _message, string _placeholder, string[] _buttonsList, SingleFieldPromptCompletion _onCompletion)
 Shows a prompt dialog that allows the user to enter text. More...
 
void ShowSingleFieldPromptDialogWithSecuredText (string _title, string _message, string _placeholder, string[] _buttonsList, SingleFieldPromptCompletion _onCompletion)
 Shows a prompt dialog that allows the user to enter obscure text. More...
 
virtual void ShowLoginPromptDialog (string _title, string _message, string _usernamePlaceHolder, string _passwordPlaceHolder, string[] _buttonsList, LoginPromptCompletion _onCompletion)
 Shows a prompt dialog that allows the user to enter login details. More...
 
delegate void SingleFieldPromptCompletion (string _buttonPressed, string _inputText)
 Delegate that will be called after user clicks a button from prompt dialog. More...
 
delegate void LoginPromptCompletion (string _buttonPressed, string _usernameText, string _passwordText)
 Delegate that will be called after user clicks a button from login prompt dialog. More...
 

Detailed Description

Provides a cross-platform interface for creating and presenting native user interfaces.

Member Function Documentation

void ShowAlertDialogWithSingleButton ( string  _title,
string  _message,
string  _button,
AlertDialogCompletion  _onCompletion 
)

Shows an alert dialog with single button.

Parameters
_titleThe string that appears in the title bar.
_messageDescriptive text that provides more details than the title.
_buttonTitle of action button.
_onCompletionCallback that will be called after operation is completed.

The following code example demonstrates how to show alert dialog with single button.

using System.Collections;
public class ExampleClass : MonoBehaviour
{
public void ShowAlertDialog ()
{
NPBinding.UI.ShowAlertDialogWithSingleButton("Test", "This is a sample message.", "Ok", OnButtonPressed);
}
private void OnButtonPressed (string _buttonPressed)
{
Debug.Log("Button pressed: " + _buttonPressed);
}
}
void ShowAlertDialogWithMultipleButtons ( string  _title,
string  _message,
string[]  _buttonsList,
AlertDialogCompletion  _onCompletion 
)

Shows an alert dialog with multiple buttons.

Parameters
_titleThe string that appears in the title bar.
_messageDescriptive text that provides more details than the title.
_buttonsListAn array of string values, used as title of action buttons.
_onCompletionCallback that will be called after operation is completed.

The following code example demonstrates how to show alert dialog with 2 action buttons.

using System.Collections;
public class ExampleClass : MonoBehaviour
{
public void ShowAlertDialog ()
{
string[] _buttons = new string[] {
"Ok",
"Cancel"
};
NPBinding.UI.ShowAlertDialogWithMultipleButtons("Test", "This is a sample message.", _buttons, OnButtonPressed);
}
private void OnButtonPressed (string _buttonPressed)
{
Debug.Log("Button pressed: " + _buttonPressed);
}
}
delegate void AlertDialogCompletion ( string  _buttonPressed)

Delegate that will be called after user clicks a button from alert dialog.

Parameters
_buttonPressedTitle of the button that was pressed.
virtual void ShowToast ( string  _message,
eToastMessageLength  _length 
)
virtual

Shows the toast. A toast is a view containing a quick little message for the user.

Parameters
_messageThe text message in a Toast view.
_lengthToast view show duration length.

The following code example demonstrates how to show a short toast message.

using System.Collections;
public class ExampleClass : MonoBehaviour
{
public void ShowToastMessage ()
{
NPBinding.UI.ShowToast("This is a sample message.", eToastMessageLength.SHORT);
}
}
Note
This is an Android only feature. On iOS, this call has no effect.
virtual void SetPopoverPoint ( Vector2  _position)
virtual

Sets position of popover controller to specified position.

Popover controllers are used to Pick Media and to present Share options in iPad. And by default, popover controllers are set to (0.0, 0.0) position.

Parameters
_positionScreen position where popover is displayed.
Note
This is an iOS only feature. On Android, this call has no effect.
void SetPopoverPointAtLastTouchPosition ( )

Sets position of popover controller to last touch position.

Popover controllers are used to Pick Media and to present Share options in iPad. And by default, popover controllers are set to (0.0, 0.0) position.

Note
This is an iOS only feature. On Android, this call has no effect.
void ShowSingleFieldPromptDialogWithPlainText ( string  _title,
string  _message,
string  _placeholder,
string[]  _buttonsList,
SingleFieldPromptCompletion  _onCompletion 
)

Shows a prompt dialog that allows the user to enter text.

Parameters
_titleThe string that appears in the title bar.
_messageDescriptive text that provides more details than the title.
_placeholderThe string that is displayed when there is no other text in the textfield.
_buttonsListAn array of string values, used as title of action buttons.
_onCompletionCallback that will be called after operation is completed.

The following code example demonstrates how to prompt user to enter profile name.

using System.Collections;
public class ExampleClass : MonoBehaviour
{
public void ShowPromptDialog ()
{
string[] _buttons = new string[] {
"Ok",
"Cancel"
};
NPBinding.UI.ShowSingleFieldPromptDialogWithPlainText("Profile", "Please enter a profile name to store your game progress.", "username", _buttons, OnButtonPressed);
}
private void OnButtonPressed (string _buttonPressed, string _inputText)
{
Debug.Log("Button pressed: " + _buttonPressed);
Debug.Log("Input text: " + _inputText);
}
}
void ShowSingleFieldPromptDialogWithSecuredText ( string  _title,
string  _message,
string  _placeholder,
string[]  _buttonsList,
SingleFieldPromptCompletion  _onCompletion 
)

Shows a prompt dialog that allows the user to enter obscure text.

Parameters
_titleThe string that appears in the title bar.
_messageDescriptive text that provides more details than the title.
_placeholderThe string that is displayed when there is no other text in the textfield.
_buttonsListAn array of string values, used as title of action buttons.
_onCompletionCallback that will be called after operation is completed.
virtual void ShowLoginPromptDialog ( string  _title,
string  _message,
string  _usernamePlaceHolder,
string  _passwordPlaceHolder,
string[]  _buttonsList,
LoginPromptCompletion  _onCompletion 
)
virtual

Shows a prompt dialog that allows the user to enter login details.

Parameters
_titleThe string that appears in the title bar.
_messageDescriptive text that provides more details than the title.
_usernamePlaceHolderThe string that is displayed when there is no other text in the username textfield.
_passwordPlaceHolderThe string that is displayed when there is no other text in the password textfield.
_buttonsListAn array of string values, used as title of action buttons.
_onCompletionCallback that will be called after operation is completed.

The following code example demonstrates how to prompt user to enter login details.

using System.Collections;
public class ExampleClass : MonoBehaviour
{
public void ShowLoginDialog ()
{
string[] _buttons = new string[] {
"Ok",
"Cancel"
};
NPBinding.UI.ShowSingleFieldPromptDialogWithPlainText("Example Game", "Please enter login details.", "username", "password", _buttons, OnButtonPressed);
}
private void OnButtonPressed (string _buttonPressed, string _usernameText, string _passwordText)
{
Debug.Log("Button pressed: " + _buttonPressed);
Debug.Log("Input username is: " + _usernameText);
Debug.Log("Input password is: " + _passwordText);
}
}
delegate void SingleFieldPromptCompletion ( string  _buttonPressed,
string  _inputText 
)

Delegate that will be called after user clicks a button from prompt dialog.

Parameters
_buttonPressedTitle of the button that was pressed.
_inputTextText contents of textfield.
delegate void LoginPromptCompletion ( string  _buttonPressed,
string  _usernameText,
string  _passwordText 
)

Delegate that will be called after user clicks a button from login prompt dialog.

Parameters
_buttonPressedTitle of the button that was pressed.
_usernameTextText contents of username textfield.
_passwordTextText contents of password textfield.