Commit d1cbf2c1 authored by limingzhe's avatar limingzhe

fix: debug

parent 22dab672
No preview for this file type
...@@ -447,7 +447,7 @@ ...@@ -447,7 +447,7 @@
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
} }
], ],
"_srcBlendFactor": 770, "_srcBlendFactor": 1,
"_dstBlendFactor": 771, "_dstBlendFactor": 771,
"_spriteFrame": { "_spriteFrame": {
"__uuid__": "bbc0c425-e225-4ca1-8856-8e92a7bf7b7c" "__uuid__": "bbc0c425-e225-4ca1-8856-8e92a7bf7b7c"
...@@ -541,7 +541,7 @@ ...@@ -541,7 +541,7 @@
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
} }
], ],
"_srcBlendFactor": 770, "_srcBlendFactor": 1,
"_dstBlendFactor": 771, "_dstBlendFactor": 771,
"_spriteFrame": { "_spriteFrame": {
"__uuid__": "ce9855f3-2ba9-4e0e-becb-01fc0ea67b37" "__uuid__": "ce9855f3-2ba9-4e0e-becb-01fc0ea67b37"
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html // - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
// import { getSprNode } from "./util"; // import { getSprNode } from "./util";
import { getSprNode, playAudioByUrl, getScaleRateBy2Node, localPosTolocalPos, randomSortByArr, loadDragonBones, playAudio, showTrebleFirework, delayCall, removeFromArr, showBtnAnima, asyncDelay, RandomInt, jellyShake, getSprNodeByUrl} from "./util_JJ_Game_11"; import { getSprNode, playAudioByUrl, getScaleRateBy2Node, localPosTolocalPos, randomSortByArr, loadDragonBones, playAudio, showTrebleFirework, delayCall, removeFromArr, showBtnAnima, asyncDelay, RandomInt, jellyShake, getSprNodeByUrl, onHomeworkFinish} from "./util_JJ_Game_11";
cc.Class({ cc.Class({
extends: cc.Component, extends: cc.Component,
...@@ -151,6 +151,8 @@ cc.Class({ ...@@ -151,6 +151,8 @@ cc.Class({
}, },
getDefaultData() { getDefaultData() {
return {"contentObj":{"picArr":[{"pic_url":"http://staging-teach.cdn.ireadabc.com/d85807707eb160c82ffb4b03d3e61e8a.png","article":"aaaa"},{"pic_url":"http://staging-teach.cdn.ireadabc.com/a89555eee603cb808bc951ec3eaac592.png","article":"bbbb"},{"pic_url":"http://staging-teach.cdn.ireadabc.com/e1cccc2138b3db39825f0a5061ec8c7e.jpeg","article":"cccc"}]}}
const dataJson = '{ "contentObj": { "picArr": [ { "pic_url": "http://teach.cdn.ireadabc.com/a5c41f34559575ce7f9e340a2e458dc8.png", "article": "" } ] } }'; const dataJson = '{ "contentObj": { "picArr": [ { "pic_url": "http://teach.cdn.ireadabc.com/a5c41f34559575ce7f9e340a2e458dc8.png", "article": "" } ] } }';
const data1 = JSON.parse(dataJson); const data1 = JSON.parse(dataJson);
return data1; return data1;
...@@ -254,6 +256,7 @@ cc.Class({ ...@@ -254,6 +256,7 @@ cc.Class({
curPageIndex: null, curPageIndex: null,
stopPlayBgAudio: null, stopPlayBgAudio: null,
canTouch: null, canTouch: null,
finishData: null,
initData() { initData() {
...@@ -266,6 +269,8 @@ cc.Class({ ...@@ -266,6 +269,8 @@ cc.Class({
this.canvasWidth = this.canvas.width; this.canvasWidth = this.canvas.width;
this.canvasHeight = this.canvas.height; this.canvasHeight = this.canvas.height;
this.finishData = {};
this.initAudioEffect(); this.initAudioEffect();
}, },
...@@ -605,8 +610,30 @@ cc.Class({ ...@@ -605,8 +610,30 @@ cc.Class({
label.string = (this.curPageIndex + 1) + ' / ' + this.picArr.length; label.string = (this.curPageIndex + 1) + ' / ' + this.picArr.length;
this.showAudio(); this.showAudio();
this.finishData[this.curPageIndex.toString()] = true;
this.checkGameEnd();
}, },
isGameEnd:null,
checkGameEnd() {
if (this.isGameEnd) {
return;
}
// 获取finishData的长度
const finishLen = Object.keys(this.finishData).length;
console.log('end length: ', finishLen);
if (finishLen >= this.picArr.length) {
console.log('game end');
this.isGameEnd = true;
onHomeworkFinish();
}
},
showAudio() { showAudio() {
if (!this.stopPlayBgAudio) { if (!this.stopPlayBgAudio) {
this.playPageAudio(); this.playPageAudio();
......
...@@ -338,4 +338,15 @@ export function jellyShake(node) { ...@@ -338,4 +338,15 @@ export function jellyShake(node) {
.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();
}
export function onHomeworkFinish(data = "", callback = ()=>{}) {
const middleLayer = cc.find('middleLayer');
if (middleLayer) {
const middleLayerComponent = middleLayer.getComponent('middleLayer');
middleLayerComponent.onHomeworkFinish(callback, data);
} else {
console.log('onHomeworkFinish', JSON.stringify(data));
}
} }
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"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": 61, "width": 61,
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"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": 61, "width": 61,
......
...@@ -169,6 +169,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -169,6 +169,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
save() { save() {
(<any> window).courseware.setData(this.item, null, this.KEY); (<any> window).courseware.setData(this.item, null, this.KEY);
this.refresh(); this.refresh();
console.log(JSON.stringify(this.item));
} }
refresh() { refresh() {
......
...@@ -4,5 +4,6 @@ ...@@ -4,5 +4,6 @@
"name": "play", "name": "play",
"id": "9af72fd2-44a6-4131-8ea3-3e1b3fa22231", "id": "9af72fd2-44a6-4131-8ea3-3e1b3fa22231",
"version": "2.4.5", "version": "2.4.5",
"isNew": false "isNew": false,
"description": ""
} }
\ 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