Custom Connect Screen: Difference between revisions
No edit summary |
No edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
==Setup== | |||
Since Onset 1.2.2 the client can display a web UI while connecting and downloading files from a server. The page to show is hosted on the game server directly and can be configured in the server_config.json. | Since Onset 1.2.2 the client can display a web UI while connecting and downloading files from a server. The page to show is hosted on the game server directly and can be configured in the server_config.json. | ||
This feature is optional. | This feature is optional. | ||
Line 17: | Line 18: | ||
</pre> | </pre> | ||
==Example== | |||
Example video showing a custom screen: https://www.youtube.com/watch?v=t-OYr2jkmfE | Example video showing a custom screen: https://www.youtube.com/watch?v=t-OYr2jkmfE | ||
Download example connect screen from the video above: [[:File:loadingscreen.zip|loadingscreen.zip]] | Download example connect screen from the video above: [[:File:loadingscreen.zip|loadingscreen.zip]] | ||
==Download progress events== | |||
Since Onset 1.4.2 the following Javascript functions are now called in your custom connect screen. | |||
<syntaxhighlight lang="Javascript"> | |||
function OnDownloadComplete(file) | |||
{ | |||
console.log("OnDownloadComplete " + file); | |||
} | |||
// (string) msg: The message that is usually displayed to the player. | |||
// (string) file: What file is currently being downloaded. | |||
// (int) remaining_files: Number files still needed to download. | |||
// (string) bytes_received: The number of bytes already received for the current file downloading as a string. | |||
function OnDownloadProgress(msg, file, remaining_files, bytes_received) | |||
{ | |||
console.log("OnDownloadProgress " + msg + " " + file + " " + parseInt(remaining_files) + " " + bytes_received) | |||
} | |||
</syntaxhighlight> |
Latest revision as of 18:03, 21 January 2021
Setup
Since Onset 1.2.2 the client can display a web UI while connecting and downloading files from a server. The page to show is hosted on the game server directly and can be configured in the server_config.json. This feature is optional.
Put your html and other web files in the public_html folder of the server. If it does not exist, create the directory. The connect screen can't load content from the internet. Everything has to be inside your public_html folder.
In your server_config.json configure the page that you want to be shown.
"connect_screen_url": "loadingscreen.html"
In this case it will display loadingscreen.html from your public_html folder.
To enable the cursor during the connect screen you can set the following:
"connect_screen_show_cursor": true
Example
Example video showing a custom screen: https://www.youtube.com/watch?v=t-OYr2jkmfE
Download example connect screen from the video above: loadingscreen.zip
Download progress events
Since Onset 1.4.2 the following Javascript functions are now called in your custom connect screen.
function OnDownloadComplete(file)
{
console.log("OnDownloadComplete " + file);
}
// (string) msg: The message that is usually displayed to the player.
// (string) file: What file is currently being downloaded.
// (int) remaining_files: Number files still needed to download.
// (string) bytes_received: The number of bytes already received for the current file downloading as a string.
function OnDownloadProgress(msg, file, remaining_files, bytes_received)
{
console.log("OnDownloadProgress " + msg + " " + file + " " + parseInt(remaining_files) + " " + bytes_received)
}