/* [REMOVE THIS LINE]
* [REMOVE THIS LINE] To use this template, make a copy and remove the lines that start
* [REMOVE THIS LINE] with "[REMOVE THIS LINE]". Then add your code where the comments indicate.
* [REMOVE THIS LINE]
* [REMOVE THIS LINE] If your code references scripts or assets that are outside of the Plugins
* [REMOVE THIS LINE] folder, move this script outside of the Plugins folder, too.
* [REMOVE THIS LINE]
using UnityEngine;
using System.Collections;
using PixelCrushers.DialogueSystem;
public class TemplateTextFieldUI : MonoBehaviour, ITextFieldUI
{
///
/// This is an example private field to record the delegate that must be called when the player accepts
/// the input in the text field (e.g., by pressing the Return key).
///
private AcceptedTextDelegate acceptedText = null;
///
/// Starts the text input field.
///
/// The label text.
/// The current value to use for the input field.
/// Max length, or 0 for unlimited.
/// The delegate to call when accepting text.
public void StartTextInput(string labelText, string text, int maxLength, AcceptedTextDelegate acceptedText)
{
this.acceptedText = acceptedText;
// Add your code here to displaying your text input controls.
// When the player accepts the input, call the acceptedText() delegate, for example using
// AcceptTextInput() below.
}
///
/// Cancels the text input field.
///
public void CancelTextInput()
{
// Add your code here to cancel/hide the text input controls.
}
///
/// Accepts the text input and calls the accept handler delegate.
///
private void AcceptTextInput()
{
// Add your code here to accept the input and hide the controls.
if (acceptedText != null)
{
// Call the delegate:
// acceptedText();
acceptedText = null;
}
}
}
/**/