Sinespace Client
2023.2.17543
Client-side scripting for Sinespace
|
Contains classes which interface with user interface dialogue windows, such as prompts and text entry dialogues. More...
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 > | |
T | _wrap [get] |
Contains classes which interface with user interface dialogue windows, such as prompts and text entry dialogues.
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().
title | The title of the color picker window, choose something brief and appropriate like 'Select a wall color' |
okbutton | The title of the 'OK' button, should indicate the action e.g. 'Adjust Wall' |
onChange | A callback event, will fire multiple times as the user adjusts the color |
onSelect | A callback event, indicates the final color selected by the user |
onCancel | A callback event, fires when the user clicks the Cancel button |
defaultColor | The color to open the colour picker with |
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().
title | The title of the color picker window, choose something brief and appropriate like 'Select a wall color' |
okbutton | The title of the 'OK' button, should indicate the action e.g. 'Adjust Wall' |
onChange | A callback event, will fire multiple times as the user adjusts the color |
onSelect | A callback event, indicates the final color selected by the user |
onCancel | A callback event, fires when the user clicks the Cancel button |
defaultColor | The color to open the colour picker with |
|
virtual |
Implements ScriptClass< T >.
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.
url | The 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
void SineSpace.Scripting.Client.SDialogues.SendLocalChat | ( | string | message, |
string | from | ||
) |
Sends a message into the 'Script' chat channel
message | The message to appear in the channel |
from | The '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);
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
title | The acompanying text, should be something ala "Enter your username" |
okButton | The text displayed on the OK button, should be descriptive, e.g. "Change Username" |
result | A action which will fire containing the user input string |
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
title | The acompanying text, should be something ala "Enter your username" |
okButton | The text displayed on the OK button, should be descriptive, e.g. "Change Username" |
result | A 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);
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.
title | The question to be asked of the user, should be a simple statement, e.g. "Save room changes?" |
okbutton | The text on the OK button, should indicate the action, e.g. "Save Room" |
cancelButton | The text on the cancel button, should indicate the action, e.g. "Not now" |
result | Will fire a callback event depending on the status of the users actions |
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.
title | The question to be asked of the user, should be a simple statement, e.g. "Save room changes?" |
okbutton | The text on the OK button, should indicate the action, e.g. "Save Room" |
cancelButton | The text on the cancel button, should indicate the action, e.g. "Not now" |
result | Will 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);