123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>Unity Web Player | %UNITY_WEB_NAME%</title>
- %UNITY_UNITYOBJECT_DEPENDENCIES%
- <script type="text/javascript">
- <!--
- var unityObjectUrl = "%UNITY_UNITYOBJECT_URL%";
- if (document.location.protocol == 'https:')
- unityObjectUrl = unityObjectUrl.replace("http://", "https://ssl-");
- document.write('<script type="text\/javascript" src="' + unityObjectUrl + '"><\/script>');
-
- //from http://stackoverflow.com/questions/979975/how-to-get-the-value-from-url-parameter
- var QueryString = function () {
- // This function is anonymous, is executed immediately and
- // the return value is assigned to QueryString!
- var query_string = {};
- var query = window.location.search.substring(1);
- var vars = query.split("&");
- for (var i=0;i<vars.length;i++) {
- var pair = vars[i].split("=");
- // If first entry with this name
- if (typeof query_string[pair[0]] === "undefined") {
- query_string[pair[0]] = pair[1];
- // If second entry with this name
- } else if (typeof query_string[pair[0]] === "string") {
- var arr = [ query_string[pair[0]], pair[1] ];
- query_string[pair[0]] = arr;
- // If third or later entry with this name
- } else {
- query_string[pair[0]].push(pair[1]);
- }
- }
- return query_string;
- } ();
-
- function CheckResolution()
- {
- if (QueryString["width"] != undefined)
- {
- console.log("Resolution is "+QueryString["width"]+"x"+QueryString["height"]);
- var contentElement = document.getElementById("content");
- contentElement.style.width=QueryString["width"]+"px";
- var unityPlayerElement = document.getElementById("unityPlayer");
- unityPlayerElement.style.width=QueryString["width"]+"px";
- unityPlayerElement.style.height=QueryString["height"]+"px";
- }
- };
-
- function PlaybackForRecordedResolution(recordedScreenWidth, recordedScreenHeight)
- {
- //if we don't have a url parameter already set
- if (QueryString["width"] == undefined)
- {
- var newUrl = window.location.href;
- newUrl += newUrl.indexOf("?") == -1 ? "?" : "&";
- newUrl += "width="+recordedScreenWidth;
- newUrl += "&height="+recordedScreenHeight;
- window.location.assign(newUrl);
- }
- }
-
- -->
- </script>
- <script type="text/javascript">
- <!--
- jQuery(function() {
- var config = {
- width: QueryString["width"] != undefined? QueryString["width"] : %UNITY_WIDTH%,
- height: QueryString["height"] != undefined? QueryString["height"] : %UNITY_HEIGHT%,
- params: %UNITY_PLAYER_PARAMS%
- };
- var u = new UnityObject2(config);
- var $missingScreen = jQuery("#unityPlayer").find(".missing");
- var $brokenScreen = jQuery("#unityPlayer").find(".broken");
- $missingScreen.hide();
- $brokenScreen.hide();
- u.observeProgress(function (progress) {
- switch(progress.pluginStatus) {
- case "broken":
- $brokenScreen.find("a").click(function (e) {
- e.stopPropagation();
- e.preventDefault();
- u.installPlugin();
- return false;
- });
- $brokenScreen.show();
- break;
- case "missing":
- $missingScreen.find("a").click(function (e) {
- e.stopPropagation();
- e.preventDefault();
- u.installPlugin();
- return false;
- });
- $missingScreen.show();
- break;
- case "installed":
- $missingScreen.remove();
- break;
- case "first":
- break;
- }
- });
- u.initPlugin(jQuery("#unityPlayer")[0], "%UNITY_WEB_PATH%"+window.location.search+"&version=1.06");
- });
- -->
- </script>
- <script src="http://connect.facebook.net/en_US/all.js"></script>
- <script type="text/javascript">
- //Fired when the facebook sdk has loaded
- window.fbAsyncInit = function()
- {
- console.log("facebook plugin started");
- };
- //Load the Facebook JS SDK
- (function(d, s, id){
- var js, fjs = d.getElementsByTagName(s)[0];
- if (d.getElementById(id)) {return;}
- js = d.createElement(s); js.id = id;
- js.src = "//connect.facebook.net/en_US/all.js";
- fjs.parentNode.insertBefore(js, fjs);
- }(document, 'script', 'facebook-jssdk'));
-
- function FaceBookInit()
- {
- var appid = "528376777241923";
- FB.init(
- {
- appId : appid,
- status : true, // check login status
- cookie : true, // enable cookies to allow the server to access the session
- oauth : true, // enable OAuth 2.0
- xfbml : false // dont parse XFBML
- });
- console.log("facebook started");
- }
-
- function Login(actionHash, parameters)
- {
- if(parameters)
- {
- console.log("logging with basic permissions");
- FB.login(function(response)
- {
- var result = actionHash + JSON.stringify(response);
- getUnity().SendMessage("FacebookWebManager", "OnComplete",result);
- GetSessionValidity(null);
- }, {scope: parameters});
- }
- else
- {
- console.log("logging with extended permissions");
- FB.getLoginStatus(function(loginStatusResponse)
- {
- if(!loginStatusResponse.authResponse) //Not logged in, log him in
- {
- console.log("logging in....");
- FB.login(function(response)
- {
- var result = actionHash + JSON.stringify(response);
- getUnity().SendMessage("FacebookWebManager", "OnComplete", result);
- });
- }
- else
- {
- console.log("already logged in....");
- var result = actionHash + JSON.stringify(loginStatusResponse);
- getUnity().SendMessage("FacebookWebManager", "OnComplete", result);
- }
- GetSessionValidity(null);
- });
- }
- }
-
- function Logout(actionHash)
- {
- FB.logout(function(response) {
- var result = actionHash + JSON.stringify(response);
- getUnity().SendMessage("FacebookWebManager", "OnComplete", result);
- GetSessionValidity();
- });
- }
- function getUnity()
- {
- if (typeof unityObject != "undefined")
- {
- return unityObject.getObjectById("unityPlayer");
- }
- return null;
- }
-
-
- function LogMessage(message)
- {
- console.log(message);
- }
-
- if (typeof unityObject != "undefined")
- {
- unityObject.embedUnity("unityPlayer", "WebPlayer.unity3d", 1024, 1024);
- }
-
- function OpenDialog(actionHash, parameters )
- {
- GetSessionValidity(null);
- var params = JSON.parse(parameters);
- FB.ui(
- params
- ,
- function(response) {
- var result = actionHash + JSON.stringify(response);
- getUnity().SendMessage("FacebookWebManager", "OnComplete", result);
- }
- );
- }
-
- function GetSessionValidity(callback)
- {
- FB.getLoginStatus(function(loginStatusResponse)
- {
- if (typeof callback === "function")
- {
- callback(!loginStatusResponse.authResponse);
- }
- getUnity().SendMessage("FacebookWebManager", "UpdateSessionValidity", (!loginStatusResponse.authResponse)?"false":"true" );
- });
- }
-
- function GraphRequest(actionHash,graphPath,httpMethod, parameters )
- {
- GetSessionValidity(function(result)
- {
- Console.log("Graph Request");
- if(result)
- {
- console.log(parameters);
- var params = JSON.parse(parameters);
-
- FB.api(
- graphPath,
- httpMethod,
- params,
- function(response) {
- var result = actionHash + JSON.stringify(response);
- getUnity().SendMessage("FacebookWebManager", "OnComplete", result);
- });
- }
- });
- }
-
- </script>
- <style type="text/css">
- <!--
- body {
- font-family: Helvetica, Verdana, Arial, sans-serif;
- background-color: white;
- color: black;
- text-align: center;
- }
- a:link, a:visited {
- color: #000;
- }
- a:active, a:hover {
- color: #666;
- }
- p.header {
- font-size: small;
- }
- p.header span {
- font-weight: bold;
- }
- p.footer {
- font-size: x-small;
- }
- div#content {
- margin: auto;
- width: %UNITY_WIDTH%px;
- }
- div.broken,
- div.missing {
- margin: auto;
- position: relative;
- top: 50%;
- width: 193px;
- }
- div.broken a,
- div.missing a {
- height: 63px;
- position: relative;
- top: -31px;
- }
- div.broken img,
- div.missing img {
- border-width: 0px;
- }
- div.broken {
- display: none;
- }
- div#unityPlayer {
- cursor: default;
- height: %UNITY_HEIGHT%px;
- width: %UNITY_WIDTH%px;
- }
- -->
- </style>
- </head>
- <body onload="CheckResolution()">
- <p class="header"><span>Unity Web Player | </span>%UNITY_WEB_NAME%</p>%UNITY_BETA_WARNING%
- <div id="fb-root"></div>
- <div id="content">
- <div id="unityPlayer">
- <div class="missing">
- <a href="http://unity3d.com/webplayer/" title="Unity Web Player. Install now!">
- <img alt="Unity Web Player. Install now!" src="http://webplayer.unity3d.com/installation/getunity.png" width="193" height="63" />
- </a>
- </div>
- <div class="broken">
- <a href="http://unity3d.com/webplayer/" title="Unity Web Player. Install now! Restart your browser after install.">
- <img alt="Unity Web Player. Install now! Restart your browser after install." src="http://webplayer.unity3d.com/installation/getunityrestart.png" width="193" height="63" />
- </a>
- </div>
- </div>
- </div>
- <p class="footer">« created with <a href="http://unity3d.com/unity/" title="Go to unity3d.com">Unity</a> »</p>
- </body>
- </html>
|