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

feat: 接入接口

parent d7b71a7e
......@@ -55,8 +55,8 @@
<div id="cusEngine" style="line-height:0;font-size:0;position: absolute;">
<canvas id="canvas" style="width: 100%;height: 100%"></canvas>
</div>
<canvas id="renderCanvas"
style="margin:auto; left:0;top:0;right:0;bottom:0; pointer-events: none; position: absolute; width: 100%;height: 100%"></canvas>
<!-- <canvas id="renderCanvas"
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="https://yun.duiba.com.cn/db_games/libs0126/stats.js"></script> -->
......
......@@ -5,8 +5,8 @@
"dataInfo": [
{
"num": 1,
"context": "闲看晴云自卷舒",
"context1": "闲看",
"context": "",
"context1": "闲看晴云自卷舒",
"ifComplete": false,
"count": 74413176.81524068
},
......@@ -19,25 +19,28 @@
},
{
"num": 3,
"context": "云卷舒",
"context": "",
"context1": "云卷舒",
"ifComplete": false,
"count": 10
},
{
"num": 5,
"context": "心无意",
"context": "",
"context1": "心无意",
"ifComplete": true,
"count": 10
},
{
"num": 4,
"context": "自在休闲",
"context": "",
"context1": "自在休闲",
"ifComplete": false,
"count": 10
}
],
"collectCount": 1,
"ifFirstPlay": false
"ifFirstPlay": true
},
"code": "ipsum est tempor qui",
"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": [
{
"keys": "bg.mp3,fail.mp3,get.mp3,jump.mp3",
"name": "bgm"
},
{
"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": "failbg.png,knowbtn.png,restartbtn.png",
"name": "FailPanel",
......@@ -138,89 +40,232 @@
}
},
{
"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",
"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": {
"gamebuild.png": {
"cloud.png": {
"x": 2,
"y": 2,
"w": 750,
"h": 496,
"w": 222,
"h": 83,
"ox": 0,
"oy": 0,
"sw": 750,
"sh": 496,
"sw": 222,
"sh": 83,
"ro": false
},
"scorebg.png": {
"cdbg.png": {
"x": 2,
"y": 500,
"w": 309,
"h": 79,
"y": 87,
"w": 192,
"h": 122,
"ox": 0,
"oy": 0,
"sw": 309,
"sh": 79,
"sw": 192,
"sh": 122,
"ro": false
},
"rightbtn.png": {
"controlpeo的副本.png": {
"x": 2,
"y": 581,
"w": 206,
"h": 204,
"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": 206,
"sh": 204,
"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
},
"leftbtn.png": {
"x": 313,
"y": 500,
"w": 205,
"h": 205,
"word_休.png": {
"x": 224,
"y": 123,
"w": 112,
"h": 119,
"ox": 0,
"oy": 0,
"sw": 205,
"sh": 205,
"sw": 112,
"sh": 119,
"ro": false
},
"cloud.png": {
"x": 210,
"y": 581,
"w": 199,
"h": 60,
"word_卷.png": {
"x": 340,
"y": 2,
"w": 112,
"h": 119,
"ox": 0,
"oy": 0,
"sw": 199,
"sh": 60,
"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
},
"cdbg.png": {
"x": 520,
"y": 500,
"w": 196,
"h": 81,
"word_心.png": {
"x": 338,
"y": 123,
"w": 112,
"h": 119,
"ox": 0,
"oy": 0,
"sw": 196,
"sh": 81,
"sw": 112,
"sh": 119,
"ro": false
},
"controlpeo.png": {
"x": 520,
"y": 583,
"w": 117,
"h": 196,
"word_意.png": {
"x": 2,
"y": 360,
"w": 112,
"h": 119,
"ox": 0,
"oy": 0,
"sw": 117,
"sh": 196,
"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": 639,
"y": 583,
"x": 568,
"y": 2,
"w": 97,
"h": 116,
"ox": 0,
......@@ -230,8 +275,8 @@
"ro": false
},
"tianpop.png": {
"x": 639,
"y": 701,
"x": 568,
"y": 120,
"w": 84,
"h": 94,
"ox": 0,
......@@ -241,8 +286,8 @@
"ro": true
},
"xiangpop.png": {
"x": 735,
"y": 701,
"x": 566,
"y": 206,
"w": 84,
"h": 93,
"ox": 0,
......@@ -251,37 +296,180 @@
"sh": 93,
"ro": true
},
"closemusic.png": {
"x": 272,
"y": 707,
"w": 78,
"h": 78,
"ox": 0,
"oy": 0,
"sw": 78,
"sh": 78,
"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
},
"openmusic.png": {
"x": 352,
"y": 707,
"w": 78,
"h": 78,
"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": 78,
"sh": 78,
"sw": 147,
"sh": 156,
"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",
"atlas": {
"guide.png": {
"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,
......@@ -289,6 +477,50 @@
"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
}
}
},
......@@ -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",
"atlas": {
"midbuild.png": {
"titile.png": {
"x": 2,
"y": 2,
"w": 750,
"h": 493,
"w": 574,
"h": 126,
"ox": 0,
"oy": 0,
"sw": 750,
"sh": 493,
"sw": 574,
"sh": 177,
"ro": false
},
"mifcloud.png": {
"startbtn.png": {
"x": 2,
"y": 497,
"w": 750,
"h": 412,
"y": 130,
"w": 350,
"h": 99,
"ox": 0,
"oy": 0,
"sw": 750,
"sh": 412,
"sw": 350,
"sh": 99,
"ro": false
},
"titile.png": {
"x": 754,
"y": 2,
"w": 596,
"h": 167,
"ox": 0,
"oy": 0,
"sw": 596,
"sh": 167,
"ro": true
},
"startbtn.png": {
"collect.png": {
"x": 2,
"y": 911,
"w": 333,
"h": 174,
"y": 231,
"w": 308,
"h": 50,
"ox": 0,
"oy": 0,
"sw": 333,
"sh": 174,
"sw": 308,
"sh": 50,
"ro": false
},
"startop.png": {
"x": 754,
"y": 600,
"x": 354,
"y": 130,
"w": 117,
"h": 196,
"ox": 0,
"oy": 0,
"sw": 117,
"sh": 196,
"ro": false
"ro": true
},
"backbtn.png": {
"x": 754,
"y": 798,
"w": 141,
"h": 53,
"x": 2,
"y": 283,
"w": 145,
"h": 62,
"ox": 0,
"oy": 0,
"sw": 141,
"sh": 53,
"sw": 145,
"sh": 62,
"ro": false
},
"rulebtn.png": {
"x": 754,
"y": 853,
"w": 140,
"h": 53,
"x": 149,
"y": 283,
"w": 138,
"h": 62,
"ox": 0,
"oy": 0,
"sw": 140,
"sh": 53,
"sw": 138,
"sh": 62,
"ro": false
}
}
......@@ -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"
}
],
......
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 {
private _pause: boolean;
private canvas: HTMLCanvasElement
constructor(canvas: HTMLCanvasElement, data = {
time: 200,
time: 60,
longitude: "",
latitude: ""
}) {
......
......@@ -2,36 +2,776 @@ export const ResJson = {
"groups": [
{
"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",
"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",
"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",
"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",
"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",
"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",
"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",
"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 = {
"source": "gamebg.jpg"
},
"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 {
.to({ alpha: 0.2},500)
.to({ alpha: 1},500)
} 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)
let step3_tips = UI.Sp(this.rectlayer, 'step3_tips.png', 236, 850);
FYGE.Tween.get(step3_tips, {
......@@ -90,11 +90,10 @@ export class GuidePanel extends Panel {
this.step3_img.removeChildren();
let str = num + 's';
let arr = str.split("");
let startPos = (130 - (30 * arr.length)) / 2
let startPos = (192 - (30 * arr.length)) / 2
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(){
this.removeChild(this.rectlayer)
......
......@@ -17,6 +17,8 @@ import { playAllSound } from "../common/SoundWeb";
import { layers } from "../../module/views/layers";
import UI from "../UI";
import { allWords } from "../contant";
import { getUrlParams } from "../../module/web/webTools";
import { GDispatcher } from "../Main";
export class GameScene extends Scene {
get groupNames() { return ["GameScene"] };
get skinName() { return "GameScene" };
......@@ -25,18 +27,12 @@ export class GameScene extends Scene {
left;
right;
cdbg: FYGE.Sprite;
reset;
time = Tools.configInfo.time;
// --------
cloud: FYGE.Sprite;
peo: FYGE.Sprite;
tianpop: FYGE.Sprite;
xiangpop: FYGE.Sprite;
monster: FYGE.Sprite;
isonce = false;
wordList = this.getWordList(); // 待随机出现的列表
wordLen = this.getWordList().length; // 需要收集字体的个数
collectList: any = []; // 已收集列表
public static instance: GameScene;
initUi() {
......@@ -44,7 +40,12 @@ export class GameScene extends Scene {
async start(data) {
super.start();
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"))
......@@ -76,13 +77,17 @@ export class GameScene extends Scene {
this.setChildIndex(this.bgCon, 1)
this.initMap();
// TODO_wyx
this.upDateInfo()
// // TODO_wyx
// this.upDateInfo()
}
// 数据重置
onReset() {
changeScene(StartScene)
}
getWordList() {
let dataInfo = getWebData(WebNetName.indexInfo).data.dataInfo;
let hasWordList:any = [];
let noWordList:any = [];
let hasWordList: any = [];
let noWordList: any = [];
dataInfo.forEach(item => {
if (item.context) {
hasWordList = hasWordList.concat(item.context.split(""))
......@@ -129,16 +134,11 @@ export class GameScene extends Scene {
arr.forEach((item, index) => {
UI.Sp(this.cdbg, `num_${item}.png`, startPos + (index * 30), 46)
})
}
startGame() {
this.isonce = false
this.addRole();
this.addEventListener(FYGE.Event.ENTER_FRAME, this.onFarm, this);
// this.composites.add(this.world, [this._role.phyBody]);
}
_role; //人物
bgCon; //背景移动
......@@ -158,8 +158,6 @@ export class GameScene extends Scene {
world;
runner;
ground;
addPropsMap = new Map();
obstaclePropMap = new Map();
private createPhyWorld() {
const { Engine, Render, Runner, Composite, Bodies, World, Composites } = Matter;
this.engine = Engine.create(
......@@ -177,130 +175,108 @@ export class GameScene extends Scene {
this.composites = Composite;
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, "beforeUpdate", this.onBeforeUpdate.bind(this));
Matter.Events.on(this.engine, "tick", this.onCollisionTick.bind(this));
// 创建一个渲染器
const render = Render.create({
// element: document.body,
canvas: document.getElementById("renderCanvas"),
engine: this.engine,
options: {
width: document.body.clientWidth,
height: document.body.clientHeight,
pixelRatio: window.devicePixelRatio, // 设置像素比
background: "rgba(255,255,255,0.3)", // 全局渲染模式时背景色
wireframeBackground: "rgba(255,255,255,0.3)", // 线框模式时背景色
hasBounds: false,
wireframes: false, // 线框模式
showSleeping: true, // 刚体睡眠状态
showDebug: false, // Debug 信息
showBroadphase: false, // 粗测阶段
showBounds: true, // 刚体的界限
showVelocity: false, // 移动刚体时速度
showCollisions: false, // 刚体碰撞点
showSeparations: false, // 刚体分离
showAxes: false, // 刚体轴线
showPositions: true, // 刚体位置
showAngleIndicator: false, // 刚体转角指示
showIds: true, // 显示每个刚体的 ID
showVertexNumbers: false, // 刚体顶点数
showConvexHulls: false, // 刚体凸包点
showInternalEdges: false, // 刚体内部边界
showMousePosition: false, // 鼠标约束线
},
});
Render.run(render);
}
onBeforeUpdate(e) {
if (this.engine.timing.timestamp - this.lastTime >= 1000) {
this._role.jump()
this.lastTime = this.engine.timing.timestamp;
}
// const render = Render.create({
// // element: document.body,
// canvas: document.getElementById("renderCanvas"),
// engine: this.engine,
// options: {
// width: document.body.clientWidth,
// height: document.body.clientHeight,
// pixelRatio: window.devicePixelRatio, // 设置像素比
// background: "rgba(255,255,255,0.3)", // 全局渲染模式时背景色
// wireframeBackground: "rgba(255,255,255,0.3)", // 线框模式时背景色
// hasBounds: false,
// wireframes: false, // 线框模式
// showSleeping: true, // 刚体睡眠状态
// showDebug: false, // Debug 信息
// showBroadphase: false, // 粗测阶段
// showBounds: true, // 刚体的界限
// showVelocity: false, // 移动刚体时速度
// showCollisions: false, // 刚体碰撞点
// showSeparations: false, // 刚体分离
// showAxes: false, // 刚体轴线
// showPositions: true, // 刚体位置
// showAngleIndicator: false, // 刚体转角指示
// showIds: true, // 显示每个刚体的 ID
// showVertexNumbers: false, // 刚体顶点数
// showConvexHulls: false, // 刚体凸包点
// showInternalEdges: false, // 刚体内部边界
// showMousePosition: false, // 鼠标约束线
// },
// });
// Render.run(render);
}
onCollisionTick(e) {
}
lastTime = 0
onCollisionStart(e) {
let pairs = e.pairs;
//
// Matter.Body.applyForce(this._role.phyBody, this._role.phyBody.position, { x: 0, y: -0.1 });
pairs.map((p) => {
// ip 与 云朵 碰撞
console.log(p.bodyA.objType, p.bodyB.objType)
// ip 与 云朵 碰撞, 进行人物跳跃
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) {
this._role.jump()
this.lastTime = this.engine.timing.timestamp;
}
}
})
// 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
// this.composites.remove(this.world, prop.phyBody);
// prop.destroy();
// this.bgCon.removeChild(prop)
// this.addPropsMap.delete(body.id);
// } else if (p.bodyB.gameType == 'dieProp' || p.bodyA.gameType == 'dieProp') {
// // 死亡💀
// console.log("死亡")
// let body = p.bodyB.gameType == 'dieProp' ? p.bodyB : p.bodyA;
// let prop = this.obstaclePropMap.get(body.id);
// this.composites.remove(this.world, prop.phyBody);
// prop.destroy();
// this.bgCon.removeChild(prop)
// this.obstaclePropMap.delete(body.id);
// // this.removeWorld()
// this.composites.remove(this.world, this._role.phyBody);
// clearTimeout(this.timer);
// this.gameOver()
// } else {
// if (!this.jumpLock) {
// this._role.jump()
// this.jumpLock = true;
// setTimeout(() => {
// this.jumpLock = false
// }, 300)
// }
// }
}
// }
// });
// ip 与 文字 碰撞, 进行收集文字
if ((p.bodyA.objType == "word" && p.bodyB == this._role.phyBody) || (p.bodyB.objType == "word" && p.bodyA == this._role.phyBody)) {
if (p.bodyA.objType == "word") {
if (!this.collectList.includes(p.bodyA.wordTx)) {
this.collectList.push(p.bodyA.wordTx);
let _i = this.wordList.indexOf(p.bodyA.wordTx);
if (_i > -1) {
this.wordList.splice(_i, 1)
}
}
this.composites.remove(this.world, p.bodyA);
setTimeout(() => {
this.bgCon.removeChild(p.bodyA.nodeTx);
}, 100)
}
if (p.bodyB.objType == "word") {
if (!this.collectList.includes(p.bodyB.wordTx)) {
this.collectList.push(p.bodyB.wordTx);
let _i = this.wordList.indexOf(p.bodyB.wordTx);
if (_i > -1) {
this.wordList.splice(_i, 1)
}
}
this.composites.remove(this.world, p.bodyB);
setTimeout(() => {
this.bgCon.removeChild(p.bodyB.nodeTx);
}, 100)
}
}
})
}
initMap() {
let stageHeight = this.stage.stageHeight;
// 循环多建几行
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 = [];
createLineItem(h, x?: number, isprop = true, idx = 0) {
let sx = x ? x : Math.floor(Math.random() * 300 - 100); // 初始第一朵云的坐标
let rLen = Math.floor(Math.random() * 4 + 2); // 每一行随机出现几朵云
let space = Math.floor(Math.random() * 80); // 增加一点随机间距
createLineItem(h, _sx?: number, _rLen?:number, _space?: number) {
let sx = _sx || Math.floor(Math.random() * 300 - 100); // 初始第一朵云的坐标
let rLen = _rLen || Math.floor(Math.random() * 4 + 2); // 每一行随机出现几朵云
// let rLen = 2
let space = _space || Math.floor(Math.random() * 80); // 增加一点随机间距
const offsetY = this.stage.viewRect.y;
let cloudLi = [];
for (let i = 0; i < rLen; i++) {
let mapItem = new MapItem({
fx: sx + i * 222 + i * (space + 20),
fy: h,
index: this.mapList.length + 1,
idx: idx,
stageY: offsetY
});
this.bgCon.addChildAt(mapItem, 0);
......@@ -315,102 +291,121 @@ export class GameScene extends Scene {
let addProp = new AddProp({
fx: sx + i * 222 + i * (space + 20) + 46,
fy: h - 70,
index: this.mapList.length + 1,
stageY: offsetY,
wordTx: len == 0 ? '' : this.wordList[randomIndex]
});
this.bgCon.addChildAt(addProp, 1)
this.composites.add(this.world, [addProp.phyBody]);
this.mapList.push([mapItem, addProp])
this.addPropsMap.set(addProp.phyBody.id, addProp);
cloudLi.push([mapItem, addProp])
}
this.mapList.push(cloudLi)
}
timer = null;
isFall;
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;
// 移动容器的位置
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.isonce) {
// this.composites.remove(this.world, this._role.phyBody);
// console.log("siwang")
// clearTimeout(this.timer);
// this.gameOver()
// // 复活需要初始化
// this.isonce = true
// }
// }
if (this._role.y >= -(this.bgCon.y - 1624)) {
console.log("人物出了舒适圈")
this.isFall = true
this._role.fx = lastItem.x
this._role.fy = lastItem.y
}
}
moveMap(y) {
if (this.isFall) return
this.bgCon.y = this.bgCon.y + y;
}
removeWorld() {
this.composites.clear(this.world)
// console.log(this.composites)
this.mapList = [];
this.addPropsMap.clear()
this.obstaclePropMap.clear()
console.log(this.obstaclePropMap)
console.log(this.addPropsMap)
console.log(this.mapList)
}
getDataArr() {
console.log('this.collectList', this.collectList)
let arr = ["闲看晴云自卷舒", "静水流深", "云卷舒", "心无意", "自在休闲"];
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() {
this._role.jumpSvga.visible = false;
this._role.downSvga.visible = true;
this.removeEventListener(FYGE.Event.ENTER_FRAME, this.onFarm, this);
this.removeWorld()
// let startInfo = getWebData(WebNetName.startGame).data.currInfo
// let timestamp = new Date().getTime()
// //签名方式: md5(score=分值&startId=游戏开始id&timestamp=timestamp&key=key)
// //其中key的值为开始游戏接口里返回的key+固定值9ef16b33920749fb26e8fc2f2913150a, 例如1234569ef16b33920749fb26e8fc2f2913150a
// let sign = duiba_md5(`score=${this.score}&startId=${startInfo.startId}&timestamp=${timestamp}&key=${startInfo.key + "9ef16b33920749fb26e8fc2f2913150a"}`)
// const { success, data, message } = await sendWebNet(WebNetName.submitGame, { score: this.score, sign: sign, code: startInfo.code, timestamp: timestamp ,startId:startInfo.startId})
// this._role.die(() => {
// this.bgCon.removeChildren()
// this.bgCon.y = 0
// if (!success) {
// showToast(message || "网络异常,请重试~")
// changeScene(StartScene)
// return
// }
// if (data.pass) {
// showPanel(SuccessPanel)
// } else {
// showPanel(FailPanel)
// }
// })
// 接口提交
let activityId = getUrlParams('activityId');
let startId = getWebData(WebNetName.startGame).data.startId;
let timestamp = new Date().getTime();
let type = 3
let sign = duiba_md5(String(activityId) + String(timestamp) + String(startId) + String(type) + 'posf3usrjjnd9sd4w21ln3p');
let dataArr = this.getDataArr();
const { success, data, desc } = await sendWebNet(WebNetName.submitGame, {
activityId,
type,
startId,
timestamp,
sign,
longitude: Tools.configInfo.longitude,
latitude: Tools.configInfo.latitude,
data: dataArr
})
if (success) {
GDispatcher.dispatchEvent("openGameEnd", {
point: data.point || 0
});
} else {
showToast(desc || "网络开小差了,稍后再试")
}
}
initEvents() {
super.initEvents();
......
......@@ -62,15 +62,7 @@ export class StartScene extends Scene {
}
// TODO_wyx
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 + "分"
// this.openGame()
}
openRule() {
GDispatcher.dispatchEvent("openRule");
......
......@@ -7,13 +7,11 @@ export default class AddProp extends FYGE.Container {
itemImg: FYGE.Sprite;
fx;
fy;
index;
wordTx;
constructor(data?) {
super();
this.fx = data.fx;
this.fy = data.fy;
this.index = data.index;
this.wordTx = data.wordTx;
this.position.set(this.fx, this.fy);
......@@ -27,6 +25,8 @@ export default class AddProp extends FYGE.Container {
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 {
var divW = document.body.clientWidth;
var divH = document.body.clientHeight;
// 至于为什么比对的位置, 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,
friction: 1,
isSensor: true, // 传感器,可以检测到碰撞,但是不参与碰撞
......
......@@ -11,32 +11,23 @@ export default class Role extends FYGE.Container {
jumpSvga;
downSvga;
lightSvga;
// fx;
// fy;
bili;
staY;
constructor(data?) {
super();
// this.fx = data.fx;
// this.fy = data.fy;
this.staY = data.stageY;
this.position.set(this.x, this.y);
let itemImg = this.itemImg = UI.Sp(this, "controlpeo.png", 0, 0);
let scale = this.bili = document.body.clientWidth / 750;
// 至于为什么比对的位置, 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,
// isSensor: false, // 传感器,可以检测到碰撞,但是不参与碰撞
// restitution: 0.1,
// friction: 0.01,
// inverseMass: 0.2,
// isSensor: true, // 传感器,可以检测到碰撞,但是不参与碰撞
// restitution: 0.8, // 定义刚体恢复(弹性)的数字
// // // density: 0.05,// 定义刚体密度的数字,即单位面积的质量
// // friction: 0.02,
// friction: 0.5, // 设置摩擦力
// friction: 0.01, // 设置摩擦力
// density: 0.05,// 定义刚体密度的数字,即单位面积的质量
// frictionAir: 0.01, // 设置空气摩擦力
render: {
fillStyle: "red" // 填充的颜色
}
......@@ -83,14 +74,14 @@ export default class Role extends FYGE.Container {
leftMove() {
Matter.Body.applyForce(this.phyBody, this.phyBody.position, {
x: -0.1,
x: -0.01,
y: 0
});
}
rightMove() {
Matter.Body.applyForce(this.phyBody, this.phyBody.position, {
x: 0.1,
x: 0.01,
y: 0
});
}
......@@ -98,7 +89,7 @@ export default class Role extends FYGE.Container {
/** 根据物理刚体,更新当前的坐标。 */
private onFarm() {
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.y = Ty;
......@@ -106,54 +97,20 @@ export default class Role extends FYGE.Container {
this.fx = 0;
this.fy = Ty;
} else if (Tx < 0) {
this.fx = 750;
this.fx = 750 - this.itemImg.width;
this.fy = Ty
} else {
this.fx = Tx;
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() {
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.applyForce(this.phyBody, this.phyBody.position, {
// x: 0,
// y: -10
// });
})
}
......@@ -170,7 +127,7 @@ export default class Role extends FYGE.Container {
setPhyPos() {
Matter.Body.setPosition(this.phyBody, {
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