Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var userID = "undefined";
- var thirdPartyID = "undefined";
- var rrHost;
- var rrDataPath;
- function setUserID(userIDtoSet)
- {
- userID = userIDtoSet;
- // alert("UserID" + userID);
- }
- function setThirdPartyID(thirdPartyIDToSet)
- {
- thirdPartyID = thirdPartyIDToSet;
- // alert("ThirdPartyID" + thirdPartyID);
- }
- function setHostDataPath(host, dataPath)
- {
- rrHost = host;
- rrDataPath = dataPath;
- }
- function addEventHandler(element, type, handler)
- {
- if (element.addEventListener)
- {
- element.addEventListener(type, handler, false);
- }
- else if (element.attachEvent)
- {
- element.attachEvent("on" + type, handler);
- }
- else
- {
- element["on" + type] = handler;
- }
- }
- function removeEventHandler(element, type, handler)
- {
- if (element.removeEventListener)
- {
- element.removeEventListener(type, handler, false);
- }
- else if (element.detachEvent)
- {
- element.detachEvent("on" + type, handler);
- }
- else
- {
- element["on" + type] = null;
- }
- }
- function PhotoSelected(event)
- {
- if (event.origin != "https://" + rrHost)
- {
- return;
- }
- var div = document.getElementById("selectPhoto");
- div.parentNode.removeChild(div);
- removeEventHandler(window, "message", PhotoSelected);
- UnityObject2.instances[0].getUnity().SendMessage("AVATARIMAGEUPLOADHELPER", "OnPhotoSelectedWeb", event.data);
- }
- function SelectPhoto(locPhoto, locCancel, locSizeError)
- {
- //console.log("SelectPhoto 12");
- var div = document.createElement("div");
- div.id = "selectPhoto";
- div.style.position = "absolute";
- div.style.top = "50%";
- div.style.left = "50%";
- div.style.marginTop = "-120px";
- div.style.marginLeft = "-160px";
- div.style.width = "320px";
- div.style.height = "240px";
- div.style.background = "#808080";
- div.style.border = "thick solid #000000";
- var ifrm = document.createElement("IFRAME");
- ifrm.setAttribute("src", rrDataPath + "/scripts/SelectPhoto.html?locPhoto=" + locPhoto + "&locCancel=" + locCancel + "&v=2");
- ifrm.frameBorder = "0";
- ifrm.style.width = "320px";
- ifrm.style.height = "240px";
- ifrm.onload = function()
- {
- ifrm.contentWindow.postMessage("Hello", "https://" + rrHost);
- }
- div.appendChild(ifrm);
- document.body.appendChild(div);
- addEventHandler(window, "message", PhotoSelected);
- }
- function ShowPauseScreen(unityHidden)
- {
- if (unityHidden != "True")
- {
- var div = document.getElementById("pauseScreen");
- div.parentNode.removeChild(div);
- }
- else
- {
- var div = document.createElement("div");
- div.id = "pauseScreen";
- div.style.textAlign = "center";
- div.style.top = "0%";
- div.style.left = "0%";
- div.style.width = "100%";
- div.style.height = "120%";
- div.style.position = "absolute";
- div.style.background = "#000000";
- var img = document.createElement("img");
- img.src = rrDataPath + "/images/logo_cie_paused.jpg";
- img.style.top = "10%"
- img.style.left = "0%"
- img.style.width = "100%";
- img.style.paddingBottom = "46.88%";
- img.style.position = "absolute";
- img.alt = "Game Is Paused";
- div.appendChild(img);
- document.body.appendChild(div);
- }
- }
- function OpenEmailWindow()
- {
- //console.log("OpenEmailWindow 12");
- var win = window.open("mailto:", "_blank");
- setTimeout( function()
- {
- if(!win)
- {
- //console.log("Popup blocked");
- UnityObject2.instances[0].getUnity().SendMessage("FRIENDSCONTROLLER", "OnEmailWindowOpened", "error");
- }
- else
- {
- UnityObject2.instances[0].getUnity().SendMessage("FRIENDSCONTROLLER", "OnEmailWindowOpened", "success");
- win.close();
- }
- }, 1000);
- }
- function OpenTwitterWindow()
- {
- //console.log("OpenTwitterWindow 12");
- var win = window.open("http://twitter.com", "_blank");
- setTimeout( function()
- {
- if(!win)
- {
- //console.log("Popup blocked");
- UnityObject2.instances[0].getUnity().SendMessage("FRIENDSCONTROLLER", "OnTwitterWindowOpened", "error");
- }
- else
- {
- UnityObject2.instances[0].getUnity().SendMessage("FRIENDSCONTROLLER", "OnTwitterWindowOpened", "success");
- }
- }, 1000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement