Commit 2019c511 authored by 王勇霞's avatar 王勇霞

feat: 接入接口

parent d7b71a7e
...@@ -55,8 +55,8 @@ ...@@ -55,8 +55,8 @@
<div id="cusEngine" style="line-height:0;font-size:0;position: absolute;"> <div id="cusEngine" style="line-height:0;font-size:0;position: absolute;">
<canvas id="canvas" style="width: 100%;height: 100%"></canvas> <canvas id="canvas" style="width: 100%;height: 100%"></canvas>
</div> </div>
<canvas id="renderCanvas" <!-- <canvas id="renderCanvas"
style="margin:auto; left:0;top:0;right:0;bottom:0; pointer-events: none; position: absolute; width: 100%;height: 100%"></canvas> style="margin:auto; left:0;top:0;right:0;bottom:0; pointer-events: none; position: absolute; width: 100%;height: 100%"></canvas> -->
<!-- 帧率检测 --> <!-- 帧率检测 -->
<!-- <script src="//yun.duiba.com.cn/db_games/libs0924/stats.js"></script> --> <!-- <script src="//yun.duiba.com.cn/db_games/libs0924/stats.js"></script> -->
<!-- <script src="https://yun.duiba.com.cn/db_games/libs0126/stats.js"></script> --> <!-- <script src="https://yun.duiba.com.cn/db_games/libs0126/stats.js"></script> -->
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
"dataInfo": [ "dataInfo": [
{ {
"num": 1, "num": 1,
"context": "闲看晴云自卷舒", "context": "",
"context1": "闲看", "context1": "闲看晴云自卷舒",
"ifComplete": false, "ifComplete": false,
"count": 74413176.81524068 "count": 74413176.81524068
}, },
...@@ -19,25 +19,28 @@ ...@@ -19,25 +19,28 @@
}, },
{ {
"num": 3, "num": 3,
"context": "云卷舒", "context": "",
"context1": "云卷舒",
"ifComplete": false, "ifComplete": false,
"count": 10 "count": 10
}, },
{ {
"num": 5, "num": 5,
"context": "心无意", "context": "",
"context1": "心无意",
"ifComplete": true, "ifComplete": true,
"count": 10 "count": 10
}, },
{ {
"num": 4, "num": 4,
"context": "自在休闲", "context": "",
"context1": "自在休闲",
"ifComplete": false, "ifComplete": false,
"count": 10 "count": 10
} }
], ],
"collectCount": 1, "collectCount": 1,
"ifFirstPlay": false "ifFirstPlay": true
}, },
"code": "ipsum est tempor qui", "code": "ipsum est tempor qui",
"timestamp": 3627649.9094133973 "timestamp": 3627649.9094133973
......
<!DOCTYPE html>
<html lang="zh">
<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" />
<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" />
<!-- polyfill -->
<script src="//yun.duiba.com.cn/libs0414/polyfill20210720.js" crossorigin="anonymous"></script>
<!-- 渲染引擎 -->
<script src="//yun.duiba.com.cn/db_games/libs0924/fyge2030.min.js" crossorigin="anonymous"></script>
<!-- svga解析库 -->
<script src="//yun.duiba.com.cn/db_games/libs0924/svgaParser.minWeb.js" crossorigin="anonymous"></script>
<!-- 本地的js,需要souremap调试的用本地js -->
<script src="libs/fyge.min.js"></script>
<!-- <script src="libs/svgaParser.min.js"></script> -->
<!-- <script src="libs/svgaParser.min1.js"></script> -->
<style>
html,
body {
padding: 0;
margin: 0;
border: 0;
width: 100%;
height: 100%;
overflow: hidden;
position: absolute;
background-color: #9a3636;
-webkit-user-select: none;
/* Safari */
-ms-user-select: none;
/* IE 10+ and Edge */
user-select: none;
/* Standard syntax */
outline-style: none;
/* background: linear-gradient(#93dbb7,#ff0,#b5d89a); */
/* background: linear-gradient(#93dbb7,#b5d89a); */
/* 背景图片,解决加载太慢,白屏问题,加了这个下面的__loading__可以删掉了 */
/* background-size: 100%;
background-position: center;
background-image: url("https://yun.duiba.com.cn/db_games/activity/game/1550472986/resource/assets/playscene/playscenebg.jpg"); */
}
</style>
</head>
<body>
<div id="__loading__" style="position:absolute;left:50%;top:50%;margin-left:-45px;color:#ffffff">拼命加载中...</div>
<div id="cusEngine" style="line-height:0;font-size:0;position: absolute;">
<canvas id="canvas" style="width: 100%;height: 100%"></canvas>
</div>
<!-- 帧率检测 -->
<!-- <script src="//yun.duiba.com.cn/db_games/libs0924/stats.js"></script> -->
<!-- <script src="https://yun.duiba.com.cn/db_games/libs0126/stats.js"></script> -->
<script src="//yun.duiba.com.cn/db_games/libs0924/howler.min.js"></script>
<script>"use strict";
//为了duiba-utils有用到appID
var CFG = CFG || {}; //星速台会注入
CFG.appID = '54855';
window.addEventListener("load", function () {
//获取canvas
var canvas = document.getElementById("canvas"); //实例
new Main(canvas) //加鼠标事件,
.stage.addWebMouseEvent(); //淘宝环境自行用stage.onMouseEvent
});
</script>
<!-- 构建的js -->
<script src="//yun.duiba.com.cn/db_games/activity/template/1654672360/output.js" crossorigin="anonymous"></script>
</body>
</html>
\ No newline at end of file
{
"failbg.png": {
"x": 2,
"y": 2,
"w": 568,
"h": 598,
"ox": 0,
"oy": 0,
"sw": 568,
"sh": 598,
"ro": false
},
"knowbtn.png": {
"x": 572,
"y": 2,
"w": 230,
"h": 86,
"ox": 0,
"oy": 0,
"sw": 230,
"sh": 86,
"ro": true
},
"restartbtn.png": {
"x": 2,
"y": 602,
"w": 227,
"h": 90,
"ox": 0,
"oy": 0,
"sw": 227,
"sh": 90,
"ro": false
}
}
\ No newline at end of file
{
"gamebuild.png": {
"x": 2,
"y": 2,
"w": 750,
"h": 496,
"ox": 0,
"oy": 0,
"sw": 750,
"sh": 496,
"ro": false
},
"scorebg.png": {
"x": 2,
"y": 500,
"w": 309,
"h": 79,
"ox": 0,
"oy": 0,
"sw": 309,
"sh": 79,
"ro": false
},
"rightbtn.png": {
"x": 2,
"y": 581,
"w": 206,
"h": 204,
"ox": 0,
"oy": 0,
"sw": 206,
"sh": 204,
"ro": false
},
"leftbtn.png": {
"x": 313,
"y": 500,
"w": 205,
"h": 205,
"ox": 0,
"oy": 0,
"sw": 205,
"sh": 205,
"ro": false
},
"cloud.png": {
"x": 210,
"y": 581,
"w": 199,
"h": 60,
"ox": 0,
"oy": 0,
"sw": 199,
"sh": 60,
"ro": true
},
"cdbg.png": {
"x": 520,
"y": 500,
"w": 196,
"h": 81,
"ox": 0,
"oy": 0,
"sw": 196,
"sh": 81,
"ro": false
},
"controlpeo.png": {
"x": 520,
"y": 583,
"w": 117,
"h": 196,
"ox": 0,
"oy": 0,
"sw": 117,
"sh": 196,
"ro": false
},
"monster.png": {
"x": 639,
"y": 583,
"w": 97,
"h": 116,
"ox": 0,
"oy": 0,
"sw": 97,
"sh": 116,
"ro": false
},
"tianpop.png": {
"x": 639,
"y": 701,
"w": 84,
"h": 94,
"ox": 0,
"oy": 0,
"sw": 84,
"sh": 94,
"ro": true
},
"xiangpop.png": {
"x": 735,
"y": 701,
"w": 84,
"h": 93,
"ox": 0,
"oy": 0,
"sw": 84,
"sh": 93,
"ro": true
},
"closemusic.png": {
"x": 272,
"y": 707,
"w": 78,
"h": 78,
"ox": 0,
"oy": 0,
"sw": 78,
"sh": 78,
"ro": false
},
"openmusic.png": {
"x": 352,
"y": 707,
"w": 78,
"h": 78,
"ox": 0,
"oy": 0,
"sw": 78,
"sh": 78,
"ro": false
}
}
\ No newline at end of file
{
"guide.png": {
"x": 2,
"y": 2,
"w": 590,
"h": 586,
"ox": 0,
"oy": 0,
"sw": 590,
"sh": 586,
"ro": false
}
}
\ No newline at end of file
{
"ruleBg.png": {
"x": 2,
"y": 2,
"w": 568,
"h": 638,
"ox": 0,
"oy": 0,
"sw": 568,
"sh": 638,
"ro": false
}
}
\ No newline at end of file
{
"midbuild.png": {
"x": 2,
"y": 2,
"w": 750,
"h": 493,
"ox": 0,
"oy": 0,
"sw": 750,
"sh": 493,
"ro": false
},
"mifcloud.png": {
"x": 2,
"y": 497,
"w": 750,
"h": 412,
"ox": 0,
"oy": 0,
"sw": 750,
"sh": 412,
"ro": false
},
"titile.png": {
"x": 754,
"y": 2,
"w": 596,
"h": 167,
"ox": 0,
"oy": 0,
"sw": 596,
"sh": 167,
"ro": true
},
"startbtn.png": {
"x": 2,
"y": 911,
"w": 333,
"h": 174,
"ox": 0,
"oy": 0,
"sw": 333,
"sh": 174,
"ro": false
},
"startop.png": {
"x": 754,
"y": 600,
"w": 117,
"h": 196,
"ox": 0,
"oy": 0,
"sw": 117,
"sh": 196,
"ro": false
},
"backbtn.png": {
"x": 754,
"y": 798,
"w": 141,
"h": 53,
"ox": 0,
"oy": 0,
"sw": 141,
"sh": 53,
"ro": false
},
"rulebtn.png": {
"x": 754,
"y": 853,
"w": 140,
"h": 53,
"ox": 0,
"oy": 0,
"sw": 140,
"sh": 53,
"ro": false
}
}
\ No newline at end of file
{
"sucbg.png": {
"x": 2,
"y": 2,
"w": 568,
"h": 502,
"ox": 0,
"oy": 0,
"sw": 568,
"sh": 502,
"ro": false
},
"light.png": {
"x": 2,
"y": 506,
"w": 463,
"h": 468,
"ox": 0,
"oy": 0,
"sw": 463,
"sh": 468,
"ro": true
},
"sucstar.png": {
"x": 472,
"y": 506,
"w": 227,
"h": 87,
"ox": 0,
"oy": 0,
"sw": 227,
"sh": 87,
"ro": true
},
"infoline.png": {
"x": 561,
"y": 506,
"w": 2,
"h": 113,
"ox": 1,
"oy": 1,
"sw": 4,
"sh": 115,
"ro": false
},
"sun.png": {
"x": 472,
"y": 735,
"w": 89,
"h": 83,
"ox": 0,
"oy": 0,
"sw": 89,
"sh": 83,
"ro": false
}
}
\ No newline at end of file
{
"toastBg.png": {
"x": 2,
"y": 2,
"w": 460,
"h": 130,
"ox": 0,
"oy": 0,
"sw": 460,
"sh": 130,
"ro": false
},
"surebtn.png": {
"x": 2,
"y": 134,
"w": 267,
"h": 90,
"ox": 0,
"oy": 0,
"sw": 267,
"sh": 90,
"ro": false
},
"waitingBg.png": {
"x": 2,
"y": 226,
"w": 160,
"h": 180,
"ox": 0,
"oy": 0,
"sw": 160,
"sh": 180,
"ro": true
},
"closebtn.png": {
"x": 184,
"y": 226,
"w": 74,
"h": 74,
"ox": 0,
"oy": 0,
"sw": 74,
"sh": 74,
"ro": false
},
"关闭按钮.png": {
"x": 184,
"y": 302,
"w": 60,
"h": 60,
"ox": 0,
"oy": 0,
"sw": 60,
"sh": 60,
"ro": false
},
"关闭按钮2.png": {
"x": 246,
"y": 302,
"w": 60,
"h": 60,
"ox": 0,
"oy": 0,
"sw": 60,
"sh": 60,
"ro": false
},
"waitingRot.png": {
"x": 260,
"y": 226,
"w": 56,
"h": 56,
"ox": 0,
"oy": 0,
"sw": 56,
"sh": 56,
"ro": false
},
"comCloseBtn.png": {
"x": 271,
"y": 134,
"w": 48,
"h": 48,
"ox": 0,
"oy": 0,
"sw": 48,
"sh": 48,
"ro": false
}
}
\ No newline at end of file
{ {
"groups": [ "groups": [
{ {
"keys": "bg.mp3,fail.mp3,get.mp3,jump.mp3", "keys": "failbg.png,knowbtn.png,restartbtn.png",
"name": "bgm" "name": "FailPanel",
},
{
"keys": "closebtn.png,comCloseBtn.png,surebtn.png,toastBg.png,waitingBg.png,waitingRot.png,关闭按钮.png,关闭按钮2.png",
"name": "common",
"atlas": { "atlas": {
"toastBg.png": { "failbg.png": {
"x": 2, "x": 2,
"y": 2, "y": 2,
"w": 460, "w": 568,
"h": 130, "h": 598,
"ox": 0, "ox": 0,
"oy": 0, "oy": 0,
"sw": 460, "sw": 568,
"sh": 130, "sh": 598,
"ro": false "ro": false
}, },
"surebtn.png": { "knowbtn.png": {
"x": 572,
"y": 2,
"w": 230,
"h": 86,
"ox": 0,
"oy": 0,
"sw": 230,
"sh": 86,
"ro": true
},
"restartbtn.png": {
"x": 2, "x": 2,
"y": 134, "y": 602,
"w": 267, "w": 227,
"h": 90, "h": 90,
"ox": 0, "ox": 0,
"oy": 0, "oy": 0,
"sw": 267, "sw": 227,
"sh": 90, "sh": 90,
"ro": false "ro": false
}
}
}, },
"waitingBg.png": { {
"keys": "cdbg.png,cloud.png,controlpeo.png,controlpeo的副本.png,gamebg.jpg,monster.png,num_0.png,num_1.png,num_2.png,num_3.png,num_4.png,num_5.png,num_6.png,num_7.png,num_8.png,num_9.png,num_s.png,reset.png,tianpop.png,word_云.png,word_休.png,word_卷.png,word_在.png,word_心.png,word_意.png,word_无.png,word_晴.png,word_水.png,word_流.png,word_深.png,word_看.png,word_自.png,word_舒.png,word_闲.png,word_静.png,xiangpop.png",
"name": "GameScene",
"atlas": {
"cloud.png": {
"x": 2, "x": 2,
"y": 226, "y": 2,
"w": 160, "w": 222,
"h": 180, "h": 83,
"ox": 0, "ox": 0,
"oy": 0, "oy": 0,
"sw": 160, "sw": 222,
"sh": 180, "sh": 83,
"ro": true "ro": false
}, },
"closebtn.png": { "cdbg.png": {
"x": 184, "x": 2,
"y": 226, "y": 87,
"w": 74, "w": 192,
"h": 74, "h": 122,
"ox": 0, "ox": 0,
"oy": 0, "oy": 0,
"sw": 74, "sw": 192,
"sh": 74, "sh": 122,
"ro": false "ro": false
}, },
"关闭按钮.png": { "controlpeo的副本.png": {
"x": 184, "x": 2,
"y": 302, "y": 211,
"w": 60, "w": 147,
"h": 60, "h": 156,
"ox": 0, "ox": 0,
"oy": 0, "oy": 0,
"sw": 60, "sw": 147,
"sh": 60, "sh": 156,
"ro": false "ro": true
}, },
"关闭按钮2.png": { "reset.png": {
"x": 246, "x": 160,
"y": 302, "y": 211,
"w": 60, "w": 138,
"h": 60, "h": 62,
"ox": 0, "ox": 0,
"oy": 0, "oy": 0,
"sw": 60, "sw": 138,
"sh": 60, "sh": 62,
"ro": false "ro": true
}, },
"waitingRot.png": { "word_云.png": {
"x": 260, "x": 226,
"y": 226, "y": 2,
"w": 56, "w": 112,
"h": 56, "h": 119,
"ox": 0, "ox": 0,
"oy": 0, "oy": 0,
"sw": 56, "sw": 112,
"sh": 56, "sh": 119,
"ro": false "ro": false
}, },
"comCloseBtn.png": { "word_休.png": {
"x": 271, "x": 224,
"y": 134, "y": 123,
"w": 48, "w": 112,
"h": 48, "h": 119,
"ox": 0, "ox": 0,
"oy": 0, "oy": 0,
"sw": 48, "sw": 112,
"sh": 48, "sh": 119,
"ro": false "ro": false
}
}
}, },
{ "word_卷.png": {
"keys": "failbg.png,knowbtn.png,restartbtn.png", "x": 340,
"name": "FailPanel",
"atlas": {
"failbg.png": {
"x": 2,
"y": 2, "y": 2,
"w": 568, "w": 112,
"h": 598, "h": 119,
"ox": 0, "ox": 0,
"oy": 0, "oy": 0,
"sw": 568, "sw": 112,
"sh": 598, "sh": 119,
"ro": false "ro": false
}, },
"knowbtn.png": { "word_在.png": {
"x": 572, "x": 224,
"y": 2, "y": 244,
"w": 230, "w": 112,
"h": 86, "h": 119,
"ox": 0, "ox": 0,
"oy": 0, "oy": 0,
"sw": 230, "sw": 112,
"sh": 86, "sh": 119,
"ro": true "ro": true
}, },
"restartbtn.png": { "word_心.png": {
"x": 2, "x": 338,
"y": 602, "y": 123,
"w": 227, "w": 112,
"h": 90, "h": 119,
"ox": 0, "ox": 0,
"oy": 0, "oy": 0,
"sw": 227, "sw": 112,
"sh": 90, "sh": 119,
"ro": false "ro": false
}
}
}, },
{ "word_意.png": {
"keys": "cdbg.png,closemusic.png,cloud.png,controlpeo.png,gamebg.jpg,gamebuild.png,leftbtn.png,monster.png,openmusic.png,rightbtn.png,scorebg.png,tianpop.png,xiangpop.png",
"name": "GameScene",
"atlas": {
"gamebuild.png": {
"x": 2, "x": 2,
"y": 2, "y": 360,
"w": 750, "w": 112,
"h": 496, "h": 119,
"ox": 0, "ox": 0,
"oy": 0, "oy": 0,
"sw": 750, "sw": 112,
"sh": 496, "sh": 119,
"ro": false "ro": true
}, },
"scorebg.png": { "word_无.png": {
"x": 2, "x": 123,
"y": 500, "y": 360,
"w": 309, "w": 112,
"h": 79, "h": 119,
"ox": 0, "ox": 0,
"oy": 0, "oy": 0,
"sw": 309, "sw": 112,
"sh": 79, "sh": 119,
"ro": false "ro": true
}, },
"rightbtn.png": { "word_晴.png": {
"x": 2, "x": 244,
"y": 581, "y": 358,
"w": 206, "w": 112,
"h": 204, "h": 119,
"ox": 0, "ox": 0,
"oy": 0, "oy": 0,
"sw": 206, "sw": 112,
"sh": 204, "sh": 119,
"ro": true
},
"word_水.png": {
"x": 345,
"y": 244,
"w": 112,
"h": 119,
"ox": 0,
"oy": 0,
"sw": 112,
"sh": 119,
"ro": true
},
"word_流.png": {
"x": 452,
"y": 123,
"w": 112,
"h": 119,
"ox": 0,
"oy": 0,
"sw": 112,
"sh": 119,
"ro": false "ro": false
}, },
"leftbtn.png": { "word_深.png": {
"x": 313, "x": 454,
"y": 500, "y": 2,
"w": 205, "w": 112,
"h": 205, "h": 119,
"ox": 0, "ox": 0,
"oy": 0, "oy": 0,
"sw": 205, "sw": 112,
"sh": 205, "sh": 119,
"ro": false "ro": false
}, },
"cloud.png": { "word_看.png": {
"x": 210, "x": 365,
"y": 581, "y": 358,
"w": 199, "w": 112,
"h": 60, "h": 119,
"ox": 0, "ox": 0,
"oy": 0, "oy": 0,
"sw": 199, "sw": 112,
"sh": 60, "sh": 119,
"ro": true "ro": true
}, },
"cdbg.png": { "word_自.png": {
"x": 520, "x": 2,
"y": 500, "y": 474,
"w": 196, "w": 112,
"h": 81, "h": 119,
"ox": 0, "ox": 0,
"oy": 0, "oy": 0,
"sw": 196, "sw": 112,
"sh": 81, "sh": 119,
"ro": false "ro": true
}, },
"controlpeo.png": { "word_舒.png": {
"x": 520, "x": 123,
"y": 583, "y": 474,
"w": 117, "w": 112,
"h": 196, "h": 119,
"ox": 0, "ox": 0,
"oy": 0, "oy": 0,
"sw": 117, "sw": 112,
"sh": 196, "sh": 119,
"ro": false "ro": true
},
"word_闲.png": {
"x": 244,
"y": 472,
"w": 112,
"h": 119,
"ox": 0,
"oy": 0,
"sw": 112,
"sh": 119,
"ro": true
},
"word_静.png": {
"x": 365,
"y": 472,
"w": 112,
"h": 119,
"ox": 0,
"oy": 0,
"sw": 112,
"sh": 119,
"ro": true
}, },
"monster.png": { "monster.png": {
"x": 639, "x": 568,
"y": 583, "y": 2,
"w": 97, "w": 97,
"h": 116, "h": 116,
"ox": 0, "ox": 0,
...@@ -230,8 +275,8 @@ ...@@ -230,8 +275,8 @@
"ro": false "ro": false
}, },
"tianpop.png": { "tianpop.png": {
"x": 639, "x": 568,
"y": 701, "y": 120,
"w": 84, "w": 84,
"h": 94, "h": 94,
"ox": 0, "ox": 0,
...@@ -241,8 +286,8 @@ ...@@ -241,8 +286,8 @@
"ro": true "ro": true
}, },
"xiangpop.png": { "xiangpop.png": {
"x": 735, "x": 566,
"y": 701, "y": 206,
"w": 84, "w": 84,
"h": 93, "h": 93,
"ox": 0, "ox": 0,
...@@ -251,37 +296,180 @@ ...@@ -251,37 +296,180 @@
"sh": 93, "sh": 93,
"ro": true "ro": true
}, },
"closemusic.png": { "num_3.png": {
"x": 272, "x": 196,
"y": 707, "y": 87,
"w": 78, "w": 25,
"h": 78, "h": 46,
"ox": 2,
"oy": 2,
"sw": 30,
"sh": 50,
"ro": false
},
"num_7.png": {
"x": 196,
"y": 135,
"w": 25,
"h": 46,
"ox": 2,
"oy": 2,
"sw": 30,
"sh": 50,
"ro": false
},
"num_1.png": {
"x": 466,
"y": 292,
"w": 10,
"h": 45,
"ox": 10,
"oy": 3,
"sw": 30,
"sh": 50,
"ro": false
},
"num_9.png": {
"x": 466,
"y": 244,
"w": 27,
"h": 45,
"ox": 2,
"oy": 3,
"sw": 30,
"sh": 50,
"ro": false
},
"num_0.png": {
"x": 478,
"y": 292,
"w": 31,
"h": 44,
"ox": 0, "ox": 0,
"oy": 0, "oy": 3,
"sw": 78, "sw": 30,
"sh": 78, "sh": 50,
"ro": false "ro": false
}, },
"openmusic.png": { "num_2.png": {
"x": 352, "x": 495,
"y": 707, "y": 244,
"w": 78, "w": 31,
"h": 78, "h": 44,
"ox": 0,
"oy": 3,
"sw": 30,
"sh": 50,
"ro": false
},
"num_4.png": {
"x": 528,
"y": 244,
"w": 30,
"h": 44,
"ox": 0,
"oy": 3,
"sw": 30,
"sh": 50,
"ro": false
},
"num_5.png": {
"x": 511,
"y": 290,
"w": 30,
"h": 44,
"ox": 0,
"oy": 3,
"sw": 30,
"sh": 50,
"ro": true
},
"num_6.png": {
"x": 557,
"y": 292,
"w": 28,
"h": 44,
"ox": 1,
"oy": 3,
"sw": 30,
"sh": 50,
"ro": true
},
"num_8.png": {
"x": 603,
"y": 292,
"w": 26,
"h": 44,
"ox": 2,
"oy": 3,
"sw": 30,
"sh": 50,
"ro": true
},
"num_s.png": {
"x": 603,
"y": 320,
"w": 22,
"h": 27,
"ox": 4,
"oy": 19,
"sw": 30,
"sh": 50,
"ro": true
},
"controlpeo.png": {
"x": 664,
"y": 120,
"w": 1,
"h": 1,
"ox": 0, "ox": 0,
"oy": 0, "oy": 0,
"sw": 78, "sw": 147,
"sh": 78, "sh": 156,
"ro": false "ro": false
} }
} }
}, },
{ {
"keys": "guide.png", "keys": "guide.png,step1_img.png,step1_tips.png,step2_img.png,step2_tips.png,step3_img.png,step3_tips.png,step4_img.png",
"name": "GuidePanel", "name": "GuidePanel",
"atlas": { "atlas": {
"guide.png": { "step1_img.png": {
"x": 2, "x": 2,
"y": 2, "y": 2,
"w": 651,
"h": 388,
"ox": 0,
"oy": 0,
"sw": 651,
"sh": 388,
"ro": false
},
"step4_img.png": {
"x": 2,
"y": 392,
"w": 573,
"h": 623,
"ox": 0,
"oy": 0,
"sw": 573,
"sh": 623,
"ro": true
},
"step2_img.png": {
"x": 655,
"y": 2,
"w": 605,
"h": 470,
"ox": 0,
"oy": 0,
"sw": 605,
"sh": 470,
"ro": true
},
"guide.png": {
"x": 2,
"y": 967,
"w": 590, "w": 590,
"h": 586, "h": 586,
"ox": 0, "ox": 0,
...@@ -289,6 +477,50 @@ ...@@ -289,6 +477,50 @@
"sw": 590, "sw": 590,
"sh": 586, "sh": 586,
"ro": false "ro": false
},
"step1_tips.png": {
"x": 627,
"y": 392,
"w": 379,
"h": 26,
"ox": 0,
"oy": 0,
"sw": 379,
"sh": 26,
"ro": true
},
"step2_tips.png": {
"x": 655,
"y": 609,
"w": 355,
"h": 26,
"ox": 0,
"oy": 0,
"sw": 355,
"sh": 26,
"ro": false
},
"step3_tips.png": {
"x": 1012,
"y": 609,
"w": 281,
"h": 24,
"ox": 0,
"oy": 0,
"sw": 281,
"sh": 24,
"ro": true
},
"step3_img.png": {
"x": 655,
"y": 637,
"w": 192,
"h": 122,
"ox": 0,
"oy": 0,
"sw": 192,
"sh": 122,
"ro": false
} }
} }
}, },
...@@ -310,84 +542,73 @@ ...@@ -310,84 +542,73 @@
} }
}, },
{ {
"keys": "backbtn.png,midbuild.png,mifcloud.png,rulebtn.png,startbg.jpg,startbtn.png,startop.png,titile.png", "keys": "backbtn.png,collect.png,rulebtn.png,startbg.jpg,startbtn.png,startop.png,titile.png",
"name": "StartScene", "name": "StartScene",
"atlas": { "atlas": {
"midbuild.png": { "titile.png": {
"x": 2, "x": 2,
"y": 2, "y": 2,
"w": 750, "w": 574,
"h": 493, "h": 126,
"ox": 0, "ox": 0,
"oy": 0, "oy": 0,
"sw": 750, "sw": 574,
"sh": 493, "sh": 177,
"ro": false "ro": false
}, },
"mifcloud.png": { "startbtn.png": {
"x": 2, "x": 2,
"y": 497, "y": 130,
"w": 750, "w": 350,
"h": 412, "h": 99,
"ox": 0, "ox": 0,
"oy": 0, "oy": 0,
"sw": 750, "sw": 350,
"sh": 412, "sh": 99,
"ro": false "ro": false
}, },
"titile.png": { "collect.png": {
"x": 754,
"y": 2,
"w": 596,
"h": 167,
"ox": 0,
"oy": 0,
"sw": 596,
"sh": 167,
"ro": true
},
"startbtn.png": {
"x": 2, "x": 2,
"y": 911, "y": 231,
"w": 333, "w": 308,
"h": 174, "h": 50,
"ox": 0, "ox": 0,
"oy": 0, "oy": 0,
"sw": 333, "sw": 308,
"sh": 174, "sh": 50,
"ro": false "ro": false
}, },
"startop.png": { "startop.png": {
"x": 754, "x": 354,
"y": 600, "y": 130,
"w": 117, "w": 117,
"h": 196, "h": 196,
"ox": 0, "ox": 0,
"oy": 0, "oy": 0,
"sw": 117, "sw": 117,
"sh": 196, "sh": 196,
"ro": false "ro": true
}, },
"backbtn.png": { "backbtn.png": {
"x": 754, "x": 2,
"y": 798, "y": 283,
"w": 141, "w": 145,
"h": 53, "h": 62,
"ox": 0, "ox": 0,
"oy": 0, "oy": 0,
"sw": 141, "sw": 145,
"sh": 53, "sh": 62,
"ro": false "ro": false
}, },
"rulebtn.png": { "rulebtn.png": {
"x": 754, "x": 149,
"y": 853, "y": 283,
"w": 140, "w": 138,
"h": 53, "h": 62,
"ox": 0, "ox": 0,
"oy": 0, "oy": 0,
"sw": 140, "sw": 138,
"sh": 53, "sh": 62,
"ro": false "ro": false
} }
} }
...@@ -454,7 +675,101 @@ ...@@ -454,7 +675,101 @@
} }
}, },
{ {
"keys": "crypeo.svga,guidecount.svga,jumppeo.svga,popstar.svga,startpeo.svga,startpop.svga", "keys": "closebtn.png,comCloseBtn.png,surebtn.png,toastBg.png,waitingBg.png,waitingRot.png,关闭按钮.png,关闭按钮2.png",
"name": "common",
"atlas": {
"toastBg.png": {
"x": 2,
"y": 2,
"w": 460,
"h": 130,
"ox": 0,
"oy": 0,
"sw": 460,
"sh": 130,
"ro": false
},
"surebtn.png": {
"x": 2,
"y": 134,
"w": 267,
"h": 90,
"ox": 0,
"oy": 0,
"sw": 267,
"sh": 90,
"ro": false
},
"waitingBg.png": {
"x": 2,
"y": 226,
"w": 160,
"h": 180,
"ox": 0,
"oy": 0,
"sw": 160,
"sh": 180,
"ro": true
},
"closebtn.png": {
"x": 184,
"y": 226,
"w": 74,
"h": 74,
"ox": 0,
"oy": 0,
"sw": 74,
"sh": 74,
"ro": false
},
"关闭按钮.png": {
"x": 184,
"y": 302,
"w": 60,
"h": 60,
"ox": 0,
"oy": 0,
"sw": 60,
"sh": 60,
"ro": false
},
"关闭按钮2.png": {
"x": 246,
"y": 302,
"w": 60,
"h": 60,
"ox": 0,
"oy": 0,
"sw": 60,
"sh": 60,
"ro": false
},
"waitingRot.png": {
"x": 260,
"y": 226,
"w": 56,
"h": 56,
"ox": 0,
"oy": 0,
"sw": 56,
"sh": 56,
"ro": false
},
"comCloseBtn.png": {
"x": 271,
"y": 134,
"w": 48,
"h": 48,
"ox": 0,
"oy": 0,
"sw": 48,
"sh": 48,
"ro": false
}
}
},
{
"keys": "atmosphere.svga,crypeo.svga,guidecount.svga,jumppeo.svga,left.svga,light.svga,popstar.svga,right.svga,startbtn.svga,startpeo.svga,startpeople.svga,startpop.svga,有字完美光效.svga",
"name": "svga" "name": "svga"
} }
], ],
......
resource/GuidePanel/step3_img.png

10 KB | W: | H:

resource/GuidePanel/step3_img.png

6.09 KB | W: | H:

resource/GuidePanel/step3_img.png
resource/GuidePanel/step3_img.png
resource/GuidePanel/step3_img.png
resource/GuidePanel/step3_img.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -25,7 +25,7 @@ export class Main { ...@@ -25,7 +25,7 @@ export class Main {
private _pause: boolean; private _pause: boolean;
private canvas: HTMLCanvasElement private canvas: HTMLCanvasElement
constructor(canvas: HTMLCanvasElement, data = { constructor(canvas: HTMLCanvasElement, data = {
time: 200, time: 60,
longitude: "", longitude: "",
latitude: "" latitude: ""
}) { }) {
......
...@@ -2,36 +2,776 @@ export const ResJson = { ...@@ -2,36 +2,776 @@ export const ResJson = {
"groups": [ "groups": [
{ {
"keys": "failbg.png,knowbtn.png,restartbtn.png", "keys": "failbg.png,knowbtn.png,restartbtn.png",
"name": "FailPanel" "name": "FailPanel",
"atlas": {
"failbg.png": {
"x": 2,
"y": 2,
"w": 568,
"h": 598,
"ox": 0,
"oy": 0,
"sw": 568,
"sh": 598,
"ro": false
},
"knowbtn.png": {
"x": 572,
"y": 2,
"w": 230,
"h": 86,
"ox": 0,
"oy": 0,
"sw": 230,
"sh": 86,
"ro": true
},
"restartbtn.png": {
"x": 2,
"y": 602,
"w": 227,
"h": 90,
"ox": 0,
"oy": 0,
"sw": 227,
"sh": 90,
"ro": false
}
}
}, },
{ {
"keys": "cdbg.png,cloud.png,controlpeo.png,controlpeo的副本.png,gamebg.jpg,monster.png,num_0.png,num_1.png,num_2.png,num_3.png,num_4.png,num_5.png,num_6.png,num_7.png,num_8.png,num_9.png,num_s.png,reset.png,tianpop.png,word_云.png,word_休.png,word_卷.png,word_在.png,word_心.png,word_意.png,word_无.png,word_晴.png,word_水.png,word_流.png,word_深.png,word_看.png,word_自.png,word_舒.png,word_闲.png,word_静.png,xiangpop.png", "keys": "cdbg.png,cloud.png,controlpeo.png,controlpeo的副本.png,gamebg.jpg,monster.png,num_0.png,num_1.png,num_2.png,num_3.png,num_4.png,num_5.png,num_6.png,num_7.png,num_8.png,num_9.png,num_s.png,reset.png,tianpop.png,word_云.png,word_休.png,word_卷.png,word_在.png,word_心.png,word_意.png,word_无.png,word_晴.png,word_水.png,word_流.png,word_深.png,word_看.png,word_自.png,word_舒.png,word_闲.png,word_静.png,xiangpop.png",
"name": "GameScene" "name": "GameScene",
"atlas": {
"cloud.png": {
"x": 2,
"y": 2,
"w": 222,
"h": 83,
"ox": 0,
"oy": 0,
"sw": 222,
"sh": 83,
"ro": false
},
"cdbg.png": {
"x": 2,
"y": 87,
"w": 192,
"h": 122,
"ox": 0,
"oy": 0,
"sw": 192,
"sh": 122,
"ro": false
},
"controlpeo的副本.png": {
"x": 2,
"y": 211,
"w": 147,
"h": 156,
"ox": 0,
"oy": 0,
"sw": 147,
"sh": 156,
"ro": true
},
"reset.png": {
"x": 160,
"y": 211,
"w": 138,
"h": 62,
"ox": 0,
"oy": 0,
"sw": 138,
"sh": 62,
"ro": true
},
"word_云.png": {
"x": 226,
"y": 2,
"w": 112,
"h": 119,
"ox": 0,
"oy": 0,
"sw": 112,
"sh": 119,
"ro": false
},
"word_休.png": {
"x": 224,
"y": 123,
"w": 112,
"h": 119,
"ox": 0,
"oy": 0,
"sw": 112,
"sh": 119,
"ro": false
},
"word_卷.png": {
"x": 340,
"y": 2,
"w": 112,
"h": 119,
"ox": 0,
"oy": 0,
"sw": 112,
"sh": 119,
"ro": false
},
"word_在.png": {
"x": 224,
"y": 244,
"w": 112,
"h": 119,
"ox": 0,
"oy": 0,
"sw": 112,
"sh": 119,
"ro": true
},
"word_心.png": {
"x": 338,
"y": 123,
"w": 112,
"h": 119,
"ox": 0,
"oy": 0,
"sw": 112,
"sh": 119,
"ro": false
},
"word_意.png": {
"x": 2,
"y": 360,
"w": 112,
"h": 119,
"ox": 0,
"oy": 0,
"sw": 112,
"sh": 119,
"ro": true
},
"word_无.png": {
"x": 123,
"y": 360,
"w": 112,
"h": 119,
"ox": 0,
"oy": 0,
"sw": 112,
"sh": 119,
"ro": true
},
"word_晴.png": {
"x": 244,
"y": 358,
"w": 112,
"h": 119,
"ox": 0,
"oy": 0,
"sw": 112,
"sh": 119,
"ro": true
},
"word_水.png": {
"x": 345,
"y": 244,
"w": 112,
"h": 119,
"ox": 0,
"oy": 0,
"sw": 112,
"sh": 119,
"ro": true
},
"word_流.png": {
"x": 452,
"y": 123,
"w": 112,
"h": 119,
"ox": 0,
"oy": 0,
"sw": 112,
"sh": 119,
"ro": false
},
"word_深.png": {
"x": 454,
"y": 2,
"w": 112,
"h": 119,
"ox": 0,
"oy": 0,
"sw": 112,
"sh": 119,
"ro": false
},
"word_看.png": {
"x": 365,
"y": 358,
"w": 112,
"h": 119,
"ox": 0,
"oy": 0,
"sw": 112,
"sh": 119,
"ro": true
},
"word_自.png": {
"x": 2,
"y": 474,
"w": 112,
"h": 119,
"ox": 0,
"oy": 0,
"sw": 112,
"sh": 119,
"ro": true
},
"word_舒.png": {
"x": 123,
"y": 474,
"w": 112,
"h": 119,
"ox": 0,
"oy": 0,
"sw": 112,
"sh": 119,
"ro": true
},
"word_闲.png": {
"x": 244,
"y": 472,
"w": 112,
"h": 119,
"ox": 0,
"oy": 0,
"sw": 112,
"sh": 119,
"ro": true
},
"word_静.png": {
"x": 365,
"y": 472,
"w": 112,
"h": 119,
"ox": 0,
"oy": 0,
"sw": 112,
"sh": 119,
"ro": true
},
"monster.png": {
"x": 568,
"y": 2,
"w": 97,
"h": 116,
"ox": 0,
"oy": 0,
"sw": 97,
"sh": 116,
"ro": false
},
"tianpop.png": {
"x": 568,
"y": 120,
"w": 84,
"h": 94,
"ox": 0,
"oy": 0,
"sw": 84,
"sh": 94,
"ro": true
},
"xiangpop.png": {
"x": 566,
"y": 206,
"w": 84,
"h": 93,
"ox": 0,
"oy": 0,
"sw": 84,
"sh": 93,
"ro": true
},
"num_3.png": {
"x": 196,
"y": 87,
"w": 25,
"h": 46,
"ox": 2,
"oy": 2,
"sw": 30,
"sh": 50,
"ro": false
},
"num_7.png": {
"x": 196,
"y": 135,
"w": 25,
"h": 46,
"ox": 2,
"oy": 2,
"sw": 30,
"sh": 50,
"ro": false
},
"num_1.png": {
"x": 466,
"y": 292,
"w": 10,
"h": 45,
"ox": 10,
"oy": 3,
"sw": 30,
"sh": 50,
"ro": false
},
"num_9.png": {
"x": 466,
"y": 244,
"w": 27,
"h": 45,
"ox": 2,
"oy": 3,
"sw": 30,
"sh": 50,
"ro": false
},
"num_0.png": {
"x": 478,
"y": 292,
"w": 31,
"h": 44,
"ox": 0,
"oy": 3,
"sw": 30,
"sh": 50,
"ro": false
},
"num_2.png": {
"x": 495,
"y": 244,
"w": 31,
"h": 44,
"ox": 0,
"oy": 3,
"sw": 30,
"sh": 50,
"ro": false
},
"num_4.png": {
"x": 528,
"y": 244,
"w": 30,
"h": 44,
"ox": 0,
"oy": 3,
"sw": 30,
"sh": 50,
"ro": false
},
"num_5.png": {
"x": 511,
"y": 290,
"w": 30,
"h": 44,
"ox": 0,
"oy": 3,
"sw": 30,
"sh": 50,
"ro": true
},
"num_6.png": {
"x": 557,
"y": 292,
"w": 28,
"h": 44,
"ox": 1,
"oy": 3,
"sw": 30,
"sh": 50,
"ro": true
},
"num_8.png": {
"x": 603,
"y": 292,
"w": 26,
"h": 44,
"ox": 2,
"oy": 3,
"sw": 30,
"sh": 50,
"ro": true
},
"num_s.png": {
"x": 603,
"y": 320,
"w": 22,
"h": 27,
"ox": 4,
"oy": 19,
"sw": 30,
"sh": 50,
"ro": true
},
"controlpeo.png": {
"x": 664,
"y": 120,
"w": 1,
"h": 1,
"ox": 0,
"oy": 0,
"sw": 147,
"sh": 156,
"ro": false
}
}
}, },
{ {
"keys": "guide.png,step1_img.png,step1_tips.png,step2_img.png,step2_tips.png,step3_img.png,step3_tips.png,step4_img.png", "keys": "guide.png,step1_img.png,step1_tips.png,step2_img.png,step2_tips.png,step3_img.png,step3_tips.png,step4_img.png",
"name": "GuidePanel" "name": "GuidePanel",
"atlas": {
"step1_img.png": {
"x": 2,
"y": 2,
"w": 651,
"h": 388,
"ox": 0,
"oy": 0,
"sw": 651,
"sh": 388,
"ro": false
},
"step4_img.png": {
"x": 2,
"y": 392,
"w": 573,
"h": 623,
"ox": 0,
"oy": 0,
"sw": 573,
"sh": 623,
"ro": true
},
"step2_img.png": {
"x": 655,
"y": 2,
"w": 605,
"h": 470,
"ox": 0,
"oy": 0,
"sw": 605,
"sh": 470,
"ro": true
},
"guide.png": {
"x": 2,
"y": 967,
"w": 590,
"h": 586,
"ox": 0,
"oy": 0,
"sw": 590,
"sh": 586,
"ro": false
},
"step1_tips.png": {
"x": 627,
"y": 392,
"w": 379,
"h": 26,
"ox": 0,
"oy": 0,
"sw": 379,
"sh": 26,
"ro": true
},
"step2_tips.png": {
"x": 655,
"y": 609,
"w": 355,
"h": 26,
"ox": 0,
"oy": 0,
"sw": 355,
"sh": 26,
"ro": false
},
"step3_tips.png": {
"x": 1012,
"y": 609,
"w": 281,
"h": 24,
"ox": 0,
"oy": 0,
"sw": 281,
"sh": 24,
"ro": true
},
"step3_img.png": {
"x": 655,
"y": 637,
"w": 192,
"h": 122,
"ox": 0,
"oy": 0,
"sw": 192,
"sh": 122,
"ro": false
}
}
}, },
{ {
"keys": "ruleBg.png", "keys": "ruleBg.png",
"name": "RulePanel" "name": "RulePanel",
"atlas": {
"ruleBg.png": {
"x": 2,
"y": 2,
"w": 568,
"h": 638,
"ox": 0,
"oy": 0,
"sw": 568,
"sh": 638,
"ro": false
}
}
}, },
{ {
"keys": "backbtn.png,collect.png,rulebtn.png,startbg.jpg,startbtn.png,startop.png,titile.png", "keys": "backbtn.png,collect.png,rulebtn.png,startbg.jpg,startbtn.png,startop.png,titile.png",
"name": "StartScene" "name": "StartScene",
"atlas": {
"titile.png": {
"x": 2,
"y": 2,
"w": 574,
"h": 126,
"ox": 0,
"oy": 0,
"sw": 574,
"sh": 177,
"ro": false
},
"startbtn.png": {
"x": 2,
"y": 130,
"w": 350,
"h": 99,
"ox": 0,
"oy": 0,
"sw": 350,
"sh": 99,
"ro": false
},
"collect.png": {
"x": 2,
"y": 231,
"w": 308,
"h": 50,
"ox": 0,
"oy": 0,
"sw": 308,
"sh": 50,
"ro": false
},
"startop.png": {
"x": 354,
"y": 130,
"w": 117,
"h": 196,
"ox": 0,
"oy": 0,
"sw": 117,
"sh": 196,
"ro": true
},
"backbtn.png": {
"x": 2,
"y": 283,
"w": 145,
"h": 62,
"ox": 0,
"oy": 0,
"sw": 145,
"sh": 62,
"ro": false
},
"rulebtn.png": {
"x": 149,
"y": 283,
"w": 138,
"h": 62,
"ox": 0,
"oy": 0,
"sw": 138,
"sh": 62,
"ro": false
}
}
}, },
{ {
"keys": "infoline.png,light.png,sucbg.png,sucstar.png,sun.png", "keys": "infoline.png,light.png,sucbg.png,sucstar.png,sun.png",
"name": "SuccessPanel" "name": "SuccessPanel",
"atlas": {
"sucbg.png": {
"x": 2,
"y": 2,
"w": 568,
"h": 502,
"ox": 0,
"oy": 0,
"sw": 568,
"sh": 502,
"ro": false
},
"light.png": {
"x": 2,
"y": 506,
"w": 463,
"h": 468,
"ox": 0,
"oy": 0,
"sw": 463,
"sh": 468,
"ro": true
},
"sucstar.png": {
"x": 472,
"y": 506,
"w": 227,
"h": 87,
"ox": 0,
"oy": 0,
"sw": 227,
"sh": 87,
"ro": true
},
"infoline.png": {
"x": 561,
"y": 506,
"w": 2,
"h": 113,
"ox": 1,
"oy": 1,
"sw": 4,
"sh": 115,
"ro": false
},
"sun.png": {
"x": 472,
"y": 735,
"w": 89,
"h": 83,
"ox": 0,
"oy": 0,
"sw": 89,
"sh": 83,
"ro": false
}
}
}, },
{ {
"keys": "closebtn.png,comCloseBtn.png,surebtn.png,toastBg.png,waitingBg.png,waitingRot.png,关闭按钮.png,关闭按钮2.png", "keys": "closebtn.png,comCloseBtn.png,surebtn.png,toastBg.png,waitingBg.png,waitingRot.png,关闭按钮.png,关闭按钮2.png",
"name": "common" "name": "common",
"atlas": {
"toastBg.png": {
"x": 2,
"y": 2,
"w": 460,
"h": 130,
"ox": 0,
"oy": 0,
"sw": 460,
"sh": 130,
"ro": false
},
"surebtn.png": {
"x": 2,
"y": 134,
"w": 267,
"h": 90,
"ox": 0,
"oy": 0,
"sw": 267,
"sh": 90,
"ro": false
},
"waitingBg.png": {
"x": 2,
"y": 226,
"w": 160,
"h": 180,
"ox": 0,
"oy": 0,
"sw": 160,
"sh": 180,
"ro": true
},
"closebtn.png": {
"x": 184,
"y": 226,
"w": 74,
"h": 74,
"ox": 0,
"oy": 0,
"sw": 74,
"sh": 74,
"ro": false
},
"关闭按钮.png": {
"x": 184,
"y": 302,
"w": 60,
"h": 60,
"ox": 0,
"oy": 0,
"sw": 60,
"sh": 60,
"ro": false
},
"关闭按钮2.png": {
"x": 246,
"y": 302,
"w": 60,
"h": 60,
"ox": 0,
"oy": 0,
"sw": 60,
"sh": 60,
"ro": false
},
"waitingRot.png": {
"x": 260,
"y": 226,
"w": 56,
"h": 56,
"ox": 0,
"oy": 0,
"sw": 56,
"sh": 56,
"ro": false
},
"comCloseBtn.png": {
"x": 271,
"y": 134,
"w": 48,
"h": 48,
"ox": 0,
"oy": 0,
"sw": 48,
"sh": 48,
"ro": false
}
}
}, },
{ {
"keys": "atmosphere.svga,crypeo.svga,guidecount.svga,jumppeo.svga,left.svga,light.svga,popstar.svga,right.svga,startbtn.svga,startpeo.svga,startpeople.svga,startpop.svga,有字完美光效.svga", "keys": "atmosphere.svga,crypeo.svga,guidecount.svga,jumppeo.svga,left.svga,light.svga,popstar.svga,right.svga,startbtn.svga,startpeo.svga,startpeople.svga,startpop.svga,有字完美光效.svga",
"name": "svga" "name": "svga"
} }
], ],
"path": "./resource/" "path": "https://yun.duiba.com.cn/db_games/activity/template/1679647857/resource/"
} }
\ No newline at end of file
...@@ -303,7 +303,17 @@ export const SkinJson = { ...@@ -303,7 +303,17 @@ export const SkinJson = {
"source": "gamebg.jpg" "source": "gamebg.jpg"
}, },
"id": "bg" "id": "bg"
} },
{
"name": "reset",
"x": 612,
"y": 279,
"type": "sprite",
"props": {
"source": "reset.png"
},
"id": "reset"
},
] ]
}, },
{ {
......
...@@ -70,7 +70,7 @@ export class GuidePanel extends Panel { ...@@ -70,7 +70,7 @@ export class GuidePanel extends Panel {
.to({ alpha: 0.2},500) .to({ alpha: 0.2},500)
.to({ alpha: 1},500) .to({ alpha: 1},500)
} else if (this.guideStep == 3) { } else if (this.guideStep == 3) {
this.step3_img = UI.Sp(this.rectlayer, 'step3_img.png', 311, 333); this.step3_img = UI.Sp(this.rectlayer, 'step3_img.png', 280, 330);
this.cdUIRender(Tools.configInfo.time) this.cdUIRender(Tools.configInfo.time)
let step3_tips = UI.Sp(this.rectlayer, 'step3_tips.png', 236, 850); let step3_tips = UI.Sp(this.rectlayer, 'step3_tips.png', 236, 850);
FYGE.Tween.get(step3_tips, { FYGE.Tween.get(step3_tips, {
...@@ -90,11 +90,10 @@ export class GuidePanel extends Panel { ...@@ -90,11 +90,10 @@ export class GuidePanel extends Panel {
this.step3_img.removeChildren(); this.step3_img.removeChildren();
let str = num + 's'; let str = num + 's';
let arr = str.split(""); let arr = str.split("");
let startPos = (130 - (30 * arr.length)) / 2 let startPos = (192 - (30 * arr.length)) / 2
arr.forEach((item, index) => { arr.forEach((item, index) => {
UI.Sp(this.step3_img, `num_${item}.png`, startPos + (index * 30), 38) UI.Sp(this.step3_img, `num_${item}.png`, startPos + (index * 30), 46)
}) })
} }
showCount(){ showCount(){
this.removeChild(this.rectlayer) this.removeChild(this.rectlayer)
......
...@@ -17,6 +17,8 @@ import { playAllSound } from "../common/SoundWeb"; ...@@ -17,6 +17,8 @@ import { playAllSound } from "../common/SoundWeb";
import { layers } from "../../module/views/layers"; import { layers } from "../../module/views/layers";
import UI from "../UI"; import UI from "../UI";
import { allWords } from "../contant"; import { allWords } from "../contant";
import { getUrlParams } from "../../module/web/webTools";
import { GDispatcher } from "../Main";
export class GameScene extends Scene { export class GameScene extends Scene {
get groupNames() { return ["GameScene"] }; get groupNames() { return ["GameScene"] };
get skinName() { return "GameScene" }; get skinName() { return "GameScene" };
...@@ -25,18 +27,12 @@ export class GameScene extends Scene { ...@@ -25,18 +27,12 @@ export class GameScene extends Scene {
left; left;
right; right;
cdbg: FYGE.Sprite; cdbg: FYGE.Sprite;
reset;
time = Tools.configInfo.time; time = Tools.configInfo.time;
// --------
cloud: FYGE.Sprite;
peo: FYGE.Sprite;
tianpop: FYGE.Sprite;
xiangpop: FYGE.Sprite;
monster: FYGE.Sprite;
isonce = false;
wordList = this.getWordList(); // 待随机出现的列表 wordList = this.getWordList(); // 待随机出现的列表
wordLen = this.getWordList().length; // 需要收集字体的个数
collectList: any = []; // 已收集列表
public static instance: GameScene; public static instance: GameScene;
initUi() { initUi() {
...@@ -44,7 +40,12 @@ export class GameScene extends Scene { ...@@ -44,7 +40,12 @@ export class GameScene extends Scene {
async start(data) { async start(data) {
super.start(); super.start();
GameScene.instance = this GameScene.instance = this
// showPanel(GuidePanel); showPanel(GuidePanel);
this.reset.addEventListener(FYGE.MouseEvent.CLICK, () => {
this.btnDelay(this.reset)
this.onReset()
}, this)
// 左右按钮 // 左右按钮
this.left = new FYGE.SvgaAni(await RES.getResAsync("left.svga")) this.left = new FYGE.SvgaAni(await RES.getResAsync("left.svga"))
...@@ -76,13 +77,17 @@ export class GameScene extends Scene { ...@@ -76,13 +77,17 @@ export class GameScene extends Scene {
this.setChildIndex(this.bgCon, 1) this.setChildIndex(this.bgCon, 1)
this.initMap(); this.initMap();
// TODO_wyx // // TODO_wyx
this.upDateInfo() // this.upDateInfo()
}
// 数据重置
onReset() {
changeScene(StartScene)
} }
getWordList() { getWordList() {
let dataInfo = getWebData(WebNetName.indexInfo).data.dataInfo; let dataInfo = getWebData(WebNetName.indexInfo).data.dataInfo;
let hasWordList:any = []; let hasWordList: any = [];
let noWordList:any = []; let noWordList: any = [];
dataInfo.forEach(item => { dataInfo.forEach(item => {
if (item.context) { if (item.context) {
hasWordList = hasWordList.concat(item.context.split("")) hasWordList = hasWordList.concat(item.context.split(""))
...@@ -129,16 +134,11 @@ export class GameScene extends Scene { ...@@ -129,16 +134,11 @@ export class GameScene extends Scene {
arr.forEach((item, index) => { arr.forEach((item, index) => {
UI.Sp(this.cdbg, `num_${item}.png`, startPos + (index * 30), 46) UI.Sp(this.cdbg, `num_${item}.png`, startPos + (index * 30), 46)
}) })
} }
startGame() { startGame() {
this.isonce = false
this.addRole(); this.addRole();
this.addEventListener(FYGE.Event.ENTER_FRAME, this.onFarm, this); this.addEventListener(FYGE.Event.ENTER_FRAME, this.onFarm, this);
// this.composites.add(this.world, [this._role.phyBody]);
} }
_role; //人物 _role; //人物
bgCon; //背景移动 bgCon; //背景移动
...@@ -158,8 +158,6 @@ export class GameScene extends Scene { ...@@ -158,8 +158,6 @@ export class GameScene extends Scene {
world; world;
runner; runner;
ground; ground;
addPropsMap = new Map();
obstaclePropMap = new Map();
private createPhyWorld() { private createPhyWorld() {
const { Engine, Render, Runner, Composite, Bodies, World, Composites } = Matter; const { Engine, Render, Runner, Composite, Bodies, World, Composites } = Matter;
this.engine = Engine.create( this.engine = Engine.create(
...@@ -177,56 +175,46 @@ export class GameScene extends Scene { ...@@ -177,56 +175,46 @@ export class GameScene extends Scene {
this.composites = Composite; this.composites = Composite;
Matter.Events.on(this.engine, "collisionStart", this.onCollisionStart.bind(this)); Matter.Events.on(this.engine, "collisionStart", this.onCollisionStart.bind(this));
// Matter.Events.on(this.engine, "tick", this.onCollisionTick.bind(this)); Matter.Events.on(this.engine, "tick", this.onCollisionTick.bind(this));
// Matter.Events.on(this.engine, "beforeUpdate", this.onBeforeUpdate.bind(this));
// 创建一个渲染器 // 创建一个渲染器
const render = Render.create({ // const render = Render.create({
// element: document.body, // // element: document.body,
canvas: document.getElementById("renderCanvas"), // canvas: document.getElementById("renderCanvas"),
engine: this.engine, // engine: this.engine,
options: { // options: {
width: document.body.clientWidth, // width: document.body.clientWidth,
height: document.body.clientHeight, // height: document.body.clientHeight,
pixelRatio: window.devicePixelRatio, // 设置像素比 // pixelRatio: window.devicePixelRatio, // 设置像素比
background: "rgba(255,255,255,0.3)", // 全局渲染模式时背景色 // background: "rgba(255,255,255,0.3)", // 全局渲染模式时背景色
wireframeBackground: "rgba(255,255,255,0.3)", // 线框模式时背景色 // wireframeBackground: "rgba(255,255,255,0.3)", // 线框模式时背景色
hasBounds: false, // hasBounds: false,
wireframes: false, // 线框模式 // wireframes: false, // 线框模式
showSleeping: true, // 刚体睡眠状态 // showSleeping: true, // 刚体睡眠状态
showDebug: false, // Debug 信息 // showDebug: false, // Debug 信息
showBroadphase: false, // 粗测阶段 // showBroadphase: false, // 粗测阶段
showBounds: true, // 刚体的界限 // showBounds: true, // 刚体的界限
showVelocity: false, // 移动刚体时速度 // showVelocity: false, // 移动刚体时速度
showCollisions: false, // 刚体碰撞点 // showCollisions: false, // 刚体碰撞点
showSeparations: false, // 刚体分离 // showSeparations: false, // 刚体分离
showAxes: false, // 刚体轴线 // showAxes: false, // 刚体轴线
showPositions: true, // 刚体位置 // showPositions: true, // 刚体位置
showAngleIndicator: false, // 刚体转角指示 // showAngleIndicator: false, // 刚体转角指示
showIds: true, // 显示每个刚体的 ID // showIds: true, // 显示每个刚体的 ID
showVertexNumbers: false, // 刚体顶点数 // showVertexNumbers: false, // 刚体顶点数
showConvexHulls: false, // 刚体凸包点 // showConvexHulls: false, // 刚体凸包点
showInternalEdges: false, // 刚体内部边界 // showInternalEdges: false, // 刚体内部边界
showMousePosition: false, // 鼠标约束线 // showMousePosition: false, // 鼠标约束线
}, // },
}); // });
Render.run(render); // Render.run(render);
}
onBeforeUpdate(e) {
if (this.engine.timing.timestamp - this.lastTime >= 1000) {
this._role.jump()
this.lastTime = this.engine.timing.timestamp;
}
} }
onCollisionTick(e) { onCollisionTick(e) {
} }
lastTime = 0 lastTime = 0
onCollisionStart(e) { onCollisionStart(e) {
let pairs = e.pairs; let pairs = e.pairs;
//
// Matter.Body.applyForce(this._role.phyBody, this._role.phyBody.position, { x: 0, y: -0.1 });
pairs.map((p) => { pairs.map((p) => {
// ip 与 云朵 碰撞 // ip 与 云朵 碰撞, 进行人物跳跃
console.log(p.bodyA.objType, p.bodyB.objType)
if ((p.bodyA.objType == "cloud" && p.bodyB == this._role.phyBody) || (p.bodyB.objType == "cloud" && p.bodyA == this._role.phyBody)) { if ((p.bodyA.objType == "cloud" && p.bodyB == this._role.phyBody) || (p.bodyB.objType == "cloud" && p.bodyA == this._role.phyBody)) {
if (this.engine.timing.timestamp - this.lastTime >= 400) { if (this.engine.timing.timestamp - this.lastTime >= 400) {
this._role.jump() this._role.jump()
...@@ -234,73 +222,61 @@ export class GameScene extends Scene { ...@@ -234,73 +222,61 @@ export class GameScene extends Scene {
} }
} }
})
// pairs.map((p) => {
// // 🌹与人的碰撞
// if (p.bodyB == this._role.phyBody || p.bodyA == this._role.phyBody) {
// if (p.bodyB.gameType?.split("_")[0] == 'addProp' || p.bodyA.gameType?.split("_")[0] == 'addProp') {
// console.log("加分")
// let body = p.bodyB.gameType?.split("_")[0] == 'addProp' ? p.bodyB : p.bodyA;
// let prop = this.addPropsMap.get(body.id);
// let num = 1
// if (body.gameType.split("_")[1] == "tian") {
// num = 1
// } else {
// num = 2
// }
// this._role.addScore('+' + num, '#ffffff')
// this.score += num // ip 与 文字 碰撞, 进行收集文字
// this.composites.remove(this.world, prop.phyBody); if ((p.bodyA.objType == "word" && p.bodyB == this._role.phyBody) || (p.bodyB.objType == "word" && p.bodyA == this._role.phyBody)) {
// prop.destroy(); if (p.bodyA.objType == "word") {
// this.bgCon.removeChild(prop) if (!this.collectList.includes(p.bodyA.wordTx)) {
// this.addPropsMap.delete(body.id); this.collectList.push(p.bodyA.wordTx);
let _i = this.wordList.indexOf(p.bodyA.wordTx);
// } else if (p.bodyB.gameType == 'dieProp' || p.bodyA.gameType == 'dieProp') { if (_i > -1) {
// // 死亡💀 this.wordList.splice(_i, 1)
// console.log("死亡") }
// let body = p.bodyB.gameType == 'dieProp' ? p.bodyB : p.bodyA; }
// let prop = this.obstaclePropMap.get(body.id); this.composites.remove(this.world, p.bodyA);
// this.composites.remove(this.world, prop.phyBody); setTimeout(() => {
// prop.destroy(); this.bgCon.removeChild(p.bodyA.nodeTx);
// this.bgCon.removeChild(prop) }, 100)
// this.obstaclePropMap.delete(body.id); }
// // this.removeWorld() if (p.bodyB.objType == "word") {
// this.composites.remove(this.world, this._role.phyBody); if (!this.collectList.includes(p.bodyB.wordTx)) {
// clearTimeout(this.timer); this.collectList.push(p.bodyB.wordTx);
// this.gameOver() let _i = this.wordList.indexOf(p.bodyB.wordTx);
// } else { if (_i > -1) {
// if (!this.jumpLock) { this.wordList.splice(_i, 1)
// this._role.jump() }
// this.jumpLock = true; }
// setTimeout(() => { this.composites.remove(this.world, p.bodyB);
// this.jumpLock = false setTimeout(() => {
// }, 300) this.bgCon.removeChild(p.bodyB.nodeTx);
// } }, 100)
// } }
}
// } })
// });
} }
initMap() { initMap() {
let stageHeight = this.stage.stageHeight; let stageHeight = this.stage.stageHeight;
// 循环多建几行 // 循环多建几行
for (let i = 0; i < 10; i++) { for (let i = 0; i < 10; i++) {
this.createLineItem(stageHeight - (260 * (i + 1)), 0, false, i); if (i == 0) {
this.createLineItem(stageHeight - (260 * (i + 1)), -10, 4, 15);
} else {
this.createLineItem(stageHeight - (260 * (i + 1)));
}
} }
} }
mapList = []; mapList = [];
createLineItem(h, x?: number, isprop = true, idx = 0) { createLineItem(h, _sx?: number, _rLen?:number, _space?: number) {
let sx = x ? x : Math.floor(Math.random() * 300 - 100); // 初始第一朵云的坐标 let sx = _sx || Math.floor(Math.random() * 300 - 100); // 初始第一朵云的坐标
let rLen = Math.floor(Math.random() * 4 + 2); // 每一行随机出现几朵云 let rLen = _rLen || Math.floor(Math.random() * 4 + 2); // 每一行随机出现几朵云
let space = Math.floor(Math.random() * 80); // 增加一点随机间距 // let rLen = 2
let space = _space || Math.floor(Math.random() * 80); // 增加一点随机间距
const offsetY = this.stage.viewRect.y; const offsetY = this.stage.viewRect.y;
let cloudLi = [];
for (let i = 0; i < rLen; i++) { for (let i = 0; i < rLen; i++) {
let mapItem = new MapItem({ let mapItem = new MapItem({
fx: sx + i * 222 + i * (space + 20), fx: sx + i * 222 + i * (space + 20),
fy: h, fy: h,
index: this.mapList.length + 1,
idx: idx,
stageY: offsetY stageY: offsetY
}); });
this.bgCon.addChildAt(mapItem, 0); this.bgCon.addChildAt(mapItem, 0);
...@@ -315,102 +291,121 @@ export class GameScene extends Scene { ...@@ -315,102 +291,121 @@ export class GameScene extends Scene {
let addProp = new AddProp({ let addProp = new AddProp({
fx: sx + i * 222 + i * (space + 20) + 46, fx: sx + i * 222 + i * (space + 20) + 46,
fy: h - 70, fy: h - 70,
index: this.mapList.length + 1,
stageY: offsetY, stageY: offsetY,
wordTx: len == 0 ? '' : this.wordList[randomIndex] wordTx: len == 0 ? '' : this.wordList[randomIndex]
}); });
this.bgCon.addChildAt(addProp, 1) this.bgCon.addChildAt(addProp, 1)
this.composites.add(this.world, [addProp.phyBody]); this.composites.add(this.world, [addProp.phyBody]);
this.mapList.push([mapItem, addProp]) cloudLi.push([mapItem, addProp])
this.addPropsMap.set(addProp.phyBody.id, addProp);
} }
this.mapList.push(cloudLi)
} }
timer = null; timer = null;
isFall;
onFarm() { onFarm() {
// 检测收集的字
if (this.collectList.length >= this.wordLen) {
console.log('this.collectList', this.collectList);
// 游戏结束
this.composites.remove(this.world, this._role.phyBody);
clearTimeout(this.timer);
this.gameOver();
return
}
let roleY = this._role.y + this.bgCon.y; let roleY = this._role.y + this.bgCon.y;
// 移动容器的位置
if (roleY < 600) {
this.moveMap(600 - roleY) this.moveMap(600 - roleY)
// let roleY = this._role.y + this.bgCon.y; }
// if (roleY < 600) {
// this.moveMap(600 - roleY)
// }
// let lastLine = this.mapList[0],
// lastItem = lastLine[0];
// if (lastItem.y + this.bgCon.y > this.stage.stageHeight + 10) {
// lastLine.forEach(item => {
// this.composites.remove(this.world, item.phyBody);
// item.destroy();
// this.bgCon.removeChild(item)
// })
// this.mapList.shift()
// }
// let firstLine = this.mapList[this.mapList.length - 1], // 检测最后一行, 然后移除节点
// firstItem = firstLine[0]; let lastLine = this.mapList[0],
lastItem = lastLine[0][0]; // 云
if (lastItem.y + this.bgCon.y > this.stage.stageHeight + 120) {
lastLine.forEach(item => {
item.forEach(_item => {
this.composites.remove(this.world, _item.phyBody);
_item.destroy();
this.bgCon.removeChild(_item);
})
})
this.mapList.shift()
}
// if (firstItem.y + this.bgCon.y > -100) { // 检测第一行是否要插入数据
// this.createLineItem(firstItem.y - 240) let firstLine = this.mapList[this.mapList.length - 1],
// } firstItem = firstLine[0][0];
if (firstItem.y + this.bgCon.y > -100) {
this.createLineItem(firstItem.y - 260)
}
// if (this._role.y >= -(this.bgCon.y - 1624)) { if (this._role.y >= -(this.bgCon.y - 1624)) {
// if (!this.isonce) { console.log("人物出了舒适圈")
// this.composites.remove(this.world, this._role.phyBody); this.isFall = true
// console.log("siwang") this._role.fx = lastItem.x
// clearTimeout(this.timer); this._role.fy = lastItem.y
// this.gameOver() }
// // 复活需要初始化
// this.isonce = true
// }
// }
} }
moveMap(y) { moveMap(y) {
if (this.isFall) return
this.bgCon.y = this.bgCon.y + y; this.bgCon.y = this.bgCon.y + y;
} }
removeWorld() { removeWorld() {
this.composites.clear(this.world) this.composites.clear(this.world)
// console.log(this.composites)
this.mapList = []; this.mapList = [];
this.addPropsMap.clear() }
this.obstaclePropMap.clear() getDataArr() {
console.log(this.obstaclePropMap) console.log('this.collectList', this.collectList)
console.log(this.addPropsMap) let arr = ["闲看晴云自卷舒", "静水流深", "云卷舒", "心无意", "自在休闲"];
console.log(this.mapList) let tempData = []
arr.forEach((item, index) => {
let words = [];
item.split("").forEach(val => {
if (this.collectList.includes(val)) {
if (words.indexOf(val) == -1) {
words.push(val)
}
}
})
tempData.push({
num: index + 1,
context: words.join(',')
})
})
return tempData
} }
//游戏结束 //游戏结束
async gameOver() { async gameOver() {
this._role.jumpSvga.visible = false;
this._role.downSvga.visible = true;
this.removeEventListener(FYGE.Event.ENTER_FRAME, this.onFarm, this); this.removeEventListener(FYGE.Event.ENTER_FRAME, this.onFarm, this);
this.removeWorld() this.removeWorld()
// let startInfo = getWebData(WebNetName.startGame).data.currInfo // 接口提交
// let timestamp = new Date().getTime() let activityId = getUrlParams('activityId');
// //签名方式: md5(score=分值&startId=游戏开始id&timestamp=timestamp&key=key) let startId = getWebData(WebNetName.startGame).data.startId;
// //其中key的值为开始游戏接口里返回的key+固定值9ef16b33920749fb26e8fc2f2913150a, 例如1234569ef16b33920749fb26e8fc2f2913150a let timestamp = new Date().getTime();
// let sign = duiba_md5(`score=${this.score}&startId=${startInfo.startId}&timestamp=${timestamp}&key=${startInfo.key + "9ef16b33920749fb26e8fc2f2913150a"}`) let type = 3
// const { success, data, message } = await sendWebNet(WebNetName.submitGame, { score: this.score, sign: sign, code: startInfo.code, timestamp: timestamp ,startId:startInfo.startId}) let sign = duiba_md5(String(activityId) + String(timestamp) + String(startId) + String(type) + 'posf3usrjjnd9sd4w21ln3p');
let dataArr = this.getDataArr();
// this._role.die(() => { const { success, data, desc } = await sendWebNet(WebNetName.submitGame, {
// this.bgCon.removeChildren() activityId,
// this.bgCon.y = 0 type,
// if (!success) { startId,
// showToast(message || "网络异常,请重试~") timestamp,
// changeScene(StartScene) sign,
// return longitude: Tools.configInfo.longitude,
// } latitude: Tools.configInfo.latitude,
// if (data.pass) { data: dataArr
// showPanel(SuccessPanel) })
// } else { if (success) {
// showPanel(FailPanel) GDispatcher.dispatchEvent("openGameEnd", {
// } point: data.point || 0
// }) });
} else {
showToast(desc || "网络开小差了,稍后再试")
}
} }
initEvents() { initEvents() {
super.initEvents(); super.initEvents();
......
...@@ -62,15 +62,7 @@ export class StartScene extends Scene { ...@@ -62,15 +62,7 @@ export class StartScene extends Scene {
} }
// TODO_wyx // TODO_wyx
this.openGame() // this.openGame()
// for (let i = 0; i < data.gamecfs.length; i++) {
// if (data.gamecfs[i].code == data.gameCode) {
// this.gameInfo = data.gamecfs[i]
// }
// }
// this.titlelab.text = "闯关成功获得" + this.gameInfo.sun + "个阳光"
// this.titlescore.text = "目标分数:" + this.gameInfo.targetScore + "分"
} }
openRule() { openRule() {
GDispatcher.dispatchEvent("openRule"); GDispatcher.dispatchEvent("openRule");
......
...@@ -7,13 +7,11 @@ export default class AddProp extends FYGE.Container { ...@@ -7,13 +7,11 @@ export default class AddProp extends FYGE.Container {
itemImg: FYGE.Sprite; itemImg: FYGE.Sprite;
fx; fx;
fy; fy;
index;
wordTx; wordTx;
constructor(data?) { constructor(data?) {
super(); super();
this.fx = data.fx; this.fx = data.fx;
this.fy = data.fy; this.fy = data.fy;
this.index = data.index;
this.wordTx = data.wordTx; this.wordTx = data.wordTx;
this.position.set(this.fx, this.fy); this.position.set(this.fx, this.fy);
...@@ -27,6 +25,8 @@ export default class AddProp extends FYGE.Container { ...@@ -27,6 +25,8 @@ export default class AddProp extends FYGE.Container {
fillStyle: "blue" // 填充的颜色 fillStyle: "blue" // 填充的颜色
} }
}); });
// this.phyBody.gameType = gameType; this.phyBody.objType = "word";
this.phyBody.wordTx = this.wordTx;
this.phyBody.nodeTx = this;
} }
} }
\ No newline at end of file
...@@ -21,7 +21,7 @@ export default class MapItem extends FYGE.Container { ...@@ -21,7 +21,7 @@ export default class MapItem extends FYGE.Container {
var divW = document.body.clientWidth; var divW = document.body.clientWidth;
var divH = document.body.clientHeight; var divH = document.body.clientHeight;
// 至于为什么比对的位置, FYGE的适配缩放, 以及Main的剪裁 // 至于为什么比对的位置, FYGE的适配缩放, 以及Main的剪裁
this.phyBody = Matter.Bodies.rectangle(this.fx*scale+itemImg.width*scale/2, this.fy*scale+itemImg.height*scale/2-data.stageY*scale,itemImg.width*scale, 10, { this.phyBody = Matter.Bodies.rectangle(this.fx*scale+itemImg.width*scale/2, this.fy*scale+itemImg.height*scale/2-data.stageY*scale,itemImg.width*scale*0.8, 5, {
isStatic: true, isStatic: true,
friction: 1, friction: 1,
isSensor: true, // 传感器,可以检测到碰撞,但是不参与碰撞 isSensor: true, // 传感器,可以检测到碰撞,但是不参与碰撞
......
...@@ -11,32 +11,23 @@ export default class Role extends FYGE.Container { ...@@ -11,32 +11,23 @@ export default class Role extends FYGE.Container {
jumpSvga; jumpSvga;
downSvga; downSvga;
lightSvga; lightSvga;
// fx;
// fy;
bili; bili;
staY; staY;
constructor(data?) { constructor(data?) {
super(); super();
// this.fx = data.fx;
// this.fy = data.fy;
this.staY = data.stageY; this.staY = data.stageY;
this.position.set(this.x, this.y); this.position.set(this.x, this.y);
let itemImg = this.itemImg = UI.Sp(this, "controlpeo.png", 0, 0); let itemImg = this.itemImg = UI.Sp(this, "controlpeo.png", 0, 0);
let scale = this.bili = document.body.clientWidth / 750; let scale = this.bili = document.body.clientWidth / 750;
// 至于为什么比对的位置, FYGE的适配缩放, 以及Main的剪裁 // 至于为什么比对的位置, FYGE的适配缩放, 以及Main的剪裁
this.phyBody = Matter.Bodies.rectangle(this.x * scale + itemImg.width * scale / 2, this.y * scale + itemImg.height * scale / 2 - data.stageY * scale, itemImg.width * scale, itemImg.height * scale, { this.phyBody = Matter.Bodies.rectangle(this.x * scale + itemImg.width * scale / 2, this.y * scale + itemImg.height * scale *0.9 - data.stageY * scale, itemImg.width * scale*0.5, (itemImg.height - 120) * scale, {
isStatic: false, isStatic: false,
// isSensor: false, // 传感器,可以检测到碰撞,但是不参与碰撞 // isSensor: true, // 传感器,可以检测到碰撞,但是不参与碰撞
// restitution: 0.1,
// friction: 0.01,
// inverseMass: 0.2,
// restitution: 0.8, // 定义刚体恢复(弹性)的数字 // restitution: 0.8, // 定义刚体恢复(弹性)的数字
// // // density: 0.05,// 定义刚体密度的数字,即单位面积的质量 // friction: 0.01, // 设置摩擦力
// // friction: 0.02, // density: 0.05,// 定义刚体密度的数字,即单位面积的质量
// friction: 0.5, // 设置摩擦力
// frictionAir: 0.01, // 设置空气摩擦力 // frictionAir: 0.01, // 设置空气摩擦力
render: { render: {
fillStyle: "red" // 填充的颜色 fillStyle: "red" // 填充的颜色
} }
...@@ -83,14 +74,14 @@ export default class Role extends FYGE.Container { ...@@ -83,14 +74,14 @@ export default class Role extends FYGE.Container {
leftMove() { leftMove() {
Matter.Body.applyForce(this.phyBody, this.phyBody.position, { Matter.Body.applyForce(this.phyBody, this.phyBody.position, {
x: -0.1, x: -0.01,
y: 0 y: 0
}); });
} }
rightMove() { rightMove() {
Matter.Body.applyForce(this.phyBody, this.phyBody.position, { Matter.Body.applyForce(this.phyBody, this.phyBody.position, {
x: 0.1, x: 0.01,
y: 0 y: 0
}); });
} }
...@@ -98,7 +89,7 @@ export default class Role extends FYGE.Container { ...@@ -98,7 +89,7 @@ export default class Role extends FYGE.Container {
/** 根据物理刚体,更新当前的坐标。 */ /** 根据物理刚体,更新当前的坐标。 */
private onFarm() { private onFarm() {
let Tx = (this.phyBody.position.x - this.itemImg.width * this.bili / 2) / this.bili; let Tx = (this.phyBody.position.x - this.itemImg.width * this.bili / 2) / this.bili;
let Ty = (this.phyBody.position.y + (this.staY * this.bili) - this.itemImg.height * this.bili / 2) / this.bili; let Ty = (this.phyBody.position.y + (this.staY * this.bili) - this.itemImg.height * this.bili*0.9) / this.bili;
this.x = Tx; this.x = Tx;
this.y = Ty; this.y = Ty;
...@@ -106,54 +97,20 @@ export default class Role extends FYGE.Container { ...@@ -106,54 +97,20 @@ export default class Role extends FYGE.Container {
this.fx = 0; this.fx = 0;
this.fy = Ty; this.fy = Ty;
} else if (Tx < 0) { } else if (Tx < 0) {
this.fx = 750; this.fx = 750 - this.itemImg.width;
this.fy = Ty this.fy = Ty
} else { } else {
this.fx = Tx; this.fx = Tx;
this.fy = Ty this.fy = Ty
} }
} }
// this.x = Tx
// }
// this.x =
// this.y =
// if (this.beforeY) {
// if (this.beforeY > this.phyBody.position.y) {
// this.direction = 'up'
// }
// if (this.beforeY < this.phyBody.position.y) {
// this.direction = 'down'
// }
// }
// if (this.phyBody.position.x > 750) {
// Matter.Body.setPosition(this.phyBody, {
// x: 0,
// y: this.phyBody.position.y
// })
// } else if (this.phyBody.position.x < 0) {
// Matter.Body.setPosition(this.phyBody, {
// x: 750,
// y: this.phyBody.position.y
// })
// } else {
// this.x = this.phyBody.position.x;
// this.y = this.phyBody.position.y;
// }
// this.beforeY = this.phyBody.position.y;
jump() { jump() {
setTimeout(() => { setTimeout(() => {
this.jumpSvga.visible = true;
this.downSvga.visible = false;
this.jumpSvga.startAniRange(1, undefined, 1)
Matter.Body.setVelocity(this.phyBody, { x: 0, y: -8 }); // 立即设置刚体的线速度。位置、角度、力等不变 Matter.Body.setVelocity(this.phyBody, { x: 0, y: -8 }); // 立即设置刚体的线速度。位置、角度、力等不变
// Matter.Body.applyForce(this.phyBody, this.phyBody.position, {
// x: 0,
// y: -10
// });
}) })
} }
...@@ -170,7 +127,7 @@ export default class Role extends FYGE.Container { ...@@ -170,7 +127,7 @@ export default class Role extends FYGE.Container {
setPhyPos() { setPhyPos() {
Matter.Body.setPosition(this.phyBody, { Matter.Body.setPosition(this.phyBody, {
x: this.x * this.bili + this.itemImg.width * this.bili / 2, x: this.x * this.bili + this.itemImg.width * this.bili / 2,
y: this.y * this.bili + this.itemImg.height * this.bili / 2 - this.staY * this.bili, y: this.y * this.bili + this.itemImg.height * this.bili*0.9 - this.staY * this.bili,
}); });
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment