Want to improve the docs? Take a look at scripting-api-data!
Found a bug? jc3mp/bugs is a good place to let us know.
new WebUIWindow(string name, string location, Vector2 size)
var webuiwindow = new WebUIWindow('myui', 'package://my_package/index.html', new Vector2(jcmp.viewportSize.x, jcmp.viewportSize.y));
Name | Type | Description |
---|---|---|
size | Vector2 | the size of the CEF UI window |
location | string | the location of the page which CEF should load |
hidden | boolean | whether the UI should be hidden or not |
position | Vector2 | the WebUIWindow's position in the game world |
autoResize | boolean | whether the CEF UI should resize itself when the game resolution is changed or not |
captureMouseInput | boolean | whether mouse input should be captured by the CEF UI or not |
texture | Texture | read only the CEF UI texture |
autoRenderTexture | boolean | whether the texture is automatically drawn by the renderer or not |
Brings the CEF UI to the front
function createMyUI() {
var firstUI = new WebUIWindow("myFirstUI", "package://my_client_package/index1.html", new Vector2(jcmp.viewportSize.x, jcmp.viewportSize.y));
var secondUI = new WebUIWindow("mySecondUI", "package://my_client_package/index2.html", new Vector2(jcmp.viewportSize.x, jcmp.viewportSize.y));
//Brings "myFirstUI" to the front so it is visible
//Without this, we would see the second created UI on top and not the first one
firstUI.BringToFront();
}
createMyUI();
Reload a certain CEF UI
Name | Type | Description |
---|---|---|
ignoreCache | boolean | whether the cache should be ignored |
function createMyUI() {
var myUI = new WebUIWindow("myUI", "package://my_client_package/index1.html", new Vector2(jcmp.viewportSize.x, jcmp.viewportSize.y));
//Change the location property and force the UI to reload
myUI.location = "package://my_client_package/index2.html";
myUI.Reload(true);
}
createMyUI();
Calls an Event on the UI that has been added using
jcmp.AddEvent
returns: undefined
Name | Type | Description |
---|---|---|
name | string | event name |
...args | any | optional event arguments |
Adds an Event Handler so the UI can call it using
jcmp.CallLocalEvent
returns: undefined
Name | Type | Description |
---|---|---|
name | string | event name |
handler | function | handler function |
Destroys the WebUIWindow
By becoming the newest member of our growing forums, we and hundreds of other players will always keep you up to date on everything JC3:MP related.