mirror of
https://github.com/OpenFusionProject/Client.git
synced 2026-01-23 02:30:05 +00:00
Consistency pass and small tweaks
**Formatting going forward** Variables: camelCase (capitalization of two letter abbreviations is OK, e.g. playerID) Classes: PascalCase CSS: kebab-case Files: kebab-case **Other miscellaneous changes** * The WebPlayer crashing as well as failing to load the config file are now fatal errors and will quit the app * Moved some style attributes from index.html into openfusion.css
This commit is contained in:
97
assets/js/game-client.js
Normal file
97
assets/js/game-client.js
Normal file
@@ -0,0 +1,97 @@
|
||||
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.unity");
|
||||
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();
|
||||
}
|
||||
Reference in New Issue
Block a user