Client/assets/js/game-client.js
CakeLancelot dabb8bf484 Use extra-plugin-dirs in Electron to load plugin, add fusion manifest.
This has the advantage of being self contained (doesn't conflict with Unity 3.x - 5.x loader, so we can use the original one) and **disabling auto updates actually works**.

We can also eliminate any code used to install and verify unity, since it's all self contained.

Also added fusion manifest file to set process as DPI aware, and set ACP to UTF-8 on Windows 10 1903 and above.

Bumped version to 1.4.2
2023-09-14 05:29:34 -05:00

98 lines
3.0 KiB
JavaScript

var ipc = require("ipc");
var gameRunning = false;
// Unity invoked methods begin //
// Uncomment and enter credentials to skip login screen
function authDoCallback(param) {
/*var unity = document.getElementById('unityEmbed');
unity.SendMessage("GlobalManager", "SetTEGid", "player");
unity.SendMessage("GlobalManager", "SetAuthid", "0");
unity.SendMessage("GlobalManager", "DoAuth", 0);*/
}
function MarkProgress(param) {}
function redirect(html) {
ipc.send("exit", 0);
}
function HomePage(param) {
ipc.send("exit", 0);
}
function PageOut(param) {
ipc.send("exit", 0);
}
function updateSocialOptions(param) {
ipc.send("exit", 0);
}
function PayPage(param) {
ipc.send("exit", 0);
}
// Unity invoked methods end //
function onResize() {
if (gameRunning == true) {
var unity = document.getElementById("unityEmbed");
unity.style.width = window.innerWidth + "px";
unity.style.height = window.innerHeight + "px";
}
}
function launchGame() {
gameRunning = true;
var sel = document.getElementById("of-serverselector");
sel.remove();
document.body.style.overflow = "hidden";
var object = document.createElement("object");
object.setAttribute(
"classid",
"clsid:444785F1-DE89-4295-863A-D46C3A781394"
);
object.setAttribute(
"codebase",
"undefined/UnityWebPlayer.cab#version=2,0,0,0"
);
object.setAttribute("id", "unityObject");
object.setAttribute("width", "1264");
object.setAttribute("height", "661");
var embed = document.createElement("embed");
embed.setAttribute("type", "application/vnd.ffuwp");
embed.setAttribute(
"pluginspage",
"http://www.unity3d.com/unity-web-player-2.x"
);
embed.setAttribute("id", "unityEmbed");
embed.setAttribute("width", "1280");
embed.setAttribute("height", "680");
embed.setAttribute("src", window.assetUrl + "main.unity3d");
embed.setAttribute("bordercolor", "000000");
embed.setAttribute("backgroundcolor", "000000");
embed.setAttribute("disableContextMenu", true);
embed.setAttribute("textcolor", "ccffff");
embed.setAttribute("logoimage", "assets/img/unity-dexlabs.png");
embed.setAttribute("progressbarimage", "assets/img/unity-loadingbar.png");
embed.setAttribute(
"progressframeimage",
"assets/img/unity-loadingframe.png"
);
embed.setAttribute(
"autoupdateurlsignature",
"42180ee5edc4e3d4dd706bcc17cedd8d6ec7b7ac463071fd34ab97fe181f1a78df31db5feb4526677e4f69ef53acaff44471591e68b87f041c80fd54765f0d5725b08aa28f5acf7716ffb2a04e971269f35925c7e38d57dd78f6a206530caaa3da7e32f07f19810efc0ebf29a4eae976a925ad9cc5beb4dd51564c67dc489033"
);
embed.setAttribute(
"autoupdateurl",
"http://wp-cartoonnetwork.unity3d.com/ff/big/beta-20111013/autodownload_webplugin_beta"
);
var div = document.getElementById("client");
object.appendChild(embed);
div.appendChild(object);
document.title = "OpenFusion";
onResize();
}