Commit a4c9cbaf authored by Lwd's avatar Lwd

aaaa

parent 445f9988
<div class="model-content">
<div style="padding: 10px;">
<div style="width: 500px; margin-top: 20px; border: 1px solid #ccc; border-radius: 5px; padding: 15px;">
答对所有题或答题满<input style="width: 50px;" type="number" nz-input [(ngModel)]="item.maxWrongNumber"
(blur)="save()">次自动结束游戏
</div>
</div>
<div style="padding: 10px;">
<div *ngFor="let q of questionArr; let i = index;"
style="width: 500px; margin-top: 20px; border: 1px solid #ccc; border-radius: 5px; padding: 15px;">
<div style=" display: flex; align-items: center;">
<h3 style="margin-top: 5px">question-{{i+1}}:</h3>
<app-audio-recorder style="margin-left: 10px; " [audioUrl]="q.question_audio_url"
(audioUploaded)="onAudioUploadSuccess($event, 'question_audio_url', q)"></app-audio-recorder>
<button *ngIf="q.option_arr.length < 5" nz-button nzType="primary" (click)="addOptionBtnClick(q)"
style="margin-left: 15px;">
+
</button>
<button nz-button nzType="danger" (click)="deleteQuestionBtnClick(i)" style="margin-left: 5px;">
x
</button>
</div>
<div *ngFor="let o of q.option_arr; let oi = index" style="margin-top: 5px; display: flex;">
<div style="width: 200px;">
<app-upload-image-with-preview [picUrl]="o.pic_url"
(imageUploaded)="onImageUploadSuccess($event, 'pic_url', o)">
</app-upload-image-with-preview>
</div>
<div style="margin-left: 10px">
<h4>option-{{oi+1}} : </h4>
<div style="width: 300px; margin-top: 15px;">
<span>文本: </span>
<input type="text" nz-input [(ngModel)]="o.text" (blur)="save()">
</div>
<app-audio-recorder [audioUrl]="o.audio_url" (audioUploaded)="onAudioUploadSuccess($event, 'audio_url', o)">
</app-audio-recorder>
<div style="display: flex; align-items: center; margin-top: 10px;">
<nz-switch [(ngModel)]="o.is_right" (ngModelChange)="save()"></nz-switch>
<button nz-button nzType="danger" (click)="deleteOptionBtnClick(q.option_arr, oi)"
style="margin-left: 5px;">
delete
</button>
</div>
</div>
</div>
</div>
<button nz-button nzType="dashed" (click)="addQuestionBtnClick()" style="height: 70px; margin-top: 20px;">
<i nz-icon nzType="plus-circle" nzTheme="outline"></i>
Add Question
</button>
<!-- <div style="width: 300px;" align='center'>
<div style="padding: 10px;">
<div style="display: flex 1;margin-bottom: 10px;margin-left: 10px;">
<span>上传 ske_json 文件</span><span> : </span>
<nz-upload nzAccept=".json" [nzAction]="uploadUrl" [nzData]="uploadData" [nzShowUploadList]="false"
(nzChange)="handleChange($event, item,'ske_json')">
<button nz-button><i nz-icon nzType="upload"></i>Upload</button>
</nz-upload>
<span style="margin-left: 10px;">{{item["ske_json_name"]}}</span>
</div>
<div style="display: flex 1;margin-bottom: 10px;margin-left: 10px;">
<span>上传 tex_json 文件</span><span> : </span>
<nz-upload nzAccept=".json" [nzAction]="uploadUrl" [nzData]="uploadData" [nzShowUploadList]="false"
(nzChange)="handleChange($event, item,'tex_json')">
<button nz-button><i nz-icon nzType="upload"></i>Upload</button>
</nz-upload>
<span style="margin-left: 10px;">{{ item["tex_json_name"] }}</span>
</div>
<div style="display: flex 1;margin-bottom: 10px;margin-left: 10px;">
<span>上传 tex_png 文件</span><span> : </span>
<nz-upload nzAccept=".png" [nzAction]="uploadUrl" [nzData]="uploadData" [nzShowUploadList]="false"
(nzChange)="handleChange($event, item,'tex_png')">
<button nz-button><i nz-icon nzType="upload"></i>Upload</button>
</nz-upload>
<span style="margin-left: 10px;">{{ item["tex_png_name"] }}</span>
</div>
<div *ngFor="let q of questionArr; let i = index;"
style="width: 500px; margin-top: 20px; border: 1px solid #ccc; border-radius: 5px; padding: 15px;">
<div style=" display: flex; align-items: center;">
<h3 style="margin-top: 5px">question-{{i+1}}:</h3>
<app-audio-recorder style="margin-left: 10px; " [audioUrl]="q.question_audio_url"
(audioUploaded)="onAudioUploadSuccess($event, 'question_audio_url', q)"></app-audio-recorder>
<button *ngIf="q.option_arr.length < 5" nz-button nzType="primary" (click)="addOptionBtnClick(q)"
style="margin-left: 15px;">
+
</button>
<button nz-button nzType="danger" (click)="deleteQuestionBtnClick(i)" style="margin-left: 5px;">
x
</button>
</div>
<div *ngFor="let o of q.option_arr; let oi = index" style="margin-top: 5px; display: flex;">
<div style="width: 200px;">
<app-upload-image-with-preview [picUrl]="o.pic_url"
(imageUploaded)="onImageUploadSuccess($event, 'pic_url', o)">
</app-upload-image-with-preview>
</div>
<div style="margin-left: 10px">
<h4>option-{{oi+1}} : </h4>
<div style="width: 300px; margin-top: 15px;">
<span>文本: </span>
<input type="text" nz-input [(ngModel)]="o.text" (blur)="save()">
</div>
<app-audio-recorder [audioUrl]="o.audio_url"
(audioUploaded)="onAudioUploadSuccess($event, 'audio_url', o)">
</app-audio-recorder>
<div style="display: flex; align-items: center; margin-top: 10px;">
<nz-switch [(ngModel)]="o.is_right" (ngModelChange)="save()"></nz-switch>
<button nz-button nzType="danger" (click)="deleteOptionBtnClick(q.option_arr, oi)"
style="margin-left: 5px;">
delete
</button>
</div>
</div>
</div>
</div>
<button nz-button nzType="dashed" (click)="addQuestionBtnClick()" style="height: 70px; margin-top: 20px;">
<i nz-icon nzType="plus-circle" nzTheme="outline"></i>
Add Question
</button>
<!-- <div style="width: 300px;" align='center'>
<span>图1: </span>
<app-upload-image-with-preview
[picUrl]="item.pic_url"
......@@ -91,6 +110,6 @@
></app-audio-recorder>
</div> -->
</div>
</div>
</div>
\ No newline at end of file
import { Component, EventEmitter, Input, OnDestroy, OnChanges, OnInit, Output, ApplicationRef, ChangeDetectorRef } from '@angular/core';
import { JsonPipe } from '@angular/common';
import { NzMessageService, UploadXHRArgs, UploadFile } from 'ng-zorro-antd';
@Component({
selector: 'app-form',
templateUrl: './form.component.html',
styleUrls: ['./form.component.css']
selector: 'app-form',
templateUrl: './form.component.html',
styleUrls: ['./form.component.css']
})
export class FormComponent implements OnInit, OnChanges, OnDestroy {
// 储存数据用
saveKey = "op_09";
// 储存对象
item;
questionArr = [];
constructor(private appRef: ApplicationRef, private changeDetectorRef: ChangeDetectorRef) {
}
ngOnInit() {
this.item = {
maxWrongNumber: 4,
question_arr: []
};
// 获取存储的数据
(<any>window).courseware.getData((data) => {
if (data) {
this.item = data;
}
console.log('data: ', data);
this.init();
this.changeDetectorRef.markForCheck();
this.changeDetectorRef.detectChanges();
this.refresh();
}, this.saveKey);
}
ngOnChanges() {
}
ngOnDestroy() {
}
init() {
if (!this.item.question_arr) {
this.item.question_arr = [];
}
this.questionArr = this.item.question_arr;
}
addQuestionBtnClick() {
this.questionArr.push({
question_audio_url: '',
option_arr: [ //选项 (多选)
]
})
this.save();
}
addOptionBtnClick(question) {
question.option_arr.push({
text: '',
pic_url: '', // 图片路径
audio_url: '', //音频路径
is_right: false, //是否正确
})
this.save();
}
deleteQuestionBtnClick(index) {
this.questionArr.splice(index, 1);
this.save();
}
deleteOptionBtnClick(option, index) {
option.splice(index, 1)
this.save();
}
/**
* 储存图片数据
* @param e
*/
onImageUploadSuccess(e, key, item) {
item[key] = e.url;
this.save();
}
/**
* 储存音频数据
* @param e
*/
onAudioUploadSuccess(e, key, item) {
item[key] = e.url;
this.save();
}
onWordAudioUploadSuccess(e, idx) {
this.item.wordList[idx].audio = e.url;
this.save();
}
onBackWordAudioUploadSuccess(e, idx) {
this.item.wordList[idx].backWordAudio = e.url;
this.save();
}
/**
* 储存数据
*/
save() {
(<any>window).courseware.setData(this.item, null, this.saveKey);
this.refresh();
console.log('this.item = ' + JSON.stringify(this.item));
}
/**
* 刷新 渲染页面
*/
refresh() {
setTimeout(() => {
this.appRef.tick();
}, 1);
}
// 储存数据用
saveKey = "op_04";
// 储存对象
uploadUrl
uploadData
item;
questionArr = [];
constructor(private appRef: ApplicationRef, private changeDetectorRef: ChangeDetectorRef) {
this.uploadUrl = (<any>window).courseware.uploadUrl();
this.uploadData = (<any>window).courseware.uploadData();
window['air'].getUploadCallback = (url, data) => {
this.uploadUrl = url;
this.uploadData = data;
};
}
ngOnInit() {
this.item = {
question_arr: []
};
// 获取存储的数据
(<any>window).courseware.getData((data) => {
if (data) {
this.item = data;
}
console.log('data: ', data);
this.init();
this.changeDetectorRef.markForCheck();
this.changeDetectorRef.detectChanges();
this.refresh();
}, this.saveKey);
}
ngOnChanges() {
}
ngOnDestroy() {
}
init() {
if (!this.item.question_arr) {
this.item.question_arr = [];
}
this.questionArr = this.item.question_arr;
}
addQuestionBtnClick() {
this.questionArr.push({
question_audio_url: '',
option_arr: [ //选项 (多选)
]
})
this.save();
}
uploadSuccess(file, item, key) {
console.log(item);
item[key] = file.response.url;
item[key + '_name'] = file.name;
this.save();
}
handleChange(info: { type: string, file: UploadFile, event: any }, item, key) {
console.log('info:', info);
switch (info.type) {
case 'success':
this.uploadSuccess(info.file, item, key);
break;
}
}
addOptionBtnClick(question) {
question.option_arr.push({
text: '',
pic_url: '', // 图片路径
audio_url: '', //音频路径
is_right: false, //是否正确
})
this.save();
}
deleteQuestionBtnClick(index) {
this.questionArr.splice(index, 1);
this.save();
}
deleteOptionBtnClick(option, index) {
option.splice(index, 1)
this.save();
}
/**
* 储存图片数据
* @param e
*/
onImageUploadSuccess(e, key, item) {
item[key] = e.url;
this.save();
}
/**
* 储存音频数据
* @param e
*/
onAudioUploadSuccess(e, key, item) {
item[key] = e.url;
this.save();
}
onWordAudioUploadSuccess(e, idx) {
this.item.wordList[idx].audio = e.url;
this.save();
}
onBackWordAudioUploadSuccess(e, idx) {
this.item.wordList[idx].backWordAudio = e.url;
this.save();
}
/**
* 储存数据
*/
save() {
(<any>window).courseware.setData(this.item, null, this.saveKey);
this.refresh();
console.log('this.item = ' + JSON.stringify(this.item));
}
/**
* 刷新 渲染页面
*/
refresh() {
setTimeout(() => {
this.appRef.tick();
}, 1);
}
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
{"name":"lion","imagePath":"lion_tex.png","SubTexture":[{"name":"正常-影子","x":1,"height":140,"y":2137,"width":958},{"name":"正常-身体","x":1,"height":274,"y":1344,"width":840},{"name":"正常-手上","x":1736,"height":167,"y":2452,"width":291},{"name":"正常-下巴","x":1064,"height":119,"y":2495,"width":254},{"name":"正常-嘴巴","x":992,"height":71,"y":1263,"width":211},{"name":"正常-脸","x":843,"height":374,"y":1619,"width":417},{"name":"正常-耳朵","x":711,"height":162,"y":2660,"width":351},{"name":"正常-睁眼","x":498,"height":115,"y":700,"width":209},{"name":"正常-半睁眼","x":982,"height":94,"y":2923,"width":198},{"name":"正常-闭眼","x":1544,"height":115,"y":2826,"width":198},{"name":"正常-头","x":498,"height":492,"y":850,"width":492},{"name":"正常-鼻子","x":774,"height":94,"y":2824,"width":214},{"name":"正常-手右","x":992,"height":294,"y":850,"width":232},{"name":"正常尾巴","x":1,"height":87,"y":2764,"width":554},{"name":"皱眉-影子","x":843,"height":140,"y":1995,"width":958},{"name":"皱眉-摆手胳膊","x":774,"height":96,"y":2920,"width":206},{"name":"皱眉-摆手","x":1670,"height":278,"y":1619,"width":286},{"name":"皱眉-尾巴-后","x":1607,"height":73,"y":2751,"width":419},{"name":"皱眉-身体","x":1,"height":400,"y":1,"width":739},{"name":"皱眉-正常收上","x":1733,"height":168,"y":1063,"width":292},{"name":"皱眉-脸","x":1,"height":397,"y":899,"width":420},{"name":"皱眉-正常脸","x":1,"height":444,"frameY":-39,"y":1620,"frameHeight":483,"frameX":0,"frameWidth":417,"width":417},{"name":"皱眉-耳朵","x":357,"height":163,"y":2421,"width":352},{"name":"皱眉-睁眼","x":992,"height":115,"y":1146,"width":209},{"name":"皱眉-半睁眼","x":1064,"height":115,"y":2806,"width":199},{"name":"皱眉-头发","x":1,"height":494,"y":403,"width":495},{"name":"皱眉-正常头发","x":1239,"height":492,"y":352,"width":492},{"name":"皱眉-闭眼","x":1841,"height":115,"y":1467,"width":199},{"name":"皱眉-鼻子","x":1466,"height":94,"y":2943,"width":215},{"name":"皱眉-手1","x":1733,"height":295,"y":300,"width":231},{"name":"皱眉-尾巴-前","x":1,"height":87,"y":2586,"width":557},{"name":"张嘴-影子","x":1,"height":140,"y":2279,"width":958},{"name":"张嘴-身体","x":742,"height":349,"y":1,"width":842},{"name":"张嘴-上手","x":1733,"height":169,"y":892,"width":292},{"name":"张-下巴","x":1334,"height":122,"y":2677,"width":271},{"name":"张-鼻","x":1331,"height":181,"y":2494,"width":403},{"name":"张嘴-耳朵","x":711,"height":163,"y":2495,"width":351},{"name":"张嘴-脸","x":1331,"height":213,"y":2279,"width":366},{"name":"张嘴-下巴","x":1064,"height":127,"y":2677,"width":268},{"name":"张嘴-张嘴","x":1736,"height":128,"y":2621,"width":285},{"name":"张嘴-闭嘴嘴","x":711,"height":71,"y":2421,"width":212},{"name":"张嘴-脸-中","x":1262,"height":229,"y":1619,"width":406},{"name":"张嘴-脸-上","x":961,"height":214,"y":2279,"width":368},{"name":"张嘴-睁眼","x":1334,"height":114,"y":2801,"width":208},{"name":"张嘴-半眼","x":1744,"height":114,"y":2826,"width":198},{"name":"张嘴-闭眼","x":1265,"height":114,"y":2917,"width":199},{"name":"张嘴-头发","x":1239,"height":492,"y":846,"width":492},{"name":"张嘴-鼻子","x":1744,"height":95,"y":2942,"width":214},{"name":"张嘴-手下","x":1733,"height":293,"y":597,"width":232},{"name":"张嘴-尾巴","x":1,"height":87,"y":2675,"width":555},{"name":"嚼--影子","x":961,"height":140,"y":2137,"width":958},{"name":"嚼-身体","x":992,"height":277,"y":1340,"width":847},{"name":"嚼-手-上-完整","x":1699,"height":171,"y":2279,"width":294},{"name":"lian","x":420,"height":297,"y":1620,"width":406},{"name":"嚼-脸_拷贝","x":1586,"height":297,"y":1,"width":406},{"name":"嚼-左耳","x":1,"height":163,"y":2421,"width":354},{"name":"嚼-脸-上","x":420,"height":214,"y":1919,"width":368},{"name":"嚼-睁眼","x":1803,"height":115,"y":1989,"width":210},{"name":"嚼-半睁眼","x":1841,"height":115,"y":1233,"width":199},{"name":"嚼-毛发","x":742,"height":496,"y":352,"width":495},{"name":"嚼-闭眼","x":1841,"height":115,"y":1350,"width":199},{"name":"嚼-鼻子_","x":557,"height":94,"y":2824,"width":215},{"name":"嚼-手-下","x":498,"height":295,"y":403,"width":233},{"name":"嚼-尾巴-前","x":1262,"height":88,"y":1899,"width":559},{"name":"皱眉-正常-半睁眼 ","x":982,"height":94,"y":3019,"width":198}],"height":4096,"width":2048}
\ No newline at end of file
{"width":2048,"SubTexture":[{"width":958,"y":2137,"height":140,"name":"正常-影子","x":961},{"width":840,"y":1344,"height":274,"name":"正常-身体","x":1},{"width":291,"y":2452,"height":167,"name":"正常-手上","x":1736},{"width":254,"y":2495,"height":119,"name":"正常-下巴","x":1064},{"width":211,"y":1263,"height":71,"name":"正常-嘴巴","x":992},{"width":417,"y":1619,"height":374,"name":"正常-脸","x":843},{"width":351,"y":2660,"height":162,"name":"正常-耳朵","x":711},{"width":209,"y":1146,"height":115,"name":"正常-睁眼","x":992},{"width":198,"y":2923,"height":94,"name":"正常-半睁眼","x":982},{"width":198,"y":2826,"height":115,"name":"正常-闭眼","x":1544},{"width":492,"y":352,"height":492,"name":"正常-头","x":1239},{"width":214,"y":2824,"height":94,"name":"正常-鼻子","x":774},{"width":232,"y":850,"height":294,"name":"正常-手右","x":992},{"width":554,"y":2764,"height":87,"name":"正常尾巴","x":1},{"width":958,"y":2137,"height":140,"name":"皱眉-影子","x":1},{"width":206,"y":2920,"height":96,"name":"皱眉-摆手胳膊","x":774},{"width":286,"y":1619,"height":278,"name":"皱眉-摆手","x":1670},{"width":419,"y":2751,"height":73,"name":"皱眉-尾巴-后","x":1607},{"width":739,"y":1,"height":400,"name":"皱眉-身体","x":1},{"width":292,"y":1063,"height":168,"name":"皱眉-正常收上","x":1733},{"width":420,"y":899,"height":397,"name":"皱眉-脸","x":1},{"frameX":0,"y":1620,"frameY":-39,"frameWidth":417,"width":417,"frameHeight":483,"height":444,"name":"皱眉-正常脸","x":1},{"width":352,"y":2421,"height":163,"name":"皱眉-耳朵","x":357},{"width":209,"y":700,"height":115,"name":"皱眉-睁眼","x":498},{"width":199,"y":1233,"height":115,"name":"皱眉-半睁眼","x":1841},{"width":495,"y":403,"height":494,"name":"皱眉-头发","x":1},{"width":492,"y":846,"height":492,"name":"皱眉-正常头发","x":1239},{"width":199,"y":2806,"height":115,"name":"皱眉-闭眼","x":1064},{"width":215,"y":2824,"height":94,"name":"皱眉-鼻子","x":557},{"width":231,"y":300,"height":295,"name":"皱眉-手1","x":1733},{"width":557,"y":2586,"height":87,"name":"皱眉-尾巴-前","x":1},{"width":958,"y":2279,"height":140,"name":"张嘴-影子","x":1},{"width":842,"y":1,"height":349,"name":"张嘴-身体","x":742},{"width":292,"y":892,"height":169,"name":"张嘴-上手","x":1733},{"width":271,"y":2677,"height":122,"name":"张-下巴","x":1334},{"width":403,"y":2494,"height":181,"name":"张-鼻","x":1331},{"width":351,"y":2495,"height":163,"name":"张嘴-耳朵","x":711},{"width":366,"y":2279,"height":213,"name":"张嘴-脸","x":1331},{"width":268,"y":2677,"height":127,"name":"张嘴-下巴","x":1064},{"width":285,"y":2621,"height":128,"name":"张嘴-张嘴","x":1736},{"width":212,"y":2421,"height":71,"name":"张嘴-闭嘴嘴","x":711},{"width":406,"y":1619,"height":229,"name":"张嘴-脸-中","x":1262},{"width":368,"y":1919,"height":214,"name":"张嘴-脸-上","x":420},{"width":208,"y":2801,"height":114,"name":"张嘴-睁眼","x":1334},{"width":198,"y":2826,"height":114,"name":"张嘴-半眼","x":1744},{"width":199,"y":2917,"height":114,"name":"张嘴-闭眼","x":1265},{"width":492,"y":850,"height":492,"name":"张嘴-头发","x":498},{"width":214,"y":2942,"height":95,"name":"张嘴-鼻子","x":1744},{"width":232,"y":597,"height":293,"name":"张嘴-手下","x":1733},{"width":555,"y":2675,"height":87,"name":"张嘴-尾巴","x":1},{"width":958,"y":1995,"height":140,"name":"嚼--影子","x":843},{"width":847,"y":1340,"height":277,"name":"嚼-身体","x":992},{"width":294,"y":2279,"height":171,"name":"嚼-手-上-完整","x":1699},{"width":406,"y":1,"height":297,"name":"lian","x":1586},{"width":406,"y":1620,"height":297,"name":"嚼-脸_拷贝","x":420},{"width":354,"y":2421,"height":163,"name":"嚼-左耳","x":1},{"width":368,"y":2279,"height":214,"name":"嚼-脸-上","x":961},{"width":210,"y":1989,"height":115,"name":"嚼-睁眼","x":1803},{"width":199,"y":1350,"height":115,"name":"嚼-半睁眼","x":1841},{"width":495,"y":352,"height":496,"name":"嚼-毛发","x":742},{"width":199,"y":1467,"height":115,"name":"嚼-闭眼","x":1841},{"width":215,"y":2943,"height":94,"name":"嚼-鼻子_","x":1466},{"width":233,"y":403,"height":295,"name":"嚼-手-下","x":498},{"width":559,"y":1899,"height":88,"name":"嚼-尾巴-前","x":1262},{"width":198,"y":3019,"height":94,"name":"皱眉-正常-半睁眼 ","x":982}],"height":4096,"name":"lion","imagePath":"lion_tex.png"}
\ No newline at end of file
......@@ -13,7 +13,7 @@
"subMetas": {
"lion_tex": {
"ver": "1.0.4",
"uuid": "66dffee1-ad24-4305-8968-d8506f180d7e",
"uuid": "f2fec664-8c69-43fb-a0f1-d63abfebf8f0",
"rawTextureUuid": "c2512365-4d01-4adf-8d7f-8795350351bc",
"trimType": "auto",
"trimThreshold": 1,
......
{
"ver": "1.1.2",
"uuid": "15613a02-554e-4382-b722-cc551a8d7220",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
......@@ -630,7 +630,7 @@
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_armatureName": "armatureName",
"_armatureName": "",
"_animationName": "",
"_preCacheMode": 0,
"_cacheMode": 0,
......@@ -643,12 +643,8 @@
"_curFrame": null,
"_playing": false,
"_armatureCache": null,
"_N$dragonAsset": {
"__uuid__": "8549fef3-5ffa-4e88-9496-13fe5201e87d"
},
"_N$dragonAtlasAsset": {
"__uuid__": "27736c82-e8ad-4ec9-9aa8-93dd4278069b"
},
"_N$dragonAsset": null,
"_N$dragonAtlasAsset": null,
"_N$_defaultArmatureIndex": 0,
"_N$_animationIndex": 0,
"_N$_defaultCacheMode": 0,
......
......@@ -59,7 +59,7 @@ var game = cc.Class({
return;
}
g.data_mgr.time += 1;
if (g.data_mgr.time >= 5) {
if (g.data_mgr.time >= 10) {
g.data_mgr.time = 0;
this.hintPlay();
}
......@@ -144,7 +144,7 @@ var game = cc.Class({
//五秒没操作
hintPlay: function () {
this.playLionDragon("openmouth")
this.playLionDragon("openmouse")
this.playCatDragon("begin")
g.speaker.inst.playEffect(g.enum.E_Audio.CatHint);
......@@ -180,7 +180,9 @@ var game = cc.Class({
finish() {
this.playLionDragon("normal")
this.playCatDragon("finish")
g.speaker.inst.playEffect(g.enum.E_Audio.CatComplete);
setTimeout(() => {
g.speaker.inst.playEffect(g.enum.E_Audio.CatComplete);
}, 500)
},
//检测放到哪个节点底下
......@@ -210,6 +212,12 @@ var game = cc.Class({
//更新界面信息
UpdataUi: function () {
var Info = {
tex_json: g.data_mgr.data.tex_json,
ske_json: g.data_mgr.data.ske_json,
tex_png: g.data_mgr.data.tex_png,
}
g.res_mgr.loadSpine(this.dragonLion, Info);
//刚进入课件
//播放第一题题干
......@@ -249,7 +257,10 @@ var game = cc.Class({
//获得播放路径
var path = g.data_mgr.getQuestionStem(g.data_mgr.quesId);
g.res_mgr.playAudioByUrl(path, (url) => {
g.snd_mgr.playEffect(url, null);
g.snd_mgr.playEffect(url, () => {
//结束回调
this.playCatDragon("normal");
});
});
},
......
......@@ -33,9 +33,25 @@ cc.Class({
g.data_mgr.gameState = 2;
g.data_mgr.time = 0;
//狮子猫动画
g.game.inst.playLionDragon("openmouse");
g.res_mgr.playAudioByUrl(this.itemInfo.audio_url, (url) => {
g.snd_mgr.playEffect(url, null);
});
this.m_touchTime = 0;
clearInterval(this.timer);
//定时器
this.timer = setInterval(() => {
this.m_touchTime += 1;
if (this.m_touchTime >= 3) {
this.m_touchTime = 0;
g.res_mgr.playAudioByUrl(this.itemInfo.audio_url, (url) => {
g.snd_mgr.playEffect(url, null);
});
}
}, 1000)
this.isMove = false;
this.deltaPos = this.node.x + this.node.y;
},
......@@ -57,6 +73,10 @@ cc.Class({
//触摸结束
touchEnd: function (event) {
clearInterval(this.timer);
//暂停音效
g.snd_mgr.pauseVolume();
g.data_mgr.gameState = 1;
//获得世界坐标
var posScreen = event.getLocation(); //点击事件获取位置
......@@ -114,7 +134,6 @@ cc.Class({
g.game.inst.playCatDragon("right");
g.game.inst.playLionDragon("chew");
//先播放错误声音
g.speaker.inst.playEffect(g.enum.E_Audio.Right);
......@@ -179,6 +198,8 @@ cc.Class({
//触摸取消
touchCancel: function (event) {
clearInterval(this.timer);
//回到原来的位置
this.node.x = 0;
this.node.y = 0;
......
......@@ -36,7 +36,13 @@ g.data_mgr = {
"option_arr": [
{ "pic_url": "http://staging-teach.cdn.ireadabc.com/3134325b66d1b8ecf2f83db853195da5.png", "audio_url": "http://staging-teach.cdn.ireadabc.com/e3921a16a8313df274d8bc4e3f2bedd8.mp3", "is_right": true, "text": "a" },
{ "pic_url": "http://staging-teach.cdn.ireadabc.com/3134325b66d1b8ecf2f83db853195da5.png", "audio_url": "http://staging-teach.cdn.ireadabc.com/58eec304909298176bde6c408c9dac1b.mp3", "is_right": false, "text": "b" }]
}]
}],
"ske_json": "http://staging-teach.cdn.ireadabc.com/7355648029551e6848a2cf36ea8a6ba6.json",
"ske_json_name": "lion_ske.json",
"tex_json": "http://staging-teach.cdn.ireadabc.com/511fe163f2df10925e3da82f0f69590b.json",
"tex_json_name": "lion_tex.json",
"tex_png": "http://staging-teach.cdn.ireadabc.com/2fd2a53fcb36d36281a6ded9500dd54f.png",
"tex_png_name": "lion_tex.png"
}
const data = dataJson;
// const data = JSON.parse(dataJson);
......
......@@ -40,9 +40,6 @@ g.res_mgr = {
//加载龙骨
loadSpine(animationDisplay, Info) {
if (Info.type == 'Image') {
return;
}
cc.assetManager.loadAny([{ url: Info.tex_json, ext: '.txt' }, { url: Info.ske_json, ext: '.txt' }], (error, assets) => {
if (error) {
console.log(error)
......
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