Advertisement
dcomicboy

ciecommon.jsdata

Jan 26th, 2015
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.03 KB | None | 0 0
  1. var userID = "undefined";
  2. var thirdPartyID = "undefined";
  3. var rrHost;
  4. var rrDataPath;
  5.  
  6. function setUserID(userIDtoSet)
  7. {
  8. userID = userIDtoSet;
  9. // alert("UserID" + userID);
  10. }
  11.  
  12. function setThirdPartyID(thirdPartyIDToSet)
  13. {
  14. thirdPartyID = thirdPartyIDToSet;
  15. // alert("ThirdPartyID" + thirdPartyID);
  16. }
  17.  
  18. function setHostDataPath(host, dataPath)
  19. {
  20. rrHost = host;
  21. rrDataPath = dataPath;
  22. }
  23.  
  24. function addEventHandler(element, type, handler)
  25. {
  26. if (element.addEventListener)
  27. {
  28. element.addEventListener(type, handler, false);
  29. }
  30. else if (element.attachEvent)
  31. {
  32. element.attachEvent("on" + type, handler);
  33. }
  34. else
  35. {
  36. element["on" + type] = handler;
  37. }
  38. }
  39.  
  40. function removeEventHandler(element, type, handler)
  41. {
  42. if (element.removeEventListener)
  43. {
  44. element.removeEventListener(type, handler, false);
  45. }
  46. else if (element.detachEvent)
  47. {
  48. element.detachEvent("on" + type, handler);
  49. }
  50. else
  51. {
  52. element["on" + type] = null;
  53. }
  54. }
  55.  
  56. function PhotoSelected(event)
  57. {
  58. if (event.origin != "https://" + rrHost)
  59. {
  60. return;
  61. }
  62.  
  63. var div = document.getElementById("selectPhoto");
  64. div.parentNode.removeChild(div);
  65. removeEventHandler(window, "message", PhotoSelected);
  66. UnityObject2.instances[0].getUnity().SendMessage("AVATARIMAGEUPLOADHELPER", "OnPhotoSelectedWeb", event.data);
  67. }
  68.  
  69. function SelectPhoto(locPhoto, locCancel, locSizeError)
  70. {
  71. //console.log("SelectPhoto 12");
  72.  
  73. var div = document.createElement("div");
  74. div.id = "selectPhoto";
  75. div.style.position = "absolute";
  76. div.style.top = "50%";
  77. div.style.left = "50%";
  78. div.style.marginTop = "-120px";
  79. div.style.marginLeft = "-160px";
  80. div.style.width = "320px";
  81. div.style.height = "240px";
  82. div.style.background = "#808080";
  83. div.style.border = "thick solid #000000";
  84.  
  85. var ifrm = document.createElement("IFRAME");
  86. ifrm.setAttribute("src", rrDataPath + "/scripts/SelectPhoto.html?locPhoto=" + locPhoto + "&locCancel=" + locCancel + "&v=2");
  87. ifrm.frameBorder = "0";
  88. ifrm.style.width = "320px";
  89. ifrm.style.height = "240px";
  90. ifrm.onload = function()
  91. {
  92. ifrm.contentWindow.postMessage("Hello", "https://" + rrHost);
  93. }
  94.  
  95. div.appendChild(ifrm);
  96. document.body.appendChild(div);
  97.  
  98. addEventHandler(window, "message", PhotoSelected);
  99. }
  100.  
  101. function ShowPauseScreen(unityHidden)
  102. {
  103. if (unityHidden != "True")
  104. {
  105. var div = document.getElementById("pauseScreen");
  106. div.parentNode.removeChild(div);
  107. }
  108. else
  109. {
  110. var div = document.createElement("div");
  111. div.id = "pauseScreen";
  112. div.style.textAlign = "center";
  113. div.style.top = "0%";
  114. div.style.left = "0%";
  115. div.style.width = "100%";
  116. div.style.height = "120%";
  117. div.style.position = "absolute";
  118. div.style.background = "#000000";
  119.  
  120. var img = document.createElement("img");
  121. img.src = rrDataPath + "/images/logo_cie_paused.jpg";
  122. img.style.top = "10%"
  123. img.style.left = "0%"
  124. img.style.width = "100%";
  125. img.style.paddingBottom = "46.88%";
  126. img.style.position = "absolute";
  127. img.alt = "Game Is Paused";
  128.  
  129. div.appendChild(img);
  130. document.body.appendChild(div);
  131. }
  132. }
  133.  
  134. function OpenEmailWindow()
  135. {
  136. //console.log("OpenEmailWindow 12");
  137.  
  138. var win = window.open("mailto:", "_blank");
  139. setTimeout( function()
  140. {
  141. if(!win)
  142. {
  143. //console.log("Popup blocked");
  144. UnityObject2.instances[0].getUnity().SendMessage("FRIENDSCONTROLLER", "OnEmailWindowOpened", "error");
  145. }
  146. else
  147. {
  148. UnityObject2.instances[0].getUnity().SendMessage("FRIENDSCONTROLLER", "OnEmailWindowOpened", "success");
  149. win.close();
  150. }
  151. }, 1000);
  152. }
  153.  
  154. function OpenTwitterWindow()
  155. {
  156. //console.log("OpenTwitterWindow 12");
  157.  
  158. var win = window.open("http://twitter.com", "_blank");
  159. setTimeout( function()
  160. {
  161. if(!win)
  162. {
  163. //console.log("Popup blocked");
  164. UnityObject2.instances[0].getUnity().SendMessage("FRIENDSCONTROLLER", "OnTwitterWindowOpened", "error");
  165. }
  166. else
  167. {
  168. UnityObject2.instances[0].getUnity().SendMessage("FRIENDSCONTROLLER", "OnTwitterWindowOpened", "success");
  169. }
  170. }, 1000);
  171. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement