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
This diff is collapsed.
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: ""
}) {
......
This diff is collapsed.
......@@ -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)
......
This diff is collapsed.
......@@ -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