Commit 37bc2229 authored by 范雪寒's avatar 范雪寒

feat: homework

parent 73309607
......@@ -72,7 +72,7 @@ export function setSprNodeMaxLen(sprNode, maxW, maxH) {
export function getSpriteFrimeByUrl(url, cb) {
cc.loader.load({url}, (err, img) => {
cc.loader.load({ url }, (err, img) => {
const spriteFrame = new cc.SpriteFrame(img)
if (cb) {
cb(spriteFrame);
......@@ -100,8 +100,8 @@ export function getSprNodeByUrl(url, cb) {
export function playAudio(audioClip, cb=null) {
if (audioClip) {
export function playAudio(audioClip, cb = null) {
if (audioClip) {
const audioId = cc.audioEngine.playEffect(audioClip, false, 0.8);
if (cb) {
cc.audioEngine.setFinishCallback(audioId, () => {
......@@ -110,16 +110,16 @@ export function playAudio(audioClip, cb=null) {
}
return audioId;
}
}
}
export function playAudioByUrl(audio_url, cb=null) {
if (audio_url) {
cc.assetManager.loadRemote(audio_url, (err, audioClip) => {
export function playAudioByUrl(audio_url, cb = null) {
if (audio_url) {
cc.assetManager.loadRemote(audio_url, (err, audioClip) => {
playAudio(audioClip, cb);
});
}
});
}
}
......@@ -295,7 +295,7 @@ export function showTrebleFirework(baseNode, rabbonList) {
export function delayCall(time, cb) {
return cc.tween({})
.delay(time)
.delay(time)
.call(() => {
if (cb) {
cb();
......@@ -314,12 +314,12 @@ export function removeFromArr(arr, item) {
}
export function showBtnAnima(btn, cb=null) {
export function showBtnAnima(btn, cb = null) {
const baseS = btn.scale;
cc.tween(btn)
.to(0.05, {scale: 0.9 * baseS})
.to(0.05, {scale: 1 * baseS})
.to(0.05, { scale: 0.9 * baseS })
.to(0.05, { scale: 1 * baseS })
.call(() => {
if (cb) {
cb();
......@@ -332,11 +332,11 @@ export function jellyShake(node) {
const baseS = node.scale;
const time = 1;
cc.tween(node)
.to(time / 5 / 2, {scaleX: baseS * 0.8, scaleY: baseS * 1.2}, {easing: "sineInOut"})
.to(time / 5, {scaleX: baseS * 1.1, scaleY: baseS * 0.9}, {easing: "sineInOut"})
.to(time / 5, {scaleX: baseS * 0.95, scaleY: baseS * 1.15}, {easing: "sineInOut"})
.to(time / 5, {scaleX: baseS * 1.02, scaleY: baseS * 0.98}, {easing: "sineInOut"})
.to(time / 5, {scaleX: baseS * 1, scaleY: baseS * 1}, {easing: "sineInOut"})
.to(time / 5 / 2, { scaleX: baseS * 0.8, scaleY: baseS * 1.2 }, { easing: "sineInOut" })
.to(time / 5, { scaleX: baseS * 1.1, scaleY: baseS * 0.9 }, { easing: "sineInOut" })
.to(time / 5, { scaleX: baseS * 0.95, scaleY: baseS * 1.15 }, { easing: "sineInOut" })
.to(time / 5, { scaleX: baseS * 1.02, scaleY: baseS * 0.98 }, { easing: "sineInOut" })
.to(time / 5, { scaleX: baseS * 1, scaleY: baseS * 1 }, { easing: "sineInOut" })
.start();
}
......@@ -345,9 +345,7 @@ export function onHomeworkFinish() {
const middleLayer = cc.find('middleLayer');
if (middleLayer) {
const middleLayerComponent = middleLayer.getComponent('middleLayer');
if (middleLayerComponent.role == 'student') {
middleLayerComponent.onHomeworkFinish(() => { });
}
middleLayerComponent.onHomeworkFinish(() => { });
return;
}
}
\ No newline at end of file
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