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

feat: homework

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