Commit 52d13809 authored by 范雪寒's avatar 范雪寒

feat:

parent 9dbd3133
No preview for this file type
{ {
"ver": "1.1.2", "ver": "1.1.2",
"uuid": "c35bb2f6-f24a-4850-ae44-643f2fdc7541", "uuid": "c35bb2f6-f24a-4850-ae44-643f2fdc7541",
"isBundle": false, "isBundle": true,
"bundleName": "", "bundleName": "",
"priority": 1, "priority": 1,
"compressionType": {}, "compressionType": {},
"optimizeHotUpdate": {}, "optimizeHotUpdate": {},
"inlineSpriteFrames": {}, "inlineSpriteFrames": {},
"isRemoteBundle": { "isRemoteBundle": {
"ios": false, "ios": true,
"android": false "android": true
}, },
"subMetas": {} "subMetas": {}
} }
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "5724ed2b-9534-4b8c-9d86-813991199116",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"__type__": "cc.AnimationClip",
"_name": "hideAnim",
"_objFlags": 0,
"_native": "",
"_duration": 0,
"sample": 60,
"speed": 1,
"wrapMode": 1,
"curveData": {
"paths": {
"rectangle": {
"props": {
"opacity": [
{
"frame": 0,
"value": 255
}
]
}
}
}
},
"events": []
}
\ No newline at end of file
{
"ver": "2.1.0",
"uuid": "588ad0ee-f93e-4909-bc09-16e28568a59e",
"subMetas": {}
}
\ No newline at end of file
{
"__type__": "cc.AnimationClip",
"_name": "playAudio",
"_objFlags": 0,
"_native": "",
"_duration": 1.5,
"sample": 10,
"speed": 1,
"wrapMode": 2,
"curveData": {
"paths": {
"shape": {
"props": {
"opacity": [
{
"frame": 0,
"value": 0
},
{
"frame": 0.5,
"value": 0
},
{
"frame": 1,
"value": 255
}
]
}
},
"shape1": {
"props": {
"opacity": [
{
"frame": 0,
"value": 0
},
{
"frame": 0.5,
"value": 255
}
]
}
},
"shape2": {
"props": {
"opacity": [
{
"frame": 0,
"value": 0
},
{
"frame": 0.5,
"value": 255
}
]
}
},
"shape3": {
"props": {
"opacity": [
{
"frame": 0,
"value": 0
},
{
"frame": 0.5,
"value": 0
},
{
"frame": 1,
"value": 255
}
]
}
}
},
"props": {
"opacity": [
{
"frame": 0,
"value": 255
},
{
"frame": 1,
"value": 255
},
{
"frame": 1.5,
"value": 0
}
]
}
},
"events": []
}
\ No newline at end of file
{
"ver": "2.1.0",
"uuid": "120fd8be-2579-455f-ba16-b843edb8f914",
"subMetas": {}
}
\ No newline at end of file
{
"__type__": "cc.AnimationClip",
"_name": "stopAudio",
"_objFlags": 0,
"_native": "",
"_duration": 0.5,
"sample": 10,
"speed": 1,
"wrapMode": 1,
"curveData": {
"props": {
"opacity": [
{
"frame": 0,
"value": 255,
"curve": "cubicInOut"
},
{
"frame": 0.5,
"value": 0
}
]
}
},
"events": []
}
\ No newline at end of file
{
"ver": "2.1.0",
"uuid": "2e2ebfa2-b695-4273-9367-34a19066fd2e",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "7e5df83a-be7d-40b6-bbb4-f2869255eef9",
"downloadMode": 0,
"duration": 3.787755,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "356c5e56-b524-4c85-9f70-b0ac0b468dd8",
"downloadMode": 0,
"duration": 1.854694,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "995608bc-0cfd-4cea-a03e-4f0d27b02f86",
"downloadMode": 0,
"duration": 0.130612,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "f982908d-a0a9-4010-987b-8d9959d70cb8",
"downloadMode": 0,
"duration": 0.412,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "6aa65df2-b9ab-458a-b1e4-4d2359be83c3",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "ffdff4b8-162d-473d-9ba1-7d9eea88a485",
"subMetas": {}
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
{ {
"ver": "1.2.9", "ver": "1.2.9",
"uuid": "0737ce42-24f0-45c6-8e1a-8bdab4f74ba3", "uuid": "3134393d-e843-4095-94d8-dc1877aac390",
"asyncLoadAssets": false, "asyncLoadAssets": false,
"autoReleaseAssets": true, "autoReleaseAssets": true,
"subMetas": {} "subMetas": {}
......
import { asyncDelay, RandomInt } from "../script/util";
cc.Class({
extends: cc.Component,
properties: {
dataLabel: {
type: cc.Label,
default: null
},
picNode: {
type: cc.Node,
default: null
},
picTempNode: {
type: cc.Node,
default: null
},
leftNode: {
type: cc.Node,
default: null
},
rightNode: {
type: cc.Node,
default: null
},
playAnim: {
type: cc.Animation,
default: null
},
TopBoxNode: cc.Node,
clips: [cc.AudioClip]
},
// 生命周期 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;
},
// 生命周期 start
start() {
let getData = this.getData.bind(this);
if (window && window.courseware) {
getData = window.courseware.getData;
}
getData((data) => {
console.log('data:', data);
if (data == null || data == undefined || data.length == 0 || data.length == undefined) {
this.data = this.getDefaultData()
} else {
this.data = data
}
this.data = JSON.parse(JSON.stringify(this.data))
this.preloadItem()
})
//init show
this.TopBoxNode.opacity = 0
this.picNode.opacity = 0
this.leftNode.active = false
this.rightNode.active = false
},
onEnable() {
this.rightNode.on(cc.Node.EventType.MOUSE_DOWN, this.changeIcon.bind(this, this.rightNode, true))
this.rightNode.on(cc.Node.EventType.MOUSE_UP, this.changeIcon.bind(this, this.rightNode, false))
this.rightNode.on(cc.Node.EventType.MOUSE_LEAVE, this.changeIcon.bind(this, this.rightNode, false))
this.leftNode.on(cc.Node.EventType.MOUSE_DOWN, this.changeIcon.bind(this, this.leftNode, true))
this.leftNode.on(cc.Node.EventType.MOUSE_UP, this.changeIcon.bind(this, this.leftNode, false))
this.leftNode.on(cc.Node.EventType.MOUSE_UP, this.changeIcon.bind(this, this.leftNode, false))
},
onDisable() {
this.rightNode.off(cc.Node.EventType.MOUSE_DOWN)
this.rightNode.off(cc.Node.EventType.MOUSE_UP)
this.rightNode.off(cc.Node.EventType.MOUSE_LEAVE)
this.leftNode.off(cc.Node.EventType.MOUSE_DOWN)
this.leftNode.off(cc.Node.EventType.MOUSE_UP)
this.leftNode.off(cc.Node.EventType.MOUSE_LEAVE)
},
changeIcon(node, bl) {
node.children[0].active = !bl
node.children[1].active = bl
},
getData(func) {
if (window && window.courseware) {
window.courseware.getData(func, 'ww03');
return;
}
const middleLayer = cc.find('middleLayer');
if (middleLayer) {
const middleLayerComponent = middleLayer.getComponent('middleLayer');
middleLayerComponent.getData(func);
return;
}
func(this.getDefaultData());
},
getDefaultData() {
const dataJson = ' [{"type":"0","txt":"对对对","pic_url":"http://staging-teach.cdn.ireadabc.com/ff3536cb7e11e2fa5f8b98425dc27735.png","audio_url":"http://staging-teach.cdn.ireadabc.com/6b13f8509a360476c26336029a1ce570.mp3"},{"txt":"11发发","pic_url":"http://staging-teach.cdn.ireadabc.com/e28666860c7d1ab255569201c6749a03.png"},{"txt":"11发发","pic_url":"http://staging-teach.cdn.ireadabc.com/e28666860c7d1ab255569201c6749a03.png"}]'
const data = JSON.parse(dataJson);
return data;
},
preloadItem() {
// this.addPreloadImage();
// this.addPreloadAudio();
// this.addPreloadAnima();
this.addPreload()
this.preload();
},
addPreload() {
for (let one of this.data) {
one.pic_url && this._imageResList.push({ url: one.pic_url })
one.audio_url && this._audioResList.push({ url: one.audio_url })
}
},
addPreloadImage() {
this._imageResList.push({ url: this.data.pic_url });
this._imageResList.push({ url: this.data.pic_url_2 });
},
addPreloadAudio() {
this._audioResList.push({ url: this.data.audio_url });
},
addPreloadAnima() {
},
preload() {
const preloadArr = this._imageResList.concat(this._audioResList).concat(this._animaResList);
cc.assetManager.loadAny(preloadArr, null, null, (err, data) => {
this.loadEnd();
if (window && window["air"]) {
window["air"].hideAirClassLoading();
}
cc.debug.setDisplayStats(false);
});
},
loadEnd() {
this.initData();
this.initView();
// this.initListener();
},
_cantouch: null,
initData() {
// 所有全局变量 默认都是null
this._cantouch = true;
},
initView() {
this.initBg();
this.initPic();
},
initBg() {
const bgNode = cc.find('Canvas/bg');
bgNode.scale = this._mapScaleMax;
},
front: null,
initPic() {
this.fired = false
this.front = true
this.TopBoxNode.opacity = 0
this.picNode.opacity = 0
cc.Tween.stopAllByTarget(this.TopBoxNode)
cc.Tween.stopAllByTarget(this.picNode)
cc.tween(this.TopBoxNode).to(1, { opacity: 255 }, { easing: 'cubicInOut' }).start()
cc.tween(this.picNode).to(1, { opacity: 255 }, { easing: 'cubicInOut' }).start()
this.curPage = 0
if (this.data.length == 1) {
this.leftNode.active = false
this.rightNode.active = false
} else {
this.leftNode.active = false
this.rightNode.active = true
}
this.setPic(this.picNode, this.data[0])
this.dataLabel.string = (this.curPage + 1) + '/' + this.data.length
},
curPage: null,
onClickRight() {
if (!this._cantouch) {
return;
}
this.curPage += 1
if (this.curPage == 1) {
this.leftNode.active = true
this.leftNode.children[0].active = true
this.leftNode.children[1].active = false
this.leftNode.scale = 1
}
if (this.curPage == this.data.length - 1) {
this.rightNode.active = false
}
this.leftMove()
cc.audioEngine.play(this.clips[0], false, 0.5)
},
onClickLeft() {
if (!this._cantouch) {
return;
}
this.curPage -= 1
if (this.curPage == 0) {
this.leftNode.active = false
}
if (this.curPage == this.data.length - 2) {
this.rightNode.active = true
this.rightNode.children[0].active = true
this.rightNode.children[1].active = false
this.rightNode.scale = 1
}
this.rightMove()
cc.audioEngine.play(this.clips[0], false, 0.8)
},
onClickAudio() {
if (!this._cantouch) return
let data = this.data[this.curPage]
if (!data || !data.audio_url || data.audio_url == '') {
if (this.curPage == this.data.length - 1) {
this.showFire()
}
console.log('数据错误')
return
}
this.stopAudio()
cc.assetManager.loadRemote(data.audio_url, (err, audioClip) => {
this.audioId = cc.audioEngine.play(audioClip, false, 0.8);
this.playAnim.play('playAudio')
cc.audioEngine.setFinishCallback(this.audioId, () => {
this.audioId = null
this.playAnim.play('stopAudio')
if (this.curPage == this.data.length - 1) {
this.showFire()
}
});
});
},
stopAudio() {
if (this.audioId != null) {
cc.audioEngine.stop(this.audioId)
this.playAnim.node.opacity != 0 && this.playAnim.play('stopAudio')
this.audioId = null
}
},
onClickRotate() {
this._cantouch = false
let btn = this.picNode.getComponent(cc.Button)
btn.enabled =false
cc.Tween.stopAllByTarget(this.picNode)
cc.tween(this.picNode).to(0.4, { scaleX: 0 }).call(() => {
if (this.front) {
this.setTxt(this.picNode, this.data[this.curPage])
} else {
this.setPic(this.picNode, this.data[this.curPage])
}
this.front = !this.front
}).to(0.4, { scaleX: 1 }).call(() => {
this._cantouch = true
btn.enabled =true
}).start()
cc.audioEngine.play(this.clips[3], false)
},
fired: false,
showFire() {
return
if (this.fired) return
this.fired = true
this.showAllFirework(cc.find("Canvas"), cc.find("paperBase").children)
cc.audioEngine.play(this.clips[2], false)
},
// onClickReplay() {
// if (!this._cantouch) return
// this.stopAudio()
// this.rightNode.active = true
// this.leftNode.active = false
// this.data.sort((a, b) => -0.5 + Math.random())
// this._cantouch = false
// cc.tween(this.TopBoxNode).to(0.4, { opacity: 0 }).start()
// cc.tween(this.picNode).to(0.4, { opacity: 0 }).start()
// this.replayAnim.play().wrapMode = cc.WrapMode.Reverse
// this.replayAnim.once(cc.Animation.EventType.FINISHED, () => {
// this.initPic()
// this._cantouch = true
// })
// cc.audioEngine.play(this.clips[1], false, 0.5)
// // 游戏结束时需要调用这个方法通知系统作业完成
// onHomeworkFinish();
// },
/** 音频id */
audioId: null,
/** 左移动 */
leftMove() {
this.stopAudio()
this._cantouch = false;
let width = cc.winSize.width
this.picNode.x = 0
this.picTempNode.x = width
this.front = true
this.setPic(this.picTempNode, this.data[this.curPage])
cc.tween(this.picNode)
.to(1, { x: -width }, { easing: 'cubicInOut' })
.start();
cc.tween(this.picTempNode)
.to(1, { x: 0 }, { easing: 'cubicInOut' })
.call(() => {
let temp = this.picNode
this.picNode = this.picTempNode
this.picTempNode = temp
this.dataLabel.string = (this.curPage + 1) + '/' + this.data.length
if (this.curPage == this.data.length - 1) {
this._cantouch = true
// 游戏结束时需要调用这个方法通知系统作业完成
if (typeof (onHomeworkFinish) != "undefined") {
onHomeworkFinish();
}
} else {
this._cantouch = true;
}
})
.start();
},
/** 右移动 */
rightMove() {
this.stopAudio()
this._cantouch = false;
let width = cc.winSize.width
this.picNode.x = 0
this.picTempNode.x = -width
this.front = true
this.setPic(this.picTempNode, this.data[this.curPage])
cc.tween(this.picNode)
.to(1, { x: width }, { easing: 'cubicInOut' })
.start();
cc.tween(this.picTempNode)
.to(1, { x: 0 }, { easing: 'cubicInOut' })
.call(() => {
let temp = this.picNode
this.picNode = this.picTempNode
this.picTempNode = temp
this.dataLabel.string = (this.curPage + 1) + '/' + this.data.length
this._cantouch = true
})
.start();
},
/** 设置图片 */
setPic(picNode, data) {
if (!data) {
console.log('数据错误')
return
}
picNode.children[4].getComponent(cc.Label).string = ''
let sprite = picNode.children[2].getComponent(cc.Sprite)
this.getSpriteFrimeByUrl(data.pic_url, (sp) => {
let rect = sp.getRect()
let scale = rect.width / rect.height
let originScale = 65 / 41
if (scale < originScale) {
let width = rect.width / (rect.height / 410)
picNode.width = width + 30
picNode.height = 440
} else if (scale > originScale) {
let height = rect.height / (rect.width / 650)
picNode.height = height + 30
picNode.width = 680
} else {
picNode.width = 680
picNode.height = 440
}
sprite.spriteFrame = sp
let child = picNode.children[5]
child.x = (picNode.width - child.width) / 2
child.y = -(picNode.height - child.height) / 2
picNode.scaleY =1
})
},
/** 设置txt */
setTxt(picNode, data) {
if (!data) {
console.log('数据错误')
return
}
picNode.height = 410
picNode.width = 650
picNode.children[4].getComponent(cc.Label).string = data.txt
picNode.children[2].getComponent(cc.Sprite).spriteFrame = null
picNode.children[5].x = 273.5
picNode.children[5].y = -178
picNode.scaleY =1
},
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();
});
}
});
}
},
// ------------------------------------------
async showAllFirework(parentNode, nodeList) {
for (let i = 0; i < 6; i++) {
this.showFirework(cc.v2(0, -parentNode.height / 2), parentNode, nodeList, parentNode.width * 2 / 3, parentNode.height * 1.3);
await asyncDelay(0.1);
}
},
showFirework(pos, parentNode, nodeList, width = 200, height = 200, number = 30) {
for (let i = 0; i < number; i++) {
const quad = this.createQuads(pos, parentNode, nodeList);
const targetX = RandomInt(width / 2, -width / 2);
const targetY = RandomInt(height);
cc.tween(quad)
.by(0.5, { x: targetX })
.by(3, { x: targetX * 2 })
.start();
cc.tween(quad)
.by(0.5, { y: targetY }, { easing: 'quadOut' })
.to(4, { y: -parentNode.height * 2 }, { easing: 'quadIn' })
.removeSelf()
.start();
cc.tween(quad)
.delay(1)
.to(1.5, { opacity: 0 })
.start();
}
},
createQuads(pos, parentNode, nodeList) {
const quadBase = cc.instantiate(nodeList[RandomInt(nodeList.length)]);
quadBase.x = pos.x;
quadBase.y = pos.y;
quadBase.z = pos.z;
quadBase.angle = RandomInt(180);
quadBase.parent = parentNode;
const quad = quadBase.getChildByName('quad');
quad.x = 0;
quad.y = 0;
quad.angle = RandomInt(180);
const paper = quad.getChildByName('paper');
paper.scaleX = Math.random() * 0.5 + 0.5;
paper.scaleY = Math.random() * 0.5 + 0.5;
quadBase.scaleX = Math.random();
cc.tween(quadBase)
.to((1 - quadBase.scaleX) * 0.3, { scaleX: 1 })
.call(() => {
const time = Math.random() * 0.2;
cc.tween(quadBase)
.to(0.1 + time, { scaleX: -1 })
.to(0.1 + time, { scaleX: 1 })
.union()
.repeatForever()
.start();
})
.start();
return quadBase;
}
});
{ {
"ver": "1.0.8", "ver": "1.0.8",
"uuid": "f8b451ff-857c-4ca8-9870-866bc5154a29", "uuid": "f0d56990-49cd-42a5-aa21-fc14e246a198",
"isPlugin": false, "isPlugin": false,
"loadPluginInWeb": true, "loadPluginInWeb": true,
"loadPluginInNative": true, "loadPluginInNative": true,
......
// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.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 { ccclass, property } = cc._decorator;
export default class NewClass extends cc.Component {
label = null;
text = 'hello';
// LIFE-CYCLE CALLBACKS:
// onLoad () {}
start() {
cc.color()
this.node.off(cc.Node.EventType.MOUSE_DOWN)
}
// update (dt) {}
onEnable() {
let one = new cc.Animation()
one.currentClip.speed
one.play().wrapMode
one.defaultClip.wrapMode = cc.WrapMode.Reverse
cc.Node.EventType.MOUSE_LEAVE
cc.tween(this.node).to(1,{opacity:1}).to
}
}
{ {
"ver": "1.0.8", "ver": "1.0.8",
"uuid": "408a67f8-65fa-4cf1-8cf2-83e20e1a0fd5", "uuid": "81db3e2c-d815-4891-a77d-5651d54dc92d",
"isPlugin": false, "isPlugin": false,
"loadPluginInWeb": true, "loadPluginInWeb": true,
"loadPluginInNative": true, "loadPluginInNative": true,
......
...@@ -5,8 +5,6 @@ ...@@ -5,8 +5,6 @@
* 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";
......
...@@ -165,7 +165,7 @@ export function getSprNodeByUrl(url, cb) { ...@@ -165,7 +165,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); const audioId = cc.audioEngine.playEffect(audioClip, false, 0.8);
if (cb) { if (cb) {
cc.audioEngine.setFinishCallback(audioId, () => { cc.audioEngine.setFinishCallback(audioId, () => {
cb(); cb();
...@@ -178,7 +178,7 @@ export async function asyncDelay(time) { ...@@ -178,7 +178,7 @@ export async function asyncDelay(time) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
try { try {
setTimeout(() => { setTimeout(() => {
resolve(null); resolve();
}, time * 1000); }, time * 1000);
} catch (e) { } catch (e) {
reject(e); reject(e);
...@@ -296,7 +296,7 @@ export async function asyncTweenTo(node, duration, obj, ease = undefined) { ...@@ -296,7 +296,7 @@ export async function asyncTweenTo(node, duration, obj, ease = undefined) {
cc.tween(node) cc.tween(node)
.to(duration, obj, ease) .to(duration, obj, ease)
.call(() => { .call(() => {
resolve(null); resolve();
}) })
.start(); .start();
} catch (e) { } catch (e) {
...@@ -311,7 +311,7 @@ export async function asyncTweenBy(node, duration, obj, ease = undefined) { ...@@ -311,7 +311,7 @@ export async function asyncTweenBy(node, duration, obj, ease = undefined) {
cc.tween(node) cc.tween(node)
.by(duration, obj, ease) .by(duration, obj, ease)
.call(() => { .call(() => {
resolve(null); resolve();
}) })
.start(); .start();
} catch (e) { } catch (e) {
...@@ -348,7 +348,6 @@ export function onHomeworkFinish() { ...@@ -348,7 +348,6 @@ export function onHomeworkFinish() {
if (middleLayerComponent.role == 'student') { if (middleLayerComponent.role == 'student') {
middleLayerComponent.onHomeworkFinish(() => { }); middleLayerComponent.onHomeworkFinish(() => { });
} }
} else { return;
console.log('onHomeworkFinish');
} }
} }
\ No newline at end of file
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "9a79969a-0506-48d4-bc98-3c05d109b027", "uuid": "5bd403c0-9676-4b25-8b82-b8bba1f11db1",
"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": 29,
"height": 67, "height": 29,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"btn_left": { "Img_paper": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "ce19457d-e8f3-4c38-ae3e-d4b99208ddb5", "uuid": "9b6f7e88-adc2-446f-b791-1259c116637c",
"rawTextureUuid": "9a79969a-0506-48d4-bc98-3c05d109b027", "rawTextureUuid": "5bd403c0-9676-4b25-8b82-b8bba1f11db1",
"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": 29,
"height": 67, "height": 29,
"rawWidth": 61, "rawWidth": 29,
"rawHeight": 67, "rawHeight": 29,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
{
"ver": "1.1.2",
"uuid": "5c3defd2-5c4e-4dfb-9d8f-162d47db79fb",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "15402e1f-77bc-4ddd-bec3-26645d8edf4c",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": true,
"genMipmaps": false,
"packable": true,
"width": 650,
"height": 410,
"platformSettings": {},
"subMetas": {
"13151616148416-pic-hd": {
"ver": "1.0.4",
"uuid": "ff5b5f1e-9620-496d-ba6a-0ab6f517fc3b",
"rawTextureUuid": "15402e1f-77bc-4ddd-bec3-26645d8edf4c",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 650,
"height": 410,
"rawWidth": 650,
"rawHeight": 410,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "2f69f1e0-da46-41db-a404-01b002ca417d",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "point",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 103,
"height": 53,
"platformSettings": {},
"subMetas": {
"Combined Shape": {
"ver": "1.0.4",
"uuid": "c8cf8408-3dfb-4c8b-88ce-d5c9c79491df",
"rawTextureUuid": "2f69f1e0-da46-41db-a404-01b002ca417d",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 103,
"height": 53,
"rawWidth": 103,
"rawHeight": 53,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 24,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "666097fd-038d-4b7b-a2b7-2d03389d4d71",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "point",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 60,
"height": 40,
"platformSettings": {},
"subMetas": {
"Group": {
"ver": "1.0.4",
"uuid": "5dbb6b29-69be-4805-b8d9-e63ebeca90ef",
"rawTextureUuid": "666097fd-038d-4b7b-a2b7-2d03389d4d71",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 60,
"height": 40,
"rawWidth": 60,
"rawHeight": 40,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "e1b4d971-9876-4832-803a-5a321964a78b", "uuid": "8a58b9d4-3aa5-47d6-840e-041c6e6d879a",
"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": 1280, "width": 1169,
"height": 720, "height": 181,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"bg": { "Oval 3": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "8288e3d4-4c75-4b27-8f01-f7014417f4dd", "uuid": "10857084-2da5-4659-acfb-41ff9460726e",
"rawTextureUuid": "e1b4d971-9876-4832-803a-5a321964a78b", "rawTextureUuid": "8a58b9d4-3aa5-47d6-840e-041c6e6d879a",
"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": 1280, "width": 1169,
"height": 720, "height": 181,
"rawWidth": 1280, "rawWidth": 1169,
"rawHeight": 720, "rawHeight": 181,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "efa5fa09-a4dd-4bfc-ab7e-17c19f85408f", "uuid": "498a8cdd-ce1a-4651-9ba3-d3701c34a4a1",
"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": 273,
"height": 336, "height": 495,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"1orange": { "Oval Copy": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "43d1e79d-6de8-4dcb-b8ce-d767df7913aa", "uuid": "45224f1d-8ab0-4850-b5ae-a6477ed21c31",
"rawTextureUuid": "efa5fa09-a4dd-4bfc-ab7e-17c19f85408f", "rawTextureUuid": "498a8cdd-ce1a-4651-9ba3-d3701c34a4a1",
"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": 273,
"height": 335, "height": 495,
"rawWidth": 366, "rawWidth": 273,
"rawHeight": 336, "rawHeight": 495,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "d582359e-924e-4ee9-9964-1fc4bb417e71", "uuid": "cf462678-5a56-4c63-b244-9679bc88818a",
"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": 227,
"height": 67, "height": 218,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"btn_right": { "Path 2 Copy": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "e5a2dbaa-a677-4a32-90d7-a1b057d7fb59", "uuid": "e668056f-ac84-44f3-83b6-182916ceb26d",
"rawTextureUuid": "d582359e-924e-4ee9-9964-1fc4bb417e71", "rawTextureUuid": "cf462678-5a56-4c63-b244-9679bc88818a",
"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": 227,
"height": 66, "height": 218,
"rawWidth": 61, "rawWidth": 227,
"rawHeight": 67, "rawHeight": 218,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
{
"ver": "2.3.5",
"uuid": "fd138167-3ea2-4f2b-8a88-94e740152531",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": true,
"genMipmaps": false,
"packable": true,
"width": 496,
"height": 128,
"platformSettings": {},
"subMetas": {
"Rectangle 16@2x": {
"ver": "1.0.4",
"uuid": "a23efbdd-1b8a-453b-9b4e-4cb497c2c156",
"rawTextureUuid": "fd138167-3ea2-4f2b-8a88-94e740152531",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 496,
"height": 128,
"rawWidth": 496,
"rawHeight": 128,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "8fd6793f-f6a5-405e-a7c7-5252ad5d2c4c",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "point",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 112,
"height": 200,
"platformSettings": {},
"subMetas": {
"combined-shape-copy": {
"ver": "1.0.4",
"uuid": "43c1a202-7dcd-4194-8735-e7de697fbd4d",
"rawTextureUuid": "8fd6793f-f6a5-405e-a7c7-5252ad5d2c4c",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 112,
"height": 200,
"rawWidth": 112,
"rawHeight": 200,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "f7acb24a-a689-447b-ab7a-77298dd12925",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "point",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 158,
"height": 300,
"platformSettings": {},
"subMetas": {
"combined-shape": {
"ver": "1.0.4",
"uuid": "94ecff79-76d6-4a97-ac9a-e12659d4a734",
"rawTextureUuid": "f7acb24a-a689-447b-ab7a-77298dd12925",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 158,
"height": 300,
"rawWidth": 158,
"rawHeight": 300,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "18d07592-51a9-421e-8972-0f67b68d29e1", "uuid": "1daf3640-7cb1-4325-bc28-79539c156772",
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": true,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 144, "width": 204,
"height": 144, "height": 204,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"icon": { "leftArrow": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "6fbc30a8-3c49-44ae-8ba4-7f56f385b78a", "uuid": "1f0f0214-63c0-4c73-b762-40578a0d92d8",
"rawTextureUuid": "18d07592-51a9-421e-8972-0f67b68d29e1", "rawTextureUuid": "1daf3640-7cb1-4325-bc28-79539c156772",
"trimType": "auto", "trimType": "auto",
"trimThreshold": 1, "trimThreshold": 1,
"rotated": false, "rotated": false,
"offsetX": 0, "offsetX": 0,
"offsetY": -0.5, "offsetY": 0,
"trimX": 3, "trimX": 1,
"trimY": 2, "trimY": 1,
"width": 138, "width": 202,
"height": 141, "height": 202,
"rawWidth": 144, "rawWidth": 204,
"rawHeight": 144, "rawHeight": 204,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
{
"ver": "2.3.5",
"uuid": "6e988f8e-9206-4ec6-a699-768212d529e4",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": true,
"genMipmaps": false,
"packable": true,
"width": 236,
"height": 236,
"platformSettings": {},
"subMetas": {
"leftArrow_0": {
"ver": "1.0.4",
"uuid": "3e5ace3d-9885-498b-964f-3a8a4291131d",
"rawTextureUuid": "6e988f8e-9206-4ec6-a699-768212d529e4",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 1,
"trimY": 1,
"width": 234,
"height": 234,
"rawWidth": 236,
"rawHeight": 236,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "3ceb8adb-e6ef-43f6-a3b0-fa467c3fcc66",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "point",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 680,
"height": 440,
"platformSettings": {},
"subMetas": {
"mask": {
"ver": "1.0.4",
"uuid": "72b076e2-55dd-4f87-8086-a3489c1d30ab",
"rawTextureUuid": "3ceb8adb-e6ef-43f6-a3b0-fa467c3fcc66",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 680,
"height": 440,
"rawWidth": 680,
"rawHeight": 440,
"borderTop": 30,
"borderBottom": 30,
"borderLeft": 30,
"borderRight": 30,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "6203ebeb-8b8a-479d-b7a4-e9d324e9e03f",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": true,
"genMipmaps": false,
"packable": true,
"width": 679,
"height": 453,
"platformSettings": {},
"subMetas": {
"mask_shader": {
"ver": "1.0.4",
"uuid": "f5322b3d-0897-4985-9b49-56b4bfd27767",
"rawTextureUuid": "6203ebeb-8b8a-479d-b7a4-e9d324e9e03f",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 679,
"height": 453,
"rawWidth": 679,
"rawHeight": 453,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "69bc9685-6566-471a-85e0-7891fa79d248",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": true,
"genMipmaps": false,
"packable": true,
"width": 203,
"height": 82,
"platformSettings": {},
"subMetas": {
"rectangle-13": {
"ver": "1.0.4",
"uuid": "bd9469ad-a64d-42e0-9d02-99e5d1bbb88e",
"rawTextureUuid": "69bc9685-6566-471a-85e0-7891fa79d248",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 203,
"height": 82,
"rawWidth": 203,
"rawHeight": 82,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "eec8aebd-20a5-47b5-9347-0bb8113db99b",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "point",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 191,
"height": 54,
"platformSettings": {},
"subMetas": {
"rectangle": {
"ver": "1.0.4",
"uuid": "e8547d04-51ef-4822-8872-b595f931b7db",
"rawTextureUuid": "eec8aebd-20a5-47b5-9347-0bb8113db99b",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 191,
"height": 54,
"rawWidth": 191,
"rawHeight": 54,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "a4a9dfcb-58f9-4b34-9654-5b0427f6cfd3",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": true,
"genMipmaps": false,
"packable": true,
"width": 117,
"height": 36,
"platformSettings": {},
"subMetas": {
"replay": {
"ver": "1.0.4",
"uuid": "6cb4f36a-95c0-42f1-a28a-707076bf9203",
"rawTextureUuid": "a4a9dfcb-58f9-4b34-9654-5b0427f6cfd3",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 117,
"height": 36,
"rawWidth": 117,
"rawHeight": 36,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "7bab5dc8-8e49-471f-97d3-4bbbd246a2dd",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": true,
"genMipmaps": false,
"packable": true,
"width": 204,
"height": 204,
"platformSettings": {},
"subMetas": {
"rightArrow": {
"ver": "1.0.4",
"uuid": "2c3e2369-ad6e-489b-bec4-c90bcbdaf524",
"rawTextureUuid": "7bab5dc8-8e49-471f-97d3-4bbbd246a2dd",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 1,
"trimY": 1,
"width": 202,
"height": 202,
"rawWidth": 204,
"rawHeight": 204,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "8554f634-9ea8-4ed5-b8c0-006645f3cd6a",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": true,
"genMipmaps": false,
"packable": true,
"width": 236,
"height": 236,
"platformSettings": {},
"subMetas": {
"rightArrow_0": {
"ver": "1.0.4",
"uuid": "179191dd-d294-4ac7-af59-33249601ffa3",
"rawTextureUuid": "8554f634-9ea8-4ed5-b8c0-006645f3cd6a",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 1,
"trimY": 1,
"width": 234,
"height": 234,
"rawWidth": 236,
"rawHeight": 236,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
[
{
"__type__": "cc.SceneAsset",
"_name": "",
"_objFlags": 0,
"_native": "",
"scene": {
"__id__": 1
}
},
{
"__type__": "cc.Scene",
"_objFlags": 0,
"_parent": null,
"_children": [
{
"__id__": 2
}
],
"_active": false,
"_components": [],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_is3DNode": true,
"_groupIndex": 0,
"groupIndex": 0,
"autoReleaseAssets": true,
"_id": "0737ce42-24f0-45c6-8e1a-8bdab4f74ba3"
},
{
"__type__": "cc.Node",
"_name": "Canvas",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 3
},
{
"__id__": 5
},
{
"__id__": 7
},
{
"__id__": 14
}
],
"_active": true,
"_components": [
{
"__id__": 24
},
{
"__id__": 25
},
{
"__id__": 26
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1280,
"height": 720
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
640,
360,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "a5esZu+45LA5mBpvttspPD"
},
{
"__type__": "cc.Node",
"_name": "Main Camera",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 4
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1280,
"height": 720
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
362.85545494732423,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "e1WoFrQ79G7r4ZuQE3HlNb"
},
{
"__type__": "cc.Camera",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 3
},
"_enabled": true,
"_cullingMask": 4294967295,
"_clearFlags": 7,
"_backgroundColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_depth": -1,
"_zoomRatio": 1,
"_targetTexture": null,
"_fov": 60,
"_orthoSize": 10,
"_nearClip": 1,
"_farClip": 4096,
"_ortho": true,
"_rect": {
"__type__": "cc.Rect",
"x": 0,
"y": 0,
"width": 1,
"height": 1
},
"_renderStages": 1,
"_alignWithScreen": true,
"_id": "81GN3uXINKVLeW4+iKSlim"
},
{
"__type__": "cc.Node",
"_name": "bg",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 6
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1280,
"height": 720
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "32MJMZ2HRGF4BOf533Avyi"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "8288e3d4-4c75-4b27-8f01-f7014417f4dd"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "97/S6HDq9MeqgmV1Zwnhbb"
},
{
"__type__": "cc.Node",
"_name": "bottomPart",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [
{
"__id__": 8
},
{
"__id__": 11
}
],
"_active": true,
"_components": [],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
635.132,
-356.326,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "8c7k8ep/ZFNpO263+1QHz9"
},
{
"__type__": "cc.Node",
"_name": "btn_left",
"_objFlags": 0,
"_parent": {
"__id__": 7
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 9
},
{
"__id__": 10
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 61,
"height": 67
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-148.464,
34,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "5ad2wLQLxIN5Eg7OHecSH6"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 8
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "ce19457d-e8f3-4c38-ae3e-d4b99208ddb5"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "84mqOgJ3JNqZrYVTEU8CjE"
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 8
},
"_enabled": true,
"_normalMaterial": null,
"_grayMaterial": null,
"duration": 0.1,
"zoomScale": 1.2,
"clickEvents": [],
"_N$interactable": true,
"_N$enableAutoGrayEffect": false,
"_N$transition": 0,
"transition": 0,
"_N$normalColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"_N$hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$disabledColor": {
"__type__": "cc.Color",
"r": 124,
"g": 124,
"b": 124,
"a": 255
},
"_N$normalSprite": null,
"_N$pressedSprite": null,
"pressedSprite": null,
"_N$hoverSprite": null,
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": null,
"_id": "bcYN/4EKBJhbIAfovo9Ah1"
},
{
"__type__": "cc.Node",
"_name": "btn_right",
"_objFlags": 0,
"_parent": {
"__id__": 7
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 12
},
{
"__id__": 13
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 60,
"height": 66
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-47.164,
34,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "46i3stdzpHX6zQHTGnRsNE"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 11
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "e5a2dbaa-a677-4a32-90d7-a1b057d7fb59"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "42Sh8QS/BHn4WiGyPQPKPt"
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 11
},
"_enabled": true,
"_normalMaterial": null,
"_grayMaterial": null,
"duration": 0.1,
"zoomScale": 1.2,
"clickEvents": [],
"_N$interactable": true,
"_N$enableAutoGrayEffect": false,
"_N$transition": 0,
"transition": 0,
"_N$normalColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"_N$hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$disabledColor": {
"__type__": "cc.Color",
"r": 124,
"g": 124,
"b": 124,
"a": 255
},
"_N$normalSprite": null,
"_N$pressedSprite": null,
"pressedSprite": null,
"_N$hoverSprite": null,
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": null,
"_id": "1aj32fYY1IxLesa77E70Qu"
},
{
"__type__": "cc.Node",
"_name": "res",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [
{
"__id__": 15
},
{
"__id__": 18
},
{
"__id__": 21
}
],
"_active": false,
"_components": [],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "0aAzbH6R1E+6AmGRrkKa5O"
},
{
"__type__": "cc.Node",
"_name": "font",
"_objFlags": 0,
"_parent": {
"__id__": 14
},
"_children": [
{
"__id__": 16
}
],
"_active": true,
"_components": [],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "9bLfcYeeNKrr524vzWchiM"
},
{
"__type__": "cc.Node",
"_name": "BRLNSDB",
"_objFlags": 0,
"_parent": {
"__id__": 15
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 17
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "cfMLGsq0BMhJARv+ySMAxS"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 16
},
"_enabled": true,
"_materials": [],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "",
"_N$string": "",
"_fontSize": 40,
"_lineHeight": 40,
"_enableWrapText": true,
"_N$file": {
"__uuid__": "c551970e-b095-45f3-9f1d-25cde8b8deb1"
},
"_isSystemFontUsed": false,
"_spacingX": 0,
"_batchAsBitmap": false,
"_styleFlags": 0,
"_underlineHeight": 0,
"_N$horizontalAlign": 0,
"_N$verticalAlign": 0,
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$cacheMode": 0,
"_id": "9bNHNPu5lC7rQYyr8ai/sY"
},
{
"__type__": "cc.Node",
"_name": "img",
"_objFlags": 0,
"_parent": {
"__id__": 14
},
"_children": [
{
"__id__": 19
}
],
"_active": true,
"_components": [],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "53LUHHG2pEr79fyrvazXJs"
},
{
"__type__": "cc.Node",
"_name": "icon",
"_objFlags": 0,
"_parent": {
"__id__": 18
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 20
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 138,
"height": 141
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "1blU2OArJIfoC9XfupGxJG"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 19
},
"_enabled": true,
"_materials": [],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "6fbc30a8-3c49-44ae-8ba4-7f56f385b78a"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "03GEWUEZJGyKormWgIWCtM"
},
{
"__type__": "cc.Node",
"_name": "audio",
"_objFlags": 0,
"_parent": {
"__id__": 14
},
"_children": [
{
"__id__": 22
}
],
"_active": true,
"_components": [],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "d9f+b0lmZGSJJae6zrADhp"
},
{
"__type__": "cc.Node",
"_name": "btn",
"_objFlags": 0,
"_parent": {
"__id__": 21
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 23
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "e87DSaFCVJfb2PAUkf4/o7"
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 22
},
"_enabled": true,
"_clip": {
"__uuid__": "f0680ae0-c079-45ef-abd7-9e63d90b982b"
},
"_volume": 1,
"_mute": false,
"_loop": false,
"_firstlyEnabled": true,
"playOnLoad": false,
"preload": false,
"_id": "dey05oKrBIspvsDa6pOIQz"
},
{
"__type__": "cc.Canvas",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_designResolution": {
"__type__": "cc.Size",
"width": 1280,
"height": 720
},
"_fitWidth": true,
"_fitHeight": true,
"_id": "59Cd0ovbdF4byw5sbjJDx7"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 45,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "29zXboiXFBKoIV4PQ2liTe"
},
{
"__type__": "408a6f4ZfpM8Yzyg+IOGg/V",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_id": "eaTVUpqahPfZeO9+sUI7RP"
}
]
\ 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);
});
})
}
}
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();
});
}
});
}
}
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
"compilerOptions": { "compilerOptions": {
"target": "es6", "target": "es6",
"module": "commonjs", "module": "commonjs",
"experimentalDecorators": true "experimentalDecorators": true,
"sourceMap": true
}, },
"exclude": [ "exclude": [
"node_modules", "node_modules",
......
...@@ -3,6 +3,6 @@ ...@@ -3,6 +3,6 @@
"packages": "packages", "packages": "packages",
"name": "play", "name": "play",
"id": "9af72fd2-44a6-4131-8ea3-3e1b3fa22231", "id": "9af72fd2-44a6-4131-8ea3-3e1b3fa22231",
"version": "2.4.5", "version": "2.4.4",
"isNew": false "isNew": false
} }
\ No newline at end of file
{ {
"title": "play", "title": "play",
"packageName": "org.cocos2d.demo", "packageName": "org.cocos2d.demo",
"startScene": "0737ce42-24f0-45c6-8e1a-8bdab4f74ba3", "startScene": "3134393d-e843-4095-94d8-dc1877aac390",
"excludeScenes": [], "excludeScenes": [],
"includeSDKBox": false, "includeSDKBox": false,
"orientation": { "orientation": {
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
"experimentalDecorators": true, "experimentalDecorators": true,
"skipLibCheck": true, "skipLibCheck": true,
"outDir": "temp/vscode-dist", "outDir": "temp/vscode-dist",
"allowJs": true,
"forceConsistentCasingInFileNames": true "forceConsistentCasingInFileNames": true
}, },
"exclude": [ "exclude": [
......
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