Commit 04872986 authored by huoshizhe's avatar huoshizhe

fix: fixbugs

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