Commit da4df9fd authored by LWD's avatar LWD

代码提交

parent a70e61d2
<div class="model-content"> <div class="model-content">
<div style="width: 300px; margin-top: 15px;">
<span>点击输入文本内容: </span>
<input type="text" nz-input [(ngModel)]="item.contentObj.title" (blur)="saveItem()">
</div>
<div *ngFor="let it of pageArr; let i = index" style="padding: 0.5vw; width: 20%;">
<div class="border" style="display: flex; align-items: center;">
<div class="item-box" style="width:30%">
<div style="width: 20%; padding-left: 20px">
<h5 style="padding-left: 15px; margin: auto"> 页-{{i+1}}: </h5>
<div style="display: flex; justify-items: center; align-items: center; height: 40px;">
<button style="margin-left: 10px;" nz-button nzType="danger" (click)="deletePage(it)">
<span>删除</span>
</button>
</div>
<div nz-col nzSpan="8" class="add-btn-box">
<button style=" margin: auto; width: 60%; height: 60%;" nz-button nzType="dashed"
class="add-btn" (click)="addPic(i)">
<i nz-icon nzType="plus-circle" nzTheme="outline"></i>
add
</button>
</div>
</div>
</div>
</div>
</div>
<div nz-col nzSpan="8" class="add-btn-box">
<button style=" margin: auto; width: 60%; height: 60%;" nz-button nzType="dashed" class="add-btn"
(click)="addPage()">
<i nz-icon nzType="plus-circle" nzTheme="outline"></i>
Addpage
</button>
</div>
<div style="padding: 10px;"> <div *ngFor="let page of pageArr; let j = index" style="padding: 0.5vw; width: 100%;">
<div *ngFor="let it of page.pageInfo; let i = index" style="padding: 0.5vw; width: 100%;">
<div class="border" style="display: flex; align-items: center;">
<div style="width: 300px;" align='center'> <div style="width: 4%">
<span>图1: </span>
<app-upload-image-with-preview <h5 style="padding-left: 15px; margin: auto"> 页-{{j+1}}组-{{i+1}}: </h5>
[picUrl]="item.pic_url"
(imageUploaded)="onImageUploadSuccess($event, 'pic_url')"> <div style="display: flex; justify-items: center; align-items: center; height: 40px;">
<!--<app-audio-recorder-->
<!--[audioUrl]="it.audio_url"-->
<!--(audioUploaded)="onAudioUploadSuccessByItem($event, it)">-->
<!--</app-audio-recorder>-->
<button style="margin-left: 10px;" nz-button nzType="danger" (click)="deleteItem(it,j)">
<span>删除</span>
<!--<i nz-icon type="close"></i>-->
</button>
</div>
</div>
<!--公共部分-->
<div class="item-box" style="width: 35% ;padding-left: 100px">
<div style="width: 100%;">
<app-upload-image-with-preview style="width: 100%" [picUrl]="it['groupPic']"
(imageUploaded)="onImageUploadSuccessByItem($event, it)">
</app-upload-image-with-preview> </app-upload-image-with-preview>
</div> </div>
<input style=" width: 100%; margin-bottom: 0.5vw" type="text" nz-input placeholder="点击输入文本内容"
[(ngModel)]="it.groupLabel" (blur)="saveItem()">
</div>
<div style="width: 300px; margin-top: 5px;" align='center'> <div class="item-box" style="width:35%; padding-left: 100px">
<span>图2: </span> <div style="width: 100%;">
<app-upload-image-with-preview <app-upload-image-with-preview [picUrl]="it['a_pic_url']"
[picUrl]="item.pic_url_2" (imageUploaded)="onImageUploadSuccessByItem($event, it, 'a')">
(imageUploaded)="onImageUploadSuccess($event, 'pic_url_2')">
</app-upload-image-with-preview> </app-upload-image-with-preview>
</div> </div>
<div style="width: 300px; margin-top: 15px;"> <app-audio-recorder style="margin-top: 0.5vw" [audioUrl]="it['a_audio_url']"
<span>文本: </span> (audioUploaded)="onAudioUploadSuccessByItem($event, it, 'a')">
<input type="text" nz-input [(ngModel)]="item.text" (blur)="save()"> </app-audio-recorder>
</div> </div>
<div style="margin-top: 5px">
<span>音频: </span> <!--中间部分-->
<app-audio-recorder <div class="item-box" style="width: 35% ;padding-left: 100px">
[audioUrl]="item.audio_url" <div style="width: 100%;">
(audioUploaded)="onAudioUploadSuccess($event, 'audio_url')" <app-upload-image-with-preview style="width: 100%" [picUrl]="it['b_pic_url']"
></app-audio-recorder> (imageUploaded)="onImageUploadSuccessByItem($event, it, 'b')">
</app-upload-image-with-preview>
</div> </div>
<app-audio-recorder style="margin-top: 0.5vw" [audioUrl]="it['b_audio_url']"
(audioUploaded)="onAudioUploadSuccessByItem($event, it, 'b')">
</app-audio-recorder>
</div> </div>
</div>
</div>
</div>
</div> </div>
\ No newline at end of file
import { Component, EventEmitter, Input, OnDestroy, OnChanges, OnInit, Output, ApplicationRef, ChangeDetectorRef } from '@angular/core'; import {
import { JsonPipe } from '@angular/common'; Component,
EventEmitter,
Input,
OnDestroy,
OnChanges,
OnInit,
Output,
ApplicationRef,
ChangeDetectorRef
} from '@angular/core';
@Component({ @Component({
selector: 'app-form', selector: 'app-form',
templateUrl: './form.component.html', templateUrl: './form.component.html',
styleUrls: ['./form.component.css'] styleUrls: ['./form.component.scss']
}) })
export class FormComponent implements OnInit, OnChanges, OnDestroy { export class FormComponent implements OnInit, OnChanges, OnDestroy {
pageArr = [];//页数据
_item: any;
// 储存数据用 KEY = 'hw_004';
saveKey = "test_001";
// 储存对象
item;
constructor(private appRef: ApplicationRef, private changeDetectorRef: ChangeDetectorRef) { answerType = 'A';
} showGuideAudio;
// @Input()
set item(item) {
this._item = item;
// this.init();
createShell() { }
this.item.wordList.push({ get item() {
word: '', return this._item;
audio: '',
backWord: '',
backWordAudio: '',
});
this.save();
} }
removeShell(idx) { @Output()
this.item.wordList.splice(idx, 1); update = new EventEmitter();
this.save();
constructor(private appRef: ApplicationRef,
public changeDetectorRef: ChangeDetectorRef) {
} }
ngOnInit() { ngOnInit() {
this.item = {}; this.item = {};
this.item.contentObj = {};
// 获取存储的数据 const getData = (<any>window).courseware.getData;
(<any>window).courseware.getData((data) => { getData((data) => {
if (data) { if (data) {
this.item = data; this.item = data;
} else {
this.item = {};
} }
if (!this.item.contentObj) {
this.item.contentObj = {};
}
console.log('~data:', data);
this.init(); this.init();
this.changeDetectorRef.markForCheck(); this.changeDetectorRef.markForCheck();
this.changeDetectorRef.detectChanges(); this.changeDetectorRef.detectChanges();
this.refresh(); this.refresh();
}, this.saveKey); }, this.KEY);
}
// this.initData();
}
ngOnChanges() { ngOnChanges() {
} }
ngOnDestroy() { ngOnDestroy() {
} }
init() { init() {
if (this.item.contentObj.pageArr) {
this.pageArr = this.item.contentObj.pageArr;
} else {
this.pageArr = this.getDefaultPicArr();
this.item.contentObj.pageArr = this.pageArr;
}
this.save();
console.log('item:', this.item);
}
getDefaultPicArr() {
const arr = [];
// for (let i = 0; i < 4; i ++) {
// const data = {};
// data['pic_url'] = '';
//
// const soundArr = [];
// for (let i = 0; i < 3; i++) {
// const tmpData = {};
// tmpData['answer'] = false;
// tmpData['audio_url'] = '';
// soundArr.push(tmpData);
// }
// data['soundArr'] = soundArr;
//
// arr.push(data);
// }
return arr;
} }
/**
* 储存图片数据
* @param e
*/
onImageUploadSuccess(e, key) {
this.item[key] = e.url; initData() {
}
deletePage(data) {
const index = this.pageArr.indexOf(data);
if (index !== -1) {
this.pageArr.splice(index, 1);
}
// this.update.emit(this.item);
this.save(); this.save();
} }
/**
* 储存音频数据 deleteItem(data, j) {
* @param e const index = this.pageArr[j].pageInfo.indexOf(data);
*/ if (index !== -1) {
onAudioUploadSuccess(e, key) { this.pageArr[j].pageInfo.splice(index, 1);
this.item[key] = e.url; }
// this.update.emit(this.item);
this.save(); this.save();
} }
onWordAudioUploadSuccess(e, idx) { onImageUploadSuccessByItem(e, item, id = null) {
this.item.wordList[idx].audio = e.url;
if (id != null) {
item[id + '_pic_url'] = e.url;
} else {
item['groupPic'] = e.url;
}
this.save(); this.save();
// this.update.emit(this.item);
// console.log('this.item: ', this.item);
} }
onBackWordAudioUploadSuccess(e, idx) { onAudioUploadSuccessByItem(e, item, id = null) {
this.item.wordList[idx].backWordAudio = e.url; if (id != null) {
item[id + '_audio_url'] = e.url;
} else {
item.audio_url = e.url;
}
// this.update.emit(this.item);
this.save(); this.save();
} }
/** //添加页面
* 储存数据 addPage() {
*/ const data = {
save() { pageInfo: []
(<any>window).courseware.setData(this.item, null, this.saveKey); };
this.pageArr.push(data);
console.log(this.pageArr);
this.saveItem();
}
//添加项进页面
addPic(i) {
const data = {
a_pic_url: '',
b_pic_url: '',
a_audio_url: '',
b_audio_url: '',
groupLabel: '',
groupPic: '',
};
this.pageArr[i].pageInfo.push(data);
console.log(this.pageArr);
this.saveItem();
}
radioClick(it, radioValue) {
it.radioValue = radioValue;
this.saveItem();
}
clickCheckBox() {
console.log(' in clickCheckBox');
this.saveItem();
}
saveItem() {
console.log(' in saveItem');
// this.update.emit(this.item);
this.save();
}
save() {
(<any>window).courseware.setData(this.item, null, this.KEY);
this.refresh(); this.refresh();
console.log('this.item = ' + JSON.stringify(this.item)); // 获取数据
const getData = (<any>window).courseware.getData;
getData((data) => {
console.log('data:', data);
}, this.KEY);
} }
/**
* 刷新 渲染页面
*/
refresh() { refresh() {
setTimeout(() => { setTimeout(() => {
this.appRef.tick(); this.appRef.tick();
}, 1); }, 1);
} }
guideBtnClick(value) {
this.showGuideAudio = value;
}
} }
[
{
"__type__": "cc.SceneAsset",
"_name": "",
"_objFlags": 0,
"_native": "",
"scene": {
"__id__": 1
}
},
{
"__type__": "cc.Scene",
"_objFlags": 0,
"_parent": null,
"_children": [
{
"__id__": 2
}
],
"_active": false,
"_components": [],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_is3DNode": true,
"_groupIndex": 0,
"groupIndex": 0,
"autoReleaseAssets": true,
"_id": "57ea7c61-9b8b-498a-b024-c98ee9124beb"
},
{
"__type__": "cc.Node",
"_name": "Canvas",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 3
},
{
"__id__": 5
},
{
"__id__": 7
},
{
"__id__": 14
}
],
"_active": true,
"_components": [
{
"__id__": 24
},
{
"__id__": 25
},
{
"__id__": 26
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1280,
"height": 720
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
640,
360,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "a5esZu+45LA5mBpvttspPD"
},
{
"__type__": "cc.Node",
"_name": "Main Camera",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 4
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1280,
"height": 720
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
362.85545494732423,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "e1WoFrQ79G7r4ZuQE3HlNb"
},
{
"__type__": "cc.Camera",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 3
},
"_enabled": true,
"_cullingMask": 4294967295,
"_clearFlags": 7,
"_backgroundColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_depth": -1,
"_zoomRatio": 1,
"_targetTexture": null,
"_fov": 60,
"_orthoSize": 10,
"_nearClip": 1,
"_farClip": 4096,
"_ortho": true,
"_rect": {
"__type__": "cc.Rect",
"x": 0,
"y": 0,
"width": 1,
"height": 1
},
"_renderStages": 1,
"_alignWithScreen": true,
"_id": "81GN3uXINKVLeW4+iKSlim"
},
{
"__type__": "cc.Node",
"_name": "bg",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 6
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1280,
"height": 720
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "32MJMZ2HRGF4BOf533Avyi"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "8288e3d4-4c75-4b27-8f01-f7014417f4dd"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "97/S6HDq9MeqgmV1Zwnhbb"
},
{
"__type__": "cc.Node",
"_name": "bottomPart",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [
{
"__id__": 8
},
{
"__id__": 11
}
],
"_active": true,
"_components": [],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
635.132,
-356.326,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "8c7k8ep/ZFNpO263+1QHz9"
},
{
"__type__": "cc.Node",
"_name": "btn_left",
"_objFlags": 0,
"_parent": {
"__id__": 7
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 9
},
{
"__id__": 10
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 61,
"height": 67
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-148.464,
34,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "5ad2wLQLxIN5Eg7OHecSH6"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 8
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "ce19457d-e8f3-4c38-ae3e-d4b99208ddb5"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "84mqOgJ3JNqZrYVTEU8CjE"
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 8
},
"_enabled": true,
"_normalMaterial": null,
"_grayMaterial": null,
"duration": 0.1,
"zoomScale": 1.2,
"clickEvents": [],
"_N$interactable": true,
"_N$enableAutoGrayEffect": false,
"_N$transition": 0,
"transition": 0,
"_N$normalColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"_N$hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$disabledColor": {
"__type__": "cc.Color",
"r": 124,
"g": 124,
"b": 124,
"a": 255
},
"_N$normalSprite": null,
"_N$pressedSprite": null,
"pressedSprite": null,
"_N$hoverSprite": null,
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": null,
"_id": "bcYN/4EKBJhbIAfovo9Ah1"
},
{
"__type__": "cc.Node",
"_name": "btn_right",
"_objFlags": 0,
"_parent": {
"__id__": 7
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 12
},
{
"__id__": 13
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 60,
"height": 66
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-47.164,
34,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "46i3stdzpHX6zQHTGnRsNE"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 11
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "e5a2dbaa-a677-4a32-90d7-a1b057d7fb59"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "42Sh8QS/BHn4WiGyPQPKPt"
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 11
},
"_enabled": true,
"_normalMaterial": null,
"_grayMaterial": null,
"duration": 0.1,
"zoomScale": 1.2,
"clickEvents": [],
"_N$interactable": true,
"_N$enableAutoGrayEffect": false,
"_N$transition": 0,
"transition": 0,
"_N$normalColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"_N$hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$disabledColor": {
"__type__": "cc.Color",
"r": 124,
"g": 124,
"b": 124,
"a": 255
},
"_N$normalSprite": null,
"_N$pressedSprite": null,
"pressedSprite": null,
"_N$hoverSprite": null,
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": null,
"_id": "1aj32fYY1IxLesa77E70Qu"
},
{
"__type__": "cc.Node",
"_name": "res",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [
{
"__id__": 15
},
{
"__id__": 18
},
{
"__id__": 21
}
],
"_active": false,
"_components": [],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "0aAzbH6R1E+6AmGRrkKa5O"
},
{
"__type__": "cc.Node",
"_name": "font",
"_objFlags": 0,
"_parent": {
"__id__": 14
},
"_children": [
{
"__id__": 16
}
],
"_active": true,
"_components": [],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "9bLfcYeeNKrr524vzWchiM"
},
{
"__type__": "cc.Node",
"_name": "BRLNSDB",
"_objFlags": 0,
"_parent": {
"__id__": 15
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 17
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "cfMLGsq0BMhJARv+ySMAxS"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 16
},
"_enabled": true,
"_materials": [],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_useOriginalSize": true,
"_string": "",
"_N$string": "",
"_fontSize": 40,
"_lineHeight": 40,
"_enableWrapText": true,
"_N$file": {
"__uuid__": "c551970e-b095-45f3-9f1d-25cde8b8deb1"
},
"_isSystemFontUsed": false,
"_spacingX": 0,
"_batchAsBitmap": false,
"_styleFlags": 0,
"_underlineHeight": 0,
"_N$horizontalAlign": 0,
"_N$verticalAlign": 0,
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$cacheMode": 0,
"_id": "9bNHNPu5lC7rQYyr8ai/sY"
},
{
"__type__": "cc.Node",
"_name": "img",
"_objFlags": 0,
"_parent": {
"__id__": 14
},
"_children": [
{
"__id__": 19
}
],
"_active": true,
"_components": [],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "53LUHHG2pEr79fyrvazXJs"
},
{
"__type__": "cc.Node",
"_name": "icon",
"_objFlags": 0,
"_parent": {
"__id__": 18
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 20
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 138,
"height": 141
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "1blU2OArJIfoC9XfupGxJG"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 19
},
"_enabled": true,
"_materials": [],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "6fbc30a8-3c49-44ae-8ba4-7f56f385b78a"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "03GEWUEZJGyKormWgIWCtM"
},
{
"__type__": "cc.Node",
"_name": "audio",
"_objFlags": 0,
"_parent": {
"__id__": 14
},
"_children": [
{
"__id__": 22
}
],
"_active": true,
"_components": [],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "b823DIVC9L+Ihc3T9Bt7m3"
},
{
"__type__": "cc.Node",
"_name": "btn",
"_objFlags": 0,
"_parent": {
"__id__": 21
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 23
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "3d0p0/uJZJIoRva5Br2iqv"
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 22
},
"_enabled": true,
"_clip": {
"__uuid__": "f0680ae0-c079-45ef-abd7-9e63d90b982b"
},
"_volume": 1,
"_mute": false,
"_loop": false,
"playOnLoad": false,
"preload": false,
"_id": "0adN50f61DlbmppsPkOnjX"
},
{
"__type__": "cc.Canvas",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_designResolution": {
"__type__": "cc.Size",
"width": 1280,
"height": 720
},
"_fitWidth": false,
"_fitHeight": false,
"_id": "59Cd0ovbdF4byw5sbjJDx7"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 45,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "29zXboiXFBKoIV4PQ2liTe"
},
{
"__type__": "f4edeRi+NdAabqAkVYRwFjK",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_id": "e687yyoRBIzZAOVRL8Sseh"
}
]
\ No newline at end of file
import { onHomeworkFinish } from "./util";
cc.Class({
extends: cc.Component,
properties: {
},
// 生命周期 onLoad
onLoad() {
this.initSceneData();
this.initSize();
},
_imageResList: null,
_audioResList: null,
_animaResList: null,
initSceneData() {
this._imageResList = [];
this._audioResList = [];
this._animaResList = [];
},
_designSize: null, // 设计分辨率
_frameSize: null, // 屏幕分辨率
_mapScaleMin: null, // 场景中常用缩放(取大值)
_mapScaleMax: null, // 场景中常用缩放(取小值)
_cocosScale: null, // cocos 自缩放 (较少用到)
initSize() {
// 注意cc.winSize只有在适配后(修改fitHeight/fitWidth后)才能获取到正确的值,因此使用cc.getFrameSize()来获取初始的屏幕大小
let screen_size = cc.view.getFrameSize().width / cc.view.getFrameSize().height
let design_size = cc.Canvas.instance.designResolution.width / cc.Canvas.instance.designResolution.height
let f = screen_size >= design_size
cc.Canvas.instance.fitHeight = f
cc.Canvas.instance.fitWidth = !f
const frameSize = cc.view.getFrameSize();
this._frameSize = frameSize;
this._designSize = cc.view.getDesignResolutionSize();
let sx = cc.winSize.width / frameSize.width;
let sy = cc.winSize.height / frameSize.height;
this._cocosScale = Math.min(sx, sy);
sx = frameSize.width / this._designSize.width;
sy = frameSize.height / this._designSize.height;
this._mapScaleMin = Math.min(sx, sy) * this._cocosScale;
this._mapScaleMax = Math.max(sx, sy) * this._cocosScale;
},
// 生命周期 start
start() {
let getData = this.getData.bind(this);
if (window && window.courseware) {
getData = window.courseware.getData;
}
getData((data) => {
console.log('data:', data);
this.data = data || this.getDefaultData();
this.data = JSON.parse(JSON.stringify(this.data))
this.preloadItem()
})
},
getData(cb) {
cb(this.getDefaultData());
},
getDefaultData() {
const dataJson = '{"pic_url":"http://staging-teach.cdn.ireadabc.com/ed94332a503c31e0908bd4c6923a2665.png","pic_url_2":"http://staging-teach.cdn.ireadabc.com/5fb60317ade0195d35ad8034d5370a7f.png","text":"This is a test label.","audio_url":"http://staging-teach.cdn.ireadabc.com/f47f1d7b5c160fe1c59500d180346240.mp3"}'
const data = JSON.parse(dataJson);
return data;
},
preloadItem() {
this.addPreloadImage();
this.addPreloadAudio();
this.addPreloadAnima();
this.preload();
},
addPreloadImage() {
this._imageResList.push({ url: this.data.pic_url });
this._imageResList.push({ url: this.data.pic_url_2 });
},
addPreloadAudio() {
this._audioResList.push({ url: this.data.audio_url });
},
addPreloadAnima() {
},
preload() {
const preloadArr = this._imageResList.concat(this._audioResList).concat(this._animaResList);
cc.assetManager.loadAny(preloadArr, null, null, (err, data) => {
this.loadEnd();
if (window && window["air"]) {
window["air"].hideAirClassLoading();
}
cc.debug.setDisplayStats(false);
});
},
loadEnd() {
this.initData();
this.initAudio();
this.initView();
// this.initListener();
},
_cantouch: null,
initData() {
// 所有全局变量 默认都是null
this._cantouch = true;
},
audioBtn: null,
initAudio() {
const audioNode = cc.find('Canvas/res/audio');
const getAudioByResName = (resName) => {
return audioNode.getChildByName(resName).getComponent(cc.AudioSource);
}
this.audioBtn = getAudioByResName('btn');
},
initView() {
this.initBg();
this.initPic();
this.initBtn();
this.initIcon();
},
initBg() {
const bgNode = cc.find('Canvas/bg');
bgNode.scale = this._mapScaleMax;
},
pic1: null,
pic2: null,
initPic() {
const canvas = cc.find('Canvas');
const maxW = canvas.width * 0.7;
this.getSprNodeByUrl(this.data.pic_url, (sprNode) => {
const picNode1 = sprNode;
picNode1.scale = maxW / picNode1.width;
picNode1.baseX = picNode1.x;
canvas.addChild(picNode1);
this.pic1 = picNode1;
const labelNode = new cc.Node();
labelNode.color = cc.Color.YELLOW;
const label = labelNode.addComponent(cc.Label);
label.string = this.data.text;
label.fontSize = 60;
label.lineHeight = 60;
label.font = cc.find('Canvas/res/font/BRLNSDB').getComponent('cc.Label').font;
picNode1.addChild(labelNode);
});
this.getSprNodeByUrl(this.data.pic_url_2, (sprNode) => {
const picNode2 = sprNode;
picNode2.scale = maxW / picNode2.width;
canvas.addChild(picNode2);
picNode2.x = canvas.width;
picNode2.baseX = picNode2.x;
this.pic2 = picNode2;
const labelNode = new cc.Node();
const label = labelNode.addComponent(cc.RichText);
const size = 60
label.font = cc.find('Canvas/res/font/BRLNSDB').getComponent(cc.Label).font;
label.string = `<outline color=#751e00 width=4><size=${size}><color=#ffffff>${this.data.text}</color></size></outline>`
label.lineHeight = size;
picNode2.addChild(labelNode);
});
},
initIcon() {
const iconNode = this.getSprNode('icon');
iconNode.zIndex = 5;
iconNode.anchorX = 1;
iconNode.anchorY = 1;
iconNode.parent = cc.find('Canvas');
iconNode.x = iconNode.parent.width / 2 - 10;
iconNode.y = iconNode.parent.height / 2 - 10;
iconNode.on(cc.Node.EventType.TOUCH_START, () => {
this.playAudioByUrl(this.data.audio_url);
})
},
curPage: null,
initBtn() {
this.curPage = 0;
const bottomPart = cc.find('Canvas/bottomPart');
bottomPart.zIndex = 5; // 提高层级
bottomPart.x = bottomPart.parent.width / 2;
bottomPart.y = -bottomPart.parent.height / 2;
const leftBtnNode = bottomPart.getChildByName('btn_left');
//节点中添加了button组件 则可以添加click事件监听
leftBtnNode.on('click', () => {
if (!this._cantouch) {
return;
}
if (this.curPage == 0) {
return;
}
this.curPage = 0
this.leftMove();
// 游戏结束时需要调用这个方法通知系统作业完成
onHomeworkFinish();
cc.audioEngine.play(this.audioBtn.clip, false, 0.8)
})
const rightBtnNode = bottomPart.getChildByName('btn_right');
//节点中添加了button组件 则可以添加click事件监听
rightBtnNode.on('click', () => {
if (!this._cantouch) {
return;
}
if (this.curPage == 1) {
return;
}
this.curPage = 1
this.rightMove();
cc.audioEngine.play(this.audioBtn.clip, false, 0.5)
})
},
leftMove() {
this._cantouch = false;
const len = this.pic1.parent.width;
cc.tween(this.pic1)
.to(1, { x: this.pic1.baseX }, { easing: 'cubicInOut' })
.start();
cc.tween(this.pic2)
.to(1, { x: this.pic2.baseX }, { easing: 'cubicInOut' })
.call(() => {
this._cantouch = true;
})
.start();
},
rightMove() {
this._cantouch = false;
const len = this.pic1.parent.width;
cc.tween(this.pic1)
.to(1, { x: this.pic1.baseX - len }, { easing: 'cubicInOut' })
.start();
cc.tween(this.pic2)
.to(1, { x: this.pic2.baseX - len }, { easing: 'cubicInOut' })
.call(() => {
this._cantouch = true;
})
.start();
},
// update (dt) {},
// ------------------------------------------------
getSprNode(resName) {
const sf = cc.find('Canvas/res/img/' + resName).getComponent(cc.Sprite).spriteFrame;
const node = new cc.Node();
node.addComponent(cc.Sprite).spriteFrame = sf;
return node;
},
getSpriteFrimeByUrl(url, cb) {
cc.loader.load({ url }, (err, img) => {
const spriteFrame = new cc.SpriteFrame(img)
if (cb) {
cb(spriteFrame);
}
})
},
getSprNodeByUrl(url, cb) {
const node = new cc.Node();
const spr = node.addComponent(cc.Sprite);
this.getSpriteFrimeByUrl(url, (sf) => {
spr.spriteFrame = sf;
if (cb) {
cb(node);
}
})
},
playAudioByUrl(audio_url, cb = null) {
if (audio_url) {
cc.assetManager.loadRemote(audio_url, (err, audioClip) => {
const audioId = cc.audioEngine.play(audioClip, false, 0.8);
if (cb) {
cc.audioEngine.setFinishCallback(audioId, () => {
cb();
});
}
});
}
},
// ------------------------------------------
});
/**
* Copyright (c) 2014-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
!(function (global) {
"use strict";
var Op = Object.prototype;
var hasOwn = Op.hasOwnProperty;
var undefined; // More compressible than void 0.
var $Symbol = typeof Symbol === "function" ? Symbol : {};
var iteratorSymbol = $Symbol.iterator || "@@iterator";
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
var inModule = typeof module === "object";
var runtime = global.regeneratorRuntime;
if (runtime) {
if (inModule) {
// If regeneratorRuntime is defined globally and we're in a module,
// make the exports object identical to regeneratorRuntime.
module.exports = runtime;
}
// Don't bother evaluating the rest of this file if the runtime was
// already defined globally.
return;
}
// Define the runtime globally (as expected by generated code) as either
// module.exports (if we're in a module) or a new, empty object.
runtime = global.regeneratorRuntime = inModule ? module.exports : {};
function wrap(innerFn, outerFn, self, tryLocsList) {
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
var generator = Object.create(protoGenerator.prototype);
var context = new Context(tryLocsList || []);
// The ._invoke method unifies the implementations of the .next,
// .throw, and .return methods.
generator._invoke = makeInvokeMethod(innerFn, self, context);
return generator;
}
runtime.wrap = wrap;
// Try/catch helper to minimize deoptimizations. Returns a completion
// record like context.tryEntries[i].completion. This interface could
// have been (and was previously) designed to take a closure to be
// invoked without arguments, but in all the cases we care about we
// already have an existing method we want to call, so there's no need
// to create a new function object. We can even get away with assuming
// the method takes exactly one argument, since that happens to be true
// in every case, so we don't have to touch the arguments object. The
// only additional allocation required is the completion record, which
// has a stable shape and so hopefully should be cheap to allocate.
function tryCatch(fn, obj, arg) {
try {
return { type: "normal", arg: fn.call(obj, arg) };
} catch (err) {
return { type: "throw", arg: err };
}
}
var GenStateSuspendedStart = "suspendedStart";
var GenStateSuspendedYield = "suspendedYield";
var GenStateExecuting = "executing";
var GenStateCompleted = "completed";
// Returning this object from the innerFn has the same effect as
// breaking out of the dispatch switch statement.
var ContinueSentinel = {};
// Dummy constructor functions that we use as the .constructor and
// .constructor.prototype properties for functions that return Generator
// objects. For full spec compliance, you may wish to configure your
// minifier not to mangle the names of these two functions.
function Generator() { }
function GeneratorFunction() { }
function GeneratorFunctionPrototype() { }
// This is a polyfill for %IteratorPrototype% for environments that
// don't natively support it.
var IteratorPrototype = {};
IteratorPrototype[iteratorSymbol] = function () {
return this;
};
var getProto = Object.getPrototypeOf;
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
if (NativeIteratorPrototype &&
NativeIteratorPrototype !== Op &&
hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
// This environment has a native %IteratorPrototype%; use it instead
// of the polyfill.
IteratorPrototype = NativeIteratorPrototype;
}
var Gp = GeneratorFunctionPrototype.prototype =
Generator.prototype = Object.create(IteratorPrototype);
GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
GeneratorFunctionPrototype.constructor = GeneratorFunction;
GeneratorFunctionPrototype[toStringTagSymbol] =
GeneratorFunction.displayName = "GeneratorFunction";
// Helper for defining the .next, .throw, and .return methods of the
// Iterator interface in terms of a single ._invoke method.
function defineIteratorMethods(prototype) {
["next", "throw", "return"].forEach(function (method) {
prototype[method] = function (arg) {
return this._invoke(method, arg);
};
});
}
runtime.isGeneratorFunction = function (genFun) {
var ctor = typeof genFun === "function" && genFun.constructor;
return ctor
? ctor === GeneratorFunction ||
// For the native GeneratorFunction constructor, the best we can
// do is to check its .name property.
(ctor.displayName || ctor.name) === "GeneratorFunction"
: false;
};
runtime.mark = function (genFun) {
if (Object.setPrototypeOf) {
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
} else {
genFun.__proto__ = GeneratorFunctionPrototype;
if (!(toStringTagSymbol in genFun)) {
genFun[toStringTagSymbol] = "GeneratorFunction";
}
}
genFun.prototype = Object.create(Gp);
return genFun;
};
// Within the body of any async function, `await x` is transformed to
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
// `hasOwn.call(value, "__await")` to determine if the yielded value is
// meant to be awaited.
runtime.awrap = function (arg) {
return { __await: arg };
};
function AsyncIterator(generator) {
function invoke(method, arg, resolve, reject) {
var record = tryCatch(generator[method], generator, arg);
if (record.type === "throw") {
reject(record.arg);
} else {
var result = record.arg;
var value = result.value;
if (value &&
typeof value === "object" &&
hasOwn.call(value, "__await")) {
return Promise.resolve(value.__await).then(function (value) {
invoke("next", value, resolve, reject);
}, function (err) {
invoke("throw", err, resolve, reject);
});
}
return Promise.resolve(value).then(function (unwrapped) {
// When a yielded Promise is resolved, its final value becomes
// the .value of the Promise<{value,done}> result for the
// current iteration. If the Promise is rejected, however, the
// result for this iteration will be rejected with the same
// reason. Note that rejections of yielded Promises are not
// thrown back into the generator function, as is the case
// when an awaited Promise is rejected. This difference in
// behavior between yield and await is important, because it
// allows the consumer to decide what to do with the yielded
// rejection (swallow it and continue, manually .throw it back
// into the generator, abandon iteration, whatever). With
// await, by contrast, there is no opportunity to examine the
// rejection reason outside the generator function, so the
// only option is to throw it from the await expression, and
// let the generator function handle the exception.
result.value = unwrapped;
resolve(result);
}, reject);
}
}
var previousPromise;
function enqueue(method, arg) {
function callInvokeWithMethodAndArg() {
return new Promise(function (resolve, reject) {
invoke(method, arg, resolve, reject);
});
}
return previousPromise =
// If enqueue has been called before, then we want to wait until
// all previous Promises have been resolved before calling invoke,
// so that results are always delivered in the correct order. If
// enqueue has not been called before, then it is important to
// call invoke immediately, without waiting on a callback to fire,
// so that the async generator function has the opportunity to do
// any necessary setup in a predictable way. This predictability
// is why the Promise constructor synchronously invokes its
// executor callback, and why async functions synchronously
// execute code before the first await. Since we implement simple
// async functions in terms of async generators, it is especially
// important to get this right, even though it requires care.
previousPromise ? previousPromise.then(
callInvokeWithMethodAndArg,
// Avoid propagating failures to Promises returned by later
// invocations of the iterator.
callInvokeWithMethodAndArg
) : callInvokeWithMethodAndArg();
}
// Define the unified helper method that is used to implement .next,
// .throw, and .return (see defineIteratorMethods).
this._invoke = enqueue;
}
defineIteratorMethods(AsyncIterator.prototype);
AsyncIterator.prototype[asyncIteratorSymbol] = function () {
return this;
};
runtime.AsyncIterator = AsyncIterator;
// Note that simple async functions are implemented on top of
// AsyncIterator objects; they just return a Promise for the value of
// the final result produced by the iterator.
runtime.async = function (innerFn, outerFn, self, tryLocsList) {
var iter = new AsyncIterator(
wrap(innerFn, outerFn, self, tryLocsList)
);
return runtime.isGeneratorFunction(outerFn)
? iter // If outerFn is a generator, return the full iterator.
: iter.next().then(function (result) {
return result.done ? result.value : iter.next();
});
};
function makeInvokeMethod(innerFn, self, context) {
var state = GenStateSuspendedStart;
return function invoke(method, arg) {
if (state === GenStateExecuting) {
throw new Error("Generator is already running");
}
if (state === GenStateCompleted) {
if (method === "throw") {
throw arg;
}
// Be forgiving, per 25.3.3.3.3 of the spec:
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
return doneResult();
}
context.method = method;
context.arg = arg;
while (true) {
var delegate = context.delegate;
if (delegate) {
var delegateResult = maybeInvokeDelegate(delegate, context);
if (delegateResult) {
if (delegateResult === ContinueSentinel) continue;
return delegateResult;
}
}
if (context.method === "next") {
// Setting context._sent for legacy support of Babel's
// function.sent implementation.
context.sent = context._sent = context.arg;
} else if (context.method === "throw") {
if (state === GenStateSuspendedStart) {
state = GenStateCompleted;
throw context.arg;
}
context.dispatchException(context.arg);
} else if (context.method === "return") {
context.abrupt("return", context.arg);
}
state = GenStateExecuting;
var record = tryCatch(innerFn, self, context);
if (record.type === "normal") {
// If an exception is thrown from innerFn, we leave state ===
// GenStateExecuting and loop back for another invocation.
state = context.done
? GenStateCompleted
: GenStateSuspendedYield;
if (record.arg === ContinueSentinel) {
continue;
}
return {
value: record.arg,
done: context.done
};
} else if (record.type === "throw") {
state = GenStateCompleted;
// Dispatch the exception by looping back around to the
// context.dispatchException(context.arg) call above.
context.method = "throw";
context.arg = record.arg;
}
}
};
}
// Call delegate.iterator[context.method](context.arg) and handle the
// result, either by returning a { value, done } result from the
// delegate iterator, or by modifying context.method and context.arg,
// setting context.delegate to null, and returning the ContinueSentinel.
function maybeInvokeDelegate(delegate, context) {
var method = delegate.iterator[context.method];
if (method === undefined) {
// A .throw or .return when the delegate iterator has no .throw
// method always terminates the yield* loop.
context.delegate = null;
if (context.method === "throw") {
if (delegate.iterator.return) {
// If the delegate iterator has a return method, give it a
// chance to clean up.
context.method = "return";
context.arg = undefined;
maybeInvokeDelegate(delegate, context);
if (context.method === "throw") {
// If maybeInvokeDelegate(context) changed context.method from
// "return" to "throw", let that override the TypeError below.
return ContinueSentinel;
}
}
context.method = "throw";
context.arg = new TypeError(
"The iterator does not provide a 'throw' method");
}
return ContinueSentinel;
}
var record = tryCatch(method, delegate.iterator, context.arg);
if (record.type === "throw") {
context.method = "throw";
context.arg = record.arg;
context.delegate = null;
return ContinueSentinel;
}
var info = record.arg;
if (!info) {
context.method = "throw";
context.arg = new TypeError("iterator result is not an object");
context.delegate = null;
return ContinueSentinel;
}
if (info.done) {
// Assign the result of the finished delegate to the temporary
// variable specified by delegate.resultName (see delegateYield).
context[delegate.resultName] = info.value;
// Resume execution at the desired location (see delegateYield).
context.next = delegate.nextLoc;
// If context.method was "throw" but the delegate handled the
// exception, let the outer generator proceed normally. If
// context.method was "next", forget context.arg since it has been
// "consumed" by the delegate iterator. If context.method was
// "return", allow the original .return call to continue in the
// outer generator.
if (context.method !== "return") {
context.method = "next";
context.arg = undefined;
}
} else {
// Re-yield the result returned by the delegate method.
return info;
}
// The delegate iterator is finished, so forget it and continue with
// the outer generator.
context.delegate = null;
return ContinueSentinel;
}
// Define Generator.prototype.{next,throw,return} in terms of the
// unified ._invoke helper method.
defineIteratorMethods(Gp);
Gp[toStringTagSymbol] = "Generator";
// A Generator should always return itself as the iterator object when the
// @@iterator function is called on it. Some browsers' implementations of the
// iterator prototype chain incorrectly implement this, causing the Generator
// object to not be returned from this call. This ensures that doesn't happen.
// See https://github.com/facebook/regenerator/issues/274 for more details.
Gp[iteratorSymbol] = function () {
return this;
};
Gp.toString = function () {
return "[object Generator]";
};
function pushTryEntry(locs) {
var entry = { tryLoc: locs[0] };
if (1 in locs) {
entry.catchLoc = locs[1];
}
if (2 in locs) {
entry.finallyLoc = locs[2];
entry.afterLoc = locs[3];
}
this.tryEntries.push(entry);
}
function resetTryEntry(entry) {
var record = entry.completion || {};
record.type = "normal";
delete record.arg;
entry.completion = record;
}
function Context(tryLocsList) {
// The root entry object (effectively a try statement without a catch
// or a finally block) gives us a place to store values thrown from
// locations where there is no enclosing try statement.
this.tryEntries = [{ tryLoc: "root" }];
tryLocsList.forEach(pushTryEntry, this);
this.reset(true);
}
runtime.keys = function (object) {
var keys = [];
for (var key in object) {
keys.push(key);
}
keys.reverse();
// Rather than returning an object with a next method, we keep
// things simple and return the next function itself.
return function next() {
while (keys.length) {
var key = keys.pop();
if (key in object) {
next.value = key;
next.done = false;
return next;
}
}
// To avoid creating an additional object, we just hang the .value
// and .done properties off the next function object itself. This
// also ensures that the minifier will not anonymize the function.
next.done = true;
return next;
};
};
function values(iterable) {
if (iterable) {
var iteratorMethod = iterable[iteratorSymbol];
if (iteratorMethod) {
return iteratorMethod.call(iterable);
}
if (typeof iterable.next === "function") {
return iterable;
}
if (!isNaN(iterable.length)) {
var i = -1, next = function next() {
while (++i < iterable.length) {
if (hasOwn.call(iterable, i)) {
next.value = iterable[i];
next.done = false;
return next;
}
}
next.value = undefined;
next.done = true;
return next;
};
return next.next = next;
}
}
// Return an iterator with no values.
return { next: doneResult };
}
runtime.values = values;
function doneResult() {
return { value: undefined, done: true };
}
Context.prototype = {
constructor: Context,
reset: function (skipTempReset) {
this.prev = 0;
this.next = 0;
// Resetting context._sent for legacy support of Babel's
// function.sent implementation.
this.sent = this._sent = undefined;
this.done = false;
this.delegate = null;
this.method = "next";
this.arg = undefined;
this.tryEntries.forEach(resetTryEntry);
if (!skipTempReset) {
for (var name in this) {
// Not sure about the optimal order of these conditions:
if (name.charAt(0) === "t" &&
hasOwn.call(this, name) &&
!isNaN(+name.slice(1))) {
this[name] = undefined;
}
}
}
},
stop: function () {
this.done = true;
var rootEntry = this.tryEntries[0];
var rootRecord = rootEntry.completion;
if (rootRecord.type === "throw") {
throw rootRecord.arg;
}
return this.rval;
},
dispatchException: function (exception) {
if (this.done) {
throw exception;
}
var context = this;
function handle(loc, caught) {
record.type = "throw";
record.arg = exception;
context.next = loc;
if (caught) {
// If the dispatched exception was caught by a catch block,
// then let that catch block handle the exception normally.
context.method = "next";
context.arg = undefined;
}
return !!caught;
}
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
var record = entry.completion;
if (entry.tryLoc === "root") {
// Exception thrown outside of any try block that could handle
// it, so set the completion value of the entire function to
// throw the exception.
return handle("end");
}
if (entry.tryLoc <= this.prev) {
var hasCatch = hasOwn.call(entry, "catchLoc");
var hasFinally = hasOwn.call(entry, "finallyLoc");
if (hasCatch && hasFinally) {
if (this.prev < entry.catchLoc) {
return handle(entry.catchLoc, true);
} else if (this.prev < entry.finallyLoc) {
return handle(entry.finallyLoc);
}
} else if (hasCatch) {
if (this.prev < entry.catchLoc) {
return handle(entry.catchLoc, true);
}
} else if (hasFinally) {
if (this.prev < entry.finallyLoc) {
return handle(entry.finallyLoc);
}
} else {
throw new Error("try statement without catch or finally");
}
}
}
},
abrupt: function (type, arg) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc <= this.prev &&
hasOwn.call(entry, "finallyLoc") &&
this.prev < entry.finallyLoc) {
var finallyEntry = entry;
break;
}
}
if (finallyEntry &&
(type === "break" ||
type === "continue") &&
finallyEntry.tryLoc <= arg &&
arg <= finallyEntry.finallyLoc) {
// Ignore the finally entry if control is not jumping to a
// location outside the try/catch block.
finallyEntry = null;
}
var record = finallyEntry ? finallyEntry.completion : {};
record.type = type;
record.arg = arg;
if (finallyEntry) {
this.method = "next";
this.next = finallyEntry.finallyLoc;
return ContinueSentinel;
}
return this.complete(record);
},
complete: function (record, afterLoc) {
if (record.type === "throw") {
throw record.arg;
}
if (record.type === "break" ||
record.type === "continue") {
this.next = record.arg;
} else if (record.type === "return") {
this.rval = this.arg = record.arg;
this.method = "return";
this.next = "end";
} else if (record.type === "normal" && afterLoc) {
this.next = afterLoc;
}
return ContinueSentinel;
},
finish: function (finallyLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.finallyLoc === finallyLoc) {
this.complete(entry.completion, entry.afterLoc);
resetTryEntry(entry);
return ContinueSentinel;
}
}
},
"catch": function (tryLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc === tryLoc) {
var record = entry.completion;
if (record.type === "throw") {
var thrown = record.arg;
resetTryEntry(entry);
}
return thrown;
}
}
// The context.catch method must only be called with a location
// argument that corresponds to a known catch block.
throw new Error("illegal catch attempt");
},
delegateYield: function (iterable, resultName, nextLoc) {
this.delegate = {
iterator: values(iterable),
resultName: resultName,
nextLoc: nextLoc
};
if (this.method === "next") {
// Deliberately forget the last sent value so that we don't
// accidentally pass it on to the delegate.
this.arg = undefined;
}
return ContinueSentinel;
}
};
})(
// In sloppy mode, unbound `this` refers to the global object, fallback to
// Function constructor if we're in global strict mode. That is sadly a form
// of indirect eval which violates Content Security Policy.
(function () { return this })() || Function("return this")()
);
export function getPosByAngle(angle, len) {
const radian = angle * Math.PI / 180;
const x = Math.sin(radian) * len;
const y = Math.cos(radian) * len;
return { x, y };
}
export function getAngleByPos(px, py, mx, my) {
const x = Math.abs(px - mx);
const y = Math.abs(py - my);
const z = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
const cos = y / z;
const radina = Math.acos(cos); // 用反三角函数求弧度
let angle = Math.floor(180 / (Math.PI / radina) * 100) / 100; // 将弧度转换成角度
if (mx > px && my > py) {// 鼠标在第四象限
angle = 180 - angle;
}
if (mx === px && my > py) {// 鼠标在y轴负方向上
angle = 180;
}
if (mx > px && my === py) {// 鼠标在x轴正方向上
angle = 90;
}
if (mx < px && my > py) {// 鼠标在第三象限
angle = 180 + angle;
}
if (mx < px && my === py) {// 鼠标在x轴负方向
angle = 270;
}
if (mx < px && my < py) {// 鼠标在第二象限
angle = 360 - angle;
}
// console.log('angle: ', angle);
return angle;
}
export function exchangeNodePos(baseNode, targetNode) {
return baseNode.convertToNodeSpaceAR(targetNode._parent.convertToWorldSpaceAR(cc.v2(targetNode.x, targetNode.y)));
}
export function RandomInt(a, b = 0) {
let max = Math.max(a, b);
let min = Math.min(a, b);
return Math.floor(Math.random() * (max - min) + min);
}
export function randomSortByArr(arr) {
const newArr = [];
const tmpArr = arr.concat();
while (tmpArr.length > 0) {
const randomIndex = Math.floor(tmpArr.length * Math.random());
newArr.push(tmpArr[randomIndex]);
tmpArr.splice(randomIndex, 1);
}
return newArr;
}
export function setSprNodeMaxLen(sprNode, maxW, maxH) {
const sx = maxW / sprNode.width;
const sy = maxH / sprNode.height;
const s = Math.min(sx, sy);
sprNode.scale = Math.round(s * 1000) / 1000;
}
export function localPosTolocalPos(baseNode, targetNode) {
const worldPos = targetNode.parent.convertToWorldSpaceAR(cc.v2(targetNode.x, targetNode.y));
const localPos = baseNode.parent.convertToNodeSpaceAR(cc.v2(worldPos.x, worldPos.y));
return localPos;
}
export function worldPosToLocalPos(worldPos, baseNode) {
const localPos = baseNode.parent.convertToNodeSpaceAR(cc.v2(worldPos.x, worldPos.y));
return localPos;
}
export function getScaleRateBy2Node(baseNode, targetNode, maxFlag = true) {
const worldRect1 = targetNode.getBoundingBoxToWorld();
const worldRect2 = baseNode.getBoundingBoxToWorld();
const sx = worldRect1.width / worldRect2.width;
const sy = worldRect1.height / worldRect2.height;
if (maxFlag) {
return Math.max(sx, sy);
} else {
return Math.min(sx, sy);
}
}
export function getDistance (start, end){
var pos = cc.v2(start.x - end.x, start.y - end.y);
var dis = Math.sqrt(pos.x*pos.x + pos.y*pos.y);
return dis;
}
export function playAudioByUrl(audio_url, cb=null) {
if (audio_url) {
cc.assetManager.loadRemote(audio_url, (err, audioClip) => {
const audioId = cc.audioEngine.play(audioClip, false, 0.8);
if (cb) {
cc.audioEngine.setFinishCallback(audioId, () => {
cb();
});
}
});
}
}
export function btnClickAnima(btn, time=0.15, rate=1.05) {
btn.tmpScale = btn.scale;
btn.on(cc.Node.EventType.TOUCH_START, () => {
cc.tween(btn)
.to(time / 2, {scale: btn.scale * rate})
.start()
})
btn.on(cc.Node.EventType.TOUCH_CANCEL, () => {
cc.tween(btn)
.to(time / 2, {scale: btn.tmpScale})
.start()
})
btn.on(cc.Node.EventType.TOUCH_END, () => {
cc.tween(btn)
.to(time / 2, {scale: btn.tmpScale})
.start()
})
}
export function getSpriteFrimeByUrl(url, cb) {
cc.loader.load({ url }, (err, img) => {
const spriteFrame = new cc.SpriteFrame(img)
if (cb) {
cb(spriteFrame);
}
})
}
export function getSprNode(resName) {
const sf = cc.find('Canvas/res/img/' + resName).getComponent(cc.Sprite).spriteFrame;
const node = new cc.Node();
node.addComponent(cc.Sprite).spriteFrame = sf;
return node;
}
export function getSprNodeByUrl(url, cb) {
const node = new cc.Node();
const spr = node.addComponent(cc.Sprite);
getSpriteFrimeByUrl(url, (sf) => {
spr.spriteFrame = sf;
if (cb) {
cb(spr);
}
})
}
export function playAudio(audioClip, cb = null) {
if (audioClip) {
const audioId = cc.audioEngine.playEffect(audioClip, false, 0.8);
if (cb) {
cc.audioEngine.setFinishCallback(audioId, () => {
cb();
});
}
}
}
export async function asyncDelay(time) {
return new Promise((resolve, reject) => {
try {
setTimeout(() => {
resolve();
}, time * 1000);
} catch (e) {
reject(e);
}
})
}
export class FireworkSettings {
baseNode; // 父节点
nodeList; // 火花节点的array
pos; // 发射点
side; // 发射方向
range; // 扩散范围
number; // 发射数量
scalseRange; // 缩放范围
constructor(baseNode, nodeList,
pos = cc.v2(0, 0),
side = cc.v2(0, 100),
range = 50,
number = 100,
scalseRange = 0
) {
this.baseNode = baseNode;
this.nodeList = nodeList;
this.pos = pos;
this.side = side;
this.range = range;
this.number = number;
this.scalseRange = scalseRange;
}
static copy(firework) {
return new FireworkSettings(
firework.baseNode,
firework.nodeList,
firework.pos,
firework.side,
firework.range,
firework.number,
);
}
}
export async function showFireworks(fireworkSettings) {
const { baseNode, nodeList, pos, side, range, number, scalseRange } = fireworkSettings;
new Array(number).fill(' ').forEach(async (_, i) => {
let rabbonNode = new cc.Node();
rabbonNode.parent = baseNode;
rabbonNode.x = pos.x;
rabbonNode.y = pos.y;
rabbonNode.angle = 60 * Math.random() - 30;
let node = cc.instantiate(nodeList[RandomInt(nodeList.length)]);
node.parent = rabbonNode;
node.active = true;
node.x = 0;
node.y = 0;
node.angle = 0;
node.scale = (Math.random() - 0.5) * scalseRange + 1;
const rate = Math.random();
const angle = Math.PI * (Math.random() * 2 - 1);
await asyncTweenBy(rabbonNode, 0.3, {
x: side.x * rate + Math.cos(angle) * range * rate,
y: side.y * rate + Math.sin(angle) * range * rate
}, {
easing: 'quadIn'
});
cc.tween(rabbonNode)
.by(8, { y: -2000 })
.start();
cc.tween(rabbonNode)
.to(5, { scale: (Math.random() - 0.5) * scalseRange + 1 })
.start();
rabbonFall(rabbonNode);
await asyncDelay(Math.random());
cc.tween(node)
.by(0.15, { x: -10, angle: -10 })
.by(0.3, { x: 20, angle: 20 })
.by(0.15, { x: -10, angle: -10 })
.union()
.repeatForever()
.start();
cc.tween(rabbonNode)
.delay(5)
.to(0.3, { opacity: 0 })
.call(() => {
node.stopAllActions();
node.active = false;
node.parent = null;
node = null;
})
.start();
});
}
async function rabbonFall(node) {
const time = 1 + Math.random();
const offsetX = RandomInt(-200, 200) * time;
await asyncTweenBy(node, time, { x: offsetX, angle: offsetX * 60 / 200 });
rabbonFall(node);
}
export async function asyncTweenTo(node, duration, obj, ease = undefined) {
return new Promise((resolve, reject) => {
try {
cc.tween(node)
.to(duration, obj, ease)
.call(() => {
resolve();
})
.start();
} catch (e) {
reject(e);
}
});
}
export async function asyncTweenBy(node, duration, obj, ease = undefined) {
return new Promise((resolve, reject) => {
try {
cc.tween(node)
.by(duration, obj, ease)
.call(() => {
resolve();
})
.start();
} catch (e) {
reject(e);
}
});
}
export function showTrebleFirework(baseNode, rabbonList) {
const middle = new FireworkSettings(baseNode, rabbonList);
middle.pos = cc.v2(0, -400);
middle.side = cc.v2(0, 1000);
middle.range = 200;
middle.number = 100;
middle.scalseRange = 0.4;
const left = FireworkSettings.copy(middle);
left.pos = cc.v2(-600, -400);
left.side = cc.v2(200, 1000);
const right = FireworkSettings.copy(middle);
right.pos = cc.v2(600, -400);
right.side = cc.v2(-200, 1000);
showFireworks(middle);
showFireworks(left);
showFireworks(right);
}
export function onHomeworkFinish() {
const middleLayer = cc.find('middleLayer');
if (middleLayer) {
const middleLayerComponent = middleLayer.getComponent('middleLayer');
if (middleLayerComponent.role == 'student') {
middleLayerComponent.onHomeworkFinish(() => { });
}
return;
}
}
\ No newline at end of file
{ {
"ver": "1.1.2", "ver": "1.1.2",
"uuid": "c35bb2f6-f24a-4850-ae44-643f2fdc7541", "uuid": "35e7895d-d54a-4940-840f-e7ec5d397aca",
"isBundle": false, "isBundle": false,
"bundleName": "", "bundleName": "",
"priority": 1, "priority": 1,
......
{
"ver": "1.1.2",
"uuid": "7d25a5d7-a799-4071-8de4-8b430d572289",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{ {
"ver": "2.0.1", "ver": "2.0.1",
"uuid": "f0680ae0-c079-45ef-abd7-9e63d90b982b", "uuid": "1da4a1eb-1b7f-4c66-b682-afb2bb2c25f8",
"downloadMode": 0, "downloadMode": 0,
"duration": 0.130612, "duration": 0.261224,
"subMetas": {} "subMetas": {}
} }
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "897db934-b5dd-4d83-b482-45c92812366e",
"downloadMode": 0,
"duration": 4.179592,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "6c4277af-aebb-470b-bce6-5215a5edee90",
"downloadMode": 0,
"duration": 1.688,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "8e061c88-bf21-44e1-8360-13bd6085b2bf",
"downloadMode": 0,
"duration": 1.044898,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "4cd1a303-1f39-40a3-9127-5afcad88e2af",
"downloadMode": 0,
"duration": 3.343673,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "be885015-b019-4b28-8900-dcb6b18752f3",
"downloadMode": 0,
"duration": 1.3865,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "455577d8-9fe9-451b-8bb0-241ffe3d08ef",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"__type__": "cc.AnimationClip",
"_name": "eff_sahua",
"_objFlags": 0,
"_native": "",
"_duration": 2.5,
"sample": 8,
"speed": 1,
"wrapMode": 1,
"curveData": {
"paths": {
"1": {
"props": {
"opacity": [
{
"frame": 0,
"value": 0
},
{
"frame": 0.125,
"value": 255
},
{
"frame": 1,
"value": 255
},
{
"frame": 1.25,
"value": 0
}
],
"position": [
{
"frame": 0.125,
"value": [
0,
0
],
"motionPath": []
},
{
"frame": 1.25,
"value": [
-369,
-212
],
"motionPath": []
}
],
"angle": [
{
"frame": 0.125,
"value": 0
},
{
"frame": 1.25,
"value": 180
}
]
}
},
"2": {
"props": {
"opacity": [
{
"frame": 0.25,
"value": 0
},
{
"frame": 0.375,
"value": 255
},
{
"frame": 1.25,
"value": 255
},
{
"frame": 1.5,
"value": 0
}
],
"position": [
{
"frame": 0.375,
"value": [
0,
0
]
},
{
"frame": 1.5,
"value": [
-308,
-294
]
}
],
"angle": [
{
"frame": 0.375,
"value": 0
},
{
"frame": 1.5,
"value": 180
}
]
}
},
"3": {
"props": {
"opacity": [
{
"frame": 0.5,
"value": 0
},
{
"frame": 0.625,
"value": 255
},
{
"frame": 1.5,
"value": 255
},
{
"frame": 1.75,
"value": 0
}
],
"position": [
{
"frame": 0.625,
"value": [
0,
0
]
},
{
"frame": 1.75,
"value": [
-161,
-422
]
}
],
"angle": [
{
"frame": 0.625,
"value": 0
},
{
"frame": 1.75,
"value": 180
}
]
}
},
"4": {
"props": {
"opacity": [
{
"frame": 0.875,
"value": 0
},
{
"frame": 1,
"value": 255
},
{
"frame": 1.875,
"value": 255
},
{
"frame": 2.125,
"value": 0
}
],
"position": [
{
"frame": 1,
"value": [
0,
0,
0
]
},
{
"frame": 2.125,
"value": [
-335,
-340.142,
0
]
}
],
"angle": [
{
"frame": 1,
"value": 0
},
{
"frame": 2.125,
"value": 180
}
]
}
},
"5": {
"props": {
"opacity": [
{
"frame": 0,
"value": 0
},
{
"frame": 0.125,
"value": 255
},
{
"frame": 1,
"value": 255
},
{
"frame": 1.25,
"value": 0
}
],
"position": [
{
"frame": 0.125,
"value": [
0,
0
],
"motionPath": []
},
{
"frame": 1.25,
"value": [
280,
-272
],
"motionPath": []
}
],
"angle": [
{
"frame": 0.125,
"value": 0
},
{
"frame": 1.25,
"value": 180
}
]
}
},
"6": {
"props": {
"opacity": [
{
"frame": 0.25,
"value": 0
},
{
"frame": 0.375,
"value": 255
},
{
"frame": 1.25,
"value": 255
},
{
"frame": 1.5,
"value": 0
}
],
"position": [
{
"frame": 0.375,
"value": [
0,
0
]
},
{
"frame": 1.5,
"value": [
351,
-196
]
}
],
"angle": [
{
"frame": 0.375,
"value": 0
},
{
"frame": 1.5,
"value": 180
}
]
}
},
"7": {
"props": {
"opacity": [
{
"frame": 0.5,
"value": 0
},
{
"frame": 0.625,
"value": 255
},
{
"frame": 1.5,
"value": 255
},
{
"frame": 1.75,
"value": 0
}
],
"position": [
{
"frame": 0.625,
"value": [
0,
0
]
},
{
"frame": 1.75,
"value": [
435,
-141
]
}
],
"angle": [
{
"frame": 0.625,
"value": 0
},
{
"frame": 1.75,
"value": 180
}
]
}
},
"8": {
"props": {
"opacity": [
{
"frame": 0.875,
"value": 0
},
{
"frame": 1,
"value": 255
},
{
"frame": 1.875,
"value": 255
},
{
"frame": 2.125,
"value": 0
}
],
"position": [
{
"frame": 1,
"value": [
0,
0
]
},
{
"frame": 2.125,
"value": [
249,
-607
]
}
],
"angle": [
{
"frame": 1,
"value": 0
},
{
"frame": 2.125,
"value": 180
}
]
}
},
"9": {
"props": {
"opacity": [
{
"frame": 0,
"value": 0
},
{
"frame": 0.125,
"value": 255
},
{
"frame": 1,
"value": 255
},
{
"frame": 1.25,
"value": 0
}
],
"position": [
{
"frame": 0.125,
"value": [
0,
0
],
"motionPath": []
},
{
"frame": 1.25,
"value": [
-222,
-499
],
"motionPath": []
}
],
"angle": [
{
"frame": 0.125,
"value": 0
},
{
"frame": 1.25,
"value": 180
}
]
}
},
"10": {
"props": {
"opacity": [
{
"frame": 0.25,
"value": 0
},
{
"frame": 0.375,
"value": 255
},
{
"frame": 1.25,
"value": 255
},
{
"frame": 1.5,
"value": 0
}
],
"position": [
{
"frame": 0.375,
"value": [
0,
0
]
},
{
"frame": 1.5,
"value": [
351,
-393
]
}
],
"angle": [
{
"frame": 0.375,
"value": 0
},
{
"frame": 1.5,
"value": 180
}
]
}
},
"11": {
"props": {
"opacity": [
{
"frame": 0.625,
"value": 0
},
{
"frame": 0.75,
"value": 255
},
{
"frame": 1.625,
"value": 255
},
{
"frame": 1.875,
"value": 0
}
],
"position": [
{
"frame": 0.75,
"value": [
0,
0
]
},
{
"frame": 1.875,
"value": [
-359,
-99
]
}
],
"angle": [
{
"frame": 0.75,
"value": 0
},
{
"frame": 1.875,
"value": 180
}
]
}
},
"12": {
"props": {
"opacity": [
{
"frame": 0.875,
"value": 0
},
{
"frame": 1,
"value": 255
},
{
"frame": 2.125,
"value": 255
},
{
"frame": 2.5,
"value": 0
}
],
"position": [
{
"frame": 1,
"value": [
0,
0
],
"motionPath": []
},
{
"frame": 2.5,
"value": [
171,
-424
],
"motionPath": []
}
],
"angle": [
{
"frame": 1,
"value": 0
},
{
"frame": 2.5,
"value": 180
}
]
}
},
"13": {
"props": {
"opacity": [
{
"frame": 0,
"value": 0
},
{
"frame": 0.125,
"value": 255
},
{
"frame": 1,
"value": 255
},
{
"frame": 1.25,
"value": 0
}
],
"position": [
{
"frame": 0.125,
"value": [
0,
0,
0
]
},
{
"frame": 1.25,
"value": [
186,
-208
],
"motionPath": []
}
],
"angle": [
{
"frame": 0.125,
"value": 0
},
{
"frame": 1.25,
"value": 180
}
]
}
},
"14": {
"props": {
"opacity": [
{
"frame": 0,
"value": 0
},
{
"frame": 0.125,
"value": 255
},
{
"frame": 1.625,
"value": 255
},
{
"frame": 1.875,
"value": 0
}
],
"position": [
{
"frame": 0.125,
"value": [
0,
0,
0
]
},
{
"frame": 1.875,
"value": [
150,
-443
]
}
],
"angle": [
{
"frame": 0.125,
"value": 0
},
{
"frame": 1.875,
"value": 180
}
]
}
},
"15": {
"props": {
"opacity": [
{
"frame": 0.375,
"value": 0
},
{
"frame": 0.5,
"value": 255
},
{
"frame": 1.375,
"value": 255
},
{
"frame": 1.625,
"value": 0
}
],
"position": [
{
"frame": 0.5,
"value": [
0,
0,
0
]
},
{
"frame": 1.625,
"value": [
-204.867,
-257.913,
0
]
}
],
"angle": [
{
"frame": 0.5,
"value": 0
},
{
"frame": 1.625,
"value": 180
}
]
}
}
}
},
"events": []
}
\ No newline at end of file
{
"ver": "2.1.0",
"uuid": "ac5cd74f-7311-4fae-a586-f37a87e61455",
"subMetas": {}
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"ver": "1.1.2",
"uuid": "7488de23-e223-4a1c-9a61-a332a676694e",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
// 全局环境预声明
window.g = window.g || {}; // 全局
\ No newline at end of file
{ {
"ver": "1.0.8", "ver": "1.0.8",
"uuid": "ade7af40-d56d-4087-bbc6-2888fef55353", "uuid": "a9bcccd1-c2b7-4db1-8744-3c0fcb95b824",
"isPlugin": false, "isPlugin": false,
"loadPluginInWeb": true, "loadPluginInWeb": true,
"loadPluginInNative": true, "loadPluginInNative": true,
......
g.utils = {
// 范围随机
randFromTo: function (_min, _max) {
var min = parseFloat(_min);
var max = parseFloat(_max);
return (min + Math.random() * (max - min));
},
// 范围随机一个整数
// 例:1~3,返回的可能值为:1、2、3
randFromTo_Int: function (min, max) {
var val = this.randFromTo(min, max + 1 - 0.0001);
return Math.floor(val);
},
// 深拷贝
deepCopy: function (src) {
var cpy = src instanceof Array ? [] : {};
for (var i in src) {
cpy[i] = typeof src[i] === 'object' ? this.deepCopy(src[i]) : src[i];
}
return cpy;
},
deletList: function (list, val) {
var index = list(val);
if (index > -1) {
this.splice(index, 1);
}
}
}
export function getPosByAngle(angle, len) {
const radian = angle * Math.PI / 180;
const x = Math.sin(radian) * len;
const y = Math.cos(radian) * len;
return { x, y };
}
export function getAngleByPos(px, py, mx, my) {
const x = Math.abs(px - mx);
const y = Math.abs(py - my);
const z = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
const cos = y / z;
const radina = Math.acos(cos); // 用反三角函数求弧度
let angle = Math.floor(180 / (Math.PI / radina) * 100) / 100; // 将弧度转换成角度
if (mx > px && my > py) {// 鼠标在第四象限
angle = 180 - angle;
}
if (mx === px && my > py) {// 鼠标在y轴负方向上
angle = 180;
}
if (mx > px && my === py) {// 鼠标在x轴正方向上
angle = 90;
}
if (mx < px && my > py) {// 鼠标在第三象限
angle = 180 + angle;
}
if (mx < px && my === py) {// 鼠标在x轴负方向
angle = 270;
}
if (mx < px && my < py) {// 鼠标在第二象限
angle = 360 - angle;
}
// console.log('angle: ', angle);
return angle;
}
export function exchangeNodePos(baseNode, targetNode) {
return baseNode.convertToNodeSpaceAR(targetNode._parent.convertToWorldSpaceAR(cc.v2(targetNode.x, targetNode.y)));
}
export function RandomInt(a, b = 0) {
let max = Math.max(a, b);
let min = Math.min(a, b);
return Math.floor(Math.random() * (max - min) + min);
}
export function Between(a, b, c) {
return [a, b, c].sort((a, b) => a - b)[1];
}
export function randomSortByArr(arr) {
const newArr = [];
const tmpArr = arr.concat();
while (tmpArr.length > 0) {
const randomIndex = Math.floor(tmpArr.length * Math.random());
newArr.push(tmpArr[randomIndex]);
tmpArr.splice(randomIndex, 1);
}
return newArr;
}
export async function asyncTweenTo(node, duration, obj, ease = undefined) {
return new Promise((resolve, reject) => {
cc.tween(node)
.to(duration, obj, ease)
.call(() => {
resolve();
})
.start();
});
}
export async function asyncTweenBy(node, duration, obj, ease = undefined) {
return new Promise((resolve, reject) => {
cc.tween(node)
.by(duration, obj, ease)
.call(() => {
resolve();
})
.start();
});
}
export async function asyncPlayDragonBoneAnimation(node, animationName, time = 1, onFrameEvent) {
return new Promise((resolve, reject) => {
node.getComponent(dragonBones.ArmatureDisplay)
.once(dragonBones.EventObject.COMPLETE, () => {
resolve();
});
node.getComponent(dragonBones.ArmatureDisplay)
.on(dragonBones.EventObject.FRAME_EVENT, ({ name }) => {
if (onFrameEvent && typeof (onFrameEvent) == 'function') {
onFrameEvent(name);
}
});
node.getComponent(dragonBones.ArmatureDisplay)
.playAnimation(animationName, time);
});
}
export async function asyncPlayEffectByUrl(url, loop = false) {
return new Promise((resolve, reject) => {
cc.assetManager.loadRemote(url, (err, clip) => {
console.log(clip);
cc.audioEngine.playEffect(clip, loop);
resolve();
});
});
}
export async function jelly(node) {
return new Promise((resolve, reject) => {
cc.tween(node)
.to(0.1, { scaleX: 0.9, scaleY: 1.1 })
.to(0.1, { scaleX: 1.1, scaleY: 0.9 })
.to(0.1, { scaleX: 1, scaleY: 1 })
.call(resolve)
.start();
});
}
export async function asyncDelay(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve();
}, time * 1000);
})
}
export async function showFireworks(baseNode, nodeList, pos = cc.v2(0, 0), side = cc.v2(0, 100), range = 50, number = 100) {
new Array(number).fill(' ').forEach(async (_, i) => {
let rabbonNode = new cc.Node();
rabbonNode.parent = baseNode;
rabbonNode.x = pos.x;
rabbonNode.y = pos.y;
rabbonNode.angle = 60 * Math.random() - 30;
let node = cc.instantiate(nodeList[RandomInt(nodeList.length)]);
node.parent = rabbonNode;
node.active = true;
node.x = 0;
node.y = 0;
node.angle = 0;
const rate = Math.random();
const angle = Math.PI * (Math.random() * 2 - 1);
await asyncTweenBy(rabbonNode, 0.3, {
x: side.x * rate + Math.cos(angle) * range * rate,
y: side.y * rate + Math.sin(angle) * range * rate
}, {
easing: 'quadIn'
});
cc.tween(rabbonNode)
.by(8, { y: -2000 })
.start();
rabbonFall(rabbonNode);
await asyncDelay(Math.random());
cc.tween(node)
.by(0.15, { x: -10, angle: -10 })
.by(0.3, { x: 20, angle: 20 })
.by(0.15, { x: -10, angle: -10 })
.union()
.repeatForever()
.start();
cc.tween(rabbonNode)
.delay(5)
.to(0.3, { opacity: 0 })
.call(() => {
node.stopAllActions();
node.active = false;
node.parent = null;
node = null;
})
.start();
});
}
async function rabbonFall(node) {
const time = 1 + Math.random();
const offsetX = RandomInt(-200, 200) * time;
await asyncTweenBy(node, time, { x: offsetX, angle: offsetX * 60 / 200 });
rabbonFall(node);
}
\ No newline at end of file
{ {
"ver": "1.0.8", "ver": "1.0.8",
"uuid": "f4ede462-f8d7-4069-ba80-915611c058ca", "uuid": "3cf09c30-536f-42ae-83bb-cbb3c5cd93eb",
"isPlugin": false, "isPlugin": false,
"loadPluginInWeb": true, "loadPluginInWeb": true,
"loadPluginInNative": true, "loadPluginInNative": true,
......
/**
* 适配
*/
cc.Class({
extends: cc.Component,
properties: {
UIMax: {
default: [],
type: cc.Node,
displayName: "等比放大"
},
topUI: {
default: [],
type: cc.Widget,
},
canvasView: {
default: null,
type: cc.Canvas,
displayName: "根节点"
},
isCanvas: {
default: false,
}
},
onLoad: function () { //开启适配
this.widgetList = [];
this.scheduleOnce(function () {
if (!this.isCanvas) {
this.init();
} else {
var canvaSize = this.findCanvas();
var w = (canvaSize.width) / 720;
var h = (canvaSize.height) / 1280;
this.MaxSize = w / h > 1 ? w / h : h / w;
this.setUIMax(this.MaxSize);
this.settopUI(this.MaxSize);
var scene = cc.director.getScene();
var list = scene.getComponentsInChildren(cc.Widget)
for (var i in list) {
list[i].updateAlignment();
}
}
}, 0);
this.MaxSize = 1;
// if (window.addEventListener) {
// window.addEventListener('resize', scaleEventCallBack, false)
// } else if (window.attachEvent) {
// window.attachEvent('resize', scaleEventCallBack, false)
// };
// g.event_mgr.reg("adjustUI", () => {
// this.init();
// });
},
init: function () {
var canvaSize = this.findCanvas();
var diff = canvaSize.width / canvaSize.height;
var bili = 750 / 1334;
if (diff > bili) {
this.canvasView.fitWidth = false;
this.canvasView.fitHeight = true;
} else if (diff < bili) {
this.canvasView.fitWidth = true;
this.canvasView.fitHeight = false;
} else {
this.canvasView.fitWidth = true;
this.canvasView.fitHeight = true;
}
var w = (canvaSize.width) / 750;
var h = (canvaSize.height) / 1334;
this.MaxSize = w / h > 1 ? w / h : h / w;
g.data_mgr.MaxSize = this.MaxSize;
this.setUIMax(this.MaxSize);
this.settopUI(this.MaxSize);
var scene = cc.director.getScene();
var list = scene.getComponentsInChildren(cc.Widget)
for (var i in list) {
list[i].updateAlignment();
}
},
// //屏幕缩放事件
// scaleEventCallBack: function () {
// //setTimeout(function () {
// g.log("屏幕缩放");
// g.event_mgr.send("adjustUI");
// //}, 500); //延迟0.5秒
// },
onDestroy: function () {
},
settopUI: function (s) {
if (!g.data_mgr.phoneInfo) {
return;
}
var top = g.data_mgr.phoneInfo;
top = top * s;
for (var i in this.topUI) {
if (this.topUI[i].perTop == undefined) {
this.topUI[i].perTop = this.topUI[i].top;
} else {
this.topUI[i].top = this.topUI[i].perTop;
}
this.topUI[i].top += top;
console.log(this.topUI[i].top);
}
},
setUIMax: function (size) {
for (var i in this.UIMax) {
if (this.UIMax[i].perScale == undefined) {
this.UIMax[i].perScale = this.UIMax[i].scaleX;
} else {
this.UIMax[i].scaleX = this.UIMax[i].perScale;
this.UIMax[i].scaleY = this.UIMax[i].perScale;
}
this.UIMax[i].scaleX *= size;
this.UIMax[i].scaleY *= size;
}
},
findCanvas: function () {
if (cc.sys.isNative) {
return {
width: cc.view.getFrameSize().width,
height: cc.view.getFrameSize().height
};
} else {
return {
width: cc.game.canvas.clientWidth,
height: cc.game.canvas.clientHeight
};
}
}
});
{ {
"ver": "1.0.8", "ver": "1.0.8",
"uuid": "b54300af-b8e5-4b4e-aa2f-9ac1cef7b598", "uuid": "0e963fa9-ea21-492e-a9ae-92a33a8c7456",
"isPlugin": true, "isPlugin": false,
"loadPluginInWeb": true, "loadPluginInWeb": true,
"loadPluginInNative": true, "loadPluginInNative": true,
"loadPluginInEditor": false, "loadPluginInEditor": false,
......
{
"ver": "1.1.2",
"uuid": "b62d4b1c-d7ed-4c6e-8f1f-f8695a087353",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
/**
* 游戏主逻辑
*/
var game = cc.Class({
extends: cc.Component,
properties: {
contentArr_1: {
default: null,
type: cc.Node,
displayName: "内容_1"
},
Item_1: {
default: null,
type: cc.Node,
displayName: "滚动项"
},
contentArr_2: {
default: null,
type: cc.Node,
displayName: "内容_2"
},
Item_2: {
default: null,
type: cc.Node,
displayName: "滚动项"
},
draw: {
default: null,
type: cc.Graphics,
displayName: "滚动项"
},
resultNode: {
default: null,
type: cc.Node,
displayName: "结算弹窗"
}
},
ctor: function () {
game.inst = this;
g.game = game;
},
// 生命周期 onLoad
onLoad() {
//初始化游戏
this.initGame();
},
//初始化游戏
initGame: function () {
//重置游戏数据游戏数据
g.data_mgr.resGameData();
//获得数据
g.res_mgr.getFormData();
//播放游戏开始音效
g.speaker.inst.play_start();
//游戏开始
this.gameStart();
},
//更新界面信息
UpdataUi: function () {
//获得上列表的数据
var topList = g.data_mgr.getImgInfo(1);
var botList = g.data_mgr.getImgInfo(2);
//打乱列表顺序
topList.sort(function () { return Math.random() > 0.5 ? -1 : 1; })
botList.sort(function () { return Math.random() > 0.5 ? -1 : 1; })
this.addItem(topList, this.contentArr_1, this.Item_1, 0);
this.addItem(botList, this.contentArr_2, this.Item_2, 0);
//准备完毕
},
//游戏开始
gameStart: function () {
//播放一个上面的音乐
this.setAudioInfo(1);
this.PlayAudio();
},
//获得随机播放的音乐并播放
setAudioInfo: function (type) {
//随机一个数字 播放这个数字的上段部分
g.data_mgr.temPlayAudio.sort(function () { return Math.random() > 0.5 ? -1 : 1; })
var num = g.data_mgr.temPlayAudio[0];
//设置播放信息
g.data_mgr.playId = num;
g.data_mgr.playType = type;
},
//重新播放音乐
onBtnSound: function () {
this.PlayAudio();
},
//重新开始
onBtnReStart: function () {
//移除所有计时器
this.unscheduleAllCallbacks();
for (var i = 0; i < this.contentArr_1.childrenCount; i++) {
this.contentArr_1.children[i].active = false;
}
for (var i = 0; i < this.contentArr_2.childrenCount; i++) {
this.contentArr_2.children[i].active = false;
}
this.resultNode.active = false;
//初始化界面
this.UpdataUi();
//初始化游戏
this.initGame();
//清除线
this.clearLine();
},
//显示结算弹窗
showResult: function (Info) {
this.resultNode.scale = 0;
this.resultNode.active = true;
cc.tween(this.resultNode)
.to(0.5, { scale: 1 })
.start()
g.result.inst.updateUI(Info);
},
//上一关
onBtnLastPage: function () {
if (g.data_mgr.pageId - 1 >= 0) {
g.data_mgr.pageId -= 1;
this.onBtnReStart();
}
},
//下一关
onBtnNextPage: function () {
if (g.data_mgr.pageId + 1 < g.data_mgr.data.contentObj.pageArr.length) {
g.data_mgr.pageId += 1;
this.onBtnReStart();
}
},
//播放音乐
PlayAudio: function () {
//获得播放路径
var path = g.data_mgr.getPlayUrl();
g.res_mgr.playAudioByUrl(path, (url) => {
g.snd_mgr.playEffect(url);
});
},
//添加项
addItem: function (listInfo, content, item, i) {
if (listInfo.length <= i) {
content.getComponent(cc.Layout).updateLayout();
return;
}
var len = content.childrenCount;
// 添加子项
let newItem = len > i ? content.children[i] : cc.instantiate(item);
// 更新子项
var com = newItem.getComponent("item");
com.updateUI(listInfo[i]);
newItem.active = true;
newItem.parent = content;
this.scheduleOnce(function () {
i += 1;
this.addItem(listInfo, content, item, i)
}.bind(this), 0.01);
},
//点亮 conten:上列表,下列表 state:0 点亮,2变暗
allLightDark(positionId, state) {
var conten = positionId == 1 ? this.contentArr_1 : this.contentArr_2;
for (var i = 0; i < conten.childrenCount; i++) {
var item = conten.children[i]
if (item.state == 1 || item.state == 3) {
continue;
} else {
var com = item.getComponent("item");
//设置状态为可答题
com.setBtnState(state);
}
}
},
ShowLine: function (sx, sy, ex, ey) {
var b = 0;
var a = 0;
var k = ex == sx ? 0 : (ey - sy) / (ex - sx);
if (k == 0) {
a = 0;
b = -5;
} else {
a = k < 0 ? 5 : -5;
}
var difx = sx + a
var dify = sy + k * a + b;
if (ex == sx) {
var difnode = dify > ey;
}
else {
var difnode = ex > sx ? difx < ex : difx > ex;
}
if (difnode) {
this.scheduleOnce(function () {
this.DrawLine(sx, sy, difx, dify);
this.ShowLine(difx, dify, ex, ey);
}.bind(this), 0.01);
}
else {
this.DrawLine(ex, ey, ex, ey);
//移除播放列表的数据
g.data_mgr.temPlayAudio.splice(0, 1);
//显示弹窗
var Info = g.data_mgr.getResultInfo(g.data_mgr.nowNode.typeId);
g.game.inst.showResult(Info);
}
},
//点击测试
DrawLine: function (sx, sy, ex, ey) {
//获得组件
var com = this.draw;
//设置线的颜色
com.strokeColor = new cc.Color().fromHEX(g.data_mgr.lineColor[g.data_mgr.playId]);;
// 设置线条宽度
com.lineWidth = 10;
// 路径起点为0,0
com.moveTo(sx, sy);
// 路径画线到(100,100)
// 路径看不见!!!
com.lineTo(ex, ey);
// 把路径画实,能看见啦!
com.stroke();
},
//
clearLine: function () {
//获得组件
var com = this.draw;
com.clear()
},
});
{
"ver": "1.0.8",
"uuid": "8b0b794c-7f5e-4e94-82b8-d1c85bc69eb8",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
/**
* item
*/
cc.Class({
extends: cc.Component,
properties: {
Picture: {
default: null,
type: cc.Node,
displayName: "图片"
},
nodeState: {
default: [],
type: cc.Node,
displayName: "节点状态"
},
spt_error: {
default: null,
type: cc.Node,
displayName: "失败"
},
spt_chick: {
default: null,
type: cc.Node,
displayName: "小鸡"
}
},
//更新界面ui
updateUI: function (Info) {
//当前数据
this.itemInfo = Info;
//初始化数据
this.InitData();
//设置图片
this.setPicture(Info.url);
},
//初始化信息
InitData: function () {
//设置按钮状态
this.setBtnState(0);
if (this.itemInfo.positionId == 2) {
this.setBtnState(2);
}
},
//设置图片
setPicture: function (url) {
//图片资源
g.res_mgr.getSpriteFrimeByUrl(url, function (list) {
this.Picture.getComponent(cc.Sprite).spriteFrame = list;
this.Picture.active = true;
}.bind(this));
},
//设置按钮状态
setBtnOpen: function (b) {
this.node.getComponent(cc.Button).enabled = b;
},
//设置按钮状态0可点击 1已答对 2答错 3连线完成
setBtnState: function (num) {
this.nodeState[num].active = true;
switch (~~num) {
case 0:
this.nodeState[0].active = true;
this.nodeState[1].active = false;
this.nodeState[2].active = false;
this.node.state = 0;
this.setBtnOpen(true);
break;
case 1:
this.nodeState[1].active = true;
this.nodeState[2].active = false;
this.node.state = 1;
this.setBtnOpen(false);
break;
case 2:
this.nodeState[1].active = false;
this.nodeState[2].active = true;
this.node.state = 2;
this.setBtnOpen(false);
break;
case 3:
this.nodeState[0].active = true;
this.nodeState[1].active = false;
this.nodeState[2].active = false;
this.node.state = 3;
this.setBtnOpen(false);
break;
}
},
//
onBtnGet: function () {
//如果节点的Id等于当前数据的id的话
if (this.itemInfo.typeId == g.data_mgr.playId && this.itemInfo.positionId == g.data_mgr.playType) {
//播放答对音效
g.speaker.inst.play_good();
this.setBtnState(1);
//如果是上面答对的话
if (this.itemInfo.positionId == 1) {
//执行播放下排的音乐
g.data_mgr.playType = 2;
g.game.inst.PlayAudio();
//设置状态
g.game.inst.allLightDark(1, 2);
g.game.inst.allLightDark(2, 0);
//把这个答对的节点保存起来
g.data_mgr.itemInfo = this.spt_chick;
}
//如果答对的是下排的话
if (this.itemInfo.positionId == 2) {
//连线
var posStart = g.data_mgr.itemInfo.parent.convertToWorldSpaceAR(g.data_mgr.itemInfo.position);
var posEnd = this.spt_chick.parent.convertToWorldSpaceAR(this.spt_chick.position);
g.data_mgr.nowNode = this.itemInfo;
g.game.inst.ShowLine(posStart.x - 640, posStart.y - 360, posEnd.x - 640, posEnd.y - 360);
// //显示弹窗
// var Info = g.data_mgr.getResultInfo(this.itemInfo.typeId);
// g.game.inst.showResult(Info);
//弹窗关闭
// //移除当前播放的音乐
// const index = this.pageArr.indexOf(data);
// if (index !== -1) {
// this.pageArr.splice(index, 1);
// }
}
}
else {
this.spt_error.active = true;
//播放失败音效
g.speaker.inst.play_error();
this.setBtnState(2);
cc.tween(this.spt_error)
.to(0.2, { scale: 1.1 })
.to(0.5, { scale: 0 })
.start()
}
},
});
{
"ver": "1.0.8",
"uuid": "e729b387-9d1a-47a4-9d3d-076fd1ddc360",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
/**
* result
*/
var result = cc.Class({
extends: cc.Component,
properties: {
Picture: {
default: null,
type: cc.Node,
displayName: "图片"
},
wellDone: {
default: null,
type: cc.Node,
displayName: "wellDone"
},
frame_tips: {
default: null,
type: cc.Node,
displayName: "标签框"
},
lb_tips: {
default: null,
type: cc.Label,
displayName: "标签"
},
eff_sahua: {
default: null,
type: cc.Animation,
displayName: "撒花特效"
}
},
ctor: function () {
result.inst = this;
g.result = result;
},
//更新界面ui
updateUI: function (Info) {
if (Info) {
//当前数据
this.itemInfo = Info;
//设置图片
this.setPicture(Info.common_pic_url);
//设置图片
this.setTips(Info.groupLabel);
this.wellDone.active = false;
this.frame_tips.active = true;
this.eff_sahua.node.active = false;
}
else {
//播放撒花动画
this.eff_sahua.node.active = true;
this.eff_sahua.play();
this.wellDone.active = true;
this.frame_tips.active = false;
//播放撒花音效
g.speaker.inst.play_congratulation();
}
},
//设置标签
setTips: function (num) {
this.lb_tips.string = num;
},
//设置图片
setPicture: function (url) {
//图片资源
g.res_mgr.getSpriteFrimeByUrl(url, function (list) {
this.Picture.getComponent(cc.Sprite).spriteFrame = list;
this.Picture.active = true;
}.bind(this));
},
//点击关闭
onBtnClose: function () {
this.node.active = false;
//如果播放列表少于1则显示
if (g.data_mgr.temPlayAudio.length < 1) {
//显示结算撒花
g.game.inst.showResult();
} else {
//重新随机一组数据
g.game.inst.setAudioInfo(1);
//设置下一题的状态
g.game.inst.allLightDark(1, 0);
g.game.inst.allLightDark(2, 2);
}
}
});
{
"ver": "1.0.8",
"uuid": "b01b3d2b-07ce-44c5-bd5a-210c686db47c",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
/**
* 音效
*/
var speaker = cc.Class({
extends: cc.Component,
properties: {
eff_btn: {
default: null,
type: cc.AudioClip,
displayName: "点击音效"
},
eff_congratulation: {
default: null,
type: cc.AudioClip,
displayName: "撒花音效"
},
eff_error: {
default: null,
type: cc.AudioClip,
displayName: "点击错误音效"
},
eff_good: {
default: null,
type: cc.AudioClip,
displayName: "点击正确音效"
},
eff_showPop: {
default: null,
type: cc.AudioClip,
displayName: "显示弹窗音效"
},
eff_start: {
default: null,
type: cc.AudioClip,
displayName: "游戏开始音效"
},
},
ctor: function () {
speaker.inst = this;
g.speaker = speaker;
},
//点击按钮
play_btn: function () {
g.snd_mgr.playEffect(this.eff_btn);
},
//撒花音效
play_congratulation: function () {
g.snd_mgr.playEffect(this.eff_congratulation);
},
//答错
play_error: function () {
g.snd_mgr.playEffect(this.eff_error);
},
//答对
play_good: function () {
g.snd_mgr.playEffect(this.eff_good);
},
//显示弹窗
play_showPop: function () {
g.snd_mgr.playEffect(this.eff_showPop);
},
//游戏开始
play_start: function () {
g.snd_mgr.playEffect(this.eff_start);
},
});
{
"ver": "1.0.8",
"uuid": "ab52071c-b063-4dc5-8f90-7b771a4d0e68",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "739e697c-eeb0-400c-b62d-7d1da103d577",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
/**
* 数据管理器
*/
g.data_mgr = {
nowNode: null,//当前点击节点
playId: null,//播放id
playType: null,//播放类型
itemInfo: null,//已经答对的节点
temPlayAudio: [],//临时的播放列表
data: null,//表所有数据
pageId: 0,//页id
lineColor: ['#FF0000', '#FF7F00', '#FFFF00', '#00FF00', '#00FFFF', '#0000FF', ' #8B00FF',],//线的颜色
_imageResList: [],//图片资源列表
_audioResList: [],//音频资源列表
_animaResList: [],//动画资源列表
//获得默认数据
getDefaultData() {
const dataJson = '{ "contentObj": { "pageArr": [{ "pageInfo": [{ "a_pic_url": "http://staging-teach.cdn.ireadabc.com/19d51663c49a4faed1fd569de26611a3.png", "b_pic_url": "http://staging-teach.cdn.ireadabc.com/7629f54dc9ae5e3c556b4d898509f888.png", "a_audio_url": "http://staging-teach.cdn.ireadabc.com/495324991838775e49e3ca6593d432c9.mp3", "b_audio_url": "http://staging-teach.cdn.ireadabc.com/17cc0e2a383e4632147dc495a1397915.mp3", "groupLabel": "", "groupPic": "", "common_pic_url": "http://staging-teach.cdn.ireadabc.com/28ef69eeb008a030ce1fbb237a5d0637.png" }, { "a_pic_url": "http://staging-teach.cdn.ireadabc.com/e813b164253de04bbcdd9f1a38cc228d.png", "b_pic_url": "http://staging-teach.cdn.ireadabc.com/2c5f7fedc1cdcb91dda5bb621a2d0235.png", "a_audio_url": "http://staging-teach.cdn.ireadabc.com/20f16608cf7fc6499eb1f942e625658d.mp3", "b_audio_url": "http://staging-teach.cdn.ireadabc.com/205722475ccaca6233b2f28e635405ca.mp3", "groupLabel": "", "groupPic": "", "common_pic_url": "http://staging-teach.cdn.ireadabc.com/28ef69eeb008a030ce1fbb237a5d0637.png" }, { "a_pic_url": "http://staging-teach.cdn.ireadabc.com/9d7bdb483c7690728f0658022753c8ed.png", "b_pic_url": "http://staging-teach.cdn.ireadabc.com/9d7bdb483c7690728f0658022753c8ed.png", "a_audio_url": "http://staging-teach.cdn.ireadabc.com/0b6ef24f15c6d8ad7bf27cc913445ebf.mp3", "b_audio_url": "http://staging-teach.cdn.ireadabc.com/b2c170f84b85dddf554b5c837d1d6e30.mp3", "groupLabel": "", "groupPic": "", "common_pic_url": "http://staging-teach.cdn.ireadabc.com/28ef69eeb008a030ce1fbb237a5d0637.png" }, { "a_pic_url": "http://staging-teach.cdn.ireadabc.com/7502f454d1edc0d1d52efbe8a9b2020a.png", "b_pic_url": "http://staging-teach.cdn.ireadabc.com/7502f454d1edc0d1d52efbe8a9b2020a.png", "a_audio_url": "http://staging-teach.cdn.ireadabc.com/1e3e361ef1953dec43f250278be63e1d.mp3", "b_audio_url": "http://staging-teach.cdn.ireadabc.com/a589225b18d35b045bc52e283ec7cceb.mp3", "groupLabel": "", "groupPic": "", "common_pic_url": "http://staging-teach.cdn.ireadabc.com/28ef69eeb008a030ce1fbb237a5d0637.png" }, { "a_pic_url": "http://staging-teach.cdn.ireadabc.com/86fb8f1694cf0d5d2d81c26fecfae709.png", "b_pic_url": "http://staging-teach.cdn.ireadabc.com/a41083db803c2f15cd67402f4b751b87.png", "a_audio_url": "", "b_audio_url": "", "groupLabel": "", "groupPic": "", "common_pic_url": "http://staging-teach.cdn.ireadabc.com/28ef69eeb008a030ce1fbb237a5d0637.png" }, { "a_pic_url": "http://staging-teach.cdn.ireadabc.com/adccd435985b8ce20737e4b6a235d88f.png", "b_pic_url": "http://staging-teach.cdn.ireadabc.com/2c5f7fedc1cdcb91dda5bb621a2d0235.png", "a_audio_url": "http://staging-teach.cdn.ireadabc.com/69cbbc96cd60283120521ad606f8c886.mp3", "b_audio_url": "http://staging-teach.cdn.ireadabc.com/11bcdcf1720dd260b90a0f4b523633f8.mp3", "groupLabel": "", "groupPic": "", "common_pic_url": "http://staging-teach.cdn.ireadabc.com/28ef69eeb008a030ce1fbb237a5d0637.png" }] }, { "pageInfo": [{ "a_pic_url": "http://staging-teach.cdn.ireadabc.com/7629f54dc9ae5e3c556b4d898509f888.png", "b_pic_url": "http://staging-teach.cdn.ireadabc.com/2c5f7fedc1cdcb91dda5bb621a2d0235.png", "a_audio_url": "", "b_audio_url": "", "groupLabel": "", "groupPic": "", "common_pic_url": "http://staging-teach.cdn.ireadabc.com/28ef69eeb008a030ce1fbb237a5d0637.png" }, { "a_pic_url": "http://staging-teach.cdn.ireadabc.com/19d51663c49a4faed1fd569de26611a3.png", "b_pic_url": "http://staging-teach.cdn.ireadabc.com/7629f54dc9ae5e3c556b4d898509f888.png", "a_audio_url": "http://staging-teach.cdn.ireadabc.com/a787397544260023572b154914ff961b.mp3", "b_audio_url": "http://staging-teach.cdn.ireadabc.com/4fb9a05072f2b3c0493a2fcbb55307bf.mp3", "groupLabel": "", "groupPic": "", "common_pic_url": "http://staging-teach.cdn.ireadabc.com/28ef69eeb008a030ce1fbb237a5d0637.png" }, { "a_pic_url": "http://staging-teach.cdn.ireadabc.com/e813b164253de04bbcdd9f1a38cc228d.png", "b_pic_url": "http://staging-teach.cdn.ireadabc.com/2c5f7fedc1cdcb91dda5bb621a2d0235.png", "a_audio_url": "http://staging-teach.cdn.ireadabc.com/cc93f9eacb135dbeba69857d37d2a0fd.mp3", "b_audio_url": "http://staging-teach.cdn.ireadabc.com/3806065de519a70e2758f2b5ed46f7c1.mp3", "groupLabel": "", "groupPic": "", "common_pic_url": "http://staging-teach.cdn.ireadabc.com/28ef69eeb008a030ce1fbb237a5d0637.png" }, { "a_pic_url": "http://staging-teach.cdn.ireadabc.com/9d7bdb483c7690728f0658022753c8ed.png", "b_pic_url": "http://staging-teach.cdn.ireadabc.com/7629f54dc9ae5e3c556b4d898509f888.png", "a_audio_url": "http://staging-teach.cdn.ireadabc.com/3ed9f5f1278b67380e792d94e7a7564b.mp3", "b_audio_url": "http://staging-teach.cdn.ireadabc.com/87fb5b526def6f946c5991490ce31475.mp3", "groupLabel": "", "groupPic": "", "common_pic_url": "http://staging-teach.cdn.ireadabc.com/28ef69eeb008a030ce1fbb237a5d0637.png" }, { "a_pic_url": "http://staging-teach.cdn.ireadabc.com/c9147ba4f6865137f78a9a6331c81151.png", "b_pic_url": "http://staging-teach.cdn.ireadabc.com/502c5d3a110c40a6bfcf1a2cd1dab9ea.png", "a_audio_url": "http://staging-teach.cdn.ireadabc.com/69cbbc96cd60283120521ad606f8c886.mp3", "b_audio_url": "http://staging-teach.cdn.ireadabc.com/87fb5b526def6f946c5991490ce31475.mp3", "groupLabel": "", "groupPic": "", "common_pic_url": "http://staging-teach.cdn.ireadabc.com/28ef69eeb008a030ce1fbb237a5d0637.png" }, { "a_pic_url": "http://staging-teach.cdn.ireadabc.com/9159668d6274ead9dc1ab0cd8cd2e442.png", "b_pic_url": "http://staging-teach.cdn.ireadabc.com/adccd435985b8ce20737e4b6a235d88f.png", "a_audio_url": "http://staging-teach.cdn.ireadabc.com/4fb9a05072f2b3c0493a2fcbb55307bf.mp3", "b_audio_url": "http://staging-teach.cdn.ireadabc.com/3d2d9f1ed700be793508ab79d6de76a2.mp3", "groupLabel": "", "groupPic": "", "common_pic_url": "http://staging-teach.cdn.ireadabc.com/28ef69eeb008a030ce1fbb237a5d0637.png" }] }] } }'
const data = JSON.parse(dataJson);
return data;
},
//重置数据
resGameData() {
this._imageResList = [];
this._audioResList = [];
this._animaResList = [];
this.temPlayAudio = [];
},
//获得播放路径
getPlayUrl: function () {
for (var i in this._audioResList) {
var audioInfo = this._audioResList[i];
if (this.playId == audioInfo.typeId && this.playType == audioInfo.positionId) {
return audioInfo.url;
}
}
},
//获得整条数据
getResultInfo: function (id) {
var pageInfo = this.data.contentObj.pageArr[this.pageId].pageInfo;
return pageInfo[id];
},
//获得图片信息 type 1上面,type 2下面
getImgInfo: function (type) {
var list = [];
for (var i in g.data_mgr._imageResList) {
var imgList = g.data_mgr._imageResList[i];
if (imgList.positionId == type) {
list.push(imgList)
}
}
return list;
},
//处理数据
proGameData: function () {
this.addPreloadImage();
this.addPreloadAudio();
this.addPreloadAnima();
this.preload(); ``
},
//预加载图片
addPreloadImage() {
//btnState 0正常显示,1显示成功,2显示灰色,3连线完成
var pageInfo = this.data.contentObj.pageArr[this.pageId].pageInfo;
for (var i in pageInfo) {
this._imageResList.push({ url: pageInfo[i].a_pic_url, typeId: i, positionId: 1, btnState: 0 });
this._imageResList.push({ url: pageInfo[i].b_pic_url, typeId: i, positionId: 2, btnState: 0 });
this._imageResList.push({ url: pageInfo[i].common_pic_url, typeId: i, positionId: 0 });
}
},
//预加载声音
addPreloadAudio() {
var pageInfo = this.data.contentObj.pageArr[this.pageId].pageInfo;
for (var i in pageInfo) {
this._audioResList.push({ url: pageInfo[i].a_audio_url, typeId: i, positionId: 1, isPlay: false });
this._audioResList.push({ url: pageInfo[i].b_audio_url, typeId: i, positionId: 2, isPlay: false });
this.temPlayAudio.push(i);
}
},
addPreloadAnima() {
},
preload() {
const preloadArr = this._imageResList.concat(this._audioResList).concat(this._animaResList);
cc.assetManager.loadAny(preloadArr, null, null, (err, data) => {
//结束回调
this.loadEnd();
if (window && window["air"]) {
window["air"].hideAirClassLoading();
}
cc.debug.setDisplayStats(false);
});
},
loadEnd() {
//更新游戏界面信息
g.game.inst.UpdataUi();
//初始化音频
// this.initAudio();
// this.initListener();
},
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "91e03520-a8ad-4317-a914-1850e6e64926",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
// 事件汞
let eventList = {}; // 响应列表(元素结构:eventName,[[target:cb]])
g.event_mgr = {
// 注册事件-响应 入参:事件名、响应、目标名
reg: function (eventName, cb, target) {
var event = eventList[eventName];
if (!event) {
event = eventList[eventName] = {};
}
event[target] = cb;
},
// 注销事件-响应 入参:事件名、目标名
unReg: function (eventName, target) {
var event = eventList[eventName];
if (event) {
if (event[target]) {
event[target] = null;
}
}
},
unRegName: function (eventName) {
eventList[eventName] = {};
},
// 广播事件 入参:事件名、参数
send: function (eventName, params) {
var event = eventList[eventName];
if (event) {
for (var target in event) {
var cb = event[target];
if (cb) {
cb(params);
}
}
}
},
getReglist: function () {
return eventList;
}
};
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "b8bf01c9-341f-4994-91ea-ff45a2f9d150",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
// localStorage封装
g.local_storage = {
// 背景音乐音量
getMusicVolume: function () {
var vol = cc.sys.localStorage.getItem("music");
return vol;
},
setMusicVolume: function (vol) {
cc.sys.localStorage.setItem('music', vol)
},
// 音效音量
getEffectsVolume: function () {
var vol = cc.sys.localStorage.getItem("effect");
return vol;
},
setEffectsVolume: function (vol) {
cc.sys.localStorage.setItem('effect', vol);
},
};
{
"ver": "1.0.8",
"uuid": "0d515142-090e-49ac-aea8-19c7b34f8cb4",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
/**
* 资源管理器
*/
g.res_mgr = {
//获得表数据数据
getFormData() {
console.log('初始化数据');
try {
window.courseware.getData(function (res) {
//存入数据管理器
g.data_mgr.data = res;
//数据处理
g.data_mgr.proGameData();
console.log(res);
}.bind(this));
} catch (error) {
//console.error('没有查找到courseware.getData方法', error);
//获得默认数据
g.data_mgr.data = g.data_mgr.getDefaultData();
//数据处理
g.data_mgr.proGameData();
}
},
//
getSprNode(resName) {
const sf = cc.find('Canvas/res/img/' + resName).getComponent(cc.Sprite).spriteFrame;
const node = new cc.Node();
node.addComponent(cc.Sprite).spriteFrame = sf;
return node;
},
//得到图片资源
getSpriteFrimeByUrl(url, cb) {
cc.assetManager.loadRemote(url, cc.SpriteFrame, (e, sp) => {
const spriteFrame = new cc.SpriteFrame(sp)
cb && cb(spriteFrame);
});
},
getSprNodeByUrl(url, cb) {
const node = new cc.Node();
const spr = node.addComponent(cc.Sprite);
this.getSpriteFrimeByUrl(url, (sf) => {
spr.spriteFrame = sf;
if (cb) {
cb(node);
}
})
},
playAudioByUrl(audio_url, cb) {
if (audio_url) {
cc.assetManager.loadRemote(audio_url, (err, audioClip) => {
cb && cb(audioClip);
// const audioId = cc.audioEngine.play(audioClip, false, 0.8);
// if (cb) {
// cc.audioEngine.setFinishCallback(audioId, () => {
// cb();
// });
// }
});
}
},
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "7121d1fd-fef5-46f9-ae16-ffc9aa7f5e16",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
// 声音管理器
g.snd_mgr = {
bgmId: -1, // 背景音乐的音频ID
effIds: [], // 音效的音频ID列表(由cc.audioEngine保证音频ID不重复)
bgmVol: 1, // 背景音乐音量
neweffId: null, //保存上一个音效ID
effVol: 1, // 音效音量
pausebgVol: 1,
pauseeffVol: 1,
sndNativeUrls: {},
newsnd: null,
init: function () {
var local_storage = g.local_storage;
var music_vol = local_storage.getMusicVolume();
var effect_vol = local_storage.getEffectsVolume();
music_vol != undefined && music_vol + "" != "" && this.setMusicVolume(music_vol);
effect_vol != undefined && effect_vol + "" != "" && this.setEffectsVolume(effect_vol);
},
delAudId: function (id) {
if (id == this.bgmId) {
this.bgmId = -1;
return;
}
for (var i = 0; i < this.effIds.length; ++i) {
if (this.effIds[i] == id) {
this.effIds.splice(i, 1);
return;
}
}
},
playMusic: function (snd, _loop, finishCB) {
if (!snd) return;
this.newsnd = snd;
var loop = _loop ? false : true; // 除非指定为false,否则默认为true
// if (g.configs.platform == "vo") {
// this.bgmId = cc.audioEngine.play(snd, loop);
// return;
// }
this.bgmId = cc.audioEngine.playMusic(snd, loop);
// 播放完成回调
if (finishCB) {
cc.audioEngine.setFinishCallback(this.bgmId, function () {
finishCB();
});
}
},
playEffect: function (snd, finishCB) {
if (!snd || this.effVol == 0) return;
var id = cc.audioEngine.playEffect(snd, false); // 音效限定不能重复播放
this.playaudioEffect(id, finishCB);
},
//播放音效
playaudioEffect: function (id, finishCB) {
var self = this;
this.neweffId = id;
this.effIds.push(id);
// 播放完记得删ID
cc.audioEngine.setFinishCallback(id, function () {
self.delAudId(id);
finishCB && finishCB();
});
},
pauseVolume: function () {
cc.audioEngine.stopAll();
},
resumeVolume: function () {
if (this.newsnd != null) {
cc.audioEngine.playMusic(this.newsnd)
}
},
setMusicVolume: function (percent) {
this.bgmVol = percent;
cc.audioEngine.setMusicVolume(~~percent);
},
setEffectsVolume: function (percent) {
this.effVol = percent;
cc.audioEngine.setEffectsVolume(~~percent);
cc.audioEngine.setMusicVolume(~~this.bgmVol);
},
};
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "fb034e6e-0e2d-4e5e-8a3a-b9a12ff90a0d",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "447cba4b-94fa-4a7a-91e7-95e89d5d31c0",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1280,
"height": 126,
"platformSettings": {},
"subMetas": {
"bg_grass": {
"ver": "1.0.4",
"uuid": "20fde735-8d82-48b7-9c66-6ee323b4e927",
"rawTextureUuid": "447cba4b-94fa-4a7a-91e7-95e89d5d31c0",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 1280,
"height": 126,
"rawWidth": 1280,
"rawHeight": 126,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "efa5fa09-a4dd-4bfc-ab7e-17c19f85408f", "uuid": "e6835f5c-c81a-457b-841d-239a27bab680",
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": false,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 366, "width": 384,
"height": 336, "height": 199,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"1orange": { "bg_kate": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "43d1e79d-6de8-4dcb-b8ce-d767df7913aa", "uuid": "cb2236c1-f762-4174-8105-f2817ed05989",
"rawTextureUuid": "efa5fa09-a4dd-4bfc-ab7e-17c19f85408f", "rawTextureUuid": "e6835f5c-c81a-457b-841d-239a27bab680",
"trimType": "auto", "trimType": "auto",
"trimThreshold": 1, "trimThreshold": 1,
"rotated": false, "rotated": false,
"offsetX": 0, "offsetX": 0,
"offsetY": -0.5, "offsetY": 0,
"trimX": 0, "trimX": 0,
"trimY": 1, "trimY": 0,
"width": 366, "width": 384,
"height": 335, "height": 199,
"rawWidth": 366, "rawWidth": 384,
"rawHeight": 336, "rawHeight": 199,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
{
"ver": "2.3.5",
"uuid": "c6d347af-b5ae-4021-944f-5f225cae3bf3",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1280,
"height": 563,
"platformSettings": {},
"subMetas": {
"bg_road": {
"ver": "1.0.4",
"uuid": "f32c4fbb-8522-43ac-b3be-846858217c39",
"rawTextureUuid": "c6d347af-b5ae-4021-944f-5f225cae3bf3",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 1280,
"height": 563,
"rawWidth": 1280,
"rawHeight": 563,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "e1b4d971-9876-4832-803a-5a321964a78b", "uuid": "e331a74e-946f-43f9-bbce-fd34297d2cff",
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
...@@ -11,10 +11,10 @@ ...@@ -11,10 +11,10 @@
"height": 720, "height": 720,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"bg": { "bg_sky": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "8288e3d4-4c75-4b27-8f01-f7014417f4dd", "uuid": "8a5a3573-755c-4a87-81da-94878a25da48",
"rawTextureUuid": "e1b4d971-9876-4832-803a-5a321964a78b", "rawTextureUuid": "e331a74e-946f-43f9-bbce-fd34297d2cff",
"trimType": "auto", "trimType": "auto",
"trimThreshold": 1, "trimThreshold": 1,
"rotated": false, "rotated": false,
......
{
"ver": "2.3.5",
"uuid": "8bc9b32b-d701-43d0-80a4-b2edc7bc1745",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 45,
"height": 46,
"platformSettings": {},
"subMetas": {
"btn_left": {
"ver": "1.0.4",
"uuid": "61c6dac8-5fc3-47f2-a082-4ba130693080",
"rawTextureUuid": "8bc9b32b-d701-43d0-80a4-b2edc7bc1745",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 45,
"height": 46,
"rawWidth": 45,
"rawHeight": 46,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "d582359e-924e-4ee9-9964-1fc4bb417e71", "uuid": "a6475da6-805d-43e7-9820-6d1ce01c7f6d",
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": false,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 61, "width": 44,
"height": 67, "height": 46,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"btn_right": { "btn_right": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "e5a2dbaa-a677-4a32-90d7-a1b057d7fb59", "uuid": "5be93a6b-15eb-4641-b5ae-2a89e7e8760b",
"rawTextureUuid": "d582359e-924e-4ee9-9964-1fc4bb417e71", "rawTextureUuid": "a6475da6-805d-43e7-9820-6d1ce01c7f6d",
"trimType": "auto", "trimType": "auto",
"trimThreshold": 1, "trimThreshold": 1,
"rotated": false, "rotated": false,
"offsetX": -0.5, "offsetX": 0,
"offsetY": 0.5, "offsetY": 0,
"trimX": 0, "trimX": 0,
"trimY": 0, "trimY": 0,
"width": 60, "width": 44,
"height": 66, "height": 46,
"rawWidth": 61, "rawWidth": 44,
"rawHeight": 67, "rawHeight": 46,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
{
"ver": "2.3.5",
"uuid": "d9e223cf-9d0a-4c4e-b6cf-667d38ea7e2e",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 57,
"height": 61,
"platformSettings": {},
"subMetas": {
"btn_sound": {
"ver": "1.0.4",
"uuid": "629c5b78-eb94-4730-8792-3ea9cbccc5b8",
"rawTextureUuid": "d9e223cf-9d0a-4c4e-b6cf-667d38ea7e2e",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 57,
"height": 61,
"rawWidth": 57,
"rawHeight": 61,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "5662c82c-6ae8-4d27-b5af-877186945977",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 47,
"height": 57,
"platformSettings": {},
"subMetas": {
"btn_start": {
"ver": "1.0.4",
"uuid": "5764d371-6ce9-468d-9f5b-0c66acb8c30a",
"rawTextureUuid": "5662c82c-6ae8-4d27-b5af-877186945977",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 47,
"height": 57,
"rawWidth": 47,
"rawHeight": 57,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "0d77db6e-1fc1-42f7-a0a7-5d5fb6ebf5e0",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 148,
"height": 148,
"platformSettings": {},
"subMetas": {
"circle_1": {
"ver": "1.0.4",
"uuid": "195d9780-fbd4-413e-9929-08c906efd775",
"rawTextureUuid": "0d77db6e-1fc1-42f7-a0a7-5d5fb6ebf5e0",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 148,
"height": 148,
"rawWidth": 148,
"rawHeight": 148,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "dd84783f-e6fb-4cab-b194-29378693a2b1",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 156,
"height": 156,
"platformSettings": {},
"subMetas": {
"circle_1_light": {
"ver": "1.0.4",
"uuid": "b27bb6ed-38a9-420c-96ec-e31f8950bd9b",
"rawTextureUuid": "dd84783f-e6fb-4cab-b194-29378693a2b1",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 156,
"height": 156,
"rawWidth": 156,
"rawHeight": 156,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "18d07592-51a9-421e-8972-0f67b68d29e1", "uuid": "2080ba05-3e89-46ee-b31a-5f06ae15829e",
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": false,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 144, "width": 138,
"height": 144, "height": 138,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"icon": { "circle_2": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "6fbc30a8-3c49-44ae-8ba4-7f56f385b78a", "uuid": "9b752013-ab8c-4a58-bae9-6c0e6dcbd68d",
"rawTextureUuid": "18d07592-51a9-421e-8972-0f67b68d29e1", "rawTextureUuid": "2080ba05-3e89-46ee-b31a-5f06ae15829e",
"trimType": "auto", "trimType": "auto",
"trimThreshold": 1, "trimThreshold": 1,
"rotated": false, "rotated": false,
"offsetX": 0, "offsetX": 0,
"offsetY": -0.5, "offsetY": 0,
"trimX": 3, "trimX": 0,
"trimY": 2, "trimY": 0,
"width": 138, "width": 138,
"height": 141, "height": 138,
"rawWidth": 144, "rawWidth": 138,
"rawHeight": 144, "rawHeight": 138,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
{
"ver": "2.3.5",
"uuid": "0bf0a019-b375-4021-bc5a-2006764e19d7",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 156,
"height": 156,
"platformSettings": {},
"subMetas": {
"circle_2_light": {
"ver": "1.0.4",
"uuid": "d6e5c1ff-9f46-4c5a-a3c3-09677a619879",
"rawTextureUuid": "0bf0a019-b375-4021-bc5a-2006764e19d7",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 156,
"height": 156,
"rawWidth": 156,
"rawHeight": 156,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "fb0af68a-44d0-46d8-93c0-5327f25a6ade",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 116,
"height": 116,
"platformSettings": {},
"subMetas": {
"error": {
"ver": "1.0.4",
"uuid": "6f1abc14-e99b-4519-88b0-43b29f826fd0",
"rawTextureUuid": "fb0af68a-44d0-46d8-93c0-5327f25a6ade",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 116,
"height": 116,
"rawWidth": 116,
"rawHeight": 116,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "0e19cd07-d674-4d6d-bf0f-65909b147a6f",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 934,
"height": 111,
"platformSettings": {},
"subMetas": {
"farme_name": {
"ver": "1.0.4",
"uuid": "dcbefe55-1bbc-4648-baac-ad54af54524a",
"rawTextureUuid": "0e19cd07-d674-4d6d-bf0f-65909b147a6f",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 934,
"height": 111,
"rawWidth": 934,
"rawHeight": 111,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "9b70b82f-db63-4bf0-ac8c-5f5a1013a737",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 942,
"height": 628,
"platformSettings": {},
"subMetas": {
"frame_1": {
"ver": "1.0.4",
"uuid": "950bb300-4b3c-4ae8-9dd2-5a933b08b5cf",
"rawTextureUuid": "9b70b82f-db63-4bf0-ac8c-5f5a1013a737",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -7,
"offsetY": -2,
"trimX": 38,
"trimY": 58,
"width": 852,
"height": 516,
"rawWidth": 942,
"rawHeight": 628,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "8734316c-f0de-46d0-b9cb-72c07b2ab882",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 740,
"height": 400,
"platformSettings": {},
"subMetas": {
"frame_2": {
"ver": "1.0.4",
"uuid": "057bb224-b22b-4dce-bd83-b0533632cabc",
"rawTextureUuid": "8734316c-f0de-46d0-b9cb-72c07b2ab882",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 740,
"height": 400,
"rawWidth": 740,
"rawHeight": 400,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "81c3d80d-3576-432e-a774-f3eedf7bc0dd",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 942,
"height": 628,
"platformSettings": {},
"subMetas": {
"frame_3": {
"ver": "1.0.4",
"uuid": "96307e34-ecbc-416f-b297-e4e16393413e",
"rawTextureUuid": "81c3d80d-3576-432e-a774-f3eedf7bc0dd",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 942,
"height": 628,
"rawWidth": 942,
"rawHeight": 628,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "ee0b8ba1-f0db-413c-8871-cb52bd6892ef",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 23,
"height": 208,
"platformSettings": {},
"subMetas": {
"gun": {
"ver": "1.0.4",
"uuid": "e509cc91-6e08-43f9-b000-5e90494a04ce",
"rawTextureUuid": "ee0b8ba1-f0db-413c-8871-cb52bd6892ef",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 23,
"height": 208,
"rawWidth": 23,
"rawHeight": 208,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "7ef9a2b0-25ce-41aa-93c2-0182310d2852",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 652,
"height": 105,
"platformSettings": {},
"subMetas": {
"lb_welldone": {
"ver": "1.0.4",
"uuid": "04f73d5e-ffe4-45eb-9e9e-2413b32266a9",
"rawTextureUuid": "7ef9a2b0-25ce-41aa-93c2-0182310d2852",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 652,
"height": 105,
"rawWidth": 652,
"rawHeight": 105,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "8c97f19a-3000-414e-827e-32b7dee9ecce",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 42,
"height": 41,
"platformSettings": {},
"subMetas": {
"spt_Star": {
"ver": "1.0.4",
"uuid": "72726b06-efbb-49a1-906e-3d0b4f8f812a",
"rawTextureUuid": "8c97f19a-3000-414e-827e-32b7dee9ecce",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 42,
"height": 41,
"rawWidth": 42,
"rawHeight": 41,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "a07c384b-2e49-426c-8996-ebe8e6e37f93",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 37,
"height": 30,
"platformSettings": {},
"subMetas": {
"spt_chick": {
"ver": "1.0.4",
"uuid": "612e46e9-bb02-41fd-88f1-f55644ce2b27",
"rawTextureUuid": "a07c384b-2e49-426c-8996-ebe8e6e37f93",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 37,
"height": 30,
"rawWidth": 37,
"rawHeight": 30,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "c2352a61-4f6a-4d27-b3f2-230bdbc0f775",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 66,
"height": 46,
"platformSettings": {},
"subMetas": {
"spt_cloud1": {
"ver": "1.0.4",
"uuid": "b43c7a8b-7f98-4262-a3c8-b8ac89d3bd95",
"rawTextureUuid": "c2352a61-4f6a-4d27-b3f2-230bdbc0f775",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 66,
"height": 46,
"rawWidth": 66,
"rawHeight": 46,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "41cd9b42-8716-45be-9035-8bcc01b44bc6",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 108,
"height": 84,
"platformSettings": {},
"subMetas": {
"spt_cloud2": {
"ver": "1.0.4",
"uuid": "69f5968f-b608-4021-b96d-9e21e93f794a",
"rawTextureUuid": "41cd9b42-8716-45be-9035-8bcc01b44bc6",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 108,
"height": 84,
"rawWidth": 108,
"rawHeight": 84,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "9a79969a-0506-48d4-bc98-3c05d109b027", "uuid": "95147b45-29ec-4cbd-869e-aba7776e775e",
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": false,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 61, "width": 123,
"height": 67, "height": 67,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"btn_left": { "spt_cloud3": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "ce19457d-e8f3-4c38-ae3e-d4b99208ddb5", "uuid": "ac2fcbab-5215-4ffa-87c8-ffdc489a69c7",
"rawTextureUuid": "9a79969a-0506-48d4-bc98-3c05d109b027", "rawTextureUuid": "95147b45-29ec-4cbd-869e-aba7776e775e",
"trimType": "auto", "trimType": "auto",
"trimThreshold": 1, "trimThreshold": 1,
"rotated": false, "rotated": false,
...@@ -22,9 +22,9 @@ ...@@ -22,9 +22,9 @@
"offsetY": 0, "offsetY": 0,
"trimX": 0, "trimX": 0,
"trimY": 0, "trimY": 0,
"width": 61, "width": 123,
"height": 67, "height": 67,
"rawWidth": 61, "rawWidth": 123,
"rawHeight": 67, "rawHeight": 67,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
......
{
"ver": "2.3.5",
"uuid": "9953ce3e-3d6f-4d1d-a32c-9ab04f2d80f2",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 84,
"height": 78,
"platformSettings": {},
"subMetas": {
"spt_cloud4": {
"ver": "1.0.4",
"uuid": "03d67bf8-0191-4f53-8649-3235921bd61c",
"rawTextureUuid": "9953ce3e-3d6f-4d1d-a32c-9ab04f2d80f2",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 84,
"height": 78,
"rawWidth": 84,
"rawHeight": 78,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "fad1b059-3b4a-42dd-8d5d-e1baba413a8b",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1342,
"height": 2376,
"platformSettings": {},
"subMetas": {
"微信图片_20210204203203": {
"ver": "1.0.4",
"uuid": "2fc7eb28-a60f-42fa-8911-789b3f20f368",
"rawTextureUuid": "fad1b059-3b4a-42dd-8d5d-e1baba413a8b",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 1342,
"height": 2376,
"rawWidth": 1342,
"rawHeight": 2376,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
...@@ -3,6 +3,6 @@ ...@@ -3,6 +3,6 @@
"packages": "packages", "packages": "packages",
"name": "play", "name": "play",
"id": "9af72fd2-44a6-4131-8ea3-3e1b3fa22231", "id": "9af72fd2-44a6-4131-8ea3-3e1b3fa22231",
"version": "2.4.4", "version": "2.4.3",
"isNew": false "isNew": false
} }
\ 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