rip smash karts
Before Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 25 KiB |
@ -1,78 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<script src="/js/all.js"></script>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>Smash Karts</title>
|
||||
<script>
|
||||
window.config = {
|
||||
loader: 'unity-2020',
|
||||
debug: false,
|
||||
maxRatio: 16 / 9,
|
||||
minRatio: 9 / 16,
|
||||
|
||||
title: 'Smash Karts',
|
||||
thumbnail: './9c9e529b14731be871b07b89660bbc2a.png',
|
||||
numScreenshots: 4 ,
|
||||
|
||||
unityVersion: '2021.2.14f1',
|
||||
unityWebglBuildUrl: '',
|
||||
|
||||
fileSize: 65 ,
|
||||
cachedDecompressedFileSizes: {
|
||||
'49bd3a5092f1fdd2d06dc7310d087454.data': 212 ,
|
||||
'548505e139656ff7ae9715fcc93cbe6d.wasm': 212 ,
|
||||
'5d3af382427db7ead36c6078ea8ec787.js': 212 ,
|
||||
'SmashKartsGraveyard16poki.loader.js': 212 ,
|
||||
},
|
||||
"metadata": {"poki_template_version":1,"background_color":"#1B70F0","code_filename":"548505e139656ff7ae9715fcc93cbe6d.wasm","company_name":"TallTeam","data_filename":"49bd3a5092f1fdd2d06dc7310d087454.data","development_player":"false","framework_filename":"5d3af382427db7ead36c6078ea8ec787.js","height":"600","loader_filename":"SmashKartsGraveyard16poki.loader.js","product_name":"Smash Karts","product_version":"2.0.2","splash_screen_style":"Light","unity_version":"2021.2.14f1","use_data_caching":"true","use_threads":"false","use_wasm":"true","use_webgl_1_0":"true","use_webgl_2_0":"true","width":"960"}
|
||||
};
|
||||
</script>
|
||||
<!-- will be copied to the resulting head //-->
|
||||
</head>
|
||||
<body>
|
||||
<script src="js/v3/master-loader.js"></script>
|
||||
<script src="js/unity-mod.js"></script>
|
||||
<!-- will be copied to the resulting body //-->
|
||||
<script src="js/firebase/9.9.3/firebase-app-compat.js"></script>
|
||||
<script src="js/firebase/9.9.3/firebase-auth-compat.js"></script>
|
||||
<script src="js/firebase/9.9.3/firebase-database-compat.js"></script>
|
||||
<script src="js/firebase/9.9.3/firebase-analytics-compat.js"></script>
|
||||
<script src="js/firebase/9.9.3/firebase-performance-compat.js"></script>
|
||||
<script src="js/firebase/9.9.3/firebase-functions-compat.js"></script>
|
||||
<script src="scripts/main.js"></script>
|
||||
<script src="scripts/auth-v3.js"></script>
|
||||
<script>
|
||||
var firebaseConfig = {
|
||||
apiKey: "AIzaSyAdY2qq9083amKDS0R8tn2tjIKQB8mocco",
|
||||
authDomain: "webgltest-17af1.firebaseapp.com",
|
||||
databaseURL: "https://webgltest-17af1.firebaseio.com",
|
||||
projectId: "webgltest-17af1",
|
||||
storageBucket: "webgltest-17af1.appspot.com",
|
||||
messagingSenderId: "480659433590",
|
||||
appId: "1:480659433590:web:a01ad1599e963843a0d757",
|
||||
measurementId: "G-1W23DRFHK9"
|
||||
};
|
||||
// Initialize Firebase
|
||||
firebase.initializeApp(firebaseConfig);
|
||||
var firebaseSupported = false;
|
||||
if(firebase.analytics != null)
|
||||
{
|
||||
firebase.analytics.isSupported().then((isSupported) =>
|
||||
{
|
||||
if (isSupported)
|
||||
{
|
||||
analytics = firebase.analytics();
|
||||
firebaseSupported = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log("firebase.analytics() not supported ");
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1 +0,0 @@
|
||||
//NullJS
|
@ -1,13 +0,0 @@
|
||||
function UnityOpen(url) {
|
||||
url= "#"+ url;
|
||||
console.log("--fx--UnityOpen--", url);
|
||||
return url;
|
||||
}
|
||||
|
||||
function UnityUrlFix(url) {
|
||||
console.log("--fx--UnityUrlFix--", url);
|
||||
if(url.indexOf("unity3d.com")>0 || url.indexOf("appspot.com")>0){
|
||||
url= "json/null.json?"+ url;
|
||||
}
|
||||
return url;
|
||||
}
|
@ -1 +0,0 @@
|
||||
(()=>{var e=function(e){var n=RegExp("[?&]"+e+"=([^&]*)").exec(window.location.search);return n&&decodeURIComponent(n[1].replace(/\+/g," "))},n="kids"===e("tag"),t=!!window.adBridge,o="yes"===e("gdhoist"),i=new(function(){function e(){var e=this;this.queue=[],this.init=function(n,t){return void 0===n&&(n={}),void 0===t&&(t={}),new Promise((function(o,i){e.enqueue("init",[n,t],o,i)}))},this.rewardedBreak=function(){return new Promise((function(e){e(!1)}))},this.commercialBreak=function(n){return new Promise((function(t,o){e.enqueue("commercialBreak",[n],t,o)}))},this.displayAd=function(e,n,t,o){o&&o(!0),t&&t()},this.withArguments=function(n){return function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];e.enqueue(n,t)}},this.handleAutoResolvePromise=function(){return new Promise((function(e){e()}))},this.throwNotLoaded=function(){console.debug("PokiSDK is not loaded yet. Not all methods are available.")},this.doNothing=function(){}}return e.prototype.enqueue=function(e,t,o,i){var r={fn:e,args:t||[],resolveFn:o,rejectFn:i};n?o&&o(!0):this.queue.push(r)},e.prototype.dequeue=function(){for(var e=this,n=function(){var n,o,i=t.queue.shift(),r=i,a=r.fn,u=r.args;if("function"==typeof window.PokiSDK[a])if((null==i?void 0:i.resolveFn)||(null==i?void 0:i.rejectFn)){var s="init"===a;if((n=window.PokiSDK)[a].apply(n,u).catch((function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];"function"==typeof i.rejectFn&&i.rejectFn.apply(i,n),s&&setTimeout((function(){e.dequeue()}),0)})).then((function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];"function"==typeof i.resolveFn&&i.resolveFn.apply(i,n),s&&setTimeout((function(){e.dequeue()}),0)})),s)return"break"}else(o=window.PokiSDK)[a].apply(o,u);else console.error("Cannot execute "+a)},t=this;this.queue.length>0;){if("break"===n())break}},e}());window.PokiSDK={init:i.init,initWithVideoHB:i.init,commercialBreak:i.commercialBreak,rewardedBreak:i.rewardedBreak,displayAd:i.displayAd,destroyAd:i.doNothing,getLeaderboard:i.handleAutoResolvePromise,shareableURL:function(){return new Promise((function(e,n){return n()}))},getURLParam:function(n){return e("gd"+n)||e(n)||""},getLanguage:function(){return navigator.language.toLowerCase().split("-")[0]},isAdBlocked:function(){}},["captureError","customEvent","gameInteractive","gameLoadingFinished","gameLoadingProgress","gameLoadingStart","gameplayStart","gameplayStop","happyTime","logError","muteAd","roundEnd","roundStart","sendHighscore","setDebug","setDebugTouchOverlayController","setLogging","setPlayerAge","setPlaytestCanvas","enableEventTracking"].forEach((function(e){window.PokiSDK[e]=i.withArguments(e)}));var r,a,u=(r=window.pokiSDKVersion||e("ab")||"v2.313.0",a="poki-sdk-core-"+r+".f.js",n&&(a="poki-sdk-kids-"+r+".js"),t&&(a="poki-sdk-playground-"+r+".js"),o&&(a="poki-sdk-hoist-"+r+".js"),"js/"+r+"/"+a),s=document.createElement("script");s.setAttribute("src",u),s.setAttribute("type","text/javascript"),s.setAttribute("crossOrigin","anonymous"),s.onload=function(){return i.dequeue()},document.head.appendChild(s)})();
|
@ -1 +0,0 @@
|
||||
"use strict";var scripts=document.getElementsByTagName("script"),scriptUrl=scripts[scripts.length-1].src,root=scriptUrl.split("master-loader.js")[0],loaders={unity:"unity.js","unity-beta":"unity-beta.js","unity-2020":"unity-2020.js"};if(0<=window.location.href.indexOf("pokiForceLocalLoader")&&(loaders.unity="/unity/dist/unity.js",loaders["unity-beta"]="/unity-beta/dist/unity-beta.js",loaders["unity-2020"]="/unity-2020/dist/unity-2020.js",root="/loaders"),!window.config)throw Error("window.config not found");var loader=loaders[window.config.loader];if(!loader)throw Error('Loader "'+window.config.loader+'" not found');if(!window.config.unityWebglLoaderUrl){var versionSplit=window.config.unityVersion?window.config.unityVersion.split("."):[],year=versionSplit[0],minor=versionSplit[1];switch(year){case"2019":window.config.unityWebglLoaderUrl=1===minor?"js/v2/unity/UnityLoader.2019.1.js":"js/v2/unity/UnityLoader.2019.2.js";break;default:window.config.unityWebglLoaderUrl="js/v2/unity/UnityLoader.js"}}var sdkScript=document.createElement("script");sdkScript.src="js/v2/poki-sdk.js",sdkScript.onload=function(){var i=document.createElement("script");i.src=root+loader,document.body.appendChild(i)},document.body.appendChild(sdkScript);
|
@ -1 +0,0 @@
|
||||
{"ISO":"VN","ccpaApplies":false}
|
@ -1 +0,0 @@
|
||||
{}
|
Before Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 110 KiB |
Before Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 63 KiB |
Before Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 5.2 KiB |
@ -1,512 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
var unityFirebaseGameOjbectName = 'JavascriptMessageReceiver';
|
||||
|
||||
var firstLoad = true;
|
||||
|
||||
function onAuthStateChanged(user) {
|
||||
if(!user)
|
||||
{
|
||||
if(firstLoad)
|
||||
{
|
||||
signInAnonymously();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sendAuthDataToUnity();
|
||||
}
|
||||
firstLoad = false;
|
||||
}
|
||||
|
||||
|
||||
function signInAnonymously()
|
||||
{
|
||||
firebase.auth().signInAnonymously().catch(function(error) {
|
||||
var errorCode = error.code;
|
||||
console.log("error logging in " + errorCode);
|
||||
console.error(error);
|
||||
});
|
||||
}
|
||||
|
||||
function signInWithEmail(email, password)
|
||||
{
|
||||
firebase.auth().signInWithEmailAndPassword(email, password)
|
||||
.then((userCredential) => {
|
||||
console.log("signInWithEmailAndPassword Success");
|
||||
})
|
||||
.catch(function(error)
|
||||
{
|
||||
console.log("error logging in " + error.code);
|
||||
console.error(error);
|
||||
window.unityGame.SendMessage(unityFirebaseGameOjbectName, "firebaseSignInWithEmailFailed", error.message);
|
||||
});
|
||||
}
|
||||
|
||||
function linkUserWithEmail(email, password)
|
||||
{
|
||||
if(firebase.auth().currentUser != null && firebase.auth().currentUser.isAnonymous)
|
||||
{
|
||||
var credential = firebase.auth.EmailAuthProvider.credential(email, password);
|
||||
firebase.auth().currentUser.linkWithCredential(credential).then(function(user) {
|
||||
console.log("Anonymous account successfully upgraded", user);
|
||||
sendAuthDataToUnity();
|
||||
}, function(error) {
|
||||
console.log("Error upgrading anonymous account", error);
|
||||
console.error(error);
|
||||
window.unityGame.SendMessage(unityFirebaseGameOjbectName, "firebaseLinkUserWithEmailFailed", error.message);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function linkOrSignInWithGoogle()
|
||||
{
|
||||
var provider = new firebase.auth.GoogleAuthProvider();
|
||||
|
||||
if(firebase.auth().currentUser != null && firebase.auth().currentUser.isAnonymous)
|
||||
{
|
||||
if(isMobile())
|
||||
{
|
||||
firebase.auth().linkWithRedirect(provider);
|
||||
|
||||
firebase.auth().getRedirectResult().then(function(result)
|
||||
{
|
||||
console.log("linkOrSignInWithGoogle:success");
|
||||
sendAuthDataToUnity();
|
||||
}, function(error)
|
||||
{
|
||||
if(error.code == "auth/credential-already-in-use")
|
||||
{
|
||||
firebase.auth().signInWithCredential(error.credential).catch(function(error)
|
||||
{
|
||||
console.log("signInWithCredential:: Error logging in " + error.code);
|
||||
console.error(error);
|
||||
window.unityGame.SendMessage(unityFirebaseGameOjbectName, "firebaseSignInWithEmailFailed", error.message);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log("linkOrSignInWithGoogle:: Error logging in " + error.code);
|
||||
console.error(error);
|
||||
window.unityGame.SendMessage(unityFirebaseGameOjbectName, "firebaseLinkUserWithEmailFailed", error.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
firebase.auth().currentUser.linkWithPopup(provider).then((result) =>
|
||||
{
|
||||
console.log("linkOrSignInWithGoogle:: Success");
|
||||
sendAuthDataToUnity();
|
||||
}).catch((error) =>
|
||||
{
|
||||
if(error.code == "auth/credential-already-in-use")
|
||||
{
|
||||
firebase.auth().signInWithCredential(error.credential).catch(function(error)
|
||||
{
|
||||
console.log("signInWithCredential:: Error logging in " + error.code);
|
||||
console.error(error);
|
||||
window.unityGame.SendMessage(unityFirebaseGameOjbectName, "firebaseSignInWithEmailFailed", error.message);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log("linkOrSignInWithGoogle:: Error logging in " + error.code);
|
||||
console.error(error);
|
||||
window.unityGame.SendMessage(unityFirebaseGameOjbectName, "firebaseLinkUserWithEmailFailed", error.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function linkOrSignInWithApple()
|
||||
{
|
||||
var provider = new firebase.auth.OAuthProvider('apple.com');
|
||||
|
||||
if(firebase.auth().currentUser != null && firebase.auth().currentUser.isAnonymous)
|
||||
{
|
||||
var isSafariBrowser = (navigator.userAgent.indexOf('Safari') > -1 && navigator.userAgent.indexOf('Chrome') <= -1);
|
||||
if(isMobile() || isSafariBrowser)
|
||||
{
|
||||
firebase.auth().currentUser.linkWithRedirect(provider);
|
||||
}
|
||||
else
|
||||
{
|
||||
firebase.auth().currentUser.linkWithPopup(provider).then((result) =>
|
||||
{
|
||||
console.log("linkOrSignInWithApple:: Success");
|
||||
sendAuthDataToUnity();
|
||||
}).catch((error) =>
|
||||
{
|
||||
if(error.code == "auth/credential-already-in-use")
|
||||
{
|
||||
firebase.auth().signInWithCredential(error.credential).catch(function(error)
|
||||
{
|
||||
console.log("signInWithCredential:: Error logging in " + error.code);
|
||||
console.error(error);
|
||||
window.unityGame.SendMessage(unityFirebaseGameOjbectName, "firebaseSignInWithEmailFailed", error.message);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log("linkOrSignInWithApple:: Error logging in " + error.code);
|
||||
console.error(error);
|
||||
window.unityGame.SendMessage(unityFirebaseGameOjbectName, "firebaseLinkUserWithEmailFailed", error.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function signOut()
|
||||
{
|
||||
firebase.auth().signOut().then(function() {
|
||||
console.log("signOut:: Success");
|
||||
signInAnonymously();
|
||||
}).catch(function(error) {
|
||||
console.log("signOut:: Failed ");
|
||||
console.error(error);
|
||||
});
|
||||
}
|
||||
|
||||
function sendAuthDataToUnity()
|
||||
{
|
||||
if(window.unityGame != null && firebase.auth().currentUser != null)
|
||||
{
|
||||
var firebaseUid = firebase.auth().currentUser.uid;
|
||||
var isAnon = firebase.auth().currentUser.isAnonymous;
|
||||
var data = {authToken:"",uid:firebaseUid,isAnonymous:isAnon};
|
||||
var dataJson = JSON.stringify(data);
|
||||
window.unityGame.SendMessage(unityFirebaseGameOjbectName, 'SetAuthToken', dataJson);
|
||||
}
|
||||
}
|
||||
|
||||
function sendPasswordResetEmail(emailAddress)
|
||||
{
|
||||
firebase.auth().sendPasswordResetEmail(emailAddress).then(function() {
|
||||
console.log("sendPasswordResetEmail:: Success");
|
||||
window.unityGame.SendMessage(unityFirebaseGameOjbectName, "SendPasswordResetEmailSuccess");
|
||||
}).catch(function(error) {
|
||||
console.log("sendPasswordResetEmail:: Failed ");
|
||||
window.unityGame.SendMessage(unityFirebaseGameOjbectName, "SendPasswordResetEmailFailed", error.message);
|
||||
console.error(error);
|
||||
});
|
||||
}
|
||||
|
||||
function getValueTT(nodeKey)
|
||||
{
|
||||
if(firebase.auth().currentUser != null)
|
||||
{
|
||||
const dbRef = firebase.database().ref();
|
||||
dbRef.child(nodeKey).once('value').then((snapshot) => {
|
||||
if (snapshot.exists())
|
||||
{
|
||||
var valJsonStr = JSON.stringify(snapshot.val());
|
||||
SendDataToUnity("OnGetValueSuccess", nodeKey, valJsonStr);
|
||||
}
|
||||
else
|
||||
{
|
||||
window.unityGame.SendMessage(unityFirebaseGameOjbectName, "OnGetValueEmptySuccess", nodeKey);
|
||||
}
|
||||
}).catch((error) =>
|
||||
{
|
||||
window.unityGame.SendMessage(unityFirebaseGameOjbectName, "OnGetValueError", nodeKey, error.message);
|
||||
console.error(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function SendDataToUnity(functionName, nk, ds)
|
||||
{
|
||||
var obj =
|
||||
{
|
||||
nodeKey: nk,
|
||||
dataStr: ds
|
||||
}
|
||||
|
||||
window.unityGame.SendMessage(unityFirebaseGameOjbectName, functionName, JSON.stringify(obj));
|
||||
}
|
||||
|
||||
|
||||
function SendResponseToUnity(functionName, k, resonseData)
|
||||
{
|
||||
resonseData["key"] = k;
|
||||
|
||||
window.unityGame.SendMessage(unityFirebaseGameOjbectName, functionName, JSON.stringify(resonseData));
|
||||
}
|
||||
|
||||
function setValueTT(nodeKey, jsonData)
|
||||
{
|
||||
if(firebase.auth().currentUser != null)
|
||||
{
|
||||
const dbRef = firebase.database().ref();
|
||||
var jsonObj = JSON.parse(jsonData);
|
||||
dbRef.child(nodeKey).set(jsonObj, (error) => {
|
||||
if (error) {
|
||||
console.log("auth.js::setValue - Error " + nodeKey);
|
||||
SendDataToUnity("OnSetValueError", nodeKey, error.message);
|
||||
} else {
|
||||
window.unityGame.SendMessage(unityFirebaseGameOjbectName, "OnSetValueSuccess", nodeKey);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function removeValueTT(nodeKey)
|
||||
{
|
||||
if(firebase.auth().currentUser != null)
|
||||
{
|
||||
const dbRef = firebase.database().ref();
|
||||
dbRef.child(nodeKey).remove()
|
||||
.then(function(){
|
||||
window.unityGame.SendMessage(unityFirebaseGameOjbectName, "OnRemoveValueSuccess", nodeKey);
|
||||
})
|
||||
.catch(function(error){
|
||||
console.log("auth.js::removeValueTT error");
|
||||
SendDataToUnity("OnRemoveValueError", nodeKey, error.message);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function updateValueTT(nodeKey, jsonData)
|
||||
{
|
||||
if(firebase.auth().currentUser != null)
|
||||
{
|
||||
const dbRef = firebase.database().ref();
|
||||
var jsonObj = JSON.parse(jsonData);
|
||||
dbRef.child(nodeKey).update(jsonObj, (error) => {
|
||||
if (error) {
|
||||
console.log("auth.js::updateValue Error " + nodeKey);
|
||||
SendDataToUnity( "OnUpdateValueError", nodeKey, error.message);
|
||||
} else {
|
||||
window.unityGame.SendMessage(unityFirebaseGameOjbectName, "OnUpdateValueSuccess", nodeKey);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var cloudFunctionSuccess = 0;
|
||||
var cloudFunctionFail = 0;
|
||||
|
||||
function callCloudFunction(functionId, jsonData, key)
|
||||
{
|
||||
if(firebase.auth().currentUser != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
const dataObject = JSON.parse(jsonData);
|
||||
var functionRef = firebase.app().functions("us-east1").httpsCallable(functionId + "Multi");
|
||||
|
||||
functionRef(dataObject).then((response)=>
|
||||
{
|
||||
SendResponseToUnity( "OnFunctionComplete", key, response.data);
|
||||
cloudFunctionSuccess++;
|
||||
}).catch((error4)=> {
|
||||
cloudFunctionFail++;
|
||||
//SendDataToUnity( "OnFunctionError", key, error4.message);
|
||||
callCloudFunctionOG(functionId, jsonData, key);
|
||||
logCloudFunctionError("v4a", jsonData, error4.message, functionId);
|
||||
});
|
||||
} catch (error1)
|
||||
{
|
||||
cloudFunctionFail++;
|
||||
//SendDataToUnity( "OnFunctionError", key, error1.message);
|
||||
callCloudFunctionOG(functionId, jsonData, key);
|
||||
logCloudFunctionError("v4b", jsonData, error1.message, functionId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function callCloudFunctionOG(functionId, jsonData, key)
|
||||
{
|
||||
if(firebase.auth().currentUser != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
const dataObject = JSON.parse(jsonData);
|
||||
var functionRef = firebase.app().functions().httpsCallable(functionId);
|
||||
|
||||
functionRef(dataObject).then((response)=>
|
||||
{
|
||||
SendResponseToUnity( "OnFunctionComplete", key, response.data);
|
||||
logCloudFunctionSuccess("v4s1", jsonData, functionId);
|
||||
cloudFunctionSuccess++;
|
||||
}).catch((error4)=> {
|
||||
cloudFunctionFail++;
|
||||
//SendDataToUnity( "OnFunctionError", key, error4.message);
|
||||
callCloudFunctionAlt(functionId, jsonData, key);
|
||||
logCloudFunctionError("v4c", jsonData, error4.message, functionId);
|
||||
});
|
||||
} catch (error1)
|
||||
{
|
||||
cloudFunctionFail++;
|
||||
//SendDataToUnity( "OnFunctionError", key, error1.message);
|
||||
callCloudFunctionAlt(functionId, jsonData, key);
|
||||
logCloudFunctionError("v4d", jsonData, error1.message, functionId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function callCloudFunctionAlt(functionId, jsonData, key)
|
||||
{
|
||||
if(firebase.auth().currentUser != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
const dataObject = JSON.parse(jsonData);
|
||||
//var functionRef = firebase.app().functions().httpsCallable(functionId);
|
||||
var functionRef = firebase.app().functions("europe-west1").httpsCallable(functionId + "Multi");
|
||||
|
||||
functionRef(dataObject).then((response)=>
|
||||
{
|
||||
SendResponseToUnity( "OnFunctionComplete", key, response.data);
|
||||
logCloudFunctionSuccess("v4s2", jsonData, functionId);
|
||||
cloudFunctionSuccess++;
|
||||
}).catch((error4)=> {
|
||||
cloudFunctionFail++;
|
||||
callCloudFunctionRewrite(functionId, jsonData, key);
|
||||
logCloudFunctionError("v4e", jsonData, error4.message, functionId);
|
||||
});
|
||||
} catch (error1)
|
||||
{
|
||||
cloudFunctionFail++;
|
||||
callCloudFunctionRewrite(functionId, jsonData, key);
|
||||
logCloudFunctionError("v4f", jsonData, error1.message, functionId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function callCloudFunctionRewrite(functionId, jsonData, key)
|
||||
{
|
||||
if(firebase.auth().currentUser != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
const dataObject = JSON.parse(jsonData);
|
||||
dataObject["funcName"] = functionId;
|
||||
|
||||
firebase.auth().currentUser.getIdToken(false).then((authToken) =>
|
||||
{
|
||||
fetch("https://smashkarts.io/rewriteCF", {
|
||||
method: 'POST',
|
||||
cache: 'no-cache',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': `Bearer ${authToken}`,
|
||||
},
|
||||
body: JSON.stringify(dataObject)
|
||||
}).then((fetchResponse) =>
|
||||
{
|
||||
//Need to parse fetch response into usable json data
|
||||
fetchResponse.json().then((responseJsonData) =>
|
||||
{
|
||||
SendResponseToUnity( "OnFunctionComplete", key, responseJsonData);
|
||||
logCloudFunctionSuccess("v4s3", jsonData, functionId);
|
||||
cloudFunctionSuccess++;
|
||||
}).catch((error4) =>
|
||||
{
|
||||
cloudFunctionFail++;
|
||||
SendDataToUnity( "OnFunctionError", key, error4.message);
|
||||
logCloudFunctionError("v4g", jsonData, error4.message, functionId);
|
||||
});
|
||||
}).catch((error3) =>
|
||||
{
|
||||
cloudFunctionFail++;
|
||||
SendDataToUnity( "OnFunctionError", key, error3.message);
|
||||
logCloudFunctionError("v4h", jsonData, error3.message, functionId);
|
||||
});
|
||||
}).catch((error2)=> {
|
||||
cloudFunctionFail++;
|
||||
SendDataToUnity( "OnFunctionError", key, error2.message);
|
||||
logCloudFunctionError("v4i", jsonData, error2.message, functionId);
|
||||
});
|
||||
}
|
||||
catch(error1)
|
||||
{
|
||||
cloudFunctionFail++;
|
||||
SendDataToUnity( "OnFunctionError", key, error1.message);
|
||||
logCloudFunctionError("v4j", jsonData, error1.message, functionId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function logCloudFunctionError(debugErrorRootNode, jsonData, message, functionId)
|
||||
{
|
||||
var firebaseUid = firebase.auth().currentUser.uid;
|
||||
var currentTime = new Date().getTime();
|
||||
var debugErrorNode = "cferror/" + debugErrorRootNode + "/" + firebaseUid + "/" + functionId + "/" + currentTime;
|
||||
const dbRef = firebase.database().ref();
|
||||
dbRef.child(debugErrorNode).set({
|
||||
errorData: jsonData,
|
||||
os: getOS(),
|
||||
time: currentTime,
|
||||
successCount: cloudFunctionSuccess,
|
||||
failCound: cloudFunctionFail,
|
||||
errorMessage: message
|
||||
}, (setValueError) =>
|
||||
{
|
||||
if (setValueError)
|
||||
{
|
||||
console.log("logCloudFunctionError setValueError:: " + setValueError.message);
|
||||
} else
|
||||
{
|
||||
var debugErrorWriteSuccessNode = "cferror/" + debugErrorRootNode + "/" + firebaseUid + "/" + functionId + "/" + currentTime + "/successTime";
|
||||
var successTime = new Date().getTime();
|
||||
dbRef.child(debugErrorWriteSuccessNode).set(successTime);
|
||||
console.log("logCloudFunctionError Successfdfd ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function logCloudFunctionSuccess(debugErrorRootNode, jsonData, functionId)
|
||||
{
|
||||
var firebaseUid = firebase.auth().currentUser.uid;
|
||||
var currentTime = new Date().getTime();
|
||||
var debugErrorNode = "cferror/" + debugErrorRootNode + "/" + firebaseUid + "/" + functionId + "/" + currentTime;
|
||||
const dbRef = firebase.database().ref();
|
||||
|
||||
dbRef.child(debugErrorNode).set({
|
||||
errorData: jsonData,
|
||||
os: getOS(),
|
||||
time : currentTime,
|
||||
successCount : cloudFunctionSuccess,
|
||||
failCount : cloudFunctionFail,
|
||||
}, (setValueError) => {
|
||||
if (setValueError) {
|
||||
console.log("logCloudFunctionSuccess setValueError:: " + setValueError.message);
|
||||
|
||||
} else {
|
||||
console.log("logCloudFunctionSuccess Success ");
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function getCurrentUserId()
|
||||
{
|
||||
if(firebase.auth().currentUser != null)
|
||||
{
|
||||
return firebase.auth().currentUser.uid;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
function getCurrentUserIsAnon()
|
||||
{
|
||||
if(firebase.auth().currentUser != null)
|
||||
{
|
||||
return firebase.auth().currentUser.isAnonymous;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
window.addEventListener('load', function() {
|
||||
console.log('Init Auth');
|
||||
if (typeof firebase !== 'undefined' && firebase.auth() != null)
|
||||
{
|
||||
firebase.auth().onAuthStateChanged(onAuthStateChanged);
|
||||
}
|
||||
}, false);
|
||||
|
||||
|
@ -1,209 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
function setV(val2)
|
||||
{
|
||||
if(window.unityGame != null)
|
||||
{
|
||||
window.unityGame.SendMessage(unityFirebaseGameOjbectName, "V2", val2);
|
||||
}
|
||||
}
|
||||
|
||||
function getReferrerUrl()
|
||||
{
|
||||
var url = (window.location != window.parent.location)
|
||||
? document.referrer
|
||||
: document.location.href;
|
||||
return url;
|
||||
}
|
||||
|
||||
function isMobile()
|
||||
{
|
||||
var isMobile = RegExp(/Android|webOS|iPhone|iPod|iPad/i).test(navigator.userAgent);
|
||||
return isMobile || isIpad();
|
||||
}
|
||||
|
||||
function isTablet()
|
||||
{
|
||||
var userAgent = navigator.userAgent.toLowerCase();
|
||||
var isAndroidTablet = ((userAgent.search("android") > -1) && !(userAgent.search("mobile") > -1));
|
||||
|
||||
return isAndroidTablet || isIpad();
|
||||
}
|
||||
|
||||
function isIpad()
|
||||
{
|
||||
var isIpad = RegExp(/iPad/i).test(navigator.userAgent);
|
||||
|
||||
if (!isIpad)
|
||||
{
|
||||
const isMac = RegExp(/Macintosh/i).test(navigator.userAgent);
|
||||
|
||||
if (isMac && navigator.maxTouchPoints && navigator.maxTouchPoints > 2)
|
||||
{
|
||||
isIpad = true;
|
||||
}
|
||||
}
|
||||
return isIpad;
|
||||
}
|
||||
|
||||
function getOS()
|
||||
{
|
||||
var detectedOS = "Unknown";
|
||||
if (window.navigator.userAgent.indexOf("Windows") != -1) { detectedOS = "Windows";}
|
||||
else if (window.navigator.userAgent.indexOf("CrOS") != -1) { detectedOS = "Chrome";}
|
||||
else if (window.navigator.userAgent.indexOf("Mac") != -1) detectedOS="Mac/iOS";
|
||||
else if (window.navigator.userAgent.indexOf("X11") != -1) detectedOS="UNIX";
|
||||
else if (window.navigator.userAgent.indexOf("Linux") != -1) detectedOS="Linux";
|
||||
|
||||
return detectedOS;
|
||||
}
|
||||
|
||||
function isIos()
|
||||
{
|
||||
var isIos = (/iPhone|iPad|iPod/i.test(navigator.userAgent));
|
||||
return isIos || isIpad();
|
||||
}
|
||||
|
||||
|
||||
function copyTextToClipboard(text)
|
||||
{
|
||||
var textArea = document.createElement("textarea");
|
||||
textArea.style.position = 'fixed';
|
||||
textArea.style.top = 0;
|
||||
textArea.style.left = 0;
|
||||
textArea.style.width = '2em';
|
||||
textArea.style.height = '2em';
|
||||
textArea.style.padding = 0;
|
||||
textArea.style.border = 'none';
|
||||
textArea.style.outline = 'none';
|
||||
textArea.style.boxShadow = 'none';
|
||||
textArea.style.background = 'transparent';
|
||||
textArea.value = text;
|
||||
document.body.appendChild(textArea);
|
||||
textArea.select();
|
||||
try {
|
||||
var successful = document.execCommand('copy');
|
||||
var msg = successful ? 'successful' : 'unsuccessful';
|
||||
console.log('Copying text command was ' + msg);
|
||||
} catch (err) {
|
||||
console.warn('Unable to copy text');
|
||||
}
|
||||
document.body.removeChild(textArea);
|
||||
}
|
||||
|
||||
window.copyText = function (text) {
|
||||
var listener = function () {
|
||||
|
||||
copyTextToClipboard(text);
|
||||
if(isMobile())
|
||||
{
|
||||
document.removeEventListener('touchend', listener);
|
||||
}
|
||||
else
|
||||
{
|
||||
document.removeEventListener('mouseup', listener);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
if(isMobile())
|
||||
{
|
||||
document.addEventListener('touchend', listener);
|
||||
}
|
||||
else
|
||||
{
|
||||
document.addEventListener('mouseup', listener);
|
||||
}
|
||||
};
|
||||
|
||||
function firebaseLogEvent(eventName)
|
||||
{
|
||||
if(firebaseSupported) firebase.analytics().logEvent(eventName);
|
||||
}
|
||||
|
||||
function firebaseSetScreen(screenName)
|
||||
{
|
||||
if(firebaseSupported) firebase.analytics().setCurrentScreen(screenName);
|
||||
if(firebaseSupported) firebase.analytics().logEvent("screen_view", { "screen_name": screenName})
|
||||
}
|
||||
|
||||
function firebaseLogEventWithParam(eventName, p, v)
|
||||
{
|
||||
if(firebaseSupported) firebase.analytics().logEvent(eventName, { [p]: v});
|
||||
}
|
||||
|
||||
var fs = false;
|
||||
function toggleFullscreen()
|
||||
{
|
||||
if(fs)
|
||||
{
|
||||
console.log("exitFullScreen");
|
||||
exitFullScreen();
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log("setElementFullScreen");
|
||||
var elem = document.getElementById("mainContainer");
|
||||
setElementFullScreen(elem);
|
||||
}
|
||||
fs = !fs;
|
||||
}
|
||||
|
||||
function isFullscreen()
|
||||
{
|
||||
return fs;
|
||||
}
|
||||
|
||||
|
||||
function onNextMouseUp(a)
|
||||
{
|
||||
var listenerName = isMobile() ? 'touchend' : 'mouseup';
|
||||
var listener = function () {
|
||||
a();
|
||||
document.removeEventListener(listenerName, listener);
|
||||
};
|
||||
document.addEventListener(listenerName, listener);
|
||||
}
|
||||
|
||||
function openUrl(url)
|
||||
{
|
||||
onNextMouseUp(function () {
|
||||
console.log("openUrl onNextMouseUp");
|
||||
window.open(url, "_blank");
|
||||
});
|
||||
}
|
||||
|
||||
function setElementFullScreen(el) {
|
||||
onNextMouseUp(function () {
|
||||
var request = el.requestFullscreen || el.webkitRequestFullscreen || el.mozRequestFullScreen || el.msRequestFullscreen;
|
||||
request.call(el);
|
||||
});
|
||||
}
|
||||
|
||||
function exitFullScreen() {
|
||||
onNextMouseUp(function () {
|
||||
var exitFS = document.exitFullscreen || document.webkitExitFullscreen || document.mozCancelFullScreen || document.msExitFullscreen;
|
||||
exitFS.call(document);
|
||||
});
|
||||
}
|
||||
|
||||
function handleKeyDown(keycode)
|
||||
{
|
||||
if(window.unityGame) window.unityGame.SendMessage(unityFirebaseGameOjbectName, "HandleKeyDown", keycode);
|
||||
}
|
||||
|
||||
function handleKeyUp(keycode)
|
||||
{
|
||||
if(window.unityGame) window.unityGame.SendMessage(unityFirebaseGameOjbectName, "HandleKeyUp", keycode);
|
||||
}
|
||||
|
||||
var source = "notset";
|
||||
function setUrlSource(src)
|
||||
{
|
||||
source = src;
|
||||
console.log("setUrlSource " + src);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
BIN
tron/icon.png
Normal file
After Width: | Height: | Size: 4.4 KiB |
27
tron/index.html
Normal file
@ -0,0 +1,27 @@
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<script src="/js/all.js"></script>
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Tron</title>
|
||||
<style>html{background-color:#000;}</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="ruffle" width="100%" height="100%"></div>
|
||||
<script src="https://unpkg.com/@ruffle-rs/ruffle"></script>
|
||||
<script>
|
||||
window.RufflePlayer = window.RufflePlayer || {};
|
||||
window.addEventListener("load", (event) => {
|
||||
const ruffle = window.RufflePlayer.newest();
|
||||
const player = ruffle.createPlayer();
|
||||
const container = document.getElementById("ruffle");
|
||||
player.id = "player";
|
||||
player.style.width = "100%";
|
||||
player.style.height = "100%";
|
||||
container.appendChild(player);
|
||||
player.load("tron.swf");
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|