聖誕節尋找聖誕老人小遊戲源代碼,上傳即可使用

      聖誕節快到了,提前祝大家節日快樂,在這也給打擊分享個應景的尋找聖誕老人小遊戲的源碼

      來自圖靈機器人官方微社區的分享,是一個比拼記憶力,尋找聖誕老人的html5小遊戲,直接下載源碼,上傳至服務器就能夠使用,遊戲操作簡單,但是有一定的難度,體驗不錯。體驗地址:http://182.92.67.78/game2/index.html

      這個部分是遊戲的主頁面代碼,源代碼已上傳,下載上傳至自己服務器即可使用   

<html>
<!--圖靈機器人聖誕節小遊戲-->
<!--下載源文件上傳至服務器即可使用,無需修改任何內容-->
<head>
    <meta charset="utf-8">
    <title>尋找聖誕老人</title>
    <meta name="viewport"
          content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no,target-densitydpi=device-dpi"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
 
    <meta name="full-screen" content="true"/>
    <meta name="screen-orientation" content="portrait"/>
    <meta name="x5-fullscreen" content="true"/>
    <meta name="360-fullscreen" content="true"/>
    <style>
        body {
            text-align: center;
            background: #00b7ee;
            padding: 0;
            border: 0;
            margin: 0;
            height: 100%;
        }
 
        html {
            -ms-touch-action: none; /* Direct all pointer events to JavaScript code. */
        }
    </style>
</head>
<body onload="load()">
<div style="display:inline-block;width:100%; height:100%;margin: 0 auto; background: #00b7ee; position:relative;"
     id="gameDiv">
    <canvas id="gameCanvas" width="480" height="800" style="background-color: #00b7ee"></canvas>
</div>
<script>var document_class = "MyTest";</script><!--這部分內容在編譯時會被替換,要修改文檔類,請到工程目錄下的egretProperties.json內編輯。-->
<script src="js/jquery-1.7.2.min.js"></script>
<script src="js/egret_loader.js"></script>
<script src="js/game-min.js"></script>
<script>
egret_h5.startGame();
</script>
<script language=javascript>
    function load(){
        $.getJSON("http://test.tuling123.com/game2/gameSecond.do",{
            name: 'game2' //參數,
        },function(json){
         
        }); 
    }
     
        var mebtnopenurl = 'http://test.tuling123.com/game2/';
        window.shareData = {
                "imgUrl": "http://test.tuling123.com/game2/icon.png",
                "timeLineLink": "http://test.tuling123.com/game2/",
                "tTitle": "尋找聖誕老人",
                "tContent": "尋找聖誕老人"
        };
                 
        function goHome(){
            window.location=mebtnopenurl;
        }
        function clickMore(){
            if((window.location+"").indexOf("zf",1)>0){
                window.location = "http://182.92.67.78/game2/";
             }
             else{
                goHome();
             }
        }
        function dp_share(){
            document.title =myData.desc;
            document.getElementById("share").style.display="";
            window.shareData.tTitle = document.title;
        }
        function dp_Ranking(){
            window.location=mebtnopenurl;
        }
 
        function showAd(){
        }
        function hideAd(){
        }
        document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
             
            WeixinJSBridge.on('menu:share:appmessage', function(argv) {
                WeixinJSBridge.invoke('sendAppMessage', {
                    "img_url": window.shareData.imgUrl,
                    "link": window.shareData.timeLineLink,
                    "desc": window.shareData.tContent,
                    "title": window.shareData.tTitle
                }, onShareComplete);
            });
 
            WeixinJSBridge.on('menu:share:timeline', function(argv) {
                WeixinJSBridge.invoke('shareTimeline', {
                    "img_url": window.shareData.imgUrl,
                    "img_width": "640",
                    "img_height": "640",
                    "link": window.shareData.timeLineLink,
                    "desc": window.shareData.tContent,
                    "title": window.shareData.tTitle
                }, onShareComplete);
            });
        }, false);
        </script>
        <div id=share style="display: none">
            <img width=100% src="share.png"
                style="position: fixed; z-index: 9999; top: 0; left: 0; display: "
                ontouchstart="document.getElementById('share').style.display='none';" />
        </div>
        <div style="display: none;">
            <script type="text/javascript">
            var myData = { gameid: "jyds" };
         //   var domain = ["oixm.cn", "hiemma.cn", "peagame.net"][parseInt(Math.random() * 3)];
            //window.shareData.timeLineLink = "http://"+ parseInt(Math.random()*100000) +"."+ myData.gameid +"."+domain+"/gamecenter.html?gameid=" + myData.gameid + (localStorage.myuid ? "&uid=" + localStorage.myuid : "");
            function dp_submitScore(score,desc){
                myData.score = parseInt(score);
                myData.desc=desc;
                myData.scoreName = score+"關";
                if(score>0){
                    if (confirm("好厲害呀,竟然闖過了"+score+"關,讓小夥伴也來試試吧!")){
                        setTimeout(dp_share,500);
                    }
                }
            }
            function onShareComplete(res) {
                if (localStorage.myuid && myData.score != undefined) {
                    setTimeout(function(){
                        if (confirm("要將成績提交到9G遊戲排行榜嗎?")) {
                            //window.location = "http://wx.9g.com/rank/submit2.jsp?gameid=" + myData.gameid + "&uid=" + localStorage.myuid + "&score=" + myData.score + "&scorename=" + encodeURIComponent(myData.scoreName);
                        }
                        else {
                            document.location.href = mebtnopenurl;
                        }
                    }, 500);
                }
                else {
                    document.location.href = mebtnopenurl;
                }
            }
            </script>
      
</body>
</html>

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章