Commit 04872986 authored by huoshizhe's avatar huoshizhe

fix: fixbugs

parent 1dcc0f9c
佳鑫、雪寒和明哲都是傻屌
\ No newline at end of file
...@@ -8,18 +8,22 @@ ...@@ -8,18 +8,22 @@
<div class="border" style="width: 520px;"> <div class="border" style="width: 520px;">
<span style="height: 30px; font-size: 18px;">正确字母:</span> <span style="height: 30px; font-size: 18px;">正确字母:</span>
<div> <div>
<div *ngFor="let rightWord of rightWordList; let i = index"> <div *ngFor="let rightWord of item.rightWordList; let i = index">
<div style="padding: 2px;"> <div style="padding: 2px;">
<input style="width: 150px;" type="text" nz-input [(ngModel)]="rightWord.word" (blur)="saveWordList()"> <input style="width: 150px;float: left;" type="text" nz-input [(ngModel)]="rightWord.word" (blur)="save()">
<button style="margin-left: 10px; height: 32px; color: red;" nz-button nzType="dashed" class="add-btn" <app-audio-recorder style="float: left;" [audioUrl]="rightWord.audio"
(click)="removeRightWord(i)"> (audioUploaded)="onRightAudioUploadSuccess($event, i)">
</app-audio-recorder>
<button style="float: right; margin-left: 10px; height: 32px; color: red;" nz-button nzType="dashed"
class="add-btn" (click)="removeRightWord(i)">
<i nz-icon nzType="minus-circle" nzTheme="outline"></i> <i nz-icon nzType="minus-circle" nzTheme="outline"></i>
删除字母 删除字母
</button> </button>
</div> </div>
<br> <br>
</div> </div>
</div> </div>
<div *ngIf="(rightWordList.length + wrongWordList.length < 5)"> <div *ngIf="(item.rightWordList.length +item.wrongWordList.length < 5)">
<button style="margin-left: 2px; margin-top: 2px; height: 32px;" nz-button nzType="dashed" class="add-btn" <button style="margin-left: 2px; margin-top: 2px; height: 32px;" nz-button nzType="dashed" class="add-btn"
(click)="addRightWord()"> (click)="addRightWord()">
<i nz-icon nzType="plus-circle" nzTheme="outline"></i> <i nz-icon nzType="plus-circle" nzTheme="outline"></i>
...@@ -31,18 +35,22 @@ ...@@ -31,18 +35,22 @@
<div class="border" style="width: 520px;"> <div class="border" style="width: 520px;">
<span style="height: 30px; font-size: 18px;">错误字母:</span> <span style="height: 30px; font-size: 18px;">错误字母:</span>
<div> <div>
<div *ngFor="let wrongWord of wrongWordList; let i = index"> <div *ngFor="let wrongWord of item.wrongWordList; let i = index">
<div style="padding: 2px;"> <div style="padding: 2px;">
<input style="width: 150px;" type="text" nz-input [(ngModel)]="wrongWord.word" (blur)="saveWordList()"> <input style="width: 150px;float: left;" type="text" nz-input [(ngModel)]="wrongWord.word" (blur)="save()">
<button style="margin-left: 10px; height: 32px; color: red;" nz-button nzType="dashed" class="add-btn" <app-audio-recorder style="float: left;" [audioUrl]="wrongWord.audio"
(click)="removeWrongWord(i)"> (audioUploaded)="onWrongAudioUploadSuccess($event, i)">
</app-audio-recorder>
<button style="float: right; margin-left: 10px; height: 32px; color: red;" nz-button nzType="dashed"
class="add-btn" (click)="removeWrongWord(i)">
<i nz-icon nzType="minus-circle" nzTheme="outline"></i> <i nz-icon nzType="minus-circle" nzTheme="outline"></i>
删除字母 删除字母
</button> </button>
</div> </div>
<br> <br>
</div> </div>
</div> </div>
<div *ngIf="(rightWordList.length + wrongWordList.length < 5)"> <div *ngIf="(item.rightWordList.length +item.wrongWordList.length < 5)">
<button style="margin-left: 2px; margin-top: 2px; height: 32px;" nz-button nzType="dashed" class="add-btn" <button style="margin-left: 2px; margin-top: 2px; height: 32px;" nz-button nzType="dashed" class="add-btn"
(click)="addWrongWord()"> (click)="addWrongWord()">
<i nz-icon nzType="plus-circle" nzTheme="outline"></i> <i nz-icon nzType="plus-circle" nzTheme="outline"></i>
......
...@@ -14,34 +14,27 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -14,34 +14,27 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
// 储存对象 // 储存对象
item; item;
rightWordList = [];
wrongWordList = [];
constructor(private appRef: ApplicationRef, private changeDetectorRef: ChangeDetectorRef) { constructor(private appRef: ApplicationRef, private changeDetectorRef: ChangeDetectorRef) {
} }
addRightWord() { addRightWord() {
this.item.rightWordList.push(''); this.item.rightWordList.push({ word: '', audio: '' });
this.loadWordList();
this.save(); this.save();
} }
removeRightWord(idx) { removeRightWord(idx) {
this.item.rightWordList.splice(idx, 1); this.item.rightWordList.splice(idx, 1);
this.loadWordList();
this.save(); this.save();
} }
addWrongWord() { addWrongWord() {
this.item.wrongWordList.push(''); this.item.wrongWordList.push({ word: '', audio: '' });
this.loadWordList();
this.save(); this.save();
} }
removeWrongWord(idx) { removeWrongWord(idx) {
this.item.wrongWordList.splice(idx, 1); this.item.wrongWordList.splice(idx, 1);
this.loadWordList();
this.save(); this.save();
} }
...@@ -60,8 +53,6 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -60,8 +53,6 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this.item = data; this.item = data;
} }
this.loadWordList();
this.init(); this.init();
this.changeDetectorRef.markForCheck(); this.changeDetectorRef.markForCheck();
this.changeDetectorRef.detectChanges(); this.changeDetectorRef.detectChanges();
...@@ -70,37 +61,12 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -70,37 +61,12 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
}, this.saveKey); }, this.saveKey);
} }
loadWordList() {
this.rightWordList = [];
this.wrongWordList = [];
if (this.item.rightWordList.length > 0) {
this.rightWordList = this.item.rightWordList.map(data => { return { word: data } });
}
if (this.item.wrongWordList.length > 0) {
this.wrongWordList = this.item.wrongWordList.map(data => { return { word: data } });
}
}
saveWordList() {
this.item.rightWordList = [];
this.item.wrongWordList = [];
if (this.rightWordList.length > 0) {
this.item.rightWordList = this.rightWordList.map(data => data.word);
}
if (this.wrongWordList.length > 0) {
this.item.wrongWordList = this.wrongWordList.map(data => data.word);
}
this.save();
}
ngOnChanges() { ngOnChanges() {
} }
ngOnDestroy() { ngOnDestroy() {
} }
init() { init() {
} }
...@@ -125,12 +91,23 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -125,12 +91,23 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this.save(); this.save();
} }
onRightAudioUploadSuccess(e, idx) {
this.item.rightWordList[idx].audio = e.url;
this.save();
}
onWrongAudioUploadSuccess(e, idx) {
this.item.wrongWordList[idx].audio = e.url;
this.save();
}
/** /**
* 储存数据 * 储存数据
*/ */
save() { save() {
(<any>window).courseware.setData(this.item, null, this.saveKey); (<any>window).courseware.setData(this.item, null, this.saveKey);
this.refresh(); this.refresh();
console.log('this.item = ' + JSON.stringify(this.item));
} }
/** /**
......
This diff is collapsed.
...@@ -38,6 +38,9 @@ cc.Class({ ...@@ -38,6 +38,9 @@ cc.Class({
}, },
start() { start() {
let winSize = cc.director.getWinSize();
console.log('winSize = ' + JSON.stringify(winSize));
this.data = defaultData; this.data = defaultData;
this.getData((data) => { this.getData((data) => {
if (data) { if (data) {
...@@ -68,6 +71,8 @@ cc.Class({ ...@@ -68,6 +71,8 @@ cc.Class({
addPreloadAudio() { addPreloadAudio() {
this._audioResList.push({ url: this.data.audio }); this._audioResList.push({ url: this.data.audio });
this._audioResList.push(...this.data.rightWordList.map(data => ({ url: data.audio })));
this._audioResList.push(...this.data.wrongWordList.map(data => ({ url: data.audio })));
}, },
preload() { preload() {
...@@ -125,7 +130,7 @@ cc.Class({ ...@@ -125,7 +130,7 @@ cc.Class({
} }
}, },
characterWalk(pos, speed = 1) { characterWalk(pos, speed = 1, changeActive = false) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const nodeCharacter = cc.find('Canvas/NodeCharacter'); const nodeCharacter = cc.find('Canvas/NodeCharacter');
nodeCharacter.stopAllActions(); nodeCharacter.stopAllActions();
...@@ -165,12 +170,14 @@ cc.Class({ ...@@ -165,12 +170,14 @@ cc.Class({
cc.tween(nodeCharacter) cc.tween(nodeCharacter)
.to(time * speed, { x: pos.x, y: pos.y }) .to(time * speed, { x: pos.x, y: pos.y })
.call(() => { .call(() => {
if (!changeActive) {
nodeCharacterUp.active = false; nodeCharacterUp.active = false;
nodeCharacterLeft.active = false; nodeCharacterLeft.active = false;
nodeCharacterRight.active = false; nodeCharacterRight.active = false;
nodeCharacterDown.active = false nodeCharacterDown.active = false
nodeCharacterFront.active = true; nodeCharacterFront.active = true;
}
resolve(); resolve();
}) })
...@@ -194,7 +201,7 @@ cc.Class({ ...@@ -194,7 +201,7 @@ cc.Class({
async showCakes() { async showCakes() {
const { rightWordList, wrongWordList } = this.data; const { rightWordList, wrongWordList } = this.data;
let wordList = randomSortByArr([...rightWordList, ...wrongWordList]); let wordList = randomSortByArr([...rightWordList.map(data => data.word), ...wrongWordList.map(data => data.word)]);
wordList.forEach((data, idx) => { wordList.forEach((data, idx) => {
let cakeNode = cc.instantiate(this.cakePrefab); let cakeNode = cc.instantiate(this.cakePrefab);
...@@ -215,6 +222,9 @@ cc.Class({ ...@@ -215,6 +222,9 @@ cc.Class({
cc.tween(cakeNode) cc.tween(cakeNode)
.to(0.1 * idx, { opacity: 255 }) .to(0.1 * idx, { opacity: 255 })
.to(0.5, { x: targetPos.x, y: targetPos.y }, { easing: 'cubicIn' }) .to(0.5, { x: targetPos.x, y: targetPos.y }, { easing: 'cubicIn' })
.call(() => {
this.playEffect('落地');
})
.start(); .start();
}); });
...@@ -265,7 +275,7 @@ cc.Class({ ...@@ -265,7 +275,7 @@ cc.Class({
checkCake(cakeNode) { checkCake(cakeNode) {
const word = cakeNode.getComponent('Cake').word; const word = cakeNode.getComponent('Cake').word;
if (this.data.rightWordList.findIndex(data => data == word) == -1) { if (this.data.rightWordList.findIndex(data => data.word == word) == -1) {
return false; return false;
} }
...@@ -295,7 +305,8 @@ cc.Class({ ...@@ -295,7 +305,8 @@ cc.Class({
hideNpc() { hideNpc() {
const nodeNpc = cc.find('Canvas/NodeNpc'); const nodeNpc = cc.find('Canvas/NodeNpc');
cc.tween(nodeNpc) cc.tween(nodeNpc)
.to(1, { y: nodeNpc.y + 100, opacity: 0 }) .by(1, { y: 350 })
.repeatForever()
.start(); .start();
}, },
...@@ -306,8 +317,10 @@ cc.Class({ ...@@ -306,8 +317,10 @@ cc.Class({
if (!cakeNode) { if (!cakeNode) {
continue; continue;
} }
// cakeNode.zIndex = 100;
cc.tween(cakeNode) cc.tween(cakeNode)
.to(1, { y: cakeNode.y + 100, opacity: 0 }) .by(1, { y: 350 })
.repeatForever()
.start(); .start();
} }
}, },
...@@ -344,9 +357,9 @@ cc.Class({ ...@@ -344,9 +357,9 @@ cc.Class({
openDoor() { openDoor() {
const delayTime = 2; const delayTime = 2;
const nodeDoor = cc.find('Canvas/NodeDoor'); const nodeDoor = cc.find('Canvas/NodeDoor');
const nodeWheel1 = cc.find('Canvas/NodeWheel1'); const nodeWheel1 = cc.find('Canvas/NodeDoorMask/NodeWheel1');
const nodeWheel2 = cc.find('Canvas/NodeWheel2'); const nodeWheel2 = cc.find('Canvas/NodeDoorMask/NodeWheel2');
const nodeWheel3 = cc.find('Canvas/NodeWheel3'); const nodeWheel3 = cc.find('Canvas/NodeDoorMask/NodeWheel3');
cc.tween(nodeWheel1) cc.tween(nodeWheel1)
.delay(delayTime) .delay(delayTime)
...@@ -363,15 +376,15 @@ cc.Class({ ...@@ -363,15 +376,15 @@ cc.Class({
.delay(delayTime) .delay(delayTime)
.by(1, { y: -200 }) .by(1, { y: -200 })
.start(); .start();
cc.tween(nodeDoor) // cc.tween(nodeDoor)
.delay(delayTime) // .delay(delayTime)
.by(1, { y: 300 }) // .by(1, { y: 300 })
.start(); // .start();
}, },
async characterMoveOut() { async characterMoveOut() {
await this.characterWalk({ x: 0, y: 360 }, 4); await this.characterWalk({ x: 0, y: 380 }, 4, true);
const nodeCharacter = cc.find('Canvas/NodeCharacter'); const nodeCharacter = cc.find('Canvas/NodeCharacter');
const nodeCharacterUp = cc.find('Canvas/NodeCharacter/NodeCharacterUp'); const nodeCharacterUp = cc.find('Canvas/NodeCharacter/NodeCharacterUp');
...@@ -383,8 +396,11 @@ cc.Class({ ...@@ -383,8 +396,11 @@ cc.Class({
nodeCharacterUp.active = true; nodeCharacterUp.active = true;
nodeCharacterFront.active = false; nodeCharacterFront.active = false;
cc.tween(nodeCharacter) const nodeDoorFront = cc.find('Canvas/NodeDoorFront');
.to(1, { opacity: 0 }) nodeDoorFront.zIndex = 100;
cc.tween(nodeDoorFront)
.to(1, { opacity: 255 })
.start(); .start();
}, },
...@@ -414,6 +430,8 @@ cc.Class({ ...@@ -414,6 +430,8 @@ cc.Class({
await asyncPlayDragonBoneAnimation(nodeNpcRight, 'npcright', 1); await asyncPlayDragonBoneAnimation(nodeNpcRight, 'npcright', 1);
nodeNpcNormal.active = true; nodeNpcNormal.active = true;
nodeNpcRight.active = false; nodeNpcRight.active = false;
// cakeNode
}, },
async npcPlayAnimWrong(cakeNode, idx) { async npcPlayAnimWrong(cakeNode, idx) {
......
module.exports = { module.exports = {
audio: 'e.mp3', audio: 'e.mp3',
rightWordList: ['ee', 'ea'], rightWordList: [{
wrongWordList: ['a', 'ao', 'ai'] word: 'ee',
audio: 'ee.mp3'
}, {
word: 'ea',
audio: 'ea.mp3'
}],
wrongWordList: [{
word: 'a',
audio: 'ee.mp3'
}, {
word: 'ao',
audio: 'ee.mp3'
}, {
word: 'ai',
audio: 'ee.mp3'
}]
} }
play/assets/tmpGame/textures/bg_bg.png

49.5 KB | W: | H:

play/assets/tmpGame/textures/bg_bg.png

9.88 KB | W: | H:

play/assets/tmpGame/textures/bg_bg.png
play/assets/tmpGame/textures/bg_bg.png
play/assets/tmpGame/textures/bg_bg.png
play/assets/tmpGame/textures/bg_bg.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -26,10 +26,10 @@ ...@@ -26,10 +26,10 @@
"height": 1036, "height": 1036,
"rawWidth": 1280, "rawWidth": 1280,
"rawHeight": 1036, "rawHeight": 1036,
"borderTop": 141, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 387, "borderLeft": 0,
"borderRight": 462, "borderRight": 0,
"subMetas": {} "subMetas": {}
} }
} }
......
...@@ -28,8 +28,8 @@ ...@@ -28,8 +28,8 @@
"rawHeight": 656, "rawHeight": 656,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 455, "borderLeft": 0,
"borderRight": 425, "borderRight": 0,
"subMetas": {} "subMetas": {}
} }
} }
......
{
"ver": "2.3.5",
"uuid": "a70c6636-6cd9-4795-9aec-99fccee6a35b",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 426,
"height": 376,
"platformSettings": {},
"subMetas": {
"bg_qiu": {
"ver": "1.0.4",
"uuid": "113f307c-93e3-4149-9262-a958f01cef85",
"rawTextureUuid": "a70c6636-6cd9-4795-9aec-99fccee6a35b",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 426,
"height": 376,
"rawWidth": 426,
"rawHeight": 376,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "2122f417-c4f4-42ae-9c78-c695beee306c",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 679,
"height": 257,
"platformSettings": {},
"subMetas": {
"bg_you": {
"ver": "1.0.4",
"uuid": "ea5e846f-5d69-457b-8246-292ab598ed44",
"rawTextureUuid": "2122f417-c4f4-42ae-9c78-c695beee306c",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 679,
"height": 257,
"rawWidth": 679,
"rawHeight": 257,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
# 雪寒是傻屌
\ 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