Commit 7763ea4d authored by Tt's avatar Tt

游戏内容修改完

parent ae7ed5db
{
"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() {
}
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);
});
})
}
}
{
"ver": "1.0.8",
"uuid": "408a67f8-65fa-4cf1-8cf2-83e20e1a0fd5",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
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.loadAny(preloadArr, null, null, (err, data) => {
if (window && window["air"]) {
// window["air"].onCourseInScreen = (next) => {
// window["air"].isCourseInScreen = true;
// this.onLoadEnd();
// next();
// };
this.onLoadEnd();
window["air"].hideAirClassLoading();
} else {
this.onLoadEnd();
}
cc.debug.setDisplayStats(false);
});
}
log (str) {
const node = cc.find('middleLayer');
if(node){
node.getComponent('middleLayer').log(str);
}else{
cc.log(str);
}
}
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
{
"ver": "1.1.2",
"uuid": "0644b079-4147-489d-ad68-72f2ca1ffe1e",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "f0680ae0-c079-45ef-abd7-9e63d90b982b",
"uuid": "d7ee13c8-7c6f-4ed4-bf81-c85ae91edfa9",
"downloadMode": 0,
"duration": 0.130612,
"duration": 7.74,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "fc2be55f-3d94-44e0-9ebf-09e0eaa47873",
"downloadMode": 0,
"duration": 10.944,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "4d2df5f4-a774-4e06-a410-4e38195952ad",
"downloadMode": 0,
"duration": 0.972,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "0d2dd7a8-9bc2-4cd5-a432-a13f8fb43033",
"downloadMode": 0,
"duration": 1.188,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "a544c1e7-32f5-4754-95a2-823398db0dcc",
"downloadMode": 0,
"duration": 0.287347,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "293ae196-a9b5-4da0-a0b6-597baa25f7b1",
"downloadMode": 0,
"duration": 0.365714,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "b733b7d3-4082-4320-9fe0-2ce28088b687",
"downloadMode": 0,
"duration": 0.966531,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "e87d3f15-54b2-4a37-9793-9923fa34fda9",
"downloadMode": 0,
"duration": 0.626939,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "d9be9283-652e-44da-98d6-680406e71a03",
"downloadMode": 0,
"duration": 0.168,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "7bf9c308-8dd5-411d-8770-ddc8341386d0",
"downloadMode": 0,
"duration": 0.39185,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "ac17bb63-beac-4d42-bc52-1d53b848082f",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
{
"ver": "1.0.1",
"uuid": "42cb15db-315a-4d11-9814-0fe5f8808a72",
"subMetas": {}
}
\ No newline at end of file
{"name":"mao","imagePath":"mao_tex.png","SubTexture":[{"name":"猫01/影子","x":1,"height":66,"y":343,"width":337},{"name":"猫01/尾巴","x":1,"height":109,"y":188,"width":175},{"name":"猫01/右腿","x":178,"height":117,"y":188,"width":104},{"name":"猫01/左腿","x":1,"height":115,"y":569,"width":64},{"name":"猫01/右手","x":427,"height":122,"y":590,"width":69},{"name":"猫01/左手","x":301,"height":74,"y":590,"width":124},{"name":"猫01伸/左手伸直","x":299,"height":169,"y":1,"width":168},{"name":"猫01伸/右手伸直","x":299,"height":169,"y":172,"width":168},{"name":"猫01/身体","x":340,"height":180,"y":343,"width":122},{"name":"猫01/领带","x":1,"height":156,"y":411,"width":120},{"name":"猫01/右耳","x":155,"height":76,"y":602,"width":90},{"name":"猫01/左耳","x":67,"height":85,"y":602,"width":86},{"name":"猫01/组_1","x":1,"height":185,"y":1,"width":296},{"name":"猫01/右眼","x":1,"height":60,"y":686,"width":59},{"name":"猫01/右眉毛","x":67,"height":5,"y":595,"width":33},{"name":"猫01/左眼","x":247,"height":60,"y":666,"width":59},{"name":"猫01/左眉毛","x":247,"height":12,"y":602,"width":31},{"name":"猫01/眼镜","x":301,"height":63,"y":525,"width":170},{"name":"猫01/胡子","x":123,"height":85,"y":515,"width":176},{"name":"猫01/鼻子","x":67,"height":24,"y":569,"width":28},{"name":"猫01/嘴","x":1,"height":30,"y":299,"width":65},{"name":"猫01/帽子","x":123,"height":102,"y":411,"width":158}],"height":1024,"width":512}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "b2242a6f-c54f-4b2d-8151-89a713576e41",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "c8f02f6a-80f7-4712-8a8c-26db0a90ab03",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 512,
"height": 1024,
"platformSettings": {},
"subMetas": {
"mao_tex": {
"ver": "1.0.4",
"uuid": "837a88a0-d171-4421-8e58-63a525eabc62",
"rawTextureUuid": "c8f02f6a-80f7-4712-8a8c-26db0a90ab03",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -7.5,
"offsetY": 138.5,
"trimX": 1,
"trimY": 1,
"width": 495,
"height": 745,
"rawWidth": 512,
"rawHeight": 1024,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "70b06f27-303c-4ea7-ab54-90e916ebd541",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{"frameRate":24,"name":"烟花","version":"5.5","compatibleVersion":"5.5","armature":[{"type":"Armature","frameRate":24,"name":"Armature","aabb":{"x":-57.5,"y":-420,"width":152,"height":97},"bone":[{"name":"root"},{"length":84,"name":"烟花","parent":"root","transform":{"x":-3,"y":-332,"skX":-91.3639,"skY":-91.3639}}],"slot":[{"name":"烟花","parent":"烟花"},{"displayIndex":-1,"name":"1","parent":"root"}],"skin":[{"slot":[{"name":"烟花","display":[{"name":"烟花/烟花","transform":{"x":38.98,"y":22.43,"skX":91.36,"skY":91.36}}]},{"name":"1","display":[{"name":"烟花/1","transform":{"x":-3,"y":-385.5}},{"name":"烟花/2","transform":{"x":-2,"y":-406}},{"name":"烟花/3","transform":{"y":-425.5}},{"name":"烟花/4","transform":{"x":-6,"y":-434}},{"name":"烟花/5","transform":{"x":-7.5,"y":-439.5}},{"name":"烟花/6","transform":{"x":-11,"y":-439.5}},{"name":"烟花/7","transform":{"x":-15.5,"y":-431.5}},{"name":"烟花/8","transform":{"x":-5,"y":-425.5}},{"name":"烟花/9","transform":{"y":-420}}]}]}],"animation":[{"duration":30,"playTimes":0,"name":"normal","bone":[{"name":"烟花","translateFrame":[{"duration":10,"tweenEasing":0,"y":421.44},{"duration":20}]}],"slot":[{"name":"烟花","displayFrame":[{"duration":12},{"duration":18,"value":-1}]},{"name":"1","displayFrame":[{"duration":12,"value":-1},{"duration":2},{"duration":2,"value":1},{"duration":2,"value":2},{"duration":2,"value":3},{"duration":2,"value":4},{"duration":2,"value":5},{"duration":2,"value":6},{"duration":2,"value":7},{"duration":2,"value":8},{"duration":0,"value":-1}]}]}],"defaultActions":[{"gotoAndPlay":"normal"}]}]}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "bce4f069-c7dc-4d7c-bdae-9528d291dc83",
"subMetas": {}
}
\ No newline at end of file
{"width":1024,"imagePath":"烟花_tex.png","height":1024,"name":"烟花","SubTexture":[{"width":152,"y":605,"height":97,"name":"烟花/烟花","x":323},{"width":167,"y":645,"height":65,"name":"烟花/1","x":1},{"width":267,"y":505,"height":98,"name":"烟花/4","x":323},{"width":456,"y":264,"height":239,"name":"烟花/7","x":528},{"width":193,"y":505,"height":54,"name":"烟花/2","x":592},{"width":493,"y":1,"height":261,"name":"烟花/8","x":528},{"width":409,"y":275,"height":211,"name":"烟花/6","x":1},{"width":320,"y":488,"height":155,"name":"烟花/5","x":1},{"width":525,"y":1,"height":272,"name":"烟花/9","x":1},{"width":203,"y":505,"height":33,"name":"烟花/3","x":787}]}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "6edbd32c-4733-466b-a910-5cf85b3eaef8",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "c138e5ff-6afa-4eef-8c24-7308cc6e2f7b",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1024,
"height": 1024,
"platformSettings": {},
"subMetas": {
"烟花_tex": {
"ver": "1.0.4",
"uuid": "91a38a51-4650-4bb3-89db-b1827ed75bf2",
"rawTextureUuid": "c138e5ff-6afa-4eef-8c24-7308cc6e2f7b",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -1,
"offsetY": 156.5,
"trimX": 1,
"trimY": 1,
"width": 1020,
"height": 709,
"rawWidth": 1024,
"rawHeight": 1024,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "1.2.9",
"uuid": "0737ce42-24f0-45c6-8e1a-8bdab4f74ba3",
"uuid": "074720a3-f261-4ae9-9af1-1adabd8f4c6d",
"asyncLoadAssets": false,
"autoReleaseAssets": true,
"subMetas": {}
......
This diff is collapsed.
{
"ver": "1.0.8",
"uuid": "f8b451ff-857c-4ca8-9870-866bc5154a29",
"uuid": "0e720e53-149d-4f8e-881b-dadb01d82383",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
......
export const defaultData = {
"maxWrongNumber": 4,
"startAudio": "http://staging-teach.cdn.ireadabc.com/17edcaecd09a72a64a77480673cdc232.mp3",
"endAudio": "http://staging-teach.cdn.ireadabc.com/fd8a2b8eeb4abbe7683d30e728ece184.mp3",
"question_arr": [
{
"question_audio_url": "",
"option_arr": [
{
"pic_url": "http://staging-teach.cdn.ireadabc.com/5ba43828aef85c585743a0c898b43c42.png",
"audio_url": "http://staging-teach.cdn.ireadabc.com/ce3337620f22232dd15c29c66af57736.mp3",
"is_right": true
},
{
"pic_url": "http://staging-teach.cdn.ireadabc.com/d69dee492fd35b3c066207c3fc8e3258.png",
"audio_url": "http://staging-teach.cdn.ireadabc.com/b4d95069fcc91976740461b9061a303a.mp3",
"is_right": false
},
{
"pic_url": "http://staging-teach.cdn.ireadabc.com/48ecba3519b1d58a1fa434ae694fc831.png",
"audio_url": "http://staging-teach.cdn.ireadabc.com/b4d95069fcc91976740461b9061a303a.mp3",
"is_right": false
},
{
"pic_url": "http://staging-teach.cdn.ireadabc.com/44464e706225cfe43e918bf1167a2ac1.png",
"audio_url": "http://staging-teach.cdn.ireadabc.com/e62f0e83bc744a6e508fa23aaa656792.mp3",
"is_right": false
},
{
"pic_url": "http://staging-teach.cdn.ireadabc.com/251667ae3d4921582392f6bc42bd2a96.png",
"audio_url": "http://staging-teach.cdn.ireadabc.com/f4e0925dec2f24505872b1c367343a6e.mp3",
"is_right": false
}
],
"audio_url": "http://staging-teach.cdn.ireadabc.com/e62f0e83bc744a6e508fa23aaa656792.mp3"
},
{
"question_audio_url": "",
"option_arr": [
{
"pic_url": "http://staging-teach.cdn.ireadabc.com/5ba43828aef85c585743a0c898b43c42.png",
"audio_url": "http://staging-teach.cdn.ireadabc.com/ce3337620f22232dd15c29c66af57736.mp3",
"is_right": true
},
{
"pic_url": "http://staging-teach.cdn.ireadabc.com/d69dee492fd35b3c066207c3fc8e3258.png",
"audio_url": "http://staging-teach.cdn.ireadabc.com/b4d95069fcc91976740461b9061a303a.mp3",
"is_right": false
},
{
"pic_url": "http://staging-teach.cdn.ireadabc.com/48ecba3519b1d58a1fa434ae694fc831.png",
"audio_url": "http://staging-teach.cdn.ireadabc.com/b4d95069fcc91976740461b9061a303a.mp3",
"is_right": false
},
{
"pic_url": "http://staging-teach.cdn.ireadabc.com/44464e706225cfe43e918bf1167a2ac1.png",
"audio_url": "http://staging-teach.cdn.ireadabc.com/e62f0e83bc744a6e508fa23aaa656792.mp3",
"is_right": false
},
{
"pic_url": "http://staging-teach.cdn.ireadabc.com/251667ae3d4921582392f6bc42bd2a96.png",
"audio_url": "http://staging-teach.cdn.ireadabc.com/f4e0925dec2f24505872b1c367343a6e.mp3",
"is_right": false
}
],
"audio_url": "http://staging-teach.cdn.ireadabc.com/e62f0e83bc744a6e508fa23aaa656792.mp3"
}]
}
\ No newline at end of file
......@@ -165,7 +165,7 @@ export function getSprNodeByUrl(url, cb) {
export function playAudio(audioClip, cb = null) {
if (audioClip) {
const audioId = cc.audioEngine.playEffect(audioClip, false);
const audioId = cc.audioEngine.playEffect(audioClip, false, 0.8);
if (cb) {
cc.audioEngine.setFinishCallback(audioId, () => {
cb();
......@@ -177,12 +177,9 @@ export function playAudio(audioClip, cb = null) {
export async function asyncDelay(time) {
return new Promise((resolve, reject) => {
try {
cc.tween(cc.find('Canvas'))
.delay(time)
.call(()=>{
resolve(null);
})
.start();
setTimeout(() => {
resolve();
}, time * 1000);
} catch (e) {
reject(e);
}
......@@ -299,7 +296,7 @@ export async function asyncTweenTo(node, duration, obj, ease = undefined) {
cc.tween(node)
.to(duration, obj, ease)
.call(() => {
resolve(null);
resolve();
})
.start();
} catch (e) {
......@@ -314,7 +311,7 @@ export async function asyncTweenBy(node, duration, obj, ease = undefined) {
cc.tween(node)
.by(duration, obj, ease)
.call(() => {
resolve(null);
resolve();
})
.start();
} catch (e) {
......@@ -354,4 +351,38 @@ export function onHomeworkFinish() {
} else {
console.log('onHomeworkFinish');
}
}
\ No newline at end of file
}
export async function asyncPlayDragonBoneAnimation(node, animationName, time = 1, onFrameEvent = null) {
return new Promise((resolve, reject) => {
const armatureDisplay = node.getComponent(dragonBones.ArmatureDisplay);
armatureDisplay.timeScale = 1;
armatureDisplay.once(dragonBones.EventObject.COMPLETE, () => {
resolve();
});
armatureDisplay.on(dragonBones.EventObject.FRAME_EVENT, (event) => {
if (onFrameEvent) {
onFrameEvent(event);
}
});
armatureDisplay.playAnimation(animationName, time);
});
}
export function playDragonBoneAnimation(node, animationName, time = 1, onFinish = null, onFrameEvent = null) {
const armatureDisplay = node.getComponent(dragonBones.ArmatureDisplay);
armatureDisplay.timeScale = 1;
armatureDisplay.once(dragonBones.EventObject.COMPLETE, () => {
if (onFinish) {
onFinish();
}
});
armatureDisplay.on(dragonBones.EventObject.FRAME_EVENT, (event) => {
if (onFrameEvent) {
onFrameEvent(event);
}
});
armatureDisplay.playAnimation(animationName, time);
}
{
"ver": "2.3.5",
"uuid": "6c8e488b-9cdf-4d20-89c5-4d432d8a2e23",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 2176,
"height": 1074,
"platformSettings": {},
"subMetas": {
"bg_bg": {
"ver": "1.0.4",
"uuid": "95074812-ffd9-4326-9008-60a88279bd2e",
"rawTextureUuid": "6c8e488b-9cdf-4d20-89c5-4d432d8a2e23",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 2176,
"height": 1074,
"rawWidth": 2176,
"rawHeight": 1074,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "e5d8b6de-dae4-4605-9f8f-8584b745b7f2",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1244,
"height": 792,
"platformSettings": {},
"subMetas": {
"bg_box_behind": {
"ver": "1.0.4",
"uuid": "83ae63f9-5160-4995-af20-110757bb4d21",
"rawTextureUuid": "e5d8b6de-dae4-4605-9f8f-8584b745b7f2",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 1,
"offsetY": 189.5,
"trimX": 2,
"trimY": 0,
"width": 1242,
"height": 413,
"rawWidth": 1244,
"rawHeight": 792,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "66f6b898-e326-4bab-89e3-78997d049e47",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1244,
"height": 792,
"platformSettings": {},
"subMetas": {
"bg_box_front": {
"ver": "1.0.4",
"uuid": "2b44a5d3-fe98-49c2-9099-8400d48c17c9",
"rawTextureUuid": "66f6b898-e326-4bab-89e3-78997d049e47",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": -47,
"trimX": 0,
"trimY": 98,
"width": 1244,
"height": 690,
"rawWidth": 1244,
"rawHeight": 792,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "efa5fa09-a4dd-4bfc-ab7e-17c19f85408f",
"uuid": "40a7f7d6-3f30-46c7-b9e4-1d5fcfc0c648",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 366,
"height": 336,
"width": 409,
"height": 409,
"platformSettings": {},
"subMetas": {
"1orange": {
"bg_circle": {
"ver": "1.0.4",
"uuid": "43d1e79d-6de8-4dcb-b8ce-d767df7913aa",
"rawTextureUuid": "efa5fa09-a4dd-4bfc-ab7e-17c19f85408f",
"uuid": "75bb0910-bb15-4daf-9a6d-6873c400a148",
"rawTextureUuid": "40a7f7d6-3f30-46c7-b9e4-1d5fcfc0c648",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": -0.5,
"offsetY": 0,
"trimX": 0,
"trimY": 1,
"width": 366,
"height": 335,
"rawWidth": 366,
"rawHeight": 336,
"trimY": 0,
"width": 409,
"height": 409,
"rawWidth": 409,
"rawHeight": 409,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
......
{
"ver": "2.3.5",
"uuid": "e5a3f41e-df6e-4314-9db7-0771939bb4d6",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 2176,
"height": 798,
"platformSettings": {},
"subMetas": {
"bg_deck": {
"ver": "1.0.4",
"uuid": "3d584bab-9dfe-4922-8dc7-821b4f063796",
"rawTextureUuid": "e5a3f41e-df6e-4314-9db7-0771939bb4d6",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 2176,
"height": 798,
"rawWidth": 2176,
"rawHeight": 798,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "e6d712f3-3bc6-4a7b-a140-9016e0628f67",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": true,
"genMipmaps": false,
"packable": true,
"width": 209,
"height": 146,
"platformSettings": {},
"subMetas": {
"btn_next": {
"ver": "1.0.4",
"uuid": "e666ed9c-0ebf-4802-8d58-7473ddde1634",
"rawTextureUuid": "e6d712f3-3bc6-4a7b-a140-9016e0628f67",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 1,
"trimY": 1,
"width": 207,
"height": 144,
"rawWidth": 209,
"rawHeight": 146,
"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.
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