Commit d6336a41 authored by Li MingZhe's avatar Li MingZhe

feat: 首次提交

parent cb1367da
No preview for this file type
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
<div style="padding: 10px;"> <div style="padding: 10px;">
<h2> 此模版无需表单配置 </h2>
<!--
<div style="width: 300px;" align='center'> <div style="width: 300px;" align='center'>
<span>图1: </span> <span>图1: </span>
<app-upload-image-with-preview <app-upload-image-with-preview
...@@ -29,7 +31,7 @@ ...@@ -29,7 +31,7 @@
[audioUrl]="item.audio_url" [audioUrl]="item.audio_url"
(audioUploaded)="onAudioUploadSuccess($event, 'audio_url')" (audioUploaded)="onAudioUploadSuccess($event, 'audio_url')"
></app-audio-recorder> ></app-audio-recorder>
</div> </div> -->
</div> </div>
......
This diff is collapsed.
{ {
"ver": "1.1.2", "ver": "1.1.2",
"uuid": "cb9fa4ea-66ca-45af-ad31-e445c7b0ef32", "uuid": "09dcf263-fd77-4a8e-babe-7b886b8fc360",
"isBundle": false, "isBundle": false,
"bundleName": "", "bundleName": "",
"priority": 1, "priority": 1,
......
{ {
"ver": "1.1.2", "ver": "1.1.2",
"uuid": "20185448-a1ca-4de2-8b37-7bf6cdfccbae", "uuid": "9e5d8a4b-66e7-47fb-8946-eac98db3384a",
"isBundle": false, "isBundle": false,
"bundleName": "", "bundleName": "",
"priority": 1, "priority": 1,
......
{ {
"ver": "1.1.2", "ver": "1.1.2",
"uuid": "0853721c-3f55-4eb2-873d-e3081cfadd4b", "uuid": "03aad558-84ee-4d5d-9eb6-5be4749cd0ea",
"isBundle": false, "isBundle": false,
"bundleName": "", "bundleName": "",
"priority": 1, "priority": 1,
......
{"name":"magic","version":"5.5","frameRate":24,"armature":[{"name":"Armature","animation":[{"name":"appear","frame":[],"ik":[],"duration":24,"slot":[{"name":"外圈","displayFrame":[],"colorFrame":[{"tweenEasing":0,"duration":4,"color":{"aM":0}},{"tweenEasing":0,"duration":12,"color":{"aM":0}},{"tweenEasing":0,"duration":4,"color":{"aM":52}},{"duration":4}]},{"name":"星2","displayFrame":[],"colorFrame":[{"tweenEasing":0,"duration":14,"color":{"aM":0}},{"tweenEasing":0,"duration":4,"color":{"aM":62}},{"duration":6}]},{"name":"三角","displayFrame":[],"colorFrame":[{"tweenEasing":0,"duration":18,"color":{"aM":0}},{"duration":6}]},{"name":"星1","displayFrame":[],"colorFrame":[{"tweenEasing":0,"duration":18,"color":{"aM":0}},{"duration":6}]},{"name":"中间","displayFrame":[],"colorFrame":[{"tweenEasing":0,"duration":12,"color":{"aM":0}},{"duration":12}]}],"bone":[{"name":"root","rotateFrame":[],"scaleFrame":[],"translateFrame":[]},{"name":"中间","rotateFrame":[],"scaleFrame":[{"duration":6,"tweenEasing":0},{"duration":6,"x":1.3,"tweenEasing":0,"y":1.3},{"duration":12},{"duration":0}],"translateFrame":[]},{"name":"星1","rotateFrame":[],"scaleFrame":[{"duration":14,"x":0.5,"tweenEasing":0,"y":0.5},{"duration":4,"x":1.2,"tweenEasing":0,"y":1.2},{"duration":6},{"duration":0}],"translateFrame":[]},{"name":"三角","rotateFrame":[],"scaleFrame":[{"duration":24},{"duration":0}],"translateFrame":[]},{"name":"星2","rotateFrame":[],"scaleFrame":[{"duration":14,"x":0.5,"tweenEasing":0,"y":0.5},{"duration":4,"x":1.2,"tweenEasing":0,"y":1.2},{"duration":6},{"duration":0}],"translateFrame":[]},{"name":"外圈","rotateFrame":[],"scaleFrame":[{"duration":4,"x":0.55,"tweenEasing":0,"y":0.55},{"duration":12,"x":0.55,"tweenEasing":0,"y":0.55},{"duration":4,"x":1.2,"tweenEasing":0,"y":1.2},{"duration":4},{"duration":0}],"translateFrame":[]}],"playTimes":0,"ffd":[]},{"name":"spinturn","frame":[],"ik":[],"duration":54,"slot":[{"name":"外圈","displayFrame":[],"colorFrame":[]},{"name":"星2","displayFrame":[],"colorFrame":[]},{"name":"三角","displayFrame":[],"colorFrame":[]},{"name":"星1","displayFrame":[],"colorFrame":[]},{"name":"中间","displayFrame":[],"colorFrame":[]}],"bone":[{"name":"root","rotateFrame":[],"scaleFrame":[],"translateFrame":[]},{"name":"中间","rotateFrame":[{"clockwise":-2,"duration":54,"tweenEasing":0},{"duration":0}],"scaleFrame":[],"translateFrame":[]},{"name":"星1","rotateFrame":[{"clockwise":-2,"duration":54,"tweenEasing":0},{"duration":0}],"scaleFrame":[],"translateFrame":[]},{"name":"三角","rotateFrame":[{"clockwise":-2,"duration":54,"tweenEasing":0},{"duration":0}],"scaleFrame":[],"translateFrame":[]},{"name":"星2","rotateFrame":[{"clockwise":2,"duration":54,"tweenEasing":0},{"duration":0}],"scaleFrame":[],"translateFrame":[]},{"name":"外圈","rotateFrame":[{"clockwise":2,"duration":54,"tweenEasing":0},{"duration":0}],"scaleFrame":[],"translateFrame":[]}],"playTimes":0,"ffd":[]}],"frameRate":24,"ik":[],"skin":[{"name":"","slot":[{"name":"星2","display":[{"name":"魔法阵/星2","transform":{},"type":"image","path":"魔法阵/星2"}]},{"name":"中间","display":[{"name":"魔法阵/中间","transform":{},"type":"image","path":"魔法阵/中间"}]},{"name":"外圈","display":[{"name":"魔法阵/外圈","transform":{},"type":"image","path":"魔法阵/外圈"}]},{"name":"星1","display":[{"name":"魔法阵/星1","transform":{},"type":"image","path":"魔法阵/星1"}]},{"name":"三角","display":[{"name":"魔法阵/三角","transform":{},"type":"image","path":"魔法阵/三角"}]}]}],"slot":[{"name":"外圈","color":{},"parent":"外圈"},{"name":"星2","color":{},"z":1,"parent":"星2"},{"name":"三角","color":{},"z":2,"parent":"三角"},{"name":"星1","color":{},"z":3,"parent":"星1"},{"name":"中间","color":{},"z":4,"parent":"中间"}],"defaultActions":[{"gotoAndPlay":"appear"}],"bone":[{"name":"root","transform":{}},{"name":"中间","transform":{},"parent":"root"},{"name":"星1","transform":{},"parent":"root"},{"name":"三角","transform":{},"parent":"root"},{"name":"星2","transform":{},"parent":"root"},{"name":"外圈","transform":{},"parent":"root"}],"type":"Armature","aabb":{"x":-259.5,"height":519,"y":-259.5,"width":519}}],"isGlobal":0}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "0c54ff42-7be8-44c4-a4ff-056ecb454305",
"subMetas": {}
}
\ No newline at end of file
{"name":"magic","imagePath":"magic_tex.png","height":1024,"SubTexture":[{"name":"魔法阵/外圈","x":1,"height":519,"y":1,"width":519},{"name":"魔法阵/星2","x":1,"height":424,"y":522,"width":424},{"name":"魔法阵/三角","x":427,"height":409,"y":522,"width":405},{"name":"魔法阵/星1","x":834,"height":322,"y":522,"width":322},{"name":"魔法阵/中间","x":1158,"height":229,"y":522,"width":229}],"width":2048}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "c8a5a7d2-1c5c-4f4e-a0a3-eac19eff713b",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "42311ad5-afc0-471d-8745-4c305c217d03",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 2048,
"height": 1024,
"platformSettings": {},
"subMetas": {
"magic_tex": {
"ver": "1.0.4",
"uuid": "8796dc4b-3755-4055-94c7-a79e2192fbbe",
"rawTextureUuid": "42311ad5-afc0-471d-8745-4c305c217d03",
"trimType": "custom",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 2048,
"height": 1024,
"rawWidth": 2048,
"rawHeight": 1024,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "892ff52a-178d-4a9e-874c-b17a22eae615",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "edc8de5c-37c9-41f4-8ebb-a36531937532",
"downloadMode": 0,
"duration": 60.081633,
"subMetas": {}
}
\ No newline at end of file
{ {
"ver": "2.0.1", "ver": "2.0.1",
"uuid": "f0680ae0-c079-45ef-abd7-9e63d90b982b", "uuid": "7ba5a104-ea06-415f-841d-18ff400a6906",
"downloadMode": 0, "downloadMode": 0,
"duration": 0.130612, "duration": 0.679184,
"subMetas": {} "subMetas": {}
} }
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "63b504d9-bb8e-4a4f-ab5a-ced055e22ca2",
"downloadMode": 0,
"duration": 5.537938,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "79c2f05c-43ba-4f50-ac34-961d957620ea",
"downloadMode": 0,
"duration": 4.022857,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "855d4ebd-b3fe-4794-9913-4add9777b0f7",
"downloadMode": 0,
"duration": 7.758367,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "b32492a0-7247-41e3-a361-fbaebbd908fb",
"downloadMode": 0,
"duration": 7.613333,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "594e4460-4dbe-46ff-bb38-9768e64ee359",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{ {
"ver": "1.1.0", "ver": "1.1.0",
"uuid": "c551970e-b095-45f3-9f1d-25cde8b8deb1", "uuid": "8ef2eb77-9294-4186-92a6-5f876ad28041",
"subMetas": {} "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
import {loadImage, setSprNodeMaxLen} from "../script/util";
cc.Class({
extends: cc.Component,
properties: {},
// LIFE-CYCLE CALLBACKS:
_canTouch: null,
_isTop: null,
_arrowUp: null,
_arrowDown: null,
_pageIndex: null,
_maxPage: null,
_lineMaxCount: null,
_disW: null,
_maxW: null,
onLoad() {
this._canTouch = true;
this._isTop = false;
this._arrowUp = this.node.getChildByName('arrowUp');
this._arrowDown = this.node.getChildByName('arrowDown');
this.node.zIndex = 10;
this._itemLen = 75;
this._pageIndex = 0;
this._maxPage = 0;
this._disW = 5;
this._maxW = 1280 - 90;
this._lineMaxCount = Math.floor(this._maxW / (this._disW + this._itemLen));
},
start() {
this._initListener();
this._initItemLayer();
},
_itemLayer: null,
_initItemLayer() {
this._itemLayer = new cc.Node();
this.node.addChild(this._itemLayer);
},
_initListener() {
this._initTopBtnListener();
this._initPageBtnListener();
},
_initTopBtnListener() {
const btn = this.node.getChildByName('btn');
btn.on('click', () => {
if (!this._canTouch) {
return;
}
this._canTouch = false;
const moveLen = 80 * this.node.scaleY;
const time = 0.5;
let targetY = moveLen;
if (this._isTop) {
targetY = -moveLen;
}
cc.tween(this.node)
.by(time, {y: targetY})
.call(() => {
this._canTouch = true;
})
.start()
this._setTopBtnState(time);
this._isTop = !this._isTop;
});
},
_pageUpBtn: null,
_pageDownBtn: null,
_initPageBtnListener() {
const pageUp = this.node.getChildByName('pageUp');
pageUp.on('click', () => {
if (!this._canTouch) {
return;
}
if (this._pageIndex <= 0) {
return;
}
this._pageIndex--;
this._refreshPage();
this._showBtnAnima(pageUp);
});
this._pageUpBtn = pageUp;
const pageDown = this.node.getChildByName('pageDown');
pageDown.on('click', () => {
if (!this._canTouch) {
return;
}
if (this._pageIndex >= this._maxPage - 1) {
return;
}
this._pageIndex++;
this._refreshPage();
this._showBtnAnima(pageDown);
});
this._pageDownBtn = pageDown;
},
_showBtnAnima(btn) {
cc.tween(btn)
.to(0.08, {scale: 1.3}, {easing: 'sineOut'})
.to(0.08, {scale: 1}, {easing: 'sineOut'})
.start();
},
_setPageBtnState() {
if (this._maxPage == 0) {
this._pageUpBtn.active = this._pageDownBtn.active = false;
return;
}
if (this._pageIndex == 0) {
this._pageUpBtn.opacity = 100;
} else {
this._pageUpBtn.opacity = 255;
}
if (this._pageIndex == this._maxPage - 1) {
this._pageDownBtn.opacity = 100;
} else {
this._pageDownBtn.opacity = 255;
}
},
_setTopBtnState(time) {
let arrow1, arrow2;
if (this._isTop) {
arrow1 = this._arrowDown;
arrow2 = this._arrowUp;
} else {
arrow1 = this._arrowUp;
arrow2 = this._arrowDown;
}
arrow1.scale = 1;
arrow2.scale = 0;
cc.tween(arrow1)
.to(time / 2, { scale: 0 }, {easing: 'cubicOut'})
.start()
cc.tween(arrow2)
.delay(time / 2)
.to(time / 2, {scale: 1}, {easing: 'cubicOut'})
.start();
},
_dataArr: null,
setItemData(dataArr) {
console.log(' in setItemData', dataArr);
if (!dataArr || dataArr.length == 0) {
return;
}
this._dataArr = dataArr;
// this._maxPage = Math.ceil(dataArr.length / this._lineMaxCount) - 1;
this._initPageArr();
this._pageIndex = 0;
this._refreshPage();
},
_pageArr: null,
_initPageArr() {
let tmpArr = [];
this._pageArr = [tmpArr];
let curLen = this._disW;
for (let i=0; i<this._dataArr.length; i++) {
const item = this._addOneItem(this._dataArr[i]);
curLen += item.width + this._disW;
if (curLen > this._maxW) {
tmpArr = [item];
this._pageArr.push(tmpArr);
curLen = this._disW + item.width + this._disW;
} else {
tmpArr.push(item);
}
}
this._maxPage = this._pageArr.length;
console.log('this._maxPage: ', this._maxPage);
},
_itemLen: null,
_addOneItem(data) {
const item = new cc.Node();
item.width = this._itemLen;
item.height = this._itemLen;
// const rect = item.addComponent(cc.Graphics);
// rect.fillColor = cc.Color.BLACK.setA(100);
// rect.fillRect(-this._itemLen / 2, -this._itemLen / 2, this._itemLen, this._itemLen);
// rect.fill();
this._addItemPic(item, data.pic_url);
this._addItemLabel(item, data.text);
this._addItemAudio(item, data.audio_url);
item.data = data;
return item;
},
_addItemPic(item, url) {
if (!url) {
return;
}
const imgLen = this._itemLen * 0.8;
cc.assetManager.loadRemote(url, (err, texture) => {
const sprNode = new cc.Node();
item.addChild(sprNode);
sprNode.width = texture.width;
sprNode.height = texture.height;
sprNode.y = (this._itemLen - imgLen) / 2;
setSprNodeMaxLen(sprNode, imgLen, imgLen);
const sf = new cc.SpriteFrame(texture);
sprNode.addComponent(cc.Sprite).spriteFrame = sf;
});
},
_labelFont: null,
_addItemLabel(item, text) {
if (!text) {
return;
}
const labelNode = new cc.Node();
labelNode.color = cc.Color.BLACK;
const label = labelNode.addComponent(cc.Label);
label.string = text;
// label.string ='ltg + ';
item.addChild(labelNode);
labelNode.y = -this._itemLen * 0.4;
label.fontSize = 16;
label.verticalAlign = cc.Label.VerticalAlign.CENTER;
if (!this._labelFont) {
const fontLabel = this.node.getChildByName('font').getComponent(cc.Label);
this._labelFont = fontLabel.font;
}
label.font = this._labelFont;
label._forceUpdateRenderData(true)
if (labelNode.width > this._itemLen) {
item.width = labelNode.width;
}
},
_addItemAudio(item, url) {
if (!url) {
return;
}
cc.assetManager.loadRemote(url, (err, audioClip) => {
item.audioClip = audioClip;
this._addItemListener(item);
});
},
_addItemListener(item) {
item.addComponent(cc.Button);
item.on('click', () => {
if (item.audioClip) {
cc.audioEngine.stopAll();
cc.audioEngine.play(item.audioClip, false, 0.5);
}
});
},
_refreshPage() {
this._itemLayer.removeAllChildren();
const dataArr = this._dataArr;
const disW = this._disW;
const startIndex = this._pageIndex * this._lineMaxCount;
// const showArr = dataArr.slice(startIndex, startIndex + this._lineMaxCount);
const showArr = this._pageArr[this._pageIndex];
let baseX = this._getCurPageBaseX();
// const baseX = -(disW + this._itemLen) * (showArr.length - 1) / 2;
const baseY = -25;
showArr.forEach((el, i) => {
const item = this._addOneItem(el.data);
this._itemLayer.addChild(item);
item.x = baseX + (disW + item.width) / 2
item.y = baseY;
baseX = item.x + (disW + item.width) / 2;
});
this._setPageBtnState();
},
_getCurPageBaseX() {
const arr = this._pageArr[this._pageIndex];
console.log('arr: ', arr);
let curLen = this._disW;
for (let i=0; i<arr.length; i++) {
curLen += (arr[i].width + this._disW)
}
return -curLen / 2;
},
// update (dt) {},
});
{ {
"ver": "1.0.8", "ver": "1.0.8",
"uuid": "c41b0e51-55d7-443c-af3a-b22c3dd9b9e5", "uuid": "ff0e987e-f8d9-4a38-b6c2-f81bbf447dbe",
"isPlugin": false, "isPlugin": false,
"loadPluginInWeb": true, "loadPluginInWeb": true,
"loadPluginInNative": true, "loadPluginInNative": true,
......
{
"ver": "1.2.7",
"uuid": "9993b7c8-e4e4-4b48-8922-9c55f423bdb3",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
{ {
"ver": "1.1.2", "ver": "1.1.2",
"uuid": "c35bb2f6-f24a-4850-ae44-643f2fdc7541", "uuid": "f9ff87df-13c3-4529-838a-93336988cede",
"isBundle": false, "isBundle": false,
"bundleName": "", "bundleName": "",
"priority": 1, "priority": 1,
......
This diff is collapsed.
{ {
"ver": "1.2.9", "ver": "1.2.7",
"uuid": "57ea7c61-9b8b-498a-b024-c98ee9124beb", "uuid": "5e0a03aa-9b9e-4076-b508-7dbf209bb115",
"asyncLoadAssets": false, "asyncLoadAssets": false,
"autoReleaseAssets": true, "autoReleaseAssets": true,
"subMetas": {} "subMetas": {}
......
{ {
"ver": "1.1.2", "ver": "1.1.2",
"uuid": "b0c008bc-cf92-463b-8360-0984e13c2e4d", "uuid": "0bdf31a9-a3f4-41ec-aa7c-f93ebd2f6505",
"isBundle": false, "isBundle": false,
"bundleName": "", "bundleName": "",
"priority": 1, "priority": 1,
......
This diff is collapsed.
{ {
"ver": "1.0.8", "ver": "1.0.8",
"uuid": "b54300af-b8e5-4b4e-aa2f-9ac1cef7b598", "uuid": "e2e0dcb5-f556-4545-b84a-3e9fb09c0a68",
"isPlugin": true, "isPlugin": true,
"loadPluginInWeb": true, "loadPluginInWeb": true,
"loadPluginInNative": true, "loadPluginInNative": true,
......
This diff is collapsed.
{ {
"ver": "1.0.8", "ver": "1.0.8",
"uuid": "f4ede462-f8d7-4069-ba80-915611c058ca", "uuid": "1e6c56e6-cdbe-42c3-bb46-53eea9c9bf93",
"isPlugin": false, "isPlugin": false,
"loadPluginInWeb": true, "loadPluginInWeb": true,
"loadPluginInNative": true, "loadPluginInNative": true,
......
...@@ -70,72 +70,9 @@ export function setSprNodeMaxLen(sprNode, maxW, maxH) { ...@@ -70,72 +70,9 @@ export function setSprNodeMaxLen(sprNode, maxW, maxH) {
sprNode.scale = Math.round(s * 1000) / 1000; 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()
})
}
export function getSpriteFrimeByUrl(url, cb) { export function getSpriteFrimeByUrl(url, cb) {
cc.loader.load({ url }, (err, img) => { cc.loader.load({url}, (err, img) => {
const spriteFrame = new cc.SpriteFrame(img) const spriteFrame = new cc.SpriteFrame(img)
if (cb) { if (cb) {
cb(spriteFrame); cb(spriteFrame);
...@@ -163,7 +100,7 @@ export function getSprNodeByUrl(url, cb) { ...@@ -163,7 +100,7 @@ export function getSprNodeByUrl(url, cb) {
export function playAudio(audioClip, cb = null) { export function playAudio(audioClip, cb=null) {
if (audioClip) { if (audioClip) {
const audioId = cc.audioEngine.playEffect(audioClip, false, 0.8); const audioId = cc.audioEngine.playEffect(audioClip, false, 0.8);
if (cb) { if (cb) {
...@@ -174,6 +111,18 @@ export function playAudio(audioClip, cb = null) { ...@@ -174,6 +111,18 @@ export function playAudio(audioClip, cb = null) {
} }
} }
export function playAudioByUrl(audio_url, cb=null) {
if (audio_url) {
cc.assetManager.loadRemote(audio_url, (err, audioClip) => {
playAudio(audioClip, cb);
});
}
}
export async function asyncDelay(time) { export async function asyncDelay(time) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
try { try {
...@@ -341,14 +290,14 @@ export function showTrebleFirework(baseNode, rabbonList) { ...@@ -341,14 +290,14 @@ export function showTrebleFirework(baseNode, rabbonList) {
showFireworks(right); showFireworks(right);
} }
export function onHomeworkFinish() {
const middleLayer = cc.find('middleLayer'); export function delayCall(time, cb) {
if (middleLayer) { return cc.tween(this)
const middleLayerComponent = middleLayer.getComponent('middleLayer'); .delay(time)
if (middleLayerComponent.role == 'student') { .call(() => {
middleLayerComponent.onHomeworkFinish(() => { }); if (cb) {
} cb();
} else {
console.log('onHomeworkFinish');
} }
})
.start();
} }
\ No newline at end of file
{ {
"ver": "1.0.8", "ver": "1.0.8",
"uuid": "ade7af40-d56d-4087-bbc6-2888fef55353", "uuid": "25ccf041-bdf3-4b6a-8683-c24e4c39fed4",
"isPlugin": false, "isPlugin": false,
"loadPluginInWeb": true, "loadPluginInWeb": true,
"loadPluginInNative": true, "loadPluginInNative": true,
......
{
"ver": "1.1.2",
"uuid": "2582562a-54bb-483a-8483-727d57c6c974",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "f5ee0180-9001-420c-b1cc-5e8daa1c24ed",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1280,
"height": 720,
"platformSettings": {},
"subMetas": {
"bg_door": {
"ver": "1.0.4",
"uuid": "6b28f410-9a93-4b36-8b98-fdcfacd11122",
"rawTextureUuid": "f5ee0180-9001-420c-b1cc-5e8daa1c24ed",
"trimType": "custom",
"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": "addfeecd-ef6d-4fbb-ba3f-a7f168aef145",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1280,
"height": 720,
"platformSettings": {},
"subMetas": {
"bg_grass": {
"ver": "1.0.4",
"uuid": "8b74fb56-c102-47a5-b94b-454c18df1b04",
"rawTextureUuid": "addfeecd-ef6d-4fbb-ba3f-a7f168aef145",
"trimType": "custom",
"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", "ver": "2.3.5",
"uuid": "efa5fa09-a4dd-4bfc-ab7e-17c19f85408f", "uuid": "ac564098-83c1-42e7-bd96-dfc5b638260b",
"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": 486,
"height": 336, "height": 487,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"1orange": { "bg_magic": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "43d1e79d-6de8-4dcb-b8ce-d767df7913aa", "uuid": "8ec3fb99-a739-40de-97a9-c97613f0918b",
"rawTextureUuid": "efa5fa09-a4dd-4bfc-ab7e-17c19f85408f", "rawTextureUuid": "ac564098-83c1-42e7-bd96-dfc5b638260b",
"trimType": "auto", "trimType": "custom",
"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": 486,
"height": 335, "height": 487,
"rawWidth": 366, "rawWidth": 486,
"rawHeight": 336, "rawHeight": 487,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "e1b4d971-9876-4832-803a-5a321964a78b", "uuid": "913ec969-8fc8-43ec-91b5-cd60e7ec670b",
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
...@@ -11,11 +11,11 @@ ...@@ -11,11 +11,11 @@
"height": 720, "height": 720,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"bg": { "bg_sky": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "8288e3d4-4c75-4b27-8f01-f7014417f4dd", "uuid": "d499e050-b773-47ae-b796-ef1b10c609ea",
"rawTextureUuid": "e1b4d971-9876-4832-803a-5a321964a78b", "rawTextureUuid": "913ec969-8fc8-43ec-91b5-cd60e7ec670b",
"trimType": "auto", "trimType": "custom",
"trimThreshold": 1, "trimThreshold": 1,
"rotated": false, "rotated": false,
"offsetX": 0, "offsetX": 0,
......
{
"ver": "1.1.2",
"uuid": "4b8436bc-8ccf-42ff-b3a3-825f8e48b63d",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"__type__": "cc.SpriteAtlas"
}
\ No newline at end of file
{
"ver": "1.2.0",
"uuid": "98e67bef-67d6-4a6d-945d-4d481cbd6b33",
"maxWidth": 1024,
"maxHeight": 1024,
"padding": 2,
"allowRotation": true,
"forceSquared": false,
"powerOfTwo": false,
"algorithm": "MaxRects",
"format": "png",
"quality": 80,
"contourBleed": true,
"paddingBleed": true,
"filterUnused": false,
"packable": false,
"premultiplyAlpha": false,
"filterMode": "bilinear",
"platformSettings": {
"default": {
"formats": [
{
"name": "png",
"quality": 80
}
]
}
},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "c8d8583e-ad3b-4137-9c65-fe4609ba41c1",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 242,
"height": 302,
"platformSettings": {},
"subMetas": {
"bg_apple": {
"ver": "1.0.4",
"uuid": "af804dad-63d5-4a7c-a78a-d2e6a062b703",
"rawTextureUuid": "c8d8583e-ad3b-4137-9c65-fe4609ba41c1",
"trimType": "custom",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 242,
"height": 302,
"rawWidth": 242,
"rawHeight": 302,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "78ce365c-13c1-4fa5-a25b-ed0fc9397864",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 260,
"height": 376,
"platformSettings": {},
"subMetas": {
"bg_banana": {
"ver": "1.0.4",
"uuid": "ce259581-6f96-4c0e-b6ab-65f3090bb918",
"rawTextureUuid": "78ce365c-13c1-4fa5-a25b-ed0fc9397864",
"trimType": "custom",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 260,
"height": 376,
"rawWidth": 260,
"rawHeight": 376,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "bf57fa48-fde2-424e-925d-60a6a71eeb07",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 353,
"height": 120,
"platformSettings": {},
"subMetas": {
"bg_leftbottom": {
"ver": "1.0.4",
"uuid": "514b5481-32ac-44d3-900d-ff56b44516ea",
"rawTextureUuid": "bf57fa48-fde2-424e-925d-60a6a71eeb07",
"trimType": "custom",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 353,
"height": 120,
"rawWidth": 353,
"rawHeight": 120,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "b6a12bf3-5e36-4b49-bc2f-af9fa9bf25d7",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 193,
"height": 236,
"platformSettings": {},
"subMetas": {
"bg_lefttop": {
"ver": "1.0.4",
"uuid": "249b1555-ab1a-4b96-ad86-d3ce4f7970e3",
"rawTextureUuid": "b6a12bf3-5e36-4b49-bc2f-af9fa9bf25d7",
"trimType": "custom",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 193,
"height": 236,
"rawWidth": 193,
"rawHeight": 236,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "7b6828de-801b-4814-ad77-a6a172434923",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 215,
"height": 271,
"platformSettings": {},
"subMetas": {
"bg_orange": {
"ver": "1.0.4",
"uuid": "40530a75-ea37-4f92-8566-30a1ca46eefe",
"rawTextureUuid": "7b6828de-801b-4814-ad77-a6a172434923",
"trimType": "custom",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 215,
"height": 271,
"rawWidth": 215,
"rawHeight": 271,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "68cbdfb2-ca6f-4d92-8b37-bcc3bbcfa81a",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 287,
"height": 115,
"platformSettings": {},
"subMetas": {
"bg_rightbottom": {
"ver": "1.0.4",
"uuid": "2c216ba0-82de-4742-9ebb-cfbe98139d9b",
"rawTextureUuid": "68cbdfb2-ca6f-4d92-8b37-bcc3bbcfa81a",
"trimType": "custom",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 287,
"height": 115,
"rawWidth": 287,
"rawHeight": 115,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "af97a2dc-e9f6-4ec3-aab6-f0649ca86a6e",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 156,
"height": 328,
"platformSettings": {},
"subMetas": {
"bg_righttop": {
"ver": "1.0.4",
"uuid": "fe11485d-21c7-493e-8fc3-448269c51500",
"rawTextureUuid": "af97a2dc-e9f6-4ec3-aab6-f0649ca86a6e",
"trimType": "custom",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 156,
"height": 328,
"rawWidth": 156,
"rawHeight": 328,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "c6cdbf80-5983-4650-aadf-15c9fd08d7c6",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 617,
"height": 176,
"platformSettings": {},
"subMetas": {
"bg_smog": {
"ver": "1.0.4",
"uuid": "fde2a19c-c308-4359-b871-e47e3f5d6768",
"rawTextureUuid": "c6cdbf80-5983-4650-aadf-15c9fd08d7c6",
"trimType": "custom",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 617,
"height": 176,
"rawWidth": 617,
"rawHeight": 176,
"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.
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.
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