Commit d208dd4b authored by 王勇霞's avatar 王勇霞

更新

parent 5432b50e
///////////////////时间相关的方法放这里
/**
* 判断当前时间是否在指定时间区间内,每日,注意没判断起始时间是否肯定小于结束时间
* @param beginTime 形如"9:30","09:30",起始时间
* @param endTime 形如"21:30",结束时间
*/
export function checkAuditDayTime(beginTime: string, endTime: string, currentTimestamp: number = Date.now()): boolean {
return !checkBeforeDayTime(beginTime, currentTimestamp) && checkBeforeDayTime(endTime, currentTimestamp)
}
/**
* 判断当前时间是否在给定时间前,每天
* 精确到分,有需要自行改造截取方法和setHours传参
* @param time 形如"11:30","09:30",小时 0(午夜) ~ 23(晚上11点),分0 ~ 59 之间,负数或超出,会进行进制换算
* @returns 返回true表示当前时间小于传入时间,即未到传入时间
*/
export function checkBeforeDayTime(time: string, currentTimestamp: number = Date.now()): boolean {
var nowDate = new Date(currentTimestamp);
var timeDate = new Date(nowDate);
var index = time.lastIndexOf("\:");
var hour = time.substring(0, index);
var minue = time.substring(index + 1, time.length);
timeDate.setHours(+hour, +minue, 0, 0);
return nowDate.getTime() < timeDate.getTime()
}
/**
* 毫秒剩余时间转成时分秒,具体格式自行修改
* 01时01分01秒
* @param timeStamp
*/
export function getShiFenMiaoByTimeStamp(timeStamp: number): string {
var hours: any = Math.floor((timeStamp % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes: any = Math.floor((timeStamp % (1000 * 60 * 60)) / (1000 * 60));
var seconds: any = Math.floor((timeStamp % (1000 * 60)) / 1000);
hours = hours < 10 ? ('0' + hours) : hours;
minutes = minutes < 10 ? ('0' + minutes) : minutes;
seconds = seconds < 10 ? ('0' + seconds) : seconds;
// return hours + ":" + minutes + ":" + seconds;
return hours + "时" + minutes + "分" + seconds + "秒";
}
/**
* 根据时间戳返回各种格式,自行修改,到时加枚举
* @param timeStamp 时间戳
* @return 20190606 09:05:33 2019-06-06 09:05:33 2019/06/06 09:05:33 2019年3月12日10时9分29秒
*/
export function getDateTime(timeStamp: number): string {
function add0(m: number) {
return m < 10 ? '0' + m : m
}
var time = new Date(timeStamp);
var y = time.getFullYear();
var m = time.getMonth() + 1;
var d = time.getDate();
var h = time.getHours();
var mm = time.getMinutes();
var s = time.getSeconds();
// return "" + y + add0(m) + add0(d) + ' ' + add0(h) + ':' + add0(mm) + ':' + add0(s);
// return "" + y + '-' + add0(m) + '-' + add0(d) + ' ' + add0(h) + ':' + add0(mm) + ':' + add0(s);
// return "" + y + '/' + add0(m) + '/' + add0(d) + ' ' + add0(h) + ':' + add0(mm) + ':' + add0(s);
return y + "年" + m + '月' + d + '日' + h + '时' + mm + '分' + s + '秒'
}
/**
* 日期格式转时间戳
* 时间格式得用/,ios用-有问题,"2019/06/17 00:00:00",,,,ios也不能直接用Number(new Date())
* @param date "2019/06/17 00:00:00" "2019-06-17 00:00:00"
*/
export function getTimeStampByDate(date: string) {
return new Date(date.replace(/-/g, "/")).getTime();
}
/**
* 快速获取年月日时分秒 "2021-02-01 18:32:32"
* @param timeStamp 不传表示当前
*/
export function getDate(timeStamp: number = Date.now()): string {
//有局限性,但是无妨 19暂时年份不会超
return new Date(timeStamp + 8 * 3600 * 1000).toJSON().substr(0, 19).replace("T", " ");
}
/**
* 判断两个时间戳是否为同一天
* @param time1
* @param time2
*/
export function checkSameDay(time1: number, time2: number): boolean {
return new Date(time1).toDateString() === new Date(time2).toDateString()
}
{
root: '/Users/duibagroup/Downloads/duiba-wyx/2023/浙江中烟/跳一跳/project_0307',
registry: 'https://registry.npmmirror.com',
pkgs: [],
production: false,
cacheStrict: false,
cacheDir: null,
env: {
npm_config_registry: 'https://registry.npmmirror.com',
npm_config_argv: '{"remain":[],"cooked":["--fix-bug-versions","--china","--userconfig=/Users/duibagroup/.cnpmrc","--disturl=https://npmmirror.com/mirrors/node","--registry=https://registry.npmmirror.com","-g","pack-textures"],"original":["--fix-bug-versions","--china","--userconfig=/Users/duibagroup/.cnpmrc","--disturl=https://npmmirror.com/mirrors/node","--registry=https://registry.npmmirror.com","-g","pack-textures"]}',
npm_config_user_agent: 'npminstall/7.4.2 npm/? node/v16.13.0 darwin x64',
NODE: '/usr/local/bin/node',
npm_node_execpath: '/usr/local/bin/node',
npm_execpath: '/usr/local/lib/node_modules/cnpm/node_modules/npminstall/bin/install.js',
npm_config_userconfig: '/Users/duibagroup/.cnpmrc',
npm_config_disturl: 'https://npmmirror.com/mirrors/node',
npm_config_r: 'https://registry.npmmirror.com',
NODEJS_ORG_MIRROR: 'https://cdn.npmmirror.com/binaries/node',
NVM_NODEJS_ORG_MIRROR: 'https://cdn.npmmirror.com/binaries/node',
PHANTOMJS_CDNURL: 'https://cdn.npmmirror.com/binaries/phantomjs',
CHROMEDRIVER_CDNURL: 'https://cdn.npmmirror.com/binaries/chromedriver',
OPERADRIVER_CDNURL: 'https://cdn.npmmirror.com/binaries/operadriver',
CYPRESS_DOWNLOAD_PATH_TEMPLATE: 'https://cdn.npmmirror.com/binaries/cypress/${version}/${platform}-${arch}/cypress.zip',
ELECTRON_MIRROR: 'https://cdn.npmmirror.com/binaries/electron/',
ELECTRON_BUILDER_BINARIES_MIRROR: 'https://cdn.npmmirror.com/binaries/electron-builder-binaries/',
SASS_BINARY_SITE: 'https://cdn.npmmirror.com/binaries/node-sass',
SWC_BINARY_SITE: 'https://cdn.npmmirror.com/binaries/node-swc',
NWJS_URLBASE: 'https://cdn.npmmirror.com/binaries/nwjs/v',
PUPPETEER_DOWNLOAD_HOST: 'https://cdn.npmmirror.com/binaries',
PLAYWRIGHT_DOWNLOAD_HOST: 'https://cdn.npmmirror.com/binaries/playwright',
SENTRYCLI_CDNURL: 'https://cdn.npmmirror.com/binaries/sentry-cli',
SAUCECTL_INSTALL_BINARY_MIRROR: 'https://cdn.npmmirror.com/binaries/saucectl',
RE2_DOWNLOAD_MIRROR: 'https://cdn.npmmirror.com/binaries/node-re2',
RE2_DOWNLOAD_SKIP_PATH: 'true',
npm_config_better_sqlite3_binary_host: 'https://cdn.npmmirror.com/binaries/better-sqlite3',
npm_config_keytar_binary_host: 'https://cdn.npmmirror.com/binaries/keytar',
npm_config_sharp_binary_host: 'https://cdn.npmmirror.com/binaries/sharp',
npm_config_sharp_libvips_binary_host: 'https://cdn.npmmirror.com/binaries/sharp-libvips',
npm_config_robotjs_binary_host: 'https://cdn.npmmirror.com/binaries/robotjs',
npm_rootpath: '/Users/duibagroup/Downloads/duiba-wyx/2023/浙江中烟/跳一跳/project_0307',
INIT_CWD: '/Users/duibagroup/Downloads/duiba-wyx/2023/浙江中烟/跳一跳/project_0307',
npm_config_cache: '/Users/duibagroup/.npminstall_tarball'
},
binaryMirrors: {
ENVS: {
NODEJS_ORG_MIRROR: 'https://cdn.npmmirror.com/binaries/node',
NVM_NODEJS_ORG_MIRROR: 'https://cdn.npmmirror.com/binaries/node',
PHANTOMJS_CDNURL: 'https://cdn.npmmirror.com/binaries/phantomjs',
CHROMEDRIVER_CDNURL: 'https://cdn.npmmirror.com/binaries/chromedriver',
OPERADRIVER_CDNURL: 'https://cdn.npmmirror.com/binaries/operadriver',
CYPRESS_DOWNLOAD_PATH_TEMPLATE: 'https://cdn.npmmirror.com/binaries/cypress/${version}/${platform}-${arch}/cypress.zip',
ELECTRON_MIRROR: 'https://cdn.npmmirror.com/binaries/electron/',
ELECTRON_BUILDER_BINARIES_MIRROR: 'https://cdn.npmmirror.com/binaries/electron-builder-binaries/',
SASS_BINARY_SITE: 'https://cdn.npmmirror.com/binaries/node-sass',
SWC_BINARY_SITE: 'https://cdn.npmmirror.com/binaries/node-swc',
NWJS_URLBASE: 'https://cdn.npmmirror.com/binaries/nwjs/v',
PUPPETEER_DOWNLOAD_HOST: 'https://cdn.npmmirror.com/binaries',
PLAYWRIGHT_DOWNLOAD_HOST: 'https://cdn.npmmirror.com/binaries/playwright',
SENTRYCLI_CDNURL: 'https://cdn.npmmirror.com/binaries/sentry-cli',
SAUCECTL_INSTALL_BINARY_MIRROR: 'https://cdn.npmmirror.com/binaries/saucectl',
RE2_DOWNLOAD_MIRROR: 'https://cdn.npmmirror.com/binaries/node-re2',
RE2_DOWNLOAD_SKIP_PATH: 'true',
npm_config_better_sqlite3_binary_host: 'https://cdn.npmmirror.com/binaries/better-sqlite3',
npm_config_keytar_binary_host: 'https://cdn.npmmirror.com/binaries/keytar',
npm_config_sharp_binary_host: 'https://cdn.npmmirror.com/binaries/sharp',
npm_config_sharp_libvips_binary_host: 'https://cdn.npmmirror.com/binaries/sharp-libvips',
npm_config_robotjs_binary_host: 'https://cdn.npmmirror.com/binaries/robotjs'
},
'@ali/s2': { host: 'https://cdn.npmmirror.com/binaries/looksgood-s2' },
sharp: { replaceHostFiles: [Array], replaceHostMap: [Object] },
'@tensorflow/tfjs-node': {
replaceHostFiles: [Array],
replaceHostRegExpMap: [Object],
replaceHostMap: [Object]
},
cypress: {
host: 'https://cdn.npmmirror.com/binaries/cypress',
newPlatforms: [Object]
},
'utf-8-validate': {
host: 'https://cdn.npmmirror.com/binaries/utf-8-validate/v{version}'
},
xprofiler: {
remote_path: './xprofiler/v{version}/',
host: 'https://cdn.npmmirror.com/binaries'
},
leveldown: { host: 'https://cdn.npmmirror.com/binaries/leveldown/v{version}' },
couchbase: { host: 'https://cdn.npmmirror.com/binaries/couchbase/v{version}' },
gl: { host: 'https://cdn.npmmirror.com/binaries/gl/v{version}' },
sqlite3: {
host: 'https://cdn.npmmirror.com/binaries/sqlite3',
remote_path: 'v{version}'
},
'@journeyapps/sqlcipher': { host: 'https://cdn.npmmirror.com/binaries' },
grpc: {
host: 'https://cdn.npmmirror.com/binaries',
remote_path: '{name}/v{version}'
},
'grpc-tools': { host: 'https://cdn.npmmirror.com/binaries' },
wrtc: {
host: 'https://cdn.npmmirror.com/binaries',
remote_path: '{name}/v{version}'
},
fsevents: { host: 'https://cdn.npmmirror.com/binaries/fsevents' },
nodejieba: { host: 'https://cdn.npmmirror.com/binaries/nodejieba' },
canvas: { host: 'https://cdn.npmmirror.com/binaries/canvas' },
'skia-canvas': { host: 'https://cdn.npmmirror.com/binaries/skia-canvas' },
'flow-bin': {
replaceHost: 'https://github.com/facebook/flow/releases/download/v',
host: 'https://cdn.npmmirror.com/binaries/flow/v'
},
'jpegtran-bin': {
replaceHost: [Array],
host: 'https://cdn.npmmirror.com/binaries/jpegtran-bin'
},
'cwebp-bin': {
replaceHost: [Array],
host: 'https://cdn.npmmirror.com/binaries/cwebp-bin'
},
'zopflipng-bin': {
replaceHost: [Array],
host: 'https://cdn.npmmirror.com/binaries/zopflipng-bin'
},
'optipng-bin': {
replaceHost: [Array],
host: 'https://cdn.npmmirror.com/binaries/optipng-bin'
},
mozjpeg: {
replaceHost: [Array],
host: 'https://cdn.npmmirror.com/binaries/mozjpeg-bin'
},
gifsicle: {
replaceHost: [Array],
host: 'https://cdn.npmmirror.com/binaries/gifsicle-bin'
},
'pngquant-bin': {
replaceHost: [Array],
host: 'https://cdn.npmmirror.com/binaries/pngquant-bin',
replaceHostMap: [Object]
},
'pngcrush-bin': {
replaceHost: [Array],
host: 'https://cdn.npmmirror.com/binaries/pngcrush-bin'
},
'jpeg-recompress-bin': {
replaceHost: [Array],
host: 'https://cdn.npmmirror.com/binaries/jpeg-recompress-bin'
},
'advpng-bin': {
replaceHost: [Array],
host: 'https://cdn.npmmirror.com/binaries/advpng-bin'
},
'pngout-bin': {
replaceHost: [Array],
host: 'https://cdn.npmmirror.com/binaries/pngout-bin'
},
'jpegoptim-bin': {
replaceHost: [Array],
host: 'https://cdn.npmmirror.com/binaries/jpegoptim-bin'
},
argon2: { host: 'https://cdn.npmmirror.com/binaries/argon2' },
'ali-zeromq': { host: 'https://cdn.npmmirror.com/binaries/ali-zeromq' },
'ali-usb_ctl': { host: 'https://cdn.npmmirror.com/binaries/ali-usb_ctl' },
'gdal-async': { host: 'https://cdn.npmmirror.com/binaries/node-gdal-async' }
},
forbiddenLicenses: null,
flatten: false,
proxy: undefined,
prune: false,
disableFallbackStore: false,
workspacesMap: Map(0) {},
enableWorkspace: false,
workspaceRoot: '/Users/duibagroup/Downloads/duiba-wyx/2023/浙江中烟/跳一跳/project_0307',
isWorkspaceRoot: true,
isWorkspacePackage: false,
strictSSL: true,
ignoreScripts: false,
ignoreOptionalDependencies: false,
detail: true,
forceLinkLatest: false,
trace: false,
engineStrict: false,
registryOnly: false,
client: false,
autoFixVersion: [Function: autoFixVersion],
targetDir: null,
binDir: null
}
\ No newline at end of file
<!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",
"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
}
}
"atlas": "FailPanel.sht"
},
{
"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,cloud2.png,controlpeo.png,gamebg.jpg,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,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",
"name": "GameScene",
"atlas": {
"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
}
}
"atlas": "GameScene.sht"
},
{
"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": {
"x": 2,
"y": 2,
"w": 590,
"h": 586,
"ox": 0,
"oy": 0,
"sw": 590,
"sh": 586,
"ro": false
}
}
"atlas": "GuidePanel.sht"
},
{
"keys": "ruleBg.png",
"name": "RulePanel",
"atlas": {
"ruleBg.png": {
"x": 2,
"y": 2,
"w": 568,
"h": 638,
"ox": 0,
"oy": 0,
"sw": 568,
"sh": 638,
"ro": false
}
}
"atlas": "RulePanel.sht"
},
{
"keys": "backbtn.png,midbuild.png,mifcloud.png,rulebtn.png,startbg.jpg,startbtn.png,startop.png,titile.png",
"name": "StartScene",
"atlas": {
"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
}
}
"atlas": "StartScene.sht"
},
{
"keys": "infoline.png,light.png,sucbg.png,sucstar.png,sun.png",
"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
}
}
"atlas": "SuccessPanel.sht"
},
{
"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": "common.sht"
},
{
"keys": "crypeo.svga,guidecount.svga,jumppeo.svga,popstar.svga,startpeo.svga,startpop.svga",
"keys": "atmosphere.svga,crypeo.svga,guidecount.svga,jumppeo.svga,left.svga,light.svga,popstar.svga,right.svga,startbtn.svga,startpeople.svga",
"name": "svga"
}
],
......
......@@ -264,17 +264,7 @@
"x": 0,
"y": 0,
"type": "container",
"children": [
{
"name": "guide",
"x": 80,
"y": 787,
"type": "sprite",
"props": {
"source": "guide.png"
}
}
]
"children": []
},
{
"name": "GameScene",
......@@ -292,19 +282,10 @@
},
"id": "bg"
},
{
"name": "gamebuild",
"x": 0,
"y": 826,
"type": "sprite",
"props": {
"source": "gamebuild.png"
}
},
{
"name": "cloud",
"x": 450,
"y": 689,
"x": 51,
"y": 761,
"type": "sprite",
"props": {
"source": "cloud.png"
......@@ -312,109 +293,36 @@
"id": "cloud"
},
{
"name": "controlpeo",
"x": 313,
"y": 788,
"name": "cloud2",
"x": 214,
"y": 1065,
"type": "sprite",
"props": {
"source": "controlpeo.png"
"source": "cloud2.png"
},
"id": "peo"
"id": "cloud2"
},
{
"name": "tianpop",
"x": 516,
"y": 638,
"type": "sprite",
"props": {
"source": "tianpop.png"
},
"id": "tianpop"
},
{
"name": "xiangpop",
"x": 27,
"y": 786,
"type": "sprite",
"props": {
"source": "xiangpop.png"
},
"id": "xiangpop"
},
{
"name": "monster",
"x": 106,
"y": 419,
"name": "controlpeo",
"x": 237,
"y": 869,
"type": "sprite",
"props": {
"source": "monster.png"
"source": "controlpeo.png"
},
"id": "monster"
"id": "peo"
},
{
"name": "controlbtn",
"x": 80,
"y": 1164,
"type": "container",
"children": [
{
"name": "rightbtn",
"x": 0,
"y": 0,
"type": "sprite",
"props": {
"source": "rightbtn.png"
},
"id": "right"
},
{
"name": "leftbtn",
"x": 385,
"y": 0,
"type": "sprite",
"props": {
"source": "leftbtn.png"
},
"id": "lrft"
}
]
},
{
"name": "score",
"x": 280,
"y": 244,
"type": "container",
"children": [
{
"name": "scorebg",
"x": 0,
"y": 0,
"type": "sprite",
"props": {
"source": "scorebg.png"
},
"id": "scorebg"
},
{
"name": "scorenum",
"x": 140,
"y": 26,
"type": "text",
"props": {
"text": "5136",
"size": 44,
"fillColor": "#ffffff",
"textAlpha": 1,
"lineHeight": 44
},
"id": "scorenum"
}
]
"children": []
},
{
"name": "countdown",
"x": 23,
"y": 244,
"x": 313,
"y": 330,
"type": "container",
"children": [
{
......@@ -426,42 +334,8 @@
"source": "cdbg.png"
},
"id": "cdbg"
},
{
"name": "cdnum",
"x": 94,
"y": 26,
"type": "text",
"props": {
"text": "15s",
"size": 44,
"fillColor": "#ffffff",
"textAlpha": 1,
"lineHeight": 44
},
"id": "cdnum"
}
]
},
{
"name": "closemusic",
"x": 650,
"y": 245,
"type": "sprite",
"props": {
"source": "closemusic.png"
},
"id": "close"
},
{
"name": "openmusic",
"x": 650,
"y": 245,
"type": "sprite",
"props": {
"source": "openmusic.png"
},
"id": "open"
}
]
},
......
......@@ -5,7 +5,7 @@
"name": "FailPanel"
},
{
"keys": "cdbg.png,closemusic.png,cloud.png,cloud2.png,controlpeo.png,gamebg.jpg,leftbtn.png,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,openmusic.png,reset.png,rightbtn.png,scorebg.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,cloud2.png,controlpeo.png,gamebg.jpg,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,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",
"name": "GameScene"
},
{
......@@ -33,7 +33,7 @@
"name": "common"
},
{
"keys": "atmosphere.svga,crypeo.svga,guidecount.svga,jumppeo.svga,left.svga,popstar.svga,right.svga,startbtn.svga,startpeople.svga",
"keys": "atmosphere.svga,crypeo.svga,guidecount.svga,jumppeo.svga,left.svga,light.svga,popstar.svga,right.svga,startbtn.svga,startpeople.svga",
"name": "svga"
}
],
......
......@@ -2,27 +2,33 @@ export const ResJson = {
"groups": [
{
"keys": "failbg.png,knowbtn.png,restartbtn.png",
"name": "FailPanel"
"name": "FailPanel",
"atlas": "FailPanel.sht"
},
{
"keys": "cdbg.png,closemusic.png,cloud.png,cloud2.png,controlpeo.png,gamebg.jpg,leftbtn.png,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,openmusic.png,reset.png,rightbtn.png,scorebg.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"
"keys": "cdbg.png,cloud.png,cloud2.png,controlpeo.png,gamebg.jpg,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,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",
"name": "GameScene",
"atlas": "GameScene.sht"
},
{
"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": "GuidePanel.sht"
},
{
"keys": "ruleBg.png",
"name": "RulePanel"
"name": "RulePanel",
"atlas": "RulePanel.sht"
},
{
"keys": "backbtn.png,midbuild.png,mifcloud.png,rulebtn.png,startbg.jpg,startbtn.png,startop.png,titile.png",
"name": "StartScene"
"name": "StartScene",
"atlas": "StartScene.sht"
},
{
"keys": "infoline.png,light.png,sucbg.png,sucstar.png,sun.png",
"name": "SuccessPanel"
"name": "SuccessPanel",
"atlas": "SuccessPanel.sht"
},
{
"keys": "bg.mp3,fail.mp3,get.mp3,jump.mp3",
......@@ -30,12 +36,13 @@ export const ResJson = {
},
{
"keys": "closebtn.png,comCloseBtn.png,surebtn.png,toastBg.png,waitingBg.png,waitingRot.png,关闭按钮.png,关闭按钮2.png",
"name": "common"
"name": "common",
"atlas": "common.sht"
},
{
"keys": "atmosphere.svga,crypeo.svga,guidecount.svga,jumppeo.svga,left.svga,popstar.svga,right.svga,startbtn.svga,startpeople.svga",
"keys": "atmosphere.svga,crypeo.svga,guidecount.svga,jumppeo.svga,left.svga,light.svga,popstar.svga,right.svga,startbtn.svga,startpeople.svga",
"name": "svga"
}
],
"path": "./resource/"
"path": "https://yun.duiba.com.cn/db_games/activity/template/1678366579/resource/"
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
......@@ -47,14 +47,8 @@ export class StartScene extends Scene {
this.indexInfo = data
this.titlelab.text = "今日收集字数( " + data.word + " / 17 )"
// test==-------
for (let i = 0; i < data.gamecfs.length; i++) {
if (data.gamecfs[i].code == data.gameCode) {
this.gameInfo = data.gamecfs[i]
}
}
// test-------
this.openGame()
// this.openGame()
}
openRule() {
showPanel(RulePanel)
......
import * as Matter from "matter-js";
import { RES } from "../../../module/RES";
export default class Role extends FYGE.Container {
public phyBody: Matter.Body;
roleImg: FYGE.Sprite;
beforeY = 0;
// direction = 'down';
direction;
jumpSvga;
downSvga;
lightSvga;
currentIndex = -2;
position;
item
item;
isMove;
constructor(data?) {
constructor() {
super();
let roleImg = this.roleImg = new FYGE.Sprite();
roleImg.texture = RES.getRes("controlpeo.png");
this.getSvga()
this.phyBody = Matter.Bodies.circle(this.x, this.y,roleImg.width/2, {
friction: 1,
isSensor: false, // 传感器,可以检测到碰撞,但是不参与碰撞
});
this.setPhyPos();
// this.addEventListener(
// FYGE.Event.ADDED_TO_STAGE,
// () => {
......@@ -40,95 +32,96 @@ export default class Role extends FYGE.Container {
this.jumpSvga.visible = false
this.addChild(this.jumpSvga);
this.downSvga = new FYGE.SvgaAni(await RES.getResAsync("crypeo.svga"));
this.downSvga.position.set(-this.downSvga.videoWidth / 2, -this.downSvga.videoHeight / 2)
this.addChild(this.downSvga);
}
// ------------test
die(callback){
this.jumpSvga.visible = false;
this.downSvga.visible = true;
FYGE.Tween.get(this.downSvga)
.to({
y:this.downSvga.y+750
},1000)
.call(()=>{
callback()
})
this.lightSvga = new FYGE.SvgaAni(await RES.getResAsync("light.svga"));
this.lightSvga.position.set(-this.lightSvga.videoWidth / 2, -this.lightSvga.videoHeight / 2)
this.lightSvga.visible = false
this.addChild(this.lightSvga);
}
leftMove(){
leftMove(data, callback){
if (this.currentIndex%2 == 0) {
console.log('左移动')
if (this.isMove) return
this.isMove = true
this.item = data.item
this.direction = 'left'
Matter.Body.applyForce(this.phyBody, this.phyBody.position, {
x: 0.1,
y: 0
});
this.downSvga.visible = false
this.jumpSvga.visible = true,
this.jumpSvga.startAniRange(1, undefined, 1)
FYGE.Tween.get(this.position).to({
x: this.item.position.x + 20,
y: this.item.position.y - 110
}, 500, FYGE.Ease.quadInOut)
.call(() => {
// console.log("播放完成")
callback && callback(this.item)
this.currentIndex = this.item.index;
this.downSvga.visible = true
this.jumpSvga.visible = false
this.isMove = false
this.lightSvga.visible = true
this.lightSvga.startAniRange(1, undefined, 1, () => {
this.lightSvga.visible = false
})
})
}
}
rightMove(){
rightMove(data, callback){
if (this.currentIndex%2 == 1) {
if (this.isMove) return
this.isMove = true
this.item = data.item
console.log('右移动', this.item.position.x)
this.direction = 'right'
Matter.Body.applyForce(this.phyBody, this.phyBody.position, {
x: -0.1,
y: 0
});
}
}
/** 根据物理刚体,更新当前的坐标。 */
private onFarm() {
if (this.direction == 'left') {
console.log('----')
Matter.Body.setPosition( this.phyBody, {
x:this.phyBody.position.x - 1,
y:this.phyBody.position.y - 1
this.downSvga.visible = false
this.jumpSvga.visible = true
this.jumpSvga.startAniRange(1, undefined, 1)
FYGE.Tween.get(this.position).to({
x: this.item.position.x + 20,
y: this.item.position.y - 110
}, 500, FYGE.Ease.quadInOut)
.call(() => {
console.log("播放完成")
callback && callback(this.item)
this.currentIndex = this.item.index
this.downSvga.visible = true
this.jumpSvga.visible = false
this.isMove = false
this.lightSvga.visible = true
this.lightSvga.startAniRange(1, undefined, 1, () => {
this.lightSvga.visible = false
})
})
this.position.set(this.phyBody.position.x,this.phyBody.position.y)
// this.downSvga.position.set(1, 1000)
// this.jumpSvga.position.set(1, 1000)
} else {
}
// console.log("this.beforeY", this.beforeY)
// 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;
}
// 人物自由落地
onFreeFall(position, data, callback) {
this.item = data.item
this.position.set(position.x, position.y - 1000)
this.downSvga.visible = false
this.jumpSvga.visible = true,
this.jumpSvga.startAniRange(1, undefined, 1)
FYGE.Tween.get(this.position, {
onChange: () => {
}
}).to({
x: position.x + 20,
y: position.y - 110
}, 1000, FYGE.Ease.quadInOut)
.call(() => {
console.log("播放完成")
callback && callback(this.item)
this.currentIndex = this.item.index;
this.downSvga.visible = true
this.jumpSvga.visible = false
})
}
addScore(num: number | string, color: string) {
var score = this.addChild(new FYGE.TextField());
......@@ -179,11 +172,6 @@ export default class Role extends FYGE.Container {
let resy = event.stageY - offsetY;
if (resx < 50 || resx > 700) { return }
this.x = resx;
// this.y = resy;
Matter.Body.setPosition(this.phyBody, {
x: resx,
y: this.y,
});
},
this
);
......@@ -199,20 +187,9 @@ export default class Role extends FYGE.Container {
set fx(value: number) {
this.position.x = value;
this.setPhyPos();
}
set fy(value: number) {
this.position.y = value;
this.setPhyPos();
}
setPhyPos() {
Matter.Body.setPosition(this.phyBody, {
x: (this.x),
y: (this.y),
});
}
}
\ No newline at end of file
......@@ -2,51 +2,27 @@
import * as Matter from "matter-js";
import { RES } from "../../../module/RES";
export default class Word extends FYGE.Container {
public phyBody: Matter.Body;
itemImg: FYGE.Sprite;
wordTx;
index
constructor(data?) {
super();
this.wordTx = data.wordTx
this.wordTx = data.wordTx;
this.index = data.index;
let itemImg = this.itemImg = new FYGE.Sprite();
itemImg.texture = RES.getRes(`word_${data.wordTx}.png`);
itemImg.position.set(-itemImg.width / 2, -itemImg.height / 2);
this.addChild(itemImg);
this.phyBody = Matter.Bodies.rectangle(this.x, this.y, itemImg.width / 2, itemImg.height / 2, {
isStatic: true,
friction: 1,
isSensor: true, // 传感器,可以检测到碰撞,但是不参与碰撞
});
this.phyBody.gameType = data.wordTx;
setTimeout(() => {
this.setPhyPos();
}, 200)
}
set fx(value: number) {
this.position.x = value;
this.setPhyPos();
}
set fy(value: number) {
this.position.y = value;
this.setPhyPos();
}
setPhyPos() {
try {
Matter.Body.setPosition(this.phyBody, {
x: (this.x),
y: (this.y),
});
} catch (e) { }
}
......
This diff is collapsed.
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