Sinespace Client  2023.2.17543
Client-side scripting for Sinespace
SineSpace.Scripting.Client.SDialogues Class Reference

Contains classes which interface with user interface dialogue windows, such as prompts and text entry dialogues. More...

Inheritance diagram for SineSpace.Scripting.Client.SDialogues:
ScriptClass< T > ScriptClassWrapper< T >

Public Member Functions

override void Initialise (SScript runtime, object wrapper)
 
void ColorPicker (string title, string okbutton, Action< SColor > onChange, Action< SColor > onSelect, Action onCancel, SColor defaultColor)
 Opens a color picker dialogue. Any change while the color picker is open will trigger onChange(SColor). Clicking 'ok' will trigger onSelect(SColor), and clicking cancel will trigger onCancel(). More...
 
void ColorPicker (string title, string okbutton, Closure onChange, Closure onSelect, Closure onCancel, SColor defaultColor)
 Opens a color picker dialogue. Any change while the color picker is open will trigger onChange(SColor). Clicking 'ok' will trigger onSelect(SColor), and clicking cancel will trigger onCancel(). More...
 
void YesNoInput (string title, string okbutton, string cancelButton, Action< bool > result)
 Opens a simple Yes/No dialogue prompt and calls the result() callback when a choice is made. Clicking the (X) on the window will be treated as cancel. More...
 
void YesNoInput (string title, string okButton, string cancelButton, Closure result)
 Opens a simple Yes/No dialogue prompt and calls the result() callback when a choice is made. Clicking the (X) on the window will be treated as cancel. More...
 
void TextInput (string title, string okButton, Action< string > result)
 Opens a text entry window with room for a single multi-line text field, fires result(string) with the resulting text More...
 
void TextInput (string title, string okButton, Closure result)
 Opens a text entry window with room for a single multi-line text field, fires result(string) with the resulting text More...
 
void OpenURL (string url, bool newTab=true)
 Opens the specified URL in the in-app webbrowser, or the system web browser. In some environments the user may be prompted before this is opened. More...
 
void SendLocalChat (string message, string from)
 Sends a message into the 'Script' chat channel More...
 
- Public Member Functions inherited from ScriptClass< T >
void ReportError (string error, bool fatal, UnityEngine.Object target=null)
 
- Public Member Functions inherited from ScriptClassWrapper< T >
override void Initialise (SScript runtime, object wrapper)
 

Additional Inherited Members

- Protected Member Functions inherited from ScriptClass< T >
void Initialise (SScript runtime)
 
- Properties inherited from ScriptClass< T >
override bool Alive [get]
 Return if the component is alive. More...
 
virtual bool Alive [get]
 
DynValue CachedData [get, set]
 
- Properties inherited from ScriptClassWrapper< T >
_wrap [get]
 

Detailed Description

Contains classes which interface with user interface dialogue windows, such as prompts and text entry dialogues.

Member Function Documentation

◆ ColorPicker() [1/2]

void SineSpace.Scripting.Client.SDialogues.ColorPicker ( string  title,
string  okbutton,
Action< SColor onChange,
Action< SColor onSelect,
Action  onCancel,
SColor  defaultColor 
)

Opens a color picker dialogue. Any change while the color picker is open will trigger onChange(SColor). Clicking 'ok' will trigger onSelect(SColor), and clicking cancel will trigger onCancel().

Parameters
titleThe title of the color picker window, choose something brief and appropriate like 'Select a wall color'
okbuttonThe title of the 'OK' button, should indicate the action e.g. 'Adjust Wall'
onChangeA callback event, will fire multiple times as the user adjusts the color
onSelectA callback event, indicates the final color selected by the user
onCancelA callback event, fires when the user clicks the Cancel button
defaultColorThe color to open the colour picker with

◆ ColorPicker() [2/2]

void SineSpace.Scripting.Client.SDialogues.ColorPicker ( string  title,
string  okbutton,
Closure  onChange,
Closure  onSelect,
Closure  onCancel,
SColor  defaultColor 
)

Opens a color picker dialogue. Any change while the color picker is open will trigger onChange(SColor). Clicking 'ok' will trigger onSelect(SColor), and clicking cancel will trigger onCancel().

Parameters
titleThe title of the color picker window, choose something brief and appropriate like 'Select a wall color'
okbuttonThe title of the 'OK' button, should indicate the action e.g. 'Adjust Wall'
onChangeA callback event, will fire multiple times as the user adjusts the color
onSelectA callback event, indicates the final color selected by the user
onCancelA callback event, fires when the user clicks the Cancel button
defaultColorThe color to open the colour picker with

◆ Initialise()

override void SineSpace.Scripting.Client.SDialogues.Initialise ( SScript  runtime,
object  wrapper 
)
virtual

Implements ScriptClass< T >.

◆ OpenURL()

void SineSpace.Scripting.Client.SDialogues.OpenURL ( string  url,
bool  newTab = true 
)

Opens the specified URL in the in-app webbrowser, or the system web browser. In some environments the user may be prompted before this is opened.

Parameters
urlThe web address to open

hostObject = Space.Host.ExecutingObject;

function openTheWebsite () Space.Dialogues.OpenURL ("http://sine.space/"); end

hostObject.SubscribeToEvents(); hostObject.OnMouseDown(openTheWebsite); – when the object is clicked, the "sine.space" website is opened

◆ SendLocalChat()

void SineSpace.Scripting.Client.SDialogues.SendLocalChat ( string  message,
string  from 
)

Sends a message into the 'Script' chat channel

Parameters
messageThe message to appear in the channel
fromThe 'from' username for the message

hostObject = Space.Host.ExecutingObject;

function chatMessage () Space.Dialogues.SendLocalChat ("I've been clicked", "Clickable Object"); end

hostObject.SubscribeToEvents(); hostObject.OnMouseDown(chatMessage);

◆ TextInput() [1/2]

void SineSpace.Scripting.Client.SDialogues.TextInput ( string  title,
string  okButton,
Action< string >  result 
)

Opens a text entry window with room for a single multi-line text field, fires result(string) with the resulting text

Parameters
titleThe acompanying text, should be something ala "Enter your username"
okButtonThe text displayed on the OK button, should be descriptive, e.g. "Change Username"
resultA action which will fire containing the user input string

◆ TextInput() [2/2]

void SineSpace.Scripting.Client.SDialogues.TextInput ( string  title,
string  okButton,
Closure  result 
)

Opens a text entry window with room for a single multi-line text field, fires result(string) with the resulting text

Parameters
titleThe acompanying text, should be something ala "Enter your username"
okButtonThe text displayed on the OK button, should be descriptive, e.g. "Change Username"
resultA action which will fire containing the user input string

hostObject = Space.Host.ExecutingObject;

printToLog = function (s) Space.Log(s); end

function openDialogue () Space.Dialogues.TextInput ("Write anything.", "Done", printToLog); end

hostObject.SubscribeToEvents(); hostObject.OnMouseDown(openDialogue);

◆ YesNoInput() [1/2]

void SineSpace.Scripting.Client.SDialogues.YesNoInput ( string  title,
string  okbutton,
string  cancelButton,
Action< bool >  result 
)

Opens a simple Yes/No dialogue prompt and calls the result() callback when a choice is made. Clicking the (X) on the window will be treated as cancel.

Parameters
titleThe question to be asked of the user, should be a simple statement, e.g. "Save room changes?"
okbuttonThe text on the OK button, should indicate the action, e.g. "Save Room"
cancelButtonThe text on the cancel button, should indicate the action, e.g. "Not now"
resultWill fire a callback event depending on the status of the users actions

◆ YesNoInput() [2/2]

void SineSpace.Scripting.Client.SDialogues.YesNoInput ( string  title,
string  okButton,
string  cancelButton,
Closure  result 
)

Opens a simple Yes/No dialogue prompt and calls the result() callback when a choice is made. Clicking the (X) on the window will be treated as cancel.

Parameters
titleThe question to be asked of the user, should be a simple statement, e.g. "Save room changes?"
okbuttonThe text on the OK button, should indicate the action, e.g. "Save Room"
cancelButtonThe text on the cancel button, should indicate the action, e.g. "Not now"
resultWill fire a callback event depending on the status of the users actions

hostObject = Space.Host.ExecutingObject; local deltaPos = Vector.New(0,100,0); local teleportTo = hostObject.WorldPosition + deltaPos;

function teleportMeUp (b) if b then Space.Scene.PlayerAvatar.Teleport(teleportTo); end end

function openDialogue () Space.Dialogues.YesNoInput ("Ready for a teleport?", "Yes", "No", teleportMeUp); end

hostObject.SubscribeToEvents(); hostObject.OnMouseDown(openDialogue);