Commit 89a049df authored by limingzhe's avatar limingzhe

fix: debug

parent c71b356e
No preview for this file type
...@@ -57,25 +57,10 @@ npm start ...@@ -57,25 +57,10 @@ npm start
* 下载模板调试专用app * 下载模板调试专用app
安卓下载:
http://download-iplayabc.oss-cn-beijing.aliyuncs.com/iDebugABC.apk http://download-iplayabc.oss-cn-beijing.aliyuncs.com/iDebugABC.apk
![avatar](http://staging-teach.cdn.ireadabc.com/084f2f95-8213-4c5a-8c46-b194819d7677.png) ![avatar](http://staging-teach.cdn.ireadabc.com/084f2f95-8213-4c5a-8c46-b194819d7677.png)
iOS下载:
由于调试APP没有上架App Store 所以需要先获取手机的UDID 发送给我们的技术支持,加入后才可以扫码下载安装
获取UDID:https://www.pgyer.com/tools/udid
下载iOS: https://www.pgyer.com/gS0X
有时可能需要反复调试一些功能性的问题,与原生APP相关或者手上临时没有设备,我们提供了一个网页版的调试方式
http://staging-openapi.iteachabc.com/api/courseware/v1/middle/debug
* 启动本地服务 * 启动本地服务
``` ```
...@@ -90,6 +75,5 @@ npm start ...@@ -90,6 +75,5 @@ npm start
### 注意事项及常见问题 ### 注意事项及常见问题
* 项目里所有文件及文件夹的命名方式要注意不能包含空格、汉字、减号 * 项目里所有文件及文件夹的命名方式要注意不能包含空格、汉字、减号
* 开发者新建的脚本文件(.js/.ts)的文件名必须包含项目名称,例如在 test_01 项目中添加一个脚本文件(如想命名为 hello.ts );则需要命名为 hello_test_01.ts
* 项目里尽量不要使用setTimeout、setInterval等定时器,如果使用了记得在onDestroy中释放掉(onDestroy 是指CocosCreator的生命周期钩子) * 项目里尽量不要使用setTimeout、setInterval等定时器,如果使用了记得在onDestroy中释放掉(onDestroy 是指CocosCreator的生命周期钩子)
* 理论上禁止使用全局变量,因为模板到线上会进行组装,常见问题是一个模板使用多次造成全局变量被读脏 * 理论上禁止使用全局变量,因为模板到线上会进行组装,常见问题是一个模板使用多次造成全局变量被读脏
{
"ver": "1.1.2",
"uuid": "c35bb2f6-f24a-4850-ae44-643f2fdc7541",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {
"ios": false,
"android": false
},
"subMetas": {}
}
\ No newline at end of file
import { asyncDelay, onHomeworkFinish } from "../script/util";
import { MyCocosSceneComponent } from "../script/MyCocosSceneComponent";
const { ccclass, property } = cc._decorator;
@ccclass
export default class SceneComponent extends MyCocosSceneComponent {
addPreloadImage() {
// TODO 根据自己的配置预加载图片资源
this._imageResList.push({ url: this.data.pic_url });
this._imageResList.push({ url: this.data.pic_url_2 });
}
addPreloadAudio() {
// TODO 根据自己的配置预加载音频资源
this._audioResList.push({ url: this.data.audio_url });
}
addPreloadAnima() {
}
async onLoadEnd() {
// TODO 加载完成后的逻辑写在这里, 下面的代码仅供参考
this.initData();
this.initView();
this.initListener();
}
_cantouch = null;
initData() {
// 所有全局变量 默认都是null
this._cantouch = true;
}
initView() {
this.initBg();
this.initPic();
this.initBtn();
this.initIcon();
}
initBg() {
const bgNode = cc.find('Canvas/bg');
bgNode.scale = this._mapScaleMax;
}
pic1 = null;
pic2 = null;
initPic() {
const canvas = cc.find('Canvas');
const maxW = canvas.width * 0.7;
this.getSprNodeByUrl(this.data.pic_url, (sprNode) => {
const picNode1 = sprNode;
picNode1.scale = maxW / picNode1.width;
picNode1.baseX = picNode1.x;
canvas.addChild(picNode1);
this.pic1 = picNode1;
const labelNode = new cc.Node();
labelNode.color = cc.Color.YELLOW;
const label = labelNode.addComponent(cc.Label);
label.string = this.data.text;
label.fontSize = 60;
label.lineHeight = 60;
label.font = cc.find('Canvas/res/font/BRLNSDB').getComponent('cc.Label').font;
picNode1.addChild(labelNode);
});
this.getSprNodeByUrl(this.data.pic_url_2, (sprNode) => {
const picNode2 = sprNode;
picNode2.scale = maxW / picNode2.width;
canvas.addChild(picNode2);
picNode2.x = canvas.width;
picNode2.baseX = picNode2.x;
this.pic2 = picNode2;
const labelNode = new cc.Node();
const label = labelNode.addComponent(cc.RichText);
const size = 60
label.font = cc.find('Canvas/res/font/BRLNSDB').getComponent(cc.Label).font;
label.string = `<outline color=#751e00 width=4><size=${size}><color=#ffffff>${this.data.text}</color></size></outline>`
label.lineHeight = size;
picNode2.addChild(labelNode);
});
}
initIcon() {
const iconNode = this.getSprNode('icon');
iconNode.zIndex = 5;
iconNode.anchorX = 1;
iconNode.anchorY = 1;
iconNode.parent = cc.find('Canvas');
iconNode.x = iconNode.parent.width / 2 - 10;
iconNode.y = iconNode.parent.height / 2 - 10;
iconNode.on(cc.Node.EventType.TOUCH_START, () => {
this.playAudioByUrl(this.data.audio_url);
})
}
curPage = null;
initBtn() {
this.curPage = 0;
const bottomPart = cc.find('Canvas/bottomPart');
bottomPart.zIndex = 5; // 提高层级
bottomPart.x = bottomPart.parent.width / 2;
bottomPart.y = -bottomPart.parent.height / 2;
const leftBtnNode = bottomPart.getChildByName('btn_left');
//节点中添加了button组件 则可以添加click事件监听
leftBtnNode.on('click', () => {
if (!this._cantouch) {
return;
}
if (this.curPage == 0) {
return;
}
this.curPage = 0
this.leftMove();
this.playLocalAudio('btn');
})
const rightBtnNode = bottomPart.getChildByName('btn_right');
//节点中添加了button组件 则可以添加click事件监听
rightBtnNode.on('click', () => {
if (!this._cantouch) {
return;
}
if (this.curPage == 1) {
return;
}
this.curPage = 1
this.rightMove();
// 游戏结束时需要调用这个方法通知系统作业完成
onHomeworkFinish();
this.playLocalAudio('btn');
})
}
leftMove() {
this._cantouch = false;
const len = this.pic1.parent.width;
cc.tween(this.pic1)
.to(1, { x: this.pic1.baseX }, { easing: 'cubicInOut' })
.start();
cc.tween(this.pic2)
.to(1, { x: this.pic2.baseX }, { easing: 'cubicInOut' })
.call(() => {
this._cantouch = true;
})
.start();
}
rightMove() {
this._cantouch = false;
const len = this.pic1.parent.width;
cc.tween(this.pic1)
.to(1, { x: this.pic1.baseX - len }, { easing: 'cubicInOut' })
.start();
cc.tween(this.pic2)
.to(1, { x: this.pic2.baseX - len }, { easing: 'cubicInOut' })
.call(() => {
this._cantouch = true;
})
.start();
}
// update (dt) {},
initListener() {
}
playLocalAudio(audioName) {
const audio = cc.find(`Canvas/res/audio/${audioName}`).getComponent(cc.AudioSource);
return new Promise((resolve, reject) => {
const id = cc.audioEngine.playEffect(audio.clip, false);
cc.audioEngine.setFinishCallback(id, () => {
resolve(id);
});
})
}
}
import { defaultData } from "../script/defaultData";
export class MyCocosSceneComponent extends cc.Component {
// 生命周期 onLoad
onLoad() {
this.initSceneData();
this.initSize();
}
_imageResList = null;
_audioResList = null;
_animaResList = null;
initSceneData() {
this._imageResList = [];
this._audioResList = [];
this._animaResList = [];
}
_designSize = null; // 设计分辨率
_frameSize = null; // 屏幕分辨率
_mapScaleMin = null; // 场景中常用缩放(取大值)
_mapScaleMax = null; // 场景中常用缩放(取小值)
_cocosScale = null; // cocos 自缩放 (较少用到)
initSize() {
// 注意cc.winSize只有在适配后(修改fitHeight/fitWidth后)才能获取到正确的值,因此使用cc.getFrameSize()来获取初始的屏幕大小
let screen_size = cc.view.getFrameSize().width / cc.view.getFrameSize().height
let design_size = cc.Canvas.instance.designResolution.width / cc.Canvas.instance.designResolution.height
let f = screen_size >= design_size
cc.Canvas.instance.fitHeight = f
cc.Canvas.instance.fitWidth = !f
const frameSize = cc.view.getFrameSize();
this._frameSize = frameSize;
this._designSize = cc.view.getDesignResolutionSize();
let sx = cc.winSize.width / frameSize.width;
let sy = cc.winSize.height / frameSize.height;
this._cocosScale = Math.min(sx, sy);
sx = frameSize.width / this._designSize.width;
sy = frameSize.height / this._designSize.height;
this._mapScaleMin = Math.min(sx, sy) * this._cocosScale;
this._mapScaleMax = Math.max(sx, sy) * this._cocosScale;
cc.director['_scene'].width = frameSize.width;
cc.director['_scene'].height = frameSize.height;
}
data = null;
// 生命周期 start
start() {
if (window && (<any>window).courseware && (<any>window).courseware.getData) {
(<any>window).courseware.getData((data) => {
this.log('data:' + data);
this.data = data || this.getDefaultData();
this.data = JSON.parse(JSON.stringify(this.data));
this.preloadItem();
})
} else {
this.data = this.getDefaultData();
this.preloadItem();
}
}
getDefaultData() {
return defaultData;
}
preloadItem() {
this.addPreloadImage();
this.addPreloadAudio();
this.addPreloadAnima();
this.preload();
}
addPreloadImage() {
}
addPreloadAudio() {
}
addPreloadAnima() {
}
preload() {
const preloadArr = this._imageResList.concat(this._audioResList).concat(this._animaResList);
cc.assetManager.preloadAny(preloadArr, null, null, async (err, data) => {
if (window && window["air"]) {
// window["air"].onCourseInScreen = (next) => {
// window["air"].isCourseInScreen = true;
// this.onLoadEnd();
// next();
// };
await this.onLoadEnd();
window["air"].hideAirClassLoading();
} else {
await this.onLoadEnd();
}
cc.debug.setDisplayStats(false);
});
}
log (str) {
const node = cc.find('middleLayer');
if(node){
node.getComponent('middleLayer').log(str);
}else{
console.log(str);
}
}
async onLoadEnd() {
}
// ------------------------------------------------
getSprNode(resName) {
const sf = cc.find('Canvas/res/img/' + resName).getComponent(cc.Sprite).spriteFrame;
const node = new cc.Node();
node.addComponent(cc.Sprite).spriteFrame = sf;
return node;
}
getSpriteFrimeByUrl(url, cb) {
cc.loader.load({ url }, (err, img) => {
const spriteFrame = new cc.SpriteFrame(img)
if (cb) {
cb(spriteFrame);
}
})
}
getSprNodeByUrl(url, cb) {
const node = new cc.Node();
const spr = node.addComponent(cc.Sprite);
this.getSpriteFrimeByUrl(url, (sf) => {
spr.spriteFrame = sf;
if (cb) {
cb(node);
}
})
}
playAudioByUrl(audio_url, cb = null) {
if (audio_url) {
cc.assetManager.loadRemote(audio_url, (err, audioClip) => {
const audioId = cc.audioEngine.play(audioClip, false, 0.8);
if (cb) {
cc.audioEngine.setFinishCallback(audioId, () => {
cb();
});
}
});
}else{
cb && cb();
}
}
}
\ No newline at end of file
export const defaultData = {
"pic_url": "http://staging-teach.cdn.ireadabc.com/ed94332a503c31e0908bd4c6923a2665.png",
"pic_url_2": "http://staging-teach.cdn.ireadabc.com/5fb60317ade0195d35ad8034d5370a7f.png",
"text": "This is a test label.",
"audio_url": "http://staging-teach.cdn.ireadabc.com/f47f1d7b5c160fe1c59500d180346240.mp3"
}
\ No newline at end of file
This diff is collapsed.
{
"ver": "2.3.5",
"uuid": "18d07592-51a9-421e-8972-0f67b68d29e1",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 144,
"height": 144,
"platformSettings": {},
"subMetas": {
"icon": {
"ver": "1.0.4",
"uuid": "6fbc30a8-3c49-44ae-8ba4-7f56f385b78a",
"rawTextureUuid": "18d07592-51a9-421e-8972-0f67b68d29e1",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": -0.5,
"trimX": 3,
"trimY": 2,
"width": 138,
"height": 141,
"rawWidth": 144,
"rawHeight": 144,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"__type__": "cc.AnimationClip",
"_name": "playAudioAni",
"_objFlags": 0,
"_native": "",
"_duration": 0.5166666666666667,
"sample": 60,
"speed": 0.5,
"wrapMode": 2,
"curveData": {
"comps": {
"cc.Sprite": {
"spriteFrame": [
{
"frame": 0,
"value": {
"__uuid__": "8a6d3781-dbab-4359-96dd-540a12324067"
}
},
{
"frame": 0.25,
"value": {
"__uuid__": "86460151-cc5a-4ee5-b295-0c2b2a59140d"
}
},
{
"frame": 0.5,
"value": {
"__uuid__": "5dc37f58-ae3c-4f55-8a7d-408fe4b430e3"
}
}
]
}
}
},
"events": []
}
\ No newline at end of file
{
"ver": "2.1.0",
"uuid": "3164c4ee-2187-4017-bcae-e74a0606adbb",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "c35bb2f6-f24a-4850-ae44-643f2fdc7541",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.2.9",
"uuid": "08943eff-5fc8-47e9-bf14-8f95396918a9",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
{ {
"ver": "1.2.9", "ver": "1.2.9",
"uuid": "0737ce42-24f0-45c6-8e1a-8bdab4f74ba3", "uuid": "72940611-edd8-42cc-b5e9-146b9cbfdc1d",
"asyncLoadAssets": false, "asyncLoadAssets": false,
"autoReleaseAssets": true, "autoReleaseAssets": true,
"subMetas": {} "subMetas": {}
......
...@@ -5,9 +5,7 @@ ...@@ -5,9 +5,7 @@
* LICENSE file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
cc.sys.capabilities["touches"] = true; !(function(global) {
!(function (global) {
"use strict"; "use strict";
var Op = Object.prototype; var Op = Object.prototype;
...@@ -80,9 +78,9 @@ cc.sys.capabilities["touches"] = true; ...@@ -80,9 +78,9 @@ cc.sys.capabilities["touches"] = true;
// .constructor.prototype properties for functions that return Generator // .constructor.prototype properties for functions that return Generator
// objects. For full spec compliance, you may wish to configure your // objects. For full spec compliance, you may wish to configure your
// minifier not to mangle the names of these two functions. // minifier not to mangle the names of these two functions.
function Generator() { } function Generator() {}
function GeneratorFunction() { } function GeneratorFunction() {}
function GeneratorFunctionPrototype() { } function GeneratorFunctionPrototype() {}
// This is a polyfill for %IteratorPrototype% for environments that // This is a polyfill for %IteratorPrototype% for environments that
// don't natively support it. // don't natively support it.
...@@ -111,14 +109,14 @@ cc.sys.capabilities["touches"] = true; ...@@ -111,14 +109,14 @@ cc.sys.capabilities["touches"] = true;
// Helper for defining the .next, .throw, and .return methods of the // Helper for defining the .next, .throw, and .return methods of the
// Iterator interface in terms of a single ._invoke method. // Iterator interface in terms of a single ._invoke method.
function defineIteratorMethods(prototype) { function defineIteratorMethods(prototype) {
["next", "throw", "return"].forEach(function (method) { ["next", "throw", "return"].forEach(function(method) {
prototype[method] = function (arg) { prototype[method] = function(arg) {
return this._invoke(method, arg); return this._invoke(method, arg);
}; };
}); });
} }
runtime.isGeneratorFunction = function (genFun) { runtime.isGeneratorFunction = function(genFun) {
var ctor = typeof genFun === "function" && genFun.constructor; var ctor = typeof genFun === "function" && genFun.constructor;
return ctor return ctor
? ctor === GeneratorFunction || ? ctor === GeneratorFunction ||
...@@ -128,7 +126,7 @@ cc.sys.capabilities["touches"] = true; ...@@ -128,7 +126,7 @@ cc.sys.capabilities["touches"] = true;
: false; : false;
}; };
runtime.mark = function (genFun) { runtime.mark = function(genFun) {
if (Object.setPrototypeOf) { if (Object.setPrototypeOf) {
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
} else { } else {
...@@ -145,7 +143,7 @@ cc.sys.capabilities["touches"] = true; ...@@ -145,7 +143,7 @@ cc.sys.capabilities["touches"] = true;
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
// `hasOwn.call(value, "__await")` to determine if the yielded value is // `hasOwn.call(value, "__await")` to determine if the yielded value is
// meant to be awaited. // meant to be awaited.
runtime.awrap = function (arg) { runtime.awrap = function(arg) {
return { __await: arg }; return { __await: arg };
}; };
...@@ -160,14 +158,14 @@ cc.sys.capabilities["touches"] = true; ...@@ -160,14 +158,14 @@ cc.sys.capabilities["touches"] = true;
if (value && if (value &&
typeof value === "object" && typeof value === "object" &&
hasOwn.call(value, "__await")) { hasOwn.call(value, "__await")) {
return Promise.resolve(value.__await).then(function (value) { return Promise.resolve(value.__await).then(function(value) {
invoke("next", value, resolve, reject); invoke("next", value, resolve, reject);
}, function (err) { }, function(err) {
invoke("throw", err, resolve, reject); invoke("throw", err, resolve, reject);
}); });
} }
return Promise.resolve(value).then(function (unwrapped) { return Promise.resolve(value).then(function(unwrapped) {
// When a yielded Promise is resolved, its final value becomes // When a yielded Promise is resolved, its final value becomes
// the .value of the Promise<{value,done}> result for the // the .value of the Promise<{value,done}> result for the
// current iteration. If the Promise is rejected, however, the // current iteration. If the Promise is rejected, however, the
...@@ -193,7 +191,7 @@ cc.sys.capabilities["touches"] = true; ...@@ -193,7 +191,7 @@ cc.sys.capabilities["touches"] = true;
function enqueue(method, arg) { function enqueue(method, arg) {
function callInvokeWithMethodAndArg() { function callInvokeWithMethodAndArg() {
return new Promise(function (resolve, reject) { return new Promise(function(resolve, reject) {
invoke(method, arg, resolve, reject); invoke(method, arg, resolve, reject);
}); });
} }
...@@ -233,14 +231,14 @@ cc.sys.capabilities["touches"] = true; ...@@ -233,14 +231,14 @@ cc.sys.capabilities["touches"] = true;
// Note that simple async functions are implemented on top of // Note that simple async functions are implemented on top of
// AsyncIterator objects; they just return a Promise for the value of // AsyncIterator objects; they just return a Promise for the value of
// the final result produced by the iterator. // the final result produced by the iterator.
runtime.async = function (innerFn, outerFn, self, tryLocsList) { runtime.async = function(innerFn, outerFn, self, tryLocsList) {
var iter = new AsyncIterator( var iter = new AsyncIterator(
wrap(innerFn, outerFn, self, tryLocsList) wrap(innerFn, outerFn, self, tryLocsList)
); );
return runtime.isGeneratorFunction(outerFn) return runtime.isGeneratorFunction(outerFn)
? iter // If outerFn is a generator, return the full iterator. ? iter // If outerFn is a generator, return the full iterator.
: iter.next().then(function (result) { : iter.next().then(function(result) {
return result.done ? result.value : iter.next(); return result.done ? result.value : iter.next();
}); });
}; };
...@@ -368,7 +366,7 @@ cc.sys.capabilities["touches"] = true; ...@@ -368,7 +366,7 @@ cc.sys.capabilities["touches"] = true;
var info = record.arg; var info = record.arg;
if (!info) { if (! info) {
context.method = "throw"; context.method = "throw";
context.arg = new TypeError("iterator result is not an object"); context.arg = new TypeError("iterator result is not an object");
context.delegate = null; context.delegate = null;
...@@ -416,11 +414,11 @@ cc.sys.capabilities["touches"] = true; ...@@ -416,11 +414,11 @@ cc.sys.capabilities["touches"] = true;
// iterator prototype chain incorrectly implement this, causing the Generator // iterator prototype chain incorrectly implement this, causing the Generator
// object to not be returned from this call. This ensures that doesn't happen. // object to not be returned from this call. This ensures that doesn't happen.
// See https://github.com/facebook/regenerator/issues/274 for more details. // See https://github.com/facebook/regenerator/issues/274 for more details.
Gp[iteratorSymbol] = function () { Gp[iteratorSymbol] = function() {
return this; return this;
}; };
Gp.toString = function () { Gp.toString = function() {
return "[object Generator]"; return "[object Generator]";
}; };
...@@ -455,7 +453,7 @@ cc.sys.capabilities["touches"] = true; ...@@ -455,7 +453,7 @@ cc.sys.capabilities["touches"] = true;
this.reset(true); this.reset(true);
} }
runtime.keys = function (object) { runtime.keys = function(object) {
var keys = []; var keys = [];
for (var key in object) { for (var key in object) {
keys.push(key); keys.push(key);
...@@ -525,7 +523,7 @@ cc.sys.capabilities["touches"] = true; ...@@ -525,7 +523,7 @@ cc.sys.capabilities["touches"] = true;
Context.prototype = { Context.prototype = {
constructor: Context, constructor: Context,
reset: function (skipTempReset) { reset: function(skipTempReset) {
this.prev = 0; this.prev = 0;
this.next = 0; this.next = 0;
// Resetting context._sent for legacy support of Babel's // Resetting context._sent for legacy support of Babel's
...@@ -551,7 +549,7 @@ cc.sys.capabilities["touches"] = true; ...@@ -551,7 +549,7 @@ cc.sys.capabilities["touches"] = true;
} }
}, },
stop: function () { stop: function() {
this.done = true; this.done = true;
var rootEntry = this.tryEntries[0]; var rootEntry = this.tryEntries[0];
...@@ -563,7 +561,7 @@ cc.sys.capabilities["touches"] = true; ...@@ -563,7 +561,7 @@ cc.sys.capabilities["touches"] = true;
return this.rval; return this.rval;
}, },
dispatchException: function (exception) { dispatchException: function(exception) {
if (this.done) { if (this.done) {
throw exception; throw exception;
} }
...@@ -581,7 +579,7 @@ cc.sys.capabilities["touches"] = true; ...@@ -581,7 +579,7 @@ cc.sys.capabilities["touches"] = true;
context.arg = undefined; context.arg = undefined;
} }
return !!caught; return !! caught;
} }
for (var i = this.tryEntries.length - 1; i >= 0; --i) { for (var i = this.tryEntries.length - 1; i >= 0; --i) {
...@@ -623,7 +621,7 @@ cc.sys.capabilities["touches"] = true; ...@@ -623,7 +621,7 @@ cc.sys.capabilities["touches"] = true;
} }
}, },
abrupt: function (type, arg) { abrupt: function(type, arg) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) { for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i]; var entry = this.tryEntries[i];
if (entry.tryLoc <= this.prev && if (entry.tryLoc <= this.prev &&
...@@ -657,7 +655,7 @@ cc.sys.capabilities["touches"] = true; ...@@ -657,7 +655,7 @@ cc.sys.capabilities["touches"] = true;
return this.complete(record); return this.complete(record);
}, },
complete: function (record, afterLoc) { complete: function(record, afterLoc) {
if (record.type === "throw") { if (record.type === "throw") {
throw record.arg; throw record.arg;
} }
...@@ -676,7 +674,7 @@ cc.sys.capabilities["touches"] = true; ...@@ -676,7 +674,7 @@ cc.sys.capabilities["touches"] = true;
return ContinueSentinel; return ContinueSentinel;
}, },
finish: function (finallyLoc) { finish: function(finallyLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) { for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i]; var entry = this.tryEntries[i];
if (entry.finallyLoc === finallyLoc) { if (entry.finallyLoc === finallyLoc) {
...@@ -687,7 +685,7 @@ cc.sys.capabilities["touches"] = true; ...@@ -687,7 +685,7 @@ cc.sys.capabilities["touches"] = true;
} }
}, },
"catch": function (tryLoc) { "catch": function(tryLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) { for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i]; var entry = this.tryEntries[i];
if (entry.tryLoc === tryLoc) { if (entry.tryLoc === tryLoc) {
...@@ -705,7 +703,7 @@ cc.sys.capabilities["touches"] = true; ...@@ -705,7 +703,7 @@ cc.sys.capabilities["touches"] = true;
throw new Error("illegal catch attempt"); throw new Error("illegal catch attempt");
}, },
delegateYield: function (iterable, resultName, nextLoc) { delegateYield: function(iterable, resultName, nextLoc) {
this.delegate = { this.delegate = {
iterator: values(iterable), iterator: values(iterable),
resultName: resultName, resultName: resultName,
...@@ -725,5 +723,5 @@ cc.sys.capabilities["touches"] = true; ...@@ -725,5 +723,5 @@ cc.sys.capabilities["touches"] = true;
// In sloppy mode, unbound `this` refers to the global object, fallback to // In sloppy mode, unbound `this` refers to the global object, fallback to
// Function constructor if we're in global strict mode. That is sadly a form // Function constructor if we're in global strict mode. That is sadly a form
// of indirect eval which violates Content Security Policy. // of indirect eval which violates Content Security Policy.
(function () { return this })() || Function("return this")() (function() { return this })() || Function("return this")()
); );
{ {
"ver": "1.0.8", "ver": "1.0.8",
"uuid": "b54300af-b8e5-4b4e-aa2f-9ac1cef7b598", "uuid": "834d2040-0939-4d6d-8865-09b1ab23481a",
"isPlugin": true, "isPlugin": true,
"loadPluginInWeb": true, "loadPluginInWeb": true,
"loadPluginInNative": true, "loadPluginInNative": true,
......
// Learn cc.Class:
// - https://docs.cocos.com/creator/manual/en/scripting/class.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
cc.Class({
extends: cc.Component,
properties: {
designWidth: {
default: 1280,
type: cc.Integer
},
designHeight: {
default: 720,
type: cc.Integer
},
relativeNode: {
default: null,
type: cc.Node,
tooltip: '设置相对节点'
},
relativeX: {
default: 0,
type: cc.Integer,
tooltip: '设置相对节点的X偏移量'
},
relativeY: {
default: 0,
type: cc.Integer,
tooltip: '设置相对节点的Y偏移量'
},
// foo: {
// // ATTRIBUTES:
// default: null, // The default value will be used only when the component attaching
// // to a node for the first time
// type: cc.SpriteFrame, // optional, default is typeof default
// serializable: true, // optional, default is true
// },
// bar: {
// get () {
// return this._bar;
// },
// set (value) {
// this._bar = value;
// }
// },
},
// LIFE-CYCLE CALLBACKS:
// onLoad () {},
start () {
cc.view._frameSize
cc.view._devicePixelRatio
window.aaa = this
this.setScale();
// this.setPosition();
},
setScale() {
const {width: designWidth, height: designHeight} = cc.view.getDesignResolutionSize()
if (!this.designWidth) {
this.designWidth = designWidth
}
if (!this.designHeight) {
this.designHeight = designHeight
}
let {width: viewWidth, height: wiewHeight} = cc.view.getFrameSize();
const ration = cc.view.getDevicePixelRatio();
viewWidth = viewWidth * ration;
wiewHeight = wiewHeight * ration;
const viewRatio = viewWidth / wiewHeight;
const designRatio = this.designWidth / this.designHeight;
let containerScale = 1;
if (designRatio > viewRatio) {
// base width
containerScale = viewWidth / this.designWidth;
console.log('base w', containerScale);
} else {
// base height
containerScale = wiewHeight / this.designHeight;
console.log('base h', containerScale);
}
// console.log(cc.winSize.width , viewWidth);
// let sx = cc.winSize.width / viewWidth;
// let sy = cc.winSize.height / wiewHeight;
// console.log(sx,sy);
let cocosScale = Math.min(cc.view._scaleX, cc.view._scaleY);
this.node.width = this.designWidth;
this.node.height = this.designHeight;
this.node.x = 0;
this.node.y = 0;
this.node.scale = containerScale / cocosScale;
},
setPosition() {
const canvas = cc.find('Canvas');
if (!this.relativeNode) {
this.relativeNode = this.node.parent
}
const worldPos = canvas.convertToWorldSpaceAR(cc.v2(this.relativeNode.x , this.relativeNode.y));
console.log(1, worldPos);
// const wx = this.relativeNode.width * (1 - this.relativeNode.anchorX) -
const wx = worldPos.x - this.relativeNode.width
// const wy = this.relativeNode.height * (this.relativeNode.anchorY - 1) + worldPos.y
const wy = worldPos.y - this.relativeNode.height
const nodePos = canvas.convertToWorldSpaceAR(cc.v2(this.node.x , this.node.y));
console.log(2, nodePos);
// const nx = this.node.width * (1 - this.node.anchorX) - nodePos.x
// const ny = this.node.height * (this.node.anchorY - 1) + nodePos.y
const nx = this.node.width * (1 - this.node.anchorX) - nodePos.x;
const ny = nodePos.y - this.node.height * (1 - this.node.anchorY) ;
// const relaX = worldPos.x - nodePos.x;
// const relaY = worldPos.y - nodePos.y;
const relaX = (wx - nx) * this.node.scale;
const relaY = (wy - ny) * this.node.scale;
this.node.x = relaX + this.relativeX;
this.node.y = relaY + this.relativeY;
}
// update (dt) {},
});
{ {
"ver": "1.0.8", "ver": "1.0.8",
"uuid": "f8b451ff-857c-4ca8-9870-866bc5154a29", "uuid": "14b5cc05-cb3a-4cf2-83c4-f0e9b048b57e",
"isPlugin": false, "isPlugin": false,
"loadPluginInWeb": true, "loadPluginInWeb": true,
"loadPluginInNative": true, "loadPluginInNative": true,
......
cc.Class({
extends: cc.Component,
properties: {
nodDoneBg:cc.Node,
},
// LIFE-CYCLE CALLBACKS:
onLoad () {
this.nodDoneBg.on('touchstart',this.onTouchStart,this)
},
onTouchStart () {
this.playAudio();
},
playAudio(){
let url = GameData.scene.data.questionList[GameData.questionIndex].audio;
cc.assetManager.loadRemote(url, null, (err, clip) => {
if (err) {
console.log(err)
return;
}
if (this.audioId) {
cc.audioEngine.stop(this.audioId);
this.audioId = null;
}
this.audioId = cc.audioEngine.play(clip, false, 1);
cc.audioEngine.setFinishCallback(id, () => {
this.audioId = null;
})
});
},
// update (dt) {},
});
{ {
"ver": "1.0.8", "ver": "1.0.8",
"uuid": "c41b0e51-55d7-443c-af3a-b22c3dd9b9e5", "uuid": "dec87788-182f-4414-a2b6-02a34000a22a",
"isPlugin": false, "isPlugin": false,
"loadPluginInWeb": true, "loadPluginInWeb": true,
"loadPluginInNative": true, "loadPluginInNative": true,
......
const { showFireworks } = require("./ym_demo_fk_utils");
cc.Class({
extends: cc.Component,
properties: {
audOver: cc.AudioClip,
},
// LIFE-CYCLE CALLBACKS:
onLoad() {
this.node.getChildByName('bg_verygood').zIndex = 99;
},
start() {
showFireworks(
this.node,
this.node.getChildByName('RibbonNodeBase').children,
cc.v2(0, -400), cc.v2(0, 1000), 200, 200
);
showFireworks(
this.node,
this.node.getChildByName('RibbonNodeBase').children,
cc.v2(-600, -400), cc.v2(200, 1000), 200, 200
);
showFireworks(
this.node,
this.node.getChildByName('RibbonNodeBase').children,
cc.v2(600, -400), cc.v2(-200, 1000), 200, 200
);
this.playAudioOver();
},
playAudioOver() {
GameData.audioCount++;
let id = cc.audioEngine.play(this.audOver, false, 0.7);
cc.audioEngine.setFinishCallback(id, () => {
GameData.audioCount--;
})
},
// update (dt) {},
});
{ {
"ver": "1.0.8", "ver": "1.0.8",
"uuid": "408a67f8-65fa-4cf1-8cf2-83e20e1a0fd5", "uuid": "e9bcac61-d23c-4412-9e7e-eb65c6175d2d",
"isPlugin": false, "isPlugin": false,
"loadPluginInWeb": true, "loadPluginInWeb": true,
"loadPluginInNative": true, "loadPluginInNative": true,
......
const FitType = {
Scale: 0,//等比缩放,一般用于背景图
FullScreen: 1,//铺满全屏,拉伸
FitMode: 2,//更改canvas适配策略,只能挂在canvas上
FullHeight: 3,
FullWidth: 4,
};
const designSize = cc.size(1280, 720);
cc.Class({
extends: cc.Component,
properties: {
FitType: {
type: cc.Enum(FitType),
default: 0
},
},
onLoad: function () {
cc.view.on('canvas-resize', this.refreshFit, this)
this.refreshFit();
},
onDestroy(){
cc.view.off('canvas-resize', this.refreshFit, this)
},
refreshFit() {
if (this.FitType == FitType.Scale) {
let winSize = cc.view.getVisibleSize();
console.log(winSize)
console.log(this.node.width,this.node.height)
if(this.node.width >= winSize.width && this.node.height >= winSize.height ){
return;
}
let scale1 = winSize.width / this.node.width;
let scale2 = winSize.height / this.node.height;
if (scale1 > scale2) {
this.node.scale = scale1;
} else {
this.node.scale = scale2;
}
} else if (this.FitType == FitType.FullScreen) {
let visiblesize = cc.view.getVisibleSize();
this.node.width = visiblesize.width;
this.node.height = visiblesize.height;
} else if (this.FitType == FitType.FullHeight) {
let visiblesize = cc.view.getVisibleSize();
let scale = visiblesize.width / this.node.width;
this.node.width = scale * this.node.width;
this.node.height = scale * this.node.height;
} else if (this.FitType == FitType.FullWidth) {
let visiblesize = cc.view.getVisibleSize();
let scale = visiblesize.height / this.node.height;
this.node.width = scale * this.node.width;
this.node.height = scale * this.node.height;
} else {
let wsize = cc.view.getFrameSize();
let scaleW = wsize.width / designSize.width;
let scaleH = wsize.height / designSize.height;
let pCanvas = this.node.getComponent(cc.Canvas);
if (pCanvas) {
if (scaleW > scaleH) { //更宽了要fitHeight, 否则height就留黑边了;
pCanvas.fitHeight = true;
pCanvas.fitWidth = false;
} else { //更高;
pCanvas.fitHeight = false;
pCanvas.fitWidth = true;
}
} else {
console.error("fitmode模式只能用在canvas节点上");
}
}
},
});
{
"ver": "1.0.8",
"uuid": "cc3ca595-cdd6-45ee-a3b2-abc0c8867a84",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
// Learn cc.Class:
// - https://docs.cocos.com/creator/manual/en/scripting/class.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
const ImageMode = cc.Enum({
NONE: 1,
FILL: 2,
CONTAIN: 3,
COVER: 4
});
cc.Class({
extends: cc.Component,
properties: {
image: {
default: null,
type: cc.Sprite
},
displayMode: {
default: ImageMode.NONE,
type: ImageMode
},
offsetX: {
default: 0,
type: cc.Integer,
},
offsetY: {
default: 0,
type: cc.Integer,
},
// foo: {
// // ATTRIBUTES:
// default: null, // The default value will be used only when the component attaching
// // to a node for the first time
// type: cc.SpriteFrame, // optional, default is typeof default
// serializable: true, // optional, default is true
// },
// bar: {
// get () {
// return this._bar;
// },
// set (value) {
// this._bar = value;
// }
// },
},
// LIFE-CYCLE CALLBACKS:
// onLoad () {},
start () {
if (!this.image) {
this.image = this.node.getComponent(cc.Sprite)
}
if (!this.image) {
return;
}
if (this.displayMode === ImageMode.FILL) {
this.node.width = this.node.parent.width;
this.node.height = this.node.parent.height;
}
if (this.displayMode === ImageMode.CONTAIN) {
const scale = this.calcMinScale();
this.node.x += this.offsetX;
this.node.y += this.offsetY;
this.node.scale = scale;
}
if (this.displayMode === ImageMode.COVER) {
const scale = this.calcMaxScale();
this.node.x += this.offsetX;
this.node.y += this.offsetY;
this.node.scale = scale;
}
},
calcMinScale() {
const {width: designWidth, height: designHeight} = this.node;
const {width: viewWidth, height: wiewHeight} = this.node.parent;
const viewRatio = viewWidth / wiewHeight;
const designRatio = designWidth / designHeight;
let containerScale = 1;
if (designRatio > viewRatio) {
// base width
containerScale = viewWidth / designWidth;
console.log('base w', containerScale);
} else {
// base height
containerScale = wiewHeight / designHeight;
console.log('base h', containerScale);
}
this.node.width = designWidth;
this.node.height = designHeight;
return containerScale
},
calcMaxScale() {
const {width: designWidth, height: designHeight} = this.node;
const {width: viewWidth, height: wiewHeight} = this.node.parent;
const viewRatio = viewWidth / wiewHeight;
const designRatio = designWidth / designHeight;
let containerScale = 1;
if (designRatio > viewRatio) {
containerScale = wiewHeight / designHeight;
console.log('base h', containerScale);
} else {
containerScale = viewWidth / designWidth;
console.log('base w', containerScale);
}
this.node.width = designWidth;
this.node.height = designHeight;
return containerScale
}
// update (dt) {},
});
{
"ver": "1.0.8",
"uuid": "b2354193-668a-46e2-8686-678d3f6da3cd",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
{
"ver": "1.0.8",
"uuid": "cb6f4310-8b84-4d78-a315-f7acc9b00373",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
export function getPosByAngle(angle, len) {
const radian = angle * Math.PI / 180;
const x = Math.sin(radian) * len;
const y = Math.cos(radian) * len;
return { x, y };
}
export function getAngleByPos(px, py, mx, my) {
const x = Math.abs(px - mx);
const y = Math.abs(py - my);
const z = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
const cos = y / z;
const radina = Math.acos(cos); // 用反三角函数求弧度
let angle = Math.floor(180 / (Math.PI / radina) * 100) / 100; // 将弧度转换成角度
if (mx > px && my > py) {// 鼠标在第四象限
angle = 180 - angle;
}
if (mx === px && my > py) {// 鼠标在y轴负方向上
angle = 180;
}
if (mx > px && my === py) {// 鼠标在x轴正方向上
angle = 90;
}
if (mx < px && my > py) {// 鼠标在第三象限
angle = 180 + angle;
}
if (mx < px && my === py) {// 鼠标在x轴负方向
angle = 270;
}
if (mx < px && my < py) {// 鼠标在第二象限
angle = 360 - angle;
}
// console.log('angle: ', angle);
return angle;
}
export function exchangeNodePos(baseNode, targetNode) {
return baseNode.convertToNodeSpaceAR(targetNode._parent.convertToWorldSpaceAR(cc.v2(targetNode.x, targetNode.y)));
}
export function RandomInt(a, b = 0) {
let max = Math.max(a, b);
let min = Math.min(a, b);
return Math.floor(Math.random() * (max - min) + min);
}
export function randomSortByArr(arr) {
const newArr = [];
const tmpArr = arr.concat();
while (tmpArr.length > 0) {
const randomIndex = Math.floor(tmpArr.length * Math.random());
newArr.push(tmpArr[randomIndex]);
tmpArr.splice(randomIndex, 1);
}
return newArr;
}
export function setSprNodeMaxLen(sprNode, maxW, maxH) {
const sx = maxW / sprNode.width;
const sy = maxH / sprNode.height;
const s = Math.min(sx, sy);
sprNode.scale = Math.round(s * 1000) / 1000;
}
export function localPosTolocalPos(baseNode, targetNode) {
const worldPos = targetNode.parent.convertToWorldSpaceAR(cc.v2(targetNode.x, targetNode.y));
const localPos = baseNode.parent.convertToNodeSpaceAR(cc.v2(worldPos.x, worldPos.y));
return localPos;
}
export function worldPosToLocalPos(worldPos, baseNode) {
const localPos = baseNode.parent.convertToNodeSpaceAR(cc.v2(worldPos.x, worldPos.y));
return localPos;
}
export function getScaleRateBy2Node(baseNode, targetNode, maxFlag = true) {
const worldRect1 = targetNode.getBoundingBoxToWorld();
const worldRect2 = baseNode.getBoundingBoxToWorld();
const sx = worldRect1.width / worldRect2.width;
const sy = worldRect1.height / worldRect2.height;
if (maxFlag) {
return Math.max(sx, sy);
} else {
return Math.min(sx, sy);
}
}
export function getDistance (start, end){
var pos = cc.v2(start.x - end.x, start.y - end.y);
var dis = Math.sqrt(pos.x*pos.x + pos.y*pos.y);
return dis;
}
export function playAudioByUrl(audio_url, cb=null) {
if (audio_url) {
cc.assetManager.loadRemote(audio_url, (err, audioClip) => {
const audioId = cc.audioEngine.play(audioClip, false, 0.8);
if (cb) {
cc.audioEngine.setFinishCallback(audioId, () => {
cb();
});
}
});
}
}
export function btnClickAnima(btn, time=0.15, rate=1.05) {
btn.tmpScale = btn.scale;
btn.on(cc.Node.EventType.TOUCH_START, () => {
cc.tween(btn)
.to(time / 2, {scale: btn.scale * rate})
.start()
})
btn.on(cc.Node.EventType.TOUCH_CANCEL, () => {
cc.tween(btn)
.to(time / 2, {scale: btn.tmpScale})
.start()
})
btn.on(cc.Node.EventType.TOUCH_END, () => {
cc.tween(btn)
.to(time / 2, {scale: btn.tmpScale})
.start()
})
}
\ No newline at end of file
export function getPosByAngle(angle, len) {
const radian = angle * Math.PI / 180;
const x = Math.sin(radian) * len;
const y = Math.cos(radian) * len;
return { x, y };
}
export function getAngleByPos(px, py, mx, my) {
const x = Math.abs(px - mx);
const y = Math.abs(py - my);
const z = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
const cos = y / z;
const radina = Math.acos(cos); // 用反三角函数求弧度
let angle = Math.floor(180 / (Math.PI / radina) * 100) / 100; // 将弧度转换成角度
if (mx > px && my > py) {// 鼠标在第四象限
angle = 180 - angle;
}
if (mx === px && my > py) {// 鼠标在y轴负方向上
angle = 180;
}
if (mx > px && my === py) {// 鼠标在x轴正方向上
angle = 90;
}
if (mx < px && my > py) {// 鼠标在第三象限
angle = 180 + angle;
}
if (mx < px && my === py) {// 鼠标在x轴负方向
angle = 270;
}
if (mx < px && my < py) {// 鼠标在第二象限
angle = 360 - angle;
}
// console.log('angle: ', angle);
return angle;
}
export function exchangeNodePos(baseNode, targetNode) {
return baseNode.convertToNodeSpaceAR(targetNode._parent.convertToWorldSpaceAR(cc.v2(targetNode.x, targetNode.y)));
}
export function RandomInt(a, b = 0) {
let max = Math.max(a, b);
let min = Math.min(a, b);
return Math.floor(Math.random() * (max - min) + min);
}
export function Between(a, b, c) {
return [a, b, c].sort((a, b) => a - b)[1];
}
export function randomSortByArr(arr) {
const newArr = [];
const tmpArr = arr.concat();
while (tmpArr.length > 0) {
const randomIndex = Math.floor(tmpArr.length * Math.random());
newArr.push(tmpArr[randomIndex]);
tmpArr.splice(randomIndex, 1);
}
return newArr;
}
export async function asyncTweenTo(node, duration, obj, ease = undefined) {
return new Promise((resolve, reject) => {
cc.tween(node)
.to(duration, obj, ease)
.call(() => {
resolve();
})
.start();
});
}
export async function asyncTweenBy(node, duration, obj, ease = undefined) {
return new Promise((resolve, reject) => {
cc.tween(node)
.by(duration, obj, ease)
.call(() => {
resolve();
})
.start();
});
}
export async function asyncPlayDragonBoneAnimation(node, animationName, time = 1, onFrameEvent) {
return new Promise((resolve, reject) => {
node.getComponent(dragonBones.ArmatureDisplay)
.once(dragonBones.EventObject.COMPLETE, () => {
resolve();
});
node.getComponent(dragonBones.ArmatureDisplay)
.on(dragonBones.EventObject.FRAME_EVENT, ({ name }) => {
if (onFrameEvent && typeof (onFrameEvent) == 'function') {
onFrameEvent(name);
}
});
node.getComponent(dragonBones.ArmatureDisplay)
.playAnimation(animationName, time);
});
}
export async function asyncPlayEffectByUrl(url, loop = false) {
return new Promise((resolve, reject) => {
cc.assetManager.loadRemote(url, (err, clip) => {
console.log(clip);
cc.audioEngine.playEffect(clip, loop);
resolve();
});
});
}
export async function jelly(node) {
return new Promise((resolve, reject) => {
cc.tween(node)
.to(0.1, { scaleX: 0.9, scaleY: 1.1 })
.to(0.1, { scaleX: 1.1, scaleY: 0.9 })
.to(0.1, { scaleX: 1, scaleY: 1 })
.call(resolve)
.start();
});
}
export async function asyncDelay(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve();
}, time * 1000);
})
}
export async function showFireworks(baseNode, nodeList, pos = cc.v2(0, 0), side = cc.v2(0, 100), range = 50, number = 100) {
new Array(number).fill(' ').forEach(async (_, i) => {
let rabbonNode = new cc.Node();
rabbonNode.parent = baseNode;
rabbonNode.x = pos.x;
rabbonNode.y = pos.y;
rabbonNode.angle = 60 * Math.random() - 30;
let node = cc.instantiate(nodeList[RandomInt(nodeList.length)]);
node.parent = rabbonNode;
node.active = true;
node.x = 0;
node.y = 0;
node.angle = 0;
const rate = Math.random();
const angle = Math.PI * (Math.random() * 2 - 1);
await asyncTweenBy(rabbonNode, 0.3, {
x: side.x * rate + Math.cos(angle) * range * rate,
y: side.y * rate + Math.sin(angle) * range * rate
}, {
easing: 'quadIn'
});
cc.tween(rabbonNode)
.by(8, { y: -2000 })
.start();
rabbonFall(rabbonNode);
await asyncDelay(Math.random());
cc.tween(node)
.by(0.15, { x: -10, angle: -10 })
.by(0.3, { x: 20, angle: 20 })
.by(0.15, { x: -10, angle: -10 })
.union()
.repeatForever()
.start();
cc.tween(rabbonNode)
.delay(5)
.to(0.3, { opacity: 0 })
.call(() => {
node.stopAllActions();
node.active = false;
node.parent = null;
node = null;
})
.start();
});
}
async function rabbonFall(node) {
const time = 1 + Math.random();
const offsetX = RandomInt(-200, 200) * time;
await asyncTweenBy(node, time, { x: offsetX, angle: offsetX * 60 / 200 });
rabbonFall(node);
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "d545f402-231b-417e-99e6-3269412a5a2c",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "9a79969a-0506-48d4-bc98-3c05d109b027", "uuid": "c223058f-4559-4058-969e-10c5a8e124da",
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": false,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 61, "width": 120,
"height": 67, "height": 175,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"btn_left": { "4": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "ce19457d-e8f3-4c38-ae3e-d4b99208ddb5", "uuid": "6b6abc4b-b76f-4a73-ae50-b9ea8c255f3e",
"rawTextureUuid": "9a79969a-0506-48d4-bc98-3c05d109b027", "rawTextureUuid": "c223058f-4559-4058-969e-10c5a8e124da",
"trimType": "auto", "trimType": "auto",
"trimThreshold": 1, "trimThreshold": 1,
"rotated": false, "rotated": false,
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
"offsetY": 0, "offsetY": 0,
"trimX": 0, "trimX": 0,
"trimY": 0, "trimY": 0,
"width": 61, "width": 120,
"height": 67, "height": 175,
"rawWidth": 61, "rawWidth": 120,
"rawHeight": 67, "rawHeight": 175,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
{
"ver": "1.1.0",
"uuid": "297f7509-d6c0-4623-bc9b-a20914fb8806",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "8f6f10ec-689a-4666-ae07-1fc41db8ca28",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "843b086f-37a0-4942-be22-456fdf6ed58d",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "443de203-a840-4728-a77c-aa23f4bdad82",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "35d50ca8-f711-4322-a55b-0e027690b4ec",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "aa5b426e-3b93-4e31-b27f-bbe5ce50bcb9",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "90ea68e6-f414-45e8-92af-5f4353f9449a",
"subMetas": {}
}
\ No newline at end of file
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "efa5fa09-a4dd-4bfc-ab7e-17c19f85408f", "uuid": "fb849b6d-7986-427d-8dde-c24543d95c99",
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": false,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 366, "width": 36,
"height": 336, "height": 24,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"1orange": { "bg_sahua": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "43d1e79d-6de8-4dcb-b8ce-d767df7913aa", "uuid": "daa5918d-8f28-437e-8649-929bb253d40c",
"rawTextureUuid": "efa5fa09-a4dd-4bfc-ab7e-17c19f85408f", "rawTextureUuid": "fb849b6d-7986-427d-8dde-c24543d95c99",
"trimType": "auto", "trimType": "auto",
"trimThreshold": 1, "trimThreshold": 1,
"rotated": false, "rotated": false,
"offsetX": 0, "offsetX": 0,
"offsetY": -0.5, "offsetY": 0,
"trimX": 0, "trimX": 0,
"trimY": 1, "trimY": 0,
"width": 366, "width": 36,
"height": 335, "height": 24,
"rawWidth": 366, "rawWidth": 36,
"rawHeight": 336, "rawHeight": 24,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
{
"ver": "2.0.1",
"uuid": "707c835f-a801-4e7a-a91e-b1b420cd122a",
"downloadMode": 0,
"duration": 0.412,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "45617302-a220-499d-ad67-4bb0a9c243c9",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1280,
"height": 102,
"platformSettings": {},
"subMetas": {
"group-8": {
"ver": "1.0.4",
"uuid": "bedb3f82-62e2-45b7-9270-dea073a4d32d",
"rawTextureUuid": "45617302-a220-499d-ad67-4bb0a9c243c9",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 1280,
"height": 102,
"rawWidth": 1280,
"rawHeight": 102,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "7c4ae2c4-0ffb-40d6-b479-689743218c19",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 260,
"height": 270,
"platformSettings": {},
"subMetas": {
"group_copy_2": {
"ver": "1.0.4",
"uuid": "3a14d55e-f8ae-4a8d-b984-eb1728551502",
"rawTextureUuid": "7c4ae2c4-0ffb-40d6-b479-689743218c19",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 260,
"height": 270,
"rawWidth": 260,
"rawHeight": 270,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "14aaffc4-c688-46b6-8f11-c48e676b1580",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 500,
"height": 107,
"platformSettings": {},
"subMetas": {
"invalid_name": {
"ver": "1.0.4",
"uuid": "7e6c30c3-f574-481f-82ae-b37ca91599eb",
"rawTextureUuid": "14aaffc4-c688-46b6-8f11-c48e676b1580",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 500,
"height": 107,
"rawWidth": 500,
"rawHeight": 107,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "d582359e-924e-4ee9-9964-1fc4bb417e71", "uuid": "1a8eab0e-76c9-47a2-9dd8-c8eccff2833c",
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": false,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 61, "width": 220,
"height": 67, "height": 220,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"btn_right": { "oval": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "e5a2dbaa-a677-4a32-90d7-a1b057d7fb59", "uuid": "04f666a2-2416-4edb-a67f-7a4937d79926",
"rawTextureUuid": "d582359e-924e-4ee9-9964-1fc4bb417e71", "rawTextureUuid": "1a8eab0e-76c9-47a2-9dd8-c8eccff2833c",
"trimType": "auto", "trimType": "auto",
"trimThreshold": 1, "trimThreshold": 1,
"rotated": false, "rotated": false,
"offsetX": -0.5, "offsetX": 0,
"offsetY": 0.5, "offsetY": 0,
"trimX": 0, "trimX": 0,
"trimY": 0, "trimY": 0,
"width": 60, "width": 220,
"height": 66, "height": 220,
"rawWidth": 61, "rawWidth": 220,
"rawHeight": 67, "rawHeight": 220,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
{
"ver": "2.3.5",
"uuid": "14e8905b-6532-4866-870d-688c77a02b42",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1280,
"height": 720,
"platformSettings": {},
"subMetas": {
"page_1": {
"ver": "1.0.4",
"uuid": "2ff4e31e-6762-4b12-a8ef-4474ea6cd186",
"rawTextureUuid": "14e8905b-6532-4866-870d-688c77a02b42",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 1280,
"height": 720,
"rawWidth": 1280,
"rawHeight": 720,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "5023fe52-8613-4b2e-bbc0-4c4dffc18f27",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 74,
"height": 82,
"platformSettings": {},
"subMetas": {
"play1": {
"ver": "1.0.4",
"uuid": "8a6d3781-dbab-4359-96dd-540a12324067",
"rawTextureUuid": "5023fe52-8613-4b2e-bbc0-4c4dffc18f27",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 74,
"height": 82,
"rawWidth": 74,
"rawHeight": 82,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "2148a8a9-dd36-4ef1-83c9-9feb52cc97ba",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 74,
"height": 82,
"platformSettings": {},
"subMetas": {
"play2": {
"ver": "1.0.4",
"uuid": "86460151-cc5a-4ee5-b295-0c2b2a59140d",
"rawTextureUuid": "2148a8a9-dd36-4ef1-83c9-9feb52cc97ba",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 74,
"height": 82,
"rawWidth": 74,
"rawHeight": 82,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "dcca9ec5-b448-4639-978c-b0f0c39a06fc",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 74,
"height": 82,
"platformSettings": {},
"subMetas": {
"play3": {
"ver": "1.0.4",
"uuid": "5dc37f58-ae3c-4f55-8a7d-408fe4b430e3",
"rawTextureUuid": "dcca9ec5-b448-4639-978c-b0f0c39a06fc",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 74,
"height": 82,
"rawWidth": 74,
"rawHeight": 82,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "8a2f4243-c1d9-4fe9-8f32-0a6fa9b33e5d",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "a72a0638-da92-4d6f-93cd-c2dea29ef042",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "c53c63be-97d4-4940-ac24-b935b3d8f9a8",
"downloadMode": 0,
"duration": 0.130612,
"subMetas": {}
}
\ No newline at end of file
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "e1b4d971-9876-4832-803a-5a321964a78b", "uuid": "35c50c90-1332-4383-bc6b-8591e9a7439d",
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
...@@ -11,10 +11,10 @@ ...@@ -11,10 +11,10 @@
"height": 720, "height": 720,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"bg": { "bg_bg": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "8288e3d4-4c75-4b27-8f01-f7014417f4dd", "uuid": "8d379215-381e-42b0-9f01-ae6c28b808ee",
"rawTextureUuid": "e1b4d971-9876-4832-803a-5a321964a78b", "rawTextureUuid": "35c50c90-1332-4383-bc6b-8591e9a7439d",
"trimType": "auto", "trimType": "auto",
"trimThreshold": 1, "trimThreshold": 1,
"rotated": false, "rotated": false,
......
{
"ver": "2.3.5",
"uuid": "ab68e69c-8b85-4630-824a-9d655e2a020d",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 240,
"height": 245,
"platformSettings": {},
"subMetas": {
"bg_card": {
"ver": "1.0.4",
"uuid": "28377c70-74ac-4360-9c6a-de8edf79cd6e",
"rawTextureUuid": "ab68e69c-8b85-4630-824a-9d655e2a020d",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 240,
"height": 245,
"rawWidth": 240,
"rawHeight": 245,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "34500df0-1d81-479f-9c5d-ae73b7bc88fa",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 240,
"height": 245,
"platformSettings": {},
"subMetas": {
"bg_card2": {
"ver": "1.0.4",
"uuid": "7fb8c745-f736-4b35-bd08-901938291e37",
"rawTextureUuid": "34500df0-1d81-479f-9c5d-ae73b7bc88fa",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 240,
"height": 245,
"rawWidth": 240,
"rawHeight": 245,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "39278e3e-c0bd-4e63-9322-1b2d790568be",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 550,
"height": 109,
"platformSettings": {},
"subMetas": {
"bg_title": {
"ver": "1.0.4",
"uuid": "32c16d32-5dd0-478a-830d-194cad1fd83e",
"rawTextureUuid": "39278e3e-c0bd-4e63-9322-1b2d790568be",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 550,
"height": 109,
"rawWidth": 550,
"rawHeight": 109,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "8061e870-7d27-40f4-a6f6-d56231c37259",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 316,
"height": 114,
"platformSettings": {},
"subMetas": {
"btn_restart": {
"ver": "1.0.4",
"uuid": "4e7b22c8-ae52-435c-ba01-c9db4c87b217",
"rawTextureUuid": "8061e870-7d27-40f4-a6f6-d56231c37259",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 316,
"height": 114,
"rawWidth": 316,
"rawHeight": 114,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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