|
|
(6 intermediate revisions by the same user not shown) |
Line 1: |
Line 1: |
− | ==Members==
| + | This page has moved to: https://docs.sine.space/v/scripting/client-scripting/components/sbrowsersurface |
− | {{ScriptFunction|void|Back|();|Equivalent to hitting the 'back' button within the browser.|5=<pre>Space.Host.ExecutingObject.Browser.Back()</pre>}}
| + | |
− | | + | |
− | {{ScriptFunction|void|CallFunction|(string name, string argument);|Calls a JS function in the browser with a single argument. The function name must begin with the characters "sinespace__".|5=<pre></pre>}}
| + | |
− | | + | |
− | {{ScriptFunction|void|Forward|();|Equivalent to hitting the 'forward' button within the browser.|5=<pre>Space.Host.ExecutingObject.Browser.Forward()</pre>}}
| + | |
− | | + | |
− | {{ScriptFunction|void|RegisterFunction|(string name, closure function);|Registers a JS function in the browser. The function name must start with the characters "sinespace__".|5=<pre></pre>}}
| + | |
− | | + | |
− | {{ScriptFunction|void|Reload|();|Refreshes and reloads the current webpage.|5=<pre>Space.Host.ExecutingObject.Browser.Reload()</pre>}}
| + | |
− | | + | |
− | {{ScriptFunction|void|SetURL|(string url);|Sets the URL for the browser frame, and navigates to it. (A standard URL recognized by Chromium; e.g. (https://www.youtube.com) |5=<pre>Space.Host.ExecutingObject.Browser.SetURL('https://www.youtube.com')</pre>}}
| + | |
− | | + | |
− | | + | |
− | | + | |
− | ==Properties==
| + | |
− | {{ScriptFunction|bool|Networked|{ get;set; }|Should changes to this browser be streamed to other clients within the area?.|5=<pre>Space.Host.ExecutingObject.Browser.Networked=true</pre>}}
| + | |
− | | + | |
− | {{ScriptFunction|bool|Muted|{ get;set; }|Whether this Browser Surface is muted or not.|5=<pre>Space.Host.ExecutingObject.Browser.Muted=true</pre>|6=<pre>--the below scipt makes this object a clickable that mutes/unmutes a browser surface
| + | |
− | --(Example: Browser Mute button )
| + | |
− | --[Required: This object's parent needs to be an object with BrowserSurface component in it]
| + | |
− | | + | |
− | thisGameObject = Space.Host.ExecutingObject
| + | |
− | | + | |
− | | + | |
− | OnClick = function()
| + | |
− | | + | |
− | if thisGameObject.Parent.Browser.Muted then
| + | |
− | thisGameObject.Parent.Browser.Muted = false
| + | |
− | Space.Log("Browser unmuted")
| + | |
− | else
| + | |
− | thisGameObject.Parent.Browser.Muted = true
| + | |
− | Space.Log("Browser muted")
| + | |
− | end
| + | |
− | | + | |
− | end
| + | |
− | | + | |
− | thisGameObject.AddClickable()
| + | |
− | thisGameObject.Clickable.Tooltip = "Click to Mute/Unmute Browser"
| + | |
− | thisGameObject.Clickable.OnClick(OnClick) </pre>}}
| + | |
− | | + | |
− | {{ScriptFunction|bool|CanGoBack|{ get; }|Returns whether this Browser Surface can navigate back|5=<pre>CanGoBack = Space.Host.ExecutingObject.Browser.CanGoBack</pre>|6=<pre> --the below scipt makes this Browser object show/hide it's Forward and Back
| + | |
− | --buttons according to wether the actions are possible or not
| + | |
− | --(Example: browser navigation )
| + | |
− | --[Required: This object needs the forward and back objects added to the references section in scripting runtime]
| + | |
− | | + | |
− | thisGameObject = Space.Host.ExecutingObject
| + | |
− | forwardButton = Space.Host.GetReference("Forward Button")
| + | |
− | backButton = Space.Host.GetReference("Back Button")
| + | |
− | | + | |
− | OnUpdate = function()
| + | |
− |
| + | |
− | if thisGameObject.Browser.CanGoBack then
| + | |
− | backButton.Active = true
| + | |
− | else backButton.Active = false
| + | |
− | end
| + | |
− | | + | |
− | if thisGameObject.Browser.CanGoForward then
| + | |
− | forwardButton.Active = true
| + | |
− | else forwardButton.Active = false
| + | |
− | end
| + | |
− | | + | |
− |
| + | |
− | end
| + | |
− | | + | |
− | | + | |
− | | + | |
− | thisGameObject.SubscribeToEvents()
| + | |
− | thisGameObject.OnUpdate(OnUpdate)
| + | |
− | | + | |
− | </pre>}}
| + | |
− | | + | |
− | {{ScriptFunction|bool|CanGoForward|{ get; }|Returns whether this Browser Surface can navigate forward|5=<pre>CanGoForward = Space.Host.ExecutingObject.Browser.CanGoForward</pre>|6=<pre> --the below scipt makes this Browser object show/hide it's Forward and Back
| + | |
− | --buttons according to wether the actions are possible or not
| + | |
− | --(Example: browser navigation )
| + | |
− | --[Required: This object needs the forward and back objects added to the references section in scripting runtime]
| + | |
− | | + | |
− | thisGameObject = Space.Host.ExecutingObject
| + | |
− | forwardButton = Space.Host.GetReference("Forward Button")
| + | |
− | backButton = Space.Host.GetReference("Back Button")
| + | |
− | | + | |
− | OnUpdate = function()
| + | |
− |
| + | |
− | if thisGameObject.Browser.CanGoBack then
| + | |
− | backButton.Active = true
| + | |
− | else backButton.Active = false
| + | |
− | end
| + | |
− | | + | |
− | if thisGameObject.Browser.CanGoForward then
| + | |
− | forwardButton.Active = true
| + | |
− | else forwardButton.Active = false
| + | |
− | end
| + | |
− | | + | |
− |
| + | |
− | end
| + | |
− | | + | |
− | | + | |
− | | + | |
− | thisGameObject.SubscribeToEvents()
| + | |
− | thisGameObject.OnUpdate(OnUpdate)
| + | |
− | | + | |
− | </pre>}}
| + | |
− | | + | |
− | {{Scripting Navbox}}
| + | |