Commit ecde648a authored by 唐鑫's avatar 唐鑫

初始化

parent ce304201
......@@ -128,5 +128,8 @@
}
}
},
"defaultProject": "ng-template-generator"
"defaultProject": "ng-template-generator",
"cli": {
"analytics": "f1a365a2-efef-4072-b5fc-c280aaa591eb"
}
}
\ No newline at end of file
@import '../style/common_mixin.css';
.model-content {
width: 100%;
height: 100%;
/* display: flex; */
/* justify-content: flex-start; */
/* align-items: flex-start; */
/* flex-wrap: wrap; */
}
.item-box {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
padding: 10px;
padding-bottom: 2vw;
padding-top: 3vw;
}
.radioPaire {
float: left;
margin: 3px;
border-style: dashed;
border-color: #000;
border-width: 1px;
.pic-sound-box {
width: 50%;
display: flex;
flex-direction: column;
}
.add-btn-box {
display: flex;
align-items: center;
justify-content: center;
height: 20vw;
padding: 10px;
padding-top: 5vw;
}
.border {
width: 450px;
height: 450px;
border-radius: 20px;
border-style: dashed;
padding: 20px;
margin: 20px;
/*width: 500px; */
/*//border-radius: 20px;*/
/*//border-width: 2px;*/
/*//border-color: #000000;*/
text-align: center;
float: left;
margin-left: 10px;
margin-bottom: 10px;
}
.border-lite {
border: 2px dashed #ddd;
border-radius: 0.5rem;
.group-title {
width: 100%;
}
.group-item {
width: 100%;
display: flex;
justify-content: flex-start;
align-items: flex-start;
flex-wrap: wrap;
padding: 10px;
margin: 10px;
}
.box-testlet-0 {
border: 1px solid gray;
width: 100%;
text-align: center;
border-top-left-radius: 25px;
border-top-right-radius: 25px;
border-bottom: 0px;
}
.box-testlet-1 {
border: 1px solid gray;
width: 100%;
text-align: left;
border-bottom-left-radius: 25px;
border-bottom-right-radius: 25px;
}
.box-testlet-2 {
margin-left: 25%;
width: 50%;
height: 100px;
text-align: center;
}
.box-group-0 {
border: 1px solid gray;
width: 100%;
text-align: center;
border-left: 0px;
border-right: 0px;
}
.box-group-1 {
border: 1px 0px 0px 0px solid gray;
width: 100%;
text-align: left;
}
.box-group-2 {
border: 1px 0px 0px 0px solid gray;
margin-left: 25%;
width: 50%;
height: 100px;
text-align: center;
}
.error-message {
border: 1px solid gray;
margin-top: 1%;
width: 100%;
height: 100px;
background-color: #fff;
border-radius: 15px;
text-align: center;
box-shadow: 0px 0px 5px 2px #888888;
overflow: hidden;
}
\ No newline at end of file
<div class="model-content">
<div>
<div style="padding: 10px;">
<div style="width: 300px;" align='center'>
<span>图1: </span>
<app-upload-image-with-preview
[picUrl]="item.pic_url"
(imageUploaded)="onImageUploadSuccess($event, 'pic_url')">
<!-- <nz-demo-notification-custom-style></nz-demo-notification-custom-style> -->
<!-- <div class="border">
<div style="padding-bottom: 20px;">
<input style="width: 80%; margin-bottom: 0.5vw" type="text" nz-input placeholder=""
[(ngModel)]="item.contentObj.title" (blur)="saveItem()">
<h5> Title-sound: </h5>
<app-audio-recorder [audioUrl]="item.contentObj.audio_url"
(audioUploaded)="onAudioUploadSuccessByItem($event, item.contentObj)">
</app-audio-recorder>
</div>
</div> -->
<div *ngFor="let testlet of picArr; let m = index" style="padding: 0.5vw;">
<div class="box-testlet-0">
<div class="group-title">
<div style="width: 100%; height: 70px; text-align: center; padding-top: 10px;">
<span style="font-weight: 700; font-size: 30px; vertical-align:middle;">星-{{m+1}}</span>
<button *ngIf="picArr.length > 1" style="margin-left: 30px; height: 40px; vertical-align:middle;" nz-button nzType="danger"
(click)="deleteTestlet(m)">
<span style="font-size: 20px;">删除星</span>
</button>
<button *ngIf="picArr.length <= 1" style="margin-left: 30px; height: 40px; vertical-align:middle;" disabled nz-button nzType="danger"
(click)="deleteTestlet(m)">
<span style="font-size: 20px;">删除星</span>
</button>
</div>
</div>
</div>
<div class="box-testlet-1">
<div *ngFor="let page of testlet; let n = index">
<div class="box-group-0">
<div class="group-title">
<div style="width: 100%; height: 70px; text-align: center; padding-top: 10px;">
<span style="font-weight: 500; font-size: 27px; vertical-align:middle;">星-{{m+1}} 页-{{n+1}}</span>
<button *ngIf="picArr[m].length <= 1" style="margin-left: 30px; height: 40px; vertical-align:middle;"
disabled nz-button nzType="danger" (click)="deletePage(m,n)">
<span style="font-size: 20px;">删除页</span>
</button>
<button *ngIf="picArr[m].length > 1" style="margin-left: 30px; height: 40px; vertical-align:middle;"
nz-button nzType="danger" (click)="deletePage(m,n)">
<span style="font-size: 20px;">删除页</span>
</button>
</div>
</div>
</div>
<div class="box-group-1">
<div class="group-item">
<div *ngFor="let it of page; let i = index">
<div class="border">
<h3 style="width: 100%; line-height: 40px; text-align: center;">星-{{m+1}} 页-{{n+1}} 卡片-{{i+1}}</h3>
<hr />
<div style="display: flex; align-items:center; width: 100%;">
<!-- 左边部分 -->
<div class="item-box" style="width: 45%;height:300px; margin-left: 5%;">
<nz-radio-group [(ngModel)]="it.left.radioValue">
<label nz-radio nzValue="A" (click)="radioClick(it, 'A')">文字
</label>
<label nz-radio nzValue="B" (click)="radioClick(it, 'B')">图片
</label>
<label nz-radio nzValue="C" (click)="radioClick(it, 'E')">音频
</label>
</nz-radio-group>
<input *ngIf="it.left.radioValue == 'A'" style="width: 80%; margin-bottom: 0.5vw" type="text"
nz-input placeholder="" [(ngModel)]="it.left.title" (blur)="saveItem()">
<app-upload-image-with-preview *ngIf="it.left.radioValue == 'B'" style="width: 100%"
[picUrl]="it.left.pic_url" (imageUploaded)="onImageUploadSuccessByItem($event, it.left)">
</app-upload-image-with-preview>
<div style="display: flex; justify-items: center; padding-top: 10px">
<app-audio-recorder [audioUrl]="it.left.audio_url"
(audioUploaded)="onAudioUploadSuccessByItem($event, it.left)">
</app-audio-recorder>
</div>
<div style="width: 300px; margin-top: 5px;" align='center'>
<span>图2: </span>
<app-upload-image-with-preview
[picUrl]="item.pic_url_2"
(imageUploaded)="onImageUploadSuccess($event, 'pic_url_2')">
<!-- <div *ngIf="!it.left.audio_url"
style="display: flex; justify-items: center; padding-top: 10px; color: red;">
请上传音频
</div> -->
</div>
<!--右边部分-->
<div class="item-box" style="width: 45%;height:300px; margin-right: 5%">
<nz-radio-group [(ngModel)]="it.right.radioValue">
<label nz-radio nzValue="A" (click)="radioClick(it, 'C')">文字
</label>
<label nz-radio nzValue="B" (click)="radioClick(it, 'D')">图片
</label>
<label nz-radio nzValue="C" (click)="radioClick(it, 'F')">音频
</label>
</nz-radio-group>
<input *ngIf="it.right.radioValue == 'A'" style="width: 80%; margin-bottom: 0.5vw" type="text"
nz-input placeholder="" [(ngModel)]="it.right.title" (blur)="saveItem()">
<app-upload-image-with-preview *ngIf="it.right.radioValue == 'B'" style="width: 100%"
[picUrl]="it.right.pic_url" (imageUploaded)="onImageUploadSuccessByItem($event, it.right)">
</app-upload-image-with-preview>
<div style="display: flex; justify-items: center; padding-top: 10px">
<app-audio-recorder [audioUrl]="it.right.audio_url"
(audioUploaded)="onAudioUploadSuccessByItem($event, it.right)">
</app-audio-recorder>
</div>
<!-- <div *ngIf="!it.right.audio_url"
style="display: flex; justify-items: center; padding-top: 10px; color: red;">
请上传音频
</div> -->
<div style="width: 300px; margin-top: 15px;">
<span>文本: </span>
<input type="text" nz-input [(ngModel)]="item.text" (blur)="save()">
</div>
</div>
<button style="margin-bottom: 10px;" nz-button nzType="danger" (click)="deleteItem(i,m,n)">
<span>删除</span>
</button>
</div>
</div>
<div class="border">
<h3 style="margin-top: 15%; width: 100%; line-height: 40px; text-align: center; color: red;">
每页卡片2~5个
</h3>
<h3 style="width: 100%; line-height: 40px; text-align: center; color: red;">
卡片2个是上传图片尺寸为280*298
</h3>
<h3 style="width: 100%; line-height: 40px; text-align: center; color: red;">
卡片3个是上传图片尺寸为250*268
</h3>
<h3 style="width: 100%; line-height: 40px; text-align: center; color: red;">
卡片4个是上传图片尺寸为250*268
</h3>
<h3 style="width: 100%; line-height: 40px; text-align: center; color: red;">
卡片5个是上传图片尺寸为200*214
</h3>
<button *ngIf="picArr[m][n].length < 5" style="margin-top: 10%;" nz-button nzType="primary"
(click)="addItem(m,n)">
<span>增加卡片</span>
</button>
<button *ngIf="picArr[m][n].length >= 5" style="margin-top: 10%;" nz-button nzType="primary" disabled
(click)="addItem(m,n)">
<span>增加卡片</span>
</button>
</div>
</div>
</div>
</div>
<div style="margin-top: 5px">
<span>音频: </span>
<app-audio-recorder
[audioUrl]="item.audio_url"
(audioUploaded)="onAudioUploadSuccess($event, 'audio_url')"
></app-audio-recorder>
<div class="box-group-2" style="padding: 0.5vw;">
<button style="width: 100%; height: 100%; border-radius: 25px; " nz-button nzType="dashed" (click)="addPage(m)">
<i nz-icon nzType="plus-circle"></i>
<span style="font-size: 20px;">增加页</span>
</button>
</div>
</div>
</div>
<div class="box-testlet-2" style="padding: 0.5vw;">
<button style="width: 100%; height: 100%; border-radius: 25px; " nz-button nzType="dashed" (click)="addTestlet()">
<i nz-icon nzType="plus-circle"></i>
<span style="font-size: 20px;">增加星</span>
</button>
</div>
<div style="position: fixed;margin-left: 70%; width:25%; top: 1em;right: 1em;">
<div class="error-message">
<div *ngFor="let err of errs; let m = index" style="font-size: 17px; color: red;"> {{err}}</div>
</div>
</div>
<!-- <div class="card-item" style="padding: 1vw;">
<div class="border">
<h5 style="width: 100%; line-height: 40px; text-align: center;">题星-{{m+1}}</h5>
<div style="display: flex; align-items: center; width: 100%;">
<button style=" margin: auto; width: 60%; height: 60%;" nz-button nzType="dashed" class="add-btn"
(click)="addPage(m)">
<i nz-icon nzType="plus-circle" nzTheme="outline"></i>
增加页码
</button>
<br />
<br />
</div>
</div>
</div> -->
<!--<h5> id-{{i+1}} </h5>-->
<!-- <div style="display: flex; align-items: center; justify-content: center; padding-bottom: 5px">-->
<!-- <input type="text" nz-input placeholder="" [(ngModel)]="it.text" (blur)="saveItem()"> -->
<!-- <button style="margin-left: 10px;" nz-button nzType="danger" (click)="deleteItem(it)"> -->
<!-- <i nz-icon type="close"></i> -->
<!-- </button> -->
<!-- </div> -->
<!--<app-upload-image-with-preview-->
<!--style="width: 100%"-->
<!--[picUrl]="it.pic_url"-->
<!--(imageUploaded)="onImageUploadSuccessByItem($event, it)"-->
<!--&gt;</app-upload-image-with-preview>-->
<!--<div style="display: flex; align-items: center; justify-content: center">-->
<!--<span style="width: 80px;">-->
<!--question:-->
<!--</span>-->
<!--<app-audio-recorder-->
<!--[audioUrl]="it['q_audio_url']"-->
<!--(audioUploaded)="onAudioUploadSuccessByItem($event, it, 'q')">-->
<!--</app-audio-recorder>-->
<!--</div>-->
<!--<div style="display: flex; align-items: center; justify-content: center">-->
<!--<span style="width: 80px;">-->
<!--answer:-->
<!--</span>-->
<!--<app-audio-recorder-->
<!--[audioUrl]="it['a_audio_url']"-->
<!--(audioUploaded)="onAudioUploadSuccessByItem($event, it, 'a')">-->
<!--</app-audio-recorder>-->
<!--</div>-->
<!--<nz-radio-group [(ngModel)]="it.radioValue" >-->
<!--<label nz-radio nzValue="A" (click)="radioClick(it, 'A')"> <i nz-icon nzType="check" nzTheme="outline"></i> </label>-->
<!--<label nz-radio nzValue="B" (click)="radioClick(it, 'B')"> <i nz-icon nzType="close" nzTheme="outline"></i> </label>-->
<!--</nz-radio-group>-->
<!-- </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)="addItem()">
<i nz-icon nzType="plus-circle" nzTheme="outline"></i>
Add
</button>
</div> -->
<!--<div style="padding-bottom: 30px;">-->
<!--<h5> bg-sound: </h5>-->
<!--<app-audio-recorder-->
<!--[audioUrl]="item.contentObj.bg_audio_url"-->
<!--(audioUploaded)="onAudioUploadSuccessByItem($event, item.contentObj, 'bg')">-->
<!--</app-audio-recorder>-->
<!--</div>-->
<!--<span style="margin-bottom: 20px"> 10 : 23 </span>-->
<!--<div *ngFor="let it of picArr; let i = index">-->
<!--<span> pic-{{i + 1}}: </span>-->
<!--<div style="display: flex; align-items: center; padding-bottom: 20px">-->
<!--<div style="width: 40%; padding-right: 20px">-->
<!--<app-upload-image-with-preview-->
<!--[picUrl]="it.pic_url"-->
<!--(imageUploaded)="onImageUploadSuccessByItem($event, it)"-->
<!--&gt;</app-upload-image-with-preview>-->
<!--</div>-->
<!--<div class="pic-sound-box">-->
<!--<div nz-row style="width: 50%; padding-bottom: 20px;">-->
<!--<div *ngFor="let it2 of it.soundArr; let i2 = index" nz-col nzSpan="8">-->
<!--<label nz-checkbox nzValue="{{'answer_' + (i2 + 1)}}" [(ngModel)]="it2.answer" (ngModelChange)="clickCheckBox()" >{{i2 + 1}}</label>-->
<!--</div>-->
<!--</div>-->
<!--<div *ngFor="let it2 of it.soundArr; let i2 = index" style="display: flex; align-items: center; padding-bottom: 5px">-->
<!--<span style="padding-right: 10px">sound-{{i2 + 1}}:</span>-->
<!--<app-audio-recorder-->
<!--[audioUrl]="it2.audio_url"-->
<!--(audioUploaded)="onAudioUploadSuccessByItem($event, it2)">-->
<!--</app-audio-recorder>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--<div style="margin: auto; width: 95%;" nz-row nzType="flex" nzJustify="start" nzAlign="middle">-->
<!--<div *ngFor="let it of picArr; let i = index"-->
<!--nz-col nzSpan="8" >-->
<!--<div class="item-box">-->
<!--<h5> id-{{i+1}} </h5>-->
<!--<div style="display: flex; align-items: center; justify-content: center; padding-bottom: 5px">-->
<!--<input type="text" nz-input placeholder="" [(ngModel)]="it.text" (blur)="saveItem()">-->
<!--<button style="margin-left: 10px;" nz-button nzType="danger" (click)="deleteItem(it)">-->
<!--<i nz-icon type="close"></i>-->
<!--</button>-->
<!--</div>-->
<!--<app-upload-image-with-preview-->
<!--style="width: 100%"-->
<!--[picUrl]="it.pic_url"-->
<!--(imageUploaded)="onImageUploadSuccessByItem($event, it)"-->
<!--&gt;</app-upload-image-with-preview>-->
<!--<div style="display: flex; align-items: center; justify-content: center">-->
<!--<span style="width: 80px;">-->
<!--question:-->
<!--</span>-->
<!--<app-audio-recorder-->
<!--[audioUrl]="it['q_audio_url']"-->
<!--(audioUploaded)="onAudioUploadSuccessByItem($event, it, 'q')">-->
<!--</app-audio-recorder>-->
<!--</div>-->
<!--<div style="display: flex; align-items: center; justify-content: center">-->
<!--<span style="width: 80px;">-->
<!--answer:-->
<!--</span>-->
<!--<app-audio-recorder-->
<!--[audioUrl]="it['a_audio_url']"-->
<!--(audioUploaded)="onAudioUploadSuccessByItem($event, it, 'a')">-->
<!--</app-audio-recorder>-->
<!--</div>-->
<!-- <nz-radio-group [(ngModel)]="it.radioValue" >-->
<!--<label nz-radio nzValue="A" (click)="radioClick(it, 'A')"> <i nz-icon nzType="check" nzTheme="outline"></i> </label>-->
<!--<label nz-radio nzValue="B" (click)="radioClick(it, 'B')"> <i nz-icon nzType="close" nzTheme="outline"></i> </label>-->
<!--</nz-radio-group> -->
<!--</div>-->
<!--</div>-->
</div>
\ No newline at end of file
import { Component, EventEmitter, Input, OnDestroy, OnChanges, OnInit, Output, ApplicationRef, ChangeDetectorRef } from '@angular/core';
import { JsonPipe } from '@angular/common';
import { Component, EventEmitter, Input, OnDestroy, OnChanges, OnInit, Output, ApplicationRef } from '@angular/core';
@Component({
......@@ -9,102 +8,255 @@ import { JsonPipe } from '@angular/common';
})
export class FormComponent implements OnInit, OnChanges, OnDestroy {
// 储存数据用
saveKey = "test_001";
// 储存对象
item;
picArr = [];
_item: any;
KEY = 'hw_006';
errs = [];
constructor(private appRef: ApplicationRef, private changeDetectorRef: ChangeDetectorRef) {
// @Input()
set item(item) {
this._item = item;
// this.init();
}
createShell() {
this.item.wordList.push({
word: '',
audio: '',
backWord: '',
backWordAudio: '',
});
this.save();
get item() {
return this._item;
}
removeShell(idx) {
this.item.wordList.splice(idx, 1);
this.save();
@Output()
update = new EventEmitter();
constructor(private appRef: ApplicationRef) {
}
ngOnInit() {
this.item = {};
this.item.contentObj = {};
// 获取存储的数据
(<any>window).courseware.getData((data) => {
const getData = (<any>window).courseware.getData;
getData((data) => {
if (data) {
this.item = data;
} else {
this.item = {};
}
if (!this.item.contentObj) {
this.item.contentObj = {};
}
console.log('~data:', data);
this.init();
this.changeDetectorRef.markForCheck();
this.changeDetectorRef.detectChanges();
this.refresh();
}, this.saveKey);
}
}, this.KEY);
// this.initData();
}
ngOnChanges() {
}
ngOnDestroy() {
}
init() {
//在卡片组之上需要增加 两个组 0根->picArr 1题组->testlet 2页面->page 3卡片对->itemData
if (this.item.contentObj.picArr) {
this.picArr = this.item.contentObj.picArr;
this.check();
} else {
this.picArr = this.getDefaultPicArr();
this.item.contentObj.picArr = this.picArr;
}
console.log('item:', this.item);
// this.picArr = this.getDefaultPicArr();
// this.item.contentObj.picArr = this.picArr;
// console.log('this.item:;', this.picArr);
}
cardItemData() {
return {
cardId: "",
left: {
title: "",
pic_url: "",
audio_url: ""
},
right: {
title: "",
pic_url: "",
audio_url: ""
}
};
}
getDefaultPicArr() {
let arr = [];
arr[0] = [];
arr[0][0] = [];
//在卡片组之上需要增加 两个组 0根->picArr 1题组->testlet 2页面->page 3卡片对->itemData
//默认 题组1 页面1 卡片对2个
for (let i = 0; i < 2; i++) {
let item = this.cardItemData();
arr[0][0].push(item);
}
// for (let index = 0; index < 4; index++) {
// let item = this.cardItemData();
// arr.push(item);
// }
return arr;
}
/**
* 储存图片数据
* @param e
*/
onImageUploadSuccess(e, key) {
initData() {
this.item[key] = e.url;
}
onImageUploadSuccessByItem(e, item) {
item.pic_url = e.url;
this.save();
}
/**
* 储存音频数据
* @param e
*/
onAudioUploadSuccess(e, key) {
this.item[key] = e.url;
onAudioUploadSuccessByItem(e, item) {
item.audio_url = e.url;
this.save();
}
onWordAudioUploadSuccess(e, idx) {
this.item.wordList[idx].audio = e.url;
//添加一对
addItem(m, n) {
//最多5对
if (this.picArr[m][n].length < 5) {
let item = this.cardItemData();
this.picArr[m][n].push(item);
this.saveItem();
}
}
deleteItem(index, m, n) {
if (index !== -1) {
this.picArr[m][n].splice(index, 1);
}
if (this.picArr[m][n].length == 0) {
this.picArr[m].splice(n, 1)
}
if (this.picArr[m].length == 0) {
this.picArr.splice(m, 1)
}
this.save();
}
//添加一页
addPage(m) {
let arr = [];
for (let i = 0; i < 2; i++) {
let item = this.cardItemData();
arr.push(item);
}
this.picArr[m].push(arr);
this.save();
}
deletePage(m, n) {
console.log("删除页," + m + "|" + n);
this.picArr[m].splice(n, 1)
if (this.picArr[m].length == 0) {
this.picArr.splice(m, 1)
}
this.save();
}
//添加题组
addTestlet() {
let arr = [[]];
for (let i = 0; i < 2; i++) {
let item = this.cardItemData();
arr[0].push(item);
}
this.picArr.push(arr);
this.save();
}
deleteTestlet(m) {
this.picArr.splice(m, 1)
this.save();
}
radioClick(it, radioValue) {
it.radioValue = radioValue;
this.saveItem();
}
clickCheckBox() {
console.log(' in clickCheckBox');
this.saveItem();
}
onBackWordAudioUploadSuccess(e, idx) {
this.item.wordList[idx].backWordAudio = e.url;
saveItem() {
console.log(' in saveItem');
// this.update.emit(this.item);
this.save();
}
/**
* 储存数据
*/
check() {
if (!this.picArr) return;
let picArr = this.picArr;
function tia(info) {
let str = "";
if (info.radioValue == "A") {
if (!info.title) str += ",图片";
} else if (info.radioValue == "B") {
if (!info.pic_url) str += ",图片";
} else if (info.radioValue == "C") {
if (!info.audio_url) str += ",音频";
} else {
str += "卡片"
}
if (str) str += "未上传"
return str;
}
this.errs.length = 0;
for (let m = 0; m < picArr.length; m++) {
for (let n = 0; n < picArr[m].length; n++) {
if (picArr[m][n].length < 2) {
this.errs.push(`星-${m + 1} 页-${n + 1} 卡片少于2个`);
}
for (let i = 0; i < picArr[m][n].length; i++) {
let item = picArr[m][n][i];
let left = item.left;
let right = item.right;
let code0 = tia(left);
let code1 = tia(right);
if (code0) this.errs.push(`星-${m + 1} 页-${n + 1}${i + 1}个卡片 左侧${code0}`);
if (code1) this.errs.push(`星-${m + 1} 页-${n + 1}${i + 1}个卡片 右侧${code1}`);
}
}
}
console.log("this.errs");
console.log(this.errs);
console.log("-------------------------");
}
save() {
(<any>window).courseware.setData(this.item, null, this.saveKey);
//触发一次检测
// this.item.picArr;
// this.message.create("error", `This is a message of error`);
this.check();
this.refresh();
(<any>window).courseware.setData(this.item, null, this.KEY);
console.log('this.item = ' + JSON.stringify(this.item));
this.refresh();
}
/**
* 刷新 渲染页面
*/
refresh() {
setTimeout(() => {
this.appRef.tick();
......@@ -112,3 +264,4 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"ver": "1.1.2",
"uuid": "c86579f8-93d0-4fd4-b735-4e5e87f46bf8",
"isBundle": true,
"bundleName": "resources",
"priority": 8,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "a3f6fefb-abb7-418b-9726-ebea06068962",
"downloadMode": 0,
"duration": 1.776327,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "88e389ad-cdd7-4d2b-8900-19bbb61c340a",
"downloadMode": 0,
"duration": 0.173333,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "665e544c-fe92-4f24-bdcc-9475a763ff0c",
"downloadMode": 0,
"duration": 0.264,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "342d6b41-d606-43d5-9676-7b67f03d236f",
"downloadMode": 0,
"duration": 0.653061,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "16a0bc5d-fd4e-443e-aeb0-80139b29574d",
"downloadMode": 0,
"duration": 4.04898,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "e3803979-40c9-4b6c-9f51-39781cec1d1b",
"downloadMode": 0,
"duration": 2.115917,
"subMetas": {}
}
\ No newline at end of file
class Ani {
//抖动效果
static shake(item) {
// alert("抖动效果");
let tween = cc.tween(item);
tween.to(0.06, { angle: 10 })
.to(0.06, { angle: 0 })
.to(0.06, { angle: -10 })
.to(0.06, { angle: 0 });
tween.repeat(4);
tween.start();
}
static scaleOut(item) {
return new Promise((resolve) => {
let tween = cc.tween(item);
tween.to(0.2, { scaleX: 0, scaleY: 0 })
.call(() => { resolve() });
tween.start();
})
}
static scaleIn(item) {
return new Promise((resolve) => {
item.scaleX = 0;
item.scaleY = 0;
let tween = cc.tween(item);
tween.to(0.2, { scaleX: 1, scaleY: 1 })
.call(() => { resolve() });
tween.start();
})
}
}
export default Ani;
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "b15f80f1-6507-44eb-af5b-07bfb945bf0c",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
class Card {
constructor(picItem, cardId, doubuleId) {
//单个具体内容 一对的内容 一组的内容
this.cardId = cardId;
this.cardDid = doubuleId;
this.type = CardManager.TYPE_NULL;
if (picItem.radioValue == "A") {
if (picItem.title) {
this.txt = picItem.title;
this.type = CardManager.TYPE_TXT;
}
} else if (picItem.radioValue == "B") {
if (picItem.pic_url) {
this.img = picItem.pic_url;
this.type = CardManager.TYPE_IMG;
}
} else if (picItem.radioValue == "C") {
if (picItem.audio_url) {
this.audio = picItem.audio_url;
this.type = CardManager.TYPE_MP3;
}
}
// this.type = CardManager.TYPE_MP3;
}
// 具体去怎么分配 按照不同的分配逻辑去走
}
//最大的星星 一二三星 卡片组 卡片对 卡片 卡片内数据
class CardManager {
static TYPE_NULL = 0;
static TYPE_TXT = 1;
static TYPE_IMG = 2;
static TYPE_MP3 = 3;
static instance;
static getIns() {
if (!CardManager.instance) CardManager.instance = new CardManager();
return CardManager.instance;
}
_cardArray;//所有卡片的组
testletId;//组id
pageId;//页id
constructor() {
this._cardArray = [];//组 页
this.testletId = 0;
this.pageId = 0;
}
initCards(obj) {
console.log(obj);
let picArr = obj.contentObj.picArr;
this._cardArray = [];
let doubuleId = 0;
let cardId = 0;
for (let m = 0; m < picArr.length; m++) {
let testlet = [];
for (let n = 0; n < picArr[m].length; n++) {
let page = [];
for (let i = 0; i < picArr[m][n].length; i++) {
doubuleId++;
let pic = picArr[m][n][i];
let left = pic.left;
let right = pic.right;
cardId++;
let card1 = new Card(left, cardId, doubuleId);
cardId++;
let card2 = new Card(right, cardId, doubuleId);
if (card1.type == CardManager.TYPE_NULL || card2.type == CardManager.TYPE_NULL) {
doubuleId--;
continue;
}
page.push(card1, card2);
}
testlet.push(page);
}
this._cardArray.push(testlet);
}
}
getTestlet() {
return this._cardArray.length - 1;
}
getPage() {
if (this._cardArray[this.testletId] && this._cardArray[this.testletId][this.pageId]) {
return this._cardArray[this.testletId][this.pageId];
} else {
return null;
}
}
addPageNum() {
this.pageId++;
if (!this.getPage()) {
this.pageId = 0;
this.testletId++;
if (!this.getPage()) {
return 2;//游戏结束
}
return 1;//组结束
} else {
return 0;//页结束
}
}
resetPageNum() {
this.testletId = 0;
this.pageId = 0;
}
randomPageCards() {
//页面内部数字要打乱 0 1 2 3 4 5 6 7 8 每次动态取出一个值 然后动态处理
let radArray = [];
for (let m = 0; m < this._cardArray.length; m++) {
for (let n = 0; n < this._cardArray[m].length; n++) {
let arr = [];
while (this._cardArray[m][n].length > 0) {
let rand = Math.floor(Math.random() * this._cardArray[m][n].length);
arr.push(this._cardArray[m][n][rand]);
this._cardArray[m][n].splice(rand, 1);
}
this._cardArray[m][n] = arr;
}
}
}
}
export default CardManager;
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "11f21116-6718-42e0-bd5e-a369c8a95b33",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
function retData() {
// let item = {"contentObj":{"picArr":[[[{"cardId":"","left":{"title":"boy1","pic_url":"http://staging-teach.cdn.ireadabc.com/1baedb0b31dc5503e65e114ce21940ab.jpeg","audio_url":"http://staging-teach.cdn.ireadabc.com/495324991838775e49e3ca6593d432c9.mp3","radioValue":"C"},"right":{"title":"food","pic_url":"http://staging-teach.cdn.ireadabc.com/38117778476574c7ef8b445cf24d6eb5.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/495324991838775e49e3ca6593d432c9.mp3","radioValue":"A"},"radioValue":"B"},{"cardId":"","left":{"title":"boy2","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/17cc0e2a383e4632147dc495a1397915.mp3","radioValue":"C"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/21373528a7f38575e871de1d8e5a9671.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/17cc0e2a383e4632147dc495a1397915.mp3","radioValue":"B"},"radioValue":"E"}],[{"cardId":"","left":{"title":"girl1","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/205722475ccaca6233b2f28e635405ca.mp3","radioValue":"A"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/5d099c38000b804241f7dc1286b17457.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/205722475ccaca6233b2f28e635405ca.mp3","radioValue":"B"},"radioValue":"D"},{"cardId":"","left":{"title":"girl2","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/0b6ef24f15c6d8ad7bf27cc913445ebf.mp3","radioValue":"A"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/0abab9a26d537ebf1835a2ed8430162e.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/0b6ef24f15c6d8ad7bf27cc913445ebf.mp3","radioValue":"B"},"radioValue":"D"},{"cardId":"","left":{"title":"girl3","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/b2c170f84b85dddf554b5c837d1d6e30.mp3","radioValue":"A"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/5f34d4100a6ecb187fd715c99e917fc8.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/b2c170f84b85dddf554b5c837d1d6e30.mp3","radioValue":"B"},"radioValue":"D"}]],[[{"cardId":"","left":{"title":"rabbit","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/a7bd7c4de71319db5b6b0b60f0957e21.mp3","radioValue":"A"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/fe229e6b32f385fb8fe5eb9ec5843c66.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/a7bd7c4de71319db5b6b0b60f0957e21.mp3","radioValue":"B"},"radioValue":"D"},{"cardId":"","left":{"title":"cat","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/6c8dcd159d4f05bc93838cc47d3895f4.mp3","radioValue":"A"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/9c5fa50efd7a004f24ea7fcbcf81080e.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/6c8dcd159d4f05bc93838cc47d3895f4.mp3","radioValue":"B"},"radioValue":"A"},{"cardId":"","left":{"title":"coffe","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/3d0fea61d5d97f3caf04a9b738a0291b.mp3","radioValue":"A"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/9d114554c4760ff35f1ff5479504a531.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/a7bd7c4de71319db5b6b0b60f0957e21.mp3","radioValue":"B"},"radioValue":"D"},{"cardId":"","left":{"title":"tea","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/448291140d0b780c0278a14bf49277cb.mp3","radioValue":"A"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/bf26f92e4f0557ad70ac27006855dae9.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/6c8dcd159d4f05bc93838cc47d3895f4.mp3","radioValue":"B"},"radioValue":"D"}]],[[{"cardId":"","left":{"title":"cool","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/0e67aa701df18cbb5581ffb81ffa7836.mp3","radioValue":"A"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/38117778476574c7ef8b445cf24d6eb5.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/4c0379bc0f3bd0722874b2e11fb35336.mp3","radioValue":"B"},"radioValue":"D"},{"cardId":"","left":{"title":"big eye","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/fe226bc303f03ea994cb9a93d1620284.mp3","radioValue":"A"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/21373528a7f38575e871de1d8e5a9671.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/b985b71cd2f3c2d31e45992e4ae69d7f.mp3","radioValue":"B"},"radioValue":"A"},{"cardId":"","left":{"title":"cute","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/84c7b82de1a09da792237a174ebe071b.mp3","radioValue":"A"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/5d099c38000b804241f7dc1286b17457.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/7c1d1540233b6d050eae8215679104a8.mp3","radioValue":"B"},"radioValue":"D"},{"cardId":"","left":{"title":"shuai","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/9e799e7e86cd50c6699ca0e859c8aa1f.mp3","radioValue":"A"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/338dbee896e1fa8869495c84c603c33f.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/9a6b3177ab53ba75bcf293df1065bb64.mp3","radioValue":"B"},"radioValue":"D"},{"cardId":"","left":{"title":"big m","pic_url":"","audio_url":"http://staging-teach.cdn.ireadabc.com/495324991838775e49e3ca6593d432c9.mp3","radioValue":"C"},"right":{"title":"","pic_url":"http://staging-teach.cdn.ireadabc.com/0abab9a26d537ebf1835a2ed8430162e.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/17cc0e2a383e4632147dc495a1397915.mp3","radioValue":"B"},"radioValue":"E"}]]]}}
let item = {"contentObj":{"picArr":[[[{"cardId":"","left":{"title":"11","pic_url":"","audio_url":"","radioValue":"A"},"right":{"title":"11-1","pic_url":"","audio_url":"","radioValue":"A"},"radioValue":"C"},{"cardId":"","left":{"title":"22","pic_url":"","audio_url":"","radioValue":"A"},"right":{"title":"22-1","pic_url":"","audio_url":"","radioValue":"A"},"radioValue":"C"}]]]}}
return item;
}
export const itemData = retData();
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "4e93bb38-2b8e-4524-a0cf-ee046467baf5",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
class HYLoader {
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();
});
}
});
}
}
}
export const hyLoader = new HYLoader();
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "2bc1b858-63dd-4bec-bb40-e6703d306bbc",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
let pg = {};
//打印
pg.logger = {
d: (str) => {
cc.log(str);
},
w: function (str) {
cc.warn(str);
}
}
const log = pg.logger;
//显示常用
pg.view = {
//显示隐藏
//添加节点
//删除节点
//加载网络节点
touchEnable(item, isEnable) {
if (!item) return pg.logger.w("设置按钮响应失败,传入了错误的item");
let node = item.node ? item.node : item;
if (!node) return pg.logger.w("设置按钮响应失败,传入了错误的item");
let btn = node.getComponent(cc.Button);
if (!btn) return pg.logger.w("当前节点没有添加button->" + node.name);
btn.interactable = isEnable;
return true;
},
touchOn(item, callback, target) {
if (!item) return pg.logger.w("添加按钮响应失败,传入了错误的item");
if (!callback || !target) return pg.logger.w("添加按钮响应失败,传入了空回调");
let node = item.node ? item.node : item;
node.on(cc.Node.EventType.TOUCH_END, callback, target);
return true;
},
touchOff(item, callback, target) {
if (!item) return log.w("移除按钮响应失败,传入了错误的item");
if (!callback || !target) return log.w("移除按钮响应失败,传入了空回调");
let node = item.node ? item.node : item;
if (!node || !node.parent) return log.w("节点已移除");
node.off(cc.Node.EventType.TOUCH_END, callback, target);
return true;
},
//更换图片
setImg(item, res) {
return new Promise((resolve, reject) => {
if (!item) return log.w("图片更换失败,传入了错误的item");
if (!res) return log.w("图片更换失败,传入了错误的res");
pg.load.loadImg(res).then((spriteFrame) => {
if (!cc.isValid(item)) return log.i("节点已销毁");
let node = item.node ? item.node : item;
if (!cc.isValid(node)) return log.i("节点已销毁");
let component = node.getComponent(cc.Sprite);
let { width, height } = spriteFrame._rect;
component.spriteFrame = spriteFrame;
resolve({ width, height });
})
})
},
setNetImg(item, res) {
return new Promise((resolve, reject) => {
if (!item) return log.w("图片更换失败,传入了错误的item");
let node = item.node ? item.node : item;
if (!res) {
node.active = false;
return log.w("图片更换失败,传入了错误的res");
}
if (!node) return log.w("图片更换失败,传入了错误的item");
if (node.net_url == res) return;
let w = node.width;
let h = node.height;
node.active = false;//
pg.load.loadNetImg(res).then((texture) => {
if (!cc.isValid(node)) return log.i("节点已销毁");
let nw = node.width = texture.width;
let nh = node.height = texture.height;
let component = node.getComponent(cc.Sprite);
let spriteFrame = new cc.SpriteFrame(texture);
component.spriteFrame = spriteFrame;
node.net_url = res;
let a = w / nw;//100 2000 0.05
let b = h / nh;//100 1000 0.1
if (a < b) {
node.width = a * nw;
node.height = a * nh;
} else {
node.width = b * nw;
node.height = b * nh;
}
node.active = true;
resolve({ w: nw, h: nh });
})
})
},
visible(item, isVisible) {
if (!item) return log.w("节点显示失败,传入了错误的item");
let node = item.node ? item.node : item;
if (!node || !node.parent) return log.w("节点已移除");
node.active = isVisible;
return true;
},
setString(item, text, count = 0) {
if (!item) return log.w("节点text失败,传入了错误的item");
if (count > 0) {
function parse_str(str, count) {
if (!str) return "";
var segmants = str.split('+');
str = segmants.join('');
var len = 0;
var idx = 0;
for (var i = 0; i < str.length; i++) {
var p = /[^x00-xff]/g;
var a = str.charAt(i);
if (p.test(a)) {
len += 2;
idx++;
}
else {
len += 1;
idx++;
}
if (len >= count * 2)
break;
}
return str.substr(0, idx);
}
text = parse_str(text, count);
}
let node = item.node ? item.node : item;
if (!node) return;
let component = node.getComponent(cc.Label);//组件功能 非node的功能
component.string = text;
return true;
},
setColor(item, color, outlineWidth = -1) {
if (!item) return log.w("setColor warn->传入了错误的item");
let RGB = this.colorRgb(color);
if (!RGB || RGB.length == 0) return log.w("color ->传入了错误的color");
item.color = new cc.Color(RGB[0], RGB[1], RGB[2]);
if (outlineWidth < 0) return;
let LabelOutline = item.getComponent(cc.LabelOutline);
if (!LabelOutline) return log.w("LabelOutline warn->未添加描边");
LabelOutline.width = outlineWidth;
},
colorRgb(color) {
var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
var sColor = color;
if (sColor && reg.test(sColor)) {
if (sColor.length === 4) {
var sColorNew = "#";
for (var i = 1; i < 4; i += 1) {
sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1));
}
sColor = sColorNew;
}
//处理六位的颜色值
var sColorChange = [];
for (var i = 1; i < 7; i += 2) {
sColorChange.push(parseInt("0x" + sColor.slice(i, i + 2)));
}
return sColorChange;
} else {
return sColor;
}
},
find(item, childPath) {
if (typeof item == "string") {
childPath = item;
item = null;
}
if (!childPath || childPath == '' || typeof childPath != 'string') return log.w("findChildByPath error->" + "请传入路径");
let child = null;
if (item) {
let node = item.node ? item.node : item;
if (!node.children || node.children.length == 0) return log.w("findChild error->" + "找不到此节点,请检查层级路径:" + childPath);
child = cc.find(childPath, node);
} else {
child = cc.find(childPath);
}
if (!child) return log.w("findChildByPath error->" + "找不到此节点,请检查层级路径:" + childPath);
return child;
},
addChild(item, child, zIndex) {
if (!child) return console.log("addChild error ->请传入子节点");
if (!item) return console.log("addChild error ->请传入父节点");
let node = item.node ? item.node : item;
if (!node) return console.log("addChild error ->请传入父节点");
if (child.parent)
return log.w("此节点已经有父节点->" + child.name);
if (zIndex >= 0) {
node.addChild(child, zIndex)
} else {
node.addChild(child);
}
return true;
},
removeSelf(item) {
if (!item) return log.w("节点移除失败,传入了错误的item");
let node = item.node ? item.node : item;
node.removeFromParent();
node.destroy();
},
removChildren(item) {
if (!item) return log.w("节点remove失败,传入了错误的item");
let node = item.node ? item.node : item;
if (!node.parent) return log.w("节点remove失败,传入了错误的item");
node.removeAllChildren();
return true;
},
removeChild(item, child) {
if (!item) return log.w("节点remove失败,传入了错误的item");
let node = item.node ? item.node : item;
if (child.parent && child.parent == node) {
node.removeChild(child);
node.destroy();
}
return true;
},
playSpineAnimation(item, aniName, loop) {
if (!item || !cc.isValid(item)) return log.w("动画播放失败,传入了错误的item");
if (!aniName) return log.w("动画播放失败,传入了错误的aniName");
let node = item.node ? item.node : item;
if (!cc.isValid(node)) return log.w("节点已销毁");
let skl = node.getComponent(sp.Skeleton);
skl.setAnimation(0, aniName, loop);
return skl;
},
}
//加载 未封装bundle
pg.load = {
loadRes: function (res, type, bundleName) {
// cc.assetManager.loadBundle('hall', (err, bundle) => {
// if (err) return cc.error(err);
// cc.director.loadScene("hall", () => { });
// });
// cc.assetManager.loadBundle('chess', (err, bundle) => {
// if (err) return cc.error(err);
// cc.director.loadScene("chess", () => {
// // //清理hall的资源
// // let hallBundle = cc.assetManager.getBundle(`hall`);
// // hallBundle.releaseAll();
// // cc.assetManager.removeBundle(hallBundle);
// });
// });
//此处需要二次封装,新的存在assetbundle
return new Promise((resolve, reject) => {
cc.loader.loadRes(res, type, (err, data) => {
if (err && !data) return resolve(pg.logger.d('loading loadRes error-> ', res));
resolve(data);
});
})
},
loadImg: function () {
return new Promise((resolve, reject) => {
this.loadRes(url, cc.SpriteFrame).then((data) => {
if (!data || data.length == 0) return;
resolve(data);
})
})
},
loadPrefab: function (path = "") {
return new Promise((resolve, reject) => {
url = "/prefabs/" + path;
this.loadRes(url, cc.Prefab).then((data) => {
if (!data || data.length == 0) return reject();
return resolve(cc.instantiate(data));
})
})
},
loadNetImg: function (url) {
return new Promise((resolve, reject) => {
cc.loader.load({ url }, (err, texture) => {
if (err && !data) return resolve(pg.logger.w('loading loadRes warn-> ', res));
resolve(texture);
});
})
},
}
//本地存储
pg.localStorage = {
setItem: function (key, val) {
cc.sys.localStorage.setItem(key, val);
},
getItem: function (key, defVal) {
return cc.sys.localStorage.getItem(key) || defVal;
}
}
//HTTP网络请求
pg.http = {
send: function (type = "GET", url, data, callback) {
let xhr = cc.loader.getXMLHttpRequest();
xhr.timeout = 5000;
xhr.responseType = "text";
xhr.open(type, url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = () => {
if (xhr.readyState !== 4) return;
if (xhr.status >= 200 && xhr.status < 300) {
try {
let resp = xhr.responseText;
pg.logger.d("resp->" + JSON.stringify(resp));
callback(resp);
} catch (e) {
}
}
else {
}
};
xhr.onerror = (e) => {
pg.logger.w("onerror->" + url);
};
xhr.ontimeout = (e) => {
pg.logger.w("ontimeout->" + url);
};
xhr.send(data);
}
}
/**事件监听部分
*
*
*
*/
class Emitter {
static instance;
static getInstance() {
if (!Emitter.instance) {
Emitter.instance = new Emitter();
}
return Emitter.instance;
}
constructor() {
this._callbacks = {};
return this;
}
on(event, fn) {
(this._callbacks[event] = this._callbacks[event] || []).push(fn);
};
once(event, fn) {
function on() {
this.off(event, on);
fn.apply(this, arguments);
}
on.fn = fn;
this.on(event, on);
};
off(event, fn) {
// all
if (0 == arguments.length) {
this._callbacks = {};
return;
}
// specific event
let callbacks = this._callbacks[event];
if (!callbacks) return;
// remove all handlers
if (1 == arguments.length) {
delete this._callbacks[event];
return;
}
// remove specific handler
let cb;
for (let i = 0; i < callbacks.length; i++) {
cb = callbacks[i];
if (cb === fn || cb.fn === fn) {
callbacks.splice(i, 1);
break;
}
}
return;
}
emit(event, ...args) {
this._callbacks = this._callbacks || {};
// let args = [].slice.call(arguments, 1);
let callbacks = this._callbacks[event];
if (callbacks) {
callbacks = callbacks.slice(0);
for (let i = 0, len = callbacks.length; i < len; ++i) {
callbacks[i].apply(this, args);
}
}
}
listeners(event) {
this._callbacks = this._callbacks || {};
return this._callbacks[event] || [];
};
hasListeners(event) {
return !!this.listeners(event).length;
};
}
class SceneStruct {
constructor() {
this.nowScene = "hb_login";
this.sceneObject = {};
this.sceneObject[this.nowScene] = [];
}
addScene(sceneName) {
this.nowScene = sceneName;
//if (!this.sceneObject[this.nowScene])
this.sceneObject[this.nowScene] = [];
}
addLayer(layerName) {
if (!this.sceneObject[this.nowScene]) return console.log("sceneStruct err->scene未初始化:" + this.nowScene)
if (!this.sceneObject[this.nowScene].includes(layerName)) {
this.sceneObject[this.nowScene].push(layerName);
}
}
removeLayer(layerName) {
if (!this.sceneObject[this.nowScene]) return console.log("sceneStruct err->scene未初始化:" + this.nowScene)
let arr = this.sceneObject[this.nowScene];
let isSuccess = false;
for (let i = arr.length - 1; i >= 0; i--) {
let laName = arr[i];
if (layerName == laName) {
isSuccess = true;
arr.splice(i, 1);
}
}
if (!isSuccess) {
console.log("sceneStruct err->scene没有对应layer:" + this.nowScene + ">" + layerName);
}
}
clearLayer() {
this.sceneObject[this.nowScene] = [];
}
getLayers() {
return this.sceneObject[this.nowScene] || [];
}
}
class SceneManager {
static debug = true;
static instance;
static getInstance() {
if (!SceneManager.instance) {
SceneManager.instance = new SceneManager();
}
return SceneManager.instance;
}
//py [-zIndex.bottom-]
//py [-zIndex.login-]
//py [-zIndex.hall-]
//py [-zIndex.club-]
//py [-zIndex.clubPop-]
//py [-zIndex.game-]
//py [-zIndex.game_1-]
//py [-zIndex.game_2-]
//py [-zIndex.game_3-]
//py [-zIndex.notice-]
//py [-zIndex.tip-]
//py [-zIndex.tips-]
//py [-zIndex.top-]
constructor() {
this.sceneStruct = new SceneStruct();
//addLayer之前和之后要对scene进行一次对比,如果异常,不进行添加。 继续游戏能看到大厅的bug。
this.zIndex = {
bottom: 0,
login: 1,
hall: 2,
game: 5,
notice: 9,
tip: 10,
top: 12,
webView: 90,//webView 会在最上层,防止出现无法关闭活动界面
}
}
nameScene;
scene;
get stage() {
return cc.find("Canvas");
}
get bottom() {
return cc.find("Canvas/bottom");
}
get camera() {
return cc.find('Canvas/Main Camera')
}
beforeLoadScene() {
let layers = [].concat(this.sceneStruct.getLayers());
if (!layers || layers.length == 0) return;
layers.forEach(layerName => {
this.removeLayer(layerName, true);
})
}
//py [-loadScene(${1:sceneName})-]
loadScene(sceneName, data, prepareFunc) {
// pg.loading.releaseAllRes();
return new Promise((resolve, reject) => {
if (this.nameScene == sceneName) {
resolve();
return console.warn("加载重复的scene->" + sceneName);
}
// this.beforeLoadScene();
setTimeout(() => {
this.sceneStruct.clearLayer();
// if (sceneName != "coclub" && sceneName != "cohall_login") {
// pg.loading.releaseAddAssetList();
// }
// pg.loading.releaseAddAssetList();
// if (!cc.game.isPaused()) {
// cc.game.pause();
// cc.loader.releaseAll();
// }
prepareFunc && prepareFunc();
cc.director.loadScene(sceneName, () => {
// cc.game.resume();
this.beforeLoadScene();//等待加载完成再移除当前场景 3.11 王林
this.nameScene = sceneName;
this.sceneStruct.addScene(sceneName);
event.call(sceneName + "_open", data);
resolve();
});
}, 0);
})
}
preloadScene(sceneName) {
// cc.isValid 判断节点是否被销毁。
return cc.director.preloadScene(sceneName);
}
preLoadLayer(layerName) {
return new Promise((resolve, reject) => {
loading.loadPrefab(layerName).then(prefab => {
resolve();
})
})
}
/*
!#zh
添加子层,并且可以修改该层的层级顺序和名字。
@param layerName 层的预制文件名称(路径在loadPrefab中自动填写)
@param zIndex 层级|zIndex.bottom /zIndex.login
@param data layerName_opn|传输得值
@example
```js
sceneManager.addLayer('login_layer', 1);
```
*/
//py [-addLayer(${1:layerName},${2:pg.scene.zIndex.},${3:data})-]
addLayer(layerName, zIndex, data, forceRepeat = false, path = "") {
return new Promise((resolve, reject) => {
if (!zIndex && zIndex != 0) {
console.warn("addLayer warn->" + "未添加zIndex:" + layerName);
zIndex = this.zIndex.top;
}
if (!forceRepeat && this.sceneStruct.getLayers().some(ln => { return ln == layerName })) {
event.call(layerName + "_open_repeat", data);
return resolve(log.w("addLayer warn->" + "重复添加界面:" + layerName));
}
let uuid = this.stage && this.stage.uuid ? this.stage.uuid : 0;
loading.loadPrefab(layerName, path).then(prefab => {
if (window.game_center.isLoadingGame || window.game_center.isRunningGame) {//|| !window.isInHall
return reject(log.w("dating ..."));
}
if (!this.stage) return reject(log.w("addLayer warn->" + "场景已切换:" + layerName));
if (uuid && uuid != this.stage.uuid) return reject(log.w("addLayer warn->" + "场景已切换:" + layerName));
if (this.sceneStruct.getLayers().indexOf(layerName) != -1) return resolve(log.w("addLayer warn->" + "多次添加界面:" + layerName));
if (zIndex == this.zIndex.bottom) {
this.bottom && this.bottom.addChild(prefab, zIndex, layerName);
// this.sceneStruct.addLayer(layerName);
} else {
this.stage.addChild(prefab, zIndex, layerName);
}
event.call(layerName + "_open", data);
this.sceneStruct.addLayer(layerName);
resolve(prefab);
})
})
}
//py [-removeLayer(${1:layerName})-]
removeLayer(layerName, isRelease = false) {
// if (layerName == "cohall_WaitLayer") {
// console.log("请求移除等待界面");
// }
if (!this.stage) return console.log("removeLayer warn->" + "找不到当前stage")
let node = this.stage.getChildByName(layerName);
if (!node && this.bottom) node = this.bottom.getChildByName(layerName);
if (!node) return (layerName != "cohall_WaitLayer" && layerName != "cohall_SceneWaitLayer") && console.log("removeLayer warn->" + "当前stage找不到“" + layerName + "");
node.removeFromParent(false);
node.destroy();
// if (layerName == "cohall_WaitLayer") {
// console.log("等待界面移除成功");
// }
this.sceneStruct.removeLayer(layerName);
if (isRelease) loading.releasePrefab(layerName, isRelease);
}
backLayer(layerName, isVisible = false) {
return new Promise((resolve, reject) => {
let layer = this.getLayerByName(layerName);
if (!layer) {
pg.scene.addLayer(layerName, pg.scene.zIndex.bottom, {}, false, false).then(layer => {
layer.active = isVisible;
return resolve();
});
return;
}
layer.parent = this.bottom;
layer.zIndex = this.zIndex.bottom;
layer.active = isVisible;
return resolve();
})
}
frontLayer(layerName) {
return new Promise((resolve, reject) => {
let layer = this.getLayerByName(layerName);
if (!layer) {
pg.scene.addLayer(layerName, pg.scene.zIndex.hall).then(layer => {
layer.active = true;
return resolve();
});
return;
} else {
layer.parent = this.stage;
layer.zIndex = this.zIndex.hall;
layer.active = true;
}
return resolve();
})
}
//py [-getLayerByName(${1:layerName})-]
getLayerByName(layerName) {
let node = this.stage.getChildByName(layerName);
if (!node) node = this.bottom.getChildByName(layerName);
return node;
}
clearLayer() {
this.sceneStruct.clearLayer();
}
//py [-isHaveLayer(${1:layerName})-]
isHaveLayer(layerName) {
return !!this.getLayerByName(layerName);
}
getSceneName() {
return this.nameScene;
}
}
/**音频播放部分
*
*
*
*/
let KEY_MUSIC_VOL = "music_vol";
let KEY_EFFECT_VOL = "effect_vol";
class AudioUtil {
static instance;
static getInstance() {
if (!AudioUtil.instance) {
AudioUtil.instance = new AudioUtil();
}
return AudioUtil.instance;
}
constructor() {
this.bgm_volume = 1.0;
this.sfx_volume = 1.0;
this.sfx_button = "button";
this.cur_bgm = "";
this.updateVolume();
// cc.game.on(cc.game.EVENT_HIDE, function () {
// cc.audioEngine.pauseAll();
// });
// cc.game.on(cc.game.EVENT_SHOW, function () {
// cc.audioEngine.resumeAll();
// });
}
updateVolume() {
let vvol = cc.sys.localStorage.getItem(KEY_MUSIC_VOL);
if (vvol != null) {
this.bgm_volume = parseFloat(vvol);
}
let evol = cc.sys.localStorage.getItem(KEY_EFFECT_VOL);
if (evol != null) {
this.sfx_volume = parseFloat(evol);
}
}
get_audio_url(url) {
return url;
}
getSfxVolume() {
return this.sfx_volume;
}
getBgmVolume() {
return this.bgm_volume;
}
clickButton() {
this.playSFX(this.sfx_button);
}
playBGM(url, ispath) {
this.updateVolume();
let us = url.split("/");
let len = us.length;
if (len < 1) return;
let surl = us[len - 1];
if (this.cur_bgm == surl) return;
let audioUrl = ispath ? url : this.get_audio_url(url);
this.load(audioUrl).then((audio) => {
if (this.bgm_audio_id >= 0) {
cc.audioEngine.stop(this.bgm_audio_id);
}
this.bgm_audio_id = cc.audioEngine.play(audio, true, this.bgm_volume);
this.cur_bgm = surl;
})
}
playSFX(url, ispath) {
return new Promise((resolve, reject) => {
let audioUrl = ispath ? url : this.get_audio_url(url);
if (this.sfx_volume > 0) {
this.load(audioUrl).then((audio) => {
let audioId = cc.audioEngine.play(audio, false, this.sfx_volume);
cc.audioEngine.setFinishCallback(audioId, () => {
resolve(audio);
});
})
}
})
}
stopAll() {
cc.audioEngine.stopAll();
this.bgm_audio_id = -1;
this.cur_bgm = "";
}
setSFXVolume(v) {
v = Number(v);
if (this.sfx_volume != v) {
cc.sys.localStorage.setItem("sfxVolume_hbhall", "" + v);
this.sfx_volume = v;
}
}
setBGMVolume(v, force) {
v = Number(v);
if (this.bgm_audio_id >= 0) {
if (v > 0) {
cc.audioEngine.resume(this.bgm_audio_id);
}
else {
cc.audioEngine.pause(this.bgm_audio_id);
}
if (this.bgm_volume != v || force) {
cc.sys.localStorage.setItem("bgmVolume_hbhall", "" + v);
this.bgm_volume = v;
cc.audioEngine.setVolume(this.bgm_audio_id, v);
}
}
}
pauseAll() {
cc.audioEngine.pauseAll();
}
resumeAll() {
cc.audioEngine.resumeAll();
}
load(audioUrl) {
return new Promise((resolve, reject) => {
cc.resources.load(audioUrl, cc.AudioClip, (err, audio) => {
if (err) {
return cc.warn("音效加载失败->" + audioUrl);
}
if (!audio) return cc.warn("音效加载失败->" + audioUrl);
resolve(audio);
});
})
}
playAudioByUrl(audio_url) {
return new Promise((resolve, reject) => {
if (!audio_url) return resolve(null);
cc.assetManager.loadRemote(audio_url, (err, audioClip) => {
const audioId = cc.audioEngine.play(audioClip, false, 0.8);
cc.audioEngine.setFinishCallback(audioId, () => {
resolve(audioClip);
});
});
});
}
}
pg.event = Emitter.getInstance();
pg.audio = AudioUtil.getInstance();
pg.scene = SceneManager.getInstance();
export default pg;
// window.pg = pg;
//EVENT CONFIG DATA NET
//SYSTEM——MANAGER ---配置文件管理,网络管理,事件管理,数据管理
//VIEW——MANAGER ---界面管理,网络数据本地同步,界面事件推送
//VIEW ---界面效果,滚动等等
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "24305734-8e44-4e40-b9cf-802b2ae89e08",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
class CalculativeResize {
static resizeInfo() {
//0.设计尺寸
let baseSize = cc.size(1920, 1080);
//1.获取屏幕尺寸
let canvasSize = cc.view.getCanvasSize();
//2.将屏幕宽高 以高度对齐的方式 换算出场景 宽度
let sumSize = cc.size(canvasSize.width * baseSize.height / canvasSize.height, baseSize.height)
//3.计算场景宽度与设计宽度比率
let scaleX = sumSize.width / baseSize.width;
let posX = sumSize.width - baseSize.width;
//高屏幕适配
if (scaleX <= 1) {
let sumSize = cc.size(baseSize.width, canvasSize.height * baseSize.width / canvasSize.width)
let scaleY = sumSize.height / baseSize.height;
let posY = sumSize.height - baseSize.height;
// let posY = sumSize.height * (1 - 1 / scaleX);
return { scaleX: 1, scaleY: scaleY, posX: 0, orgX: 0, posY: posY, orgY: - posY / 2 }
}
//需要拓展的宽度缩放比
return { scaleX: scaleX, scaleY: 1, posX: posX, orgX: - posX / 2, posY: 0, orgY: 0 };
}
}
//关于齐刘海的适配方案。
//1.需要获取对应的手机型号
//2.需要写上安全间距标记(主要是中间部分)
//3.不同的手机安全间距可能不同。(主要适配iPhone X)
cc.Class({
extends: cc.Component,
properties: {
r_width: 1,
r_height: 1,
r_top: 0,
r_bottom: 0,
p_left: 0,
p_right: 0,
p_top: 0,
p_bottom: 0,
black: 0,//用于不能直接缩放的图片(如引导),两边补齐黑边
noHead: 0,
debug: 0,
},
// LIFE-CYCLE CALLBACKS:
onLoad() {
let { scaleX, posX, scaleY, posY } = CalculativeResize.resizeInfo();
this.resizeScaleX = scaleX;
this.resizeScaleY = scaleY;
this.posX = posX;
this.posY = posY;
let { width, height, x, y } = this.node;
this.nodeWidth = width;
this.nodeHeight = height;
this.nodeX = x;
this.nodeY = y;
//增加一个resize的监听,当屏幕出现宽高比变化的时候,进行一次重新适配。
//主要用于刘海屏的重置,以及动态屏幕变化的控制(虚拟按键屏)。
},
start() {
this.resize();
},
update(dt) {
},
onDestroy() {
if (this.black1)
pg.view.removChildren(this.black1);
if (this.black2)
pg.view.removChildren(this.black2);
this.black1 = null;
this.black2 = null;
},
resize() {
if (!this.resizeScaleX && !this.nodeWidth) {
console.warn("手动调用此方法时,不能再onLoad中使用");
return;
}
this.resizeHeight();
this.resizeWidth();
},
//高屏幕适配
resizeHeight() {
if (this.resizeScaleY <= 1.05) return;
let scaleY = this.resizeScaleY;
let posY = this.posY;
let nodeWidth = this.nodeWidth;
let nodeHeight = this.nodeHeight;
let nodeX = this.nodeX;
let nodeY = this.nodeY;
if (this.debug == 1) {
console.log("断点调试点");
}
//宽度拉伸
if (this.r_width == 1) {
this.node.width = nodeWidth * scaleY;
}
//高度拉升
if (this.r_height == 1) {
this.node.height = nodeHeight * scaleY;
// //高度拉伸后,图片顶部齐边【坐标下移】 y坐标下移
// if (this.r_top == 1) {
// this.node.y = nodeY - nodeHeight * (scaleY - 1) / 2;
// }
// //高度拉伸后,图片底部齐边【坐标上移】 y坐标上移
// if (this.r_bottom == 1) {
// this.node.y = nodeY + nodeHeight * (scaleY - 1) / 2;
// }
}
// //如果是刘海屏,减去对应的刘海屏的宽度
// let lhpSize = { top: 0, bottom: 0 };
// //动态左移
// if (this.p_left == 1) {
// this.node.x = nodeX - posX / 2 + lhpSize.top;
// }
// //动态右移
// if (this.p_right == 1) {
// this.node.x = nodeX + posX / 2 - lhpSize.bottom;
// }
//动态上移
if (this.p_top == 1) {
this.node.y = nodeY + posY / 2 *0.75
}
//动态下移
if (this.p_bottom == 1) {
this.node.y = nodeY - posY / 2 *0.75
}
},
//长屏幕适配
resizeWidth() {
if (this.resizeScaleX <= 1.05) return;
let resizeScaleX = this.resizeScaleX;
let posX = this.posX;
let nodeWidth = this.nodeWidth;
let nodeHeight = this.nodeHeight;
let nodeX = this.nodeX;
let nodeY = this.nodeY;
if (this.debug == 1) {
console.log("断点调试点");
}
//宽度拉伸
if (this.r_width == 1) {
this.node.width = nodeWidth * resizeScaleX;
}
//高度拉升
if (this.r_height == 1) {
this.node.height = nodeHeight * resizeScaleX;
//高度拉伸后,图片顶部齐边【坐标下移】 y坐标下移
if (this.r_top == 1) {
this.node.y = nodeY - nodeHeight * (resizeScaleX - 1) / 2;
}
//高度拉伸后,图片底部齐边【坐标上移】 y坐标上移
if (this.r_bottom == 1) {
this.node.y = nodeY + nodeHeight * (resizeScaleX - 1) / 2;
}
}
if (this.black == 1) {
let baseSize = cc.size(1280, 720);
this.black1 = this.createBalck();
this.black2 = this.createBalck();
let curWidth = nodeWidth * resizeScaleX;
let curHeight = nodeHeight * resizeScaleX;
let blackWidth = (curWidth - baseSize.width) / 2;
let blackHeight = curHeight;
this.black1.width = blackWidth;
this.black1.height = blackHeight;
this.black2.width = blackWidth;
this.black2.height = blackHeight;
this.black1.x = - baseSize.width / 2 - this.black1.width / 2;
this.black2.x = baseSize.width / 2 + this.black1.width / 2;
this.black1.y = this.black2.y = nodeY;
pg.view.addChild(this.node, this.black1);
pg.view.addChild(this.node, this.black2);
this.black1.active = false;
this.black2.active = false;
if (this.node.nodeData && (this.node.nodeData.bg != "" && this.node.nodeData.bg != "rect")) {
this.black1.active = true;
this.black2.active = true;
}
}
//如果是刘海屏,减去对应的刘海屏的宽度
let lhpSize = { top: 0, bottom: 0 };
if (!this.noHead && posX != 0) lhpSize = { top: 44 * 1.5, bottom: 34 * 1.5 };
//动态左移
if (this.p_left == 1) {
this.node.x = nodeX - posX / 2 + lhpSize.top;
}
//动态右移
if (this.p_right == 1) {
this.node.x = nodeX + posX / 2 - lhpSize.bottom;
}
},
//屏幕适配--end
createBalck() {
let black = cc.instantiate(cc.find('Canvas/blackBg'));
return black;
},
setBlackActive(val) {
if (this.black1)
this.black1.active = val;
if (this.black2)
this.black2.active = val;
}
});
{
"ver": "1.0.8",
"uuid": "85b1fa7a-77a0-4811-8b62-826a7ca77c7e",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"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.
import { onHomeworkFinish } from "../script/util";
import { defaultData } from "../script/defaultData";
import { itemData } from "./data";
import { hyLoader } from "./hyLoader";
import CardManager from "./cardManager";
import pg from "./pg";
import ani from "./ani";
import { asyncDelay, RandomInt, showFireworks } from "../script/utils";
cc.Class({
......@@ -84,7 +90,8 @@ cc.Class({
},
getDefaultData() {
return defaultData;
return itemData;
// return defaultData;
},
preloadItem() {
......@@ -124,243 +131,582 @@ cc.Class({
});
},
//---------------------------------项目代码开始---------------------------------
loadEnd() {
this.initData();
this.initSingleData();
this.initAudio();
this.initView();
// this.initListener();
},
_cantouch: null,
//全局游戏
_gameCode: null,
initData() {
//数据解析
CardManager.getIns().initCards(this.data);
CardManager.getIns().resetPageNum();
CardManager.getIns().randomPageCards();
this._gameCode = 0;
},
//单局游戏
_cantouch: null,
_cardPage: null,
_cardLayout: null,
_cardTouchItems: null,
_successItems: null,
initSingleData() {
// 所有全局变量 默认都是null
this._cantouch = true;
//界面用数据
this._cardTouchItems = [];
this._successItems = [];
this._cardPage = CardManager.getIns().getPage();
cc.log(this._cardPage);
},
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();
this.btn_replay = pg.view.find(this, "btn_replay");
pg.view.visible(this.btn_replay, false);
pg.view.touchOn(this.btn_replay, this.onTouchReplay, this);
this.initStars();
this.initLayout();
},
initBg() {
const bgNode = cc.find('Canvas/bg');
bgNode.scale = this._mapScaleMax;
initStars() {
this.length = CardManager.getIns().getTestlet();
this.addStar();
},
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);
initLayout() {
pg.view.visible(this.btn_replay, false);
pg.view.visible(pg.view.find(this, `layout_card_4`), false);
pg.view.visible(pg.view.find(this, `layout_card_6`), false);
pg.view.visible(pg.view.find(this, `layout_card_8`), false);
pg.view.visible(pg.view.find(this, `layout_card_10`), false);
this._cardLayout = pg.view.find(this, `layout_card_${this._cardPage.length}`);
ani.scaleIn(this._cardLayout);
pg.view.visible(this._cardLayout, true);
for (let i = 0; i < this._cardPage.length; i++) {
let data = this._cardPage[i];
let item = pg.view.find(this._cardLayout, `item_${i}`);
if (!data || !item || data.type == CardManager.TYPE_NULL) continue;
this.updateItem(item, data);
}
},
updateItem(item, data) {
let img = pg.view.find(item, `img`);
let txt = pg.view.find(item, `txt`);
let audio = pg.view.find(item, `audio`);
let box = pg.view.find(item, `box`);
console.log(CardManager.TYPE_IMG);
if (data.type == CardManager.TYPE_IMG) {
pg.view.setNetImg(img, data.img);
pg.view.visible(img, true);
pg.view.visible(txt, false);
pg.view.visible(audio, false);
} else if (data.type == CardManager.TYPE_TXT) {
pg.view.setString(txt, data.txt);
pg.view.visible(img, false);
pg.view.visible(txt, true);
pg.view.visible(audio, false);
} else if (data.type == CardManager.TYPE_MP3) {
pg.view.visible(img, false);
pg.view.visible(txt, false);
pg.view.visible(audio, true);
pg.view.visible(pg.view.find(item, `audio/btn_laba`), true);
}
item.scaleX = 1;
item.scaleY = 1;
pg.view.visible(box, false);
item.attr({ data: data });
pg.view.visible(item, true);
pg.view.touchOn(item, this.onTouchItem, this);
},
onTouchItem(touch, info) {
if (!this._cantouch) return;
this._cantouch = false;
let item = touch.target;
let data = item.data;
console.log(data);
this._cardTouchItems.push(item);
if (this._cardTouchItems.length == 2) {
let item0 = this._cardTouchItems[0];
let item1 = this._cardTouchItems[1];
//检测重复点击 取消选中
if (item0.data && item1.data && item0.data.cardId == item1.data.cardId) {
pg.view.visible(pg.view.find(item, 'box'), false);
this._cantouch = true;
} else if (item0.data && item1.data && item0.data.cardDid == item1.data.cardDid) {
//成功--变小 消失
this._successItems.push(item0);
this._successItems.push(item1);
pg.view.visible(pg.view.find(item, 'box'), true);
this.playSFX("audio_choice").then(() => {
this.playAudioAni(item).then(() => {
this.createRightAni(cc.v2(item0.x, item0.y));
this.createRightAni(cc.v2(item1.x, item1.y));
this.playSFX("audio_right").then(() => {
this._cantouch = true;
this.playAudioAni(item0).then(() => {
this.playAudioAni(item1).then(() => {
ani.scaleOut(item0);
ani.scaleOut(item1).then(() => {
setTimeout(() => {
this.groupEnd();//判定单组结束
}, 100);
});
pg.view.visible(pg.view.find(item0, 'box'), false);
pg.view.visible(pg.view.find(item1, 'box'), false);
});
});
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;
});
} else {
//失败--抖动效果
pg.view.visible(pg.view.find(item, 'box'), true);
this.playSFX("audio_choice").then(() => {
this.playAudioAni(item).then(() => {
ani.shake(item0);
ani.shake(item1);
pg.view.visible(pg.view.find(item0, 'box'), false);
pg.view.visible(pg.view.find(item1, 'box'), false);
this.playSFX("audio_error").then(() => {
this._cantouch = true;
});
});
});
}
if (this.curPage == 0) {
return;
this._cardTouchItems.length = 0;
} else if (this._cardTouchItems.length == 1) {
//显示选中效果
pg.view.visible(pg.view.find(item, 'box'), true);
this.playSFX("audio_choice").then(() => {
//audio 播放的时候动画播放, audio停的时候 动画正好能停下
//如果动画停的位置不对,直接强制设置对应的效果
//下一次播放没有问题即可
this.playAudioAni(item).then(() => {
this._cantouch = true;
})
});
} else {
//异常情况
this._cardTouchItems.length = 0;
this._cantouch = true;
}
this.curPage = 0
this.leftMove();
},
playAudioAni(item) {
return new Promise((resolve, reject) => {
var anim = pg.view.find(item, `audio`).getComponent(cc.Animation);
anim.play();
//如果没有audio也要能正常走
pg.audio.playAudioByUrl(item.data.audio).then(() => {
anim.stop();
pg.view.visible(pg.view.find(item, `audio/btn_laba`), true);
resolve('');
});
});
},
onTouchReplay() {
this.playSFX("audio_btn");
this.initData();
this.initSingleData();
pg.view.visible(this.btn_replay, false);
this.initStars();
this.initLayout();
},
//回合结束
groupEnd() {
if (this._successItems.length < this._cardPage.length) return;
if (this._gameCode != 0) return;
let code = CardManager.getIns().addPageNum();
if (code == 0) {
this._gameCode = 0;
this.initSingleData();
this.initLayout();
} else if (code == 1) {
this._gameCode = 1;
//播放星星动画 然后下一页
this.playSFX("audio_bigStar");
this.createStarAni().then(() => {
this._gameCode = 0;
this.initSingleData();
this.initLayout();
})
} else if (code == 2) {
this._gameCode = 2;
//播放星星动画 然后结束
this.playSFX("audio_bigStar");
this.playSFX("audio_sahua");
this.createStarAni().then(() => { })
this.createFireworkAni().then(() => {
//gameOver
// 游戏结束时需要调用这个方法通知系统作业完成
onHomeworkFinish();
cc.audioEngine.play(this.audioBtn.clip, false, 0.8)
pg.view.visible(this.btn_replay, true);
})
const rightBtnNode = bottomPart.getChildByName('btn_right');
//节点中添加了button组件 则可以添加click事件监听
rightBtnNode.on('click', () => {
if (!this._cantouch) {
return;
}
if (this.curPage == 1) {
return;
},
createRightAni(pos) {
let right = pg.view.find(this, 'right');
let aniRight = cc.instantiate(right);
aniRight.x = pos.x;
aniRight.y = pos.y;
pg.view.find(this, 'ani').addChild(aniRight);
let armDisplay = aniRight.getComponent(dragonBones.ArmatureDisplay);
armDisplay.playAnimation('newAnimation', 1);
pg.view.visible(aniRight, true);
},
createStarAni() {
return new Promise((resolve, reject) => {
this.showStar();
setTimeout(() => {
resolve('');
}, 500);
});
},
createFireworkAni() {
return new Promise((resolve, reject) => {
// this.showAllFirework(cc.find('Canvas/firework_ani'), cc.find('Canvas/paperBase').children);
showFireworks(
cc.find('Canvas/firework_ani'),
cc.find('Canvas/RibbonNodeBase').children,
cc.v2(0, -400), cc.v2(0, 1000), 200, 200
);
showFireworks(
cc.find('Canvas/firework_ani'),
cc.find('Canvas/RibbonNodeBase').children,
cc.v2(-600, -400), cc.v2(200, 1000), 200, 200
);
showFireworks(
cc.find('Canvas/firework_ani'),
cc.find('Canvas/RibbonNodeBase').children,
cc.v2(600, -400), cc.v2(-200, 1000), 200, 200
);
setTimeout(() => {
resolve('');
}, 1000);
});
},
playSFX(name) {
return new Promise((resolve, reject) => {
let node = pg.view.find(this, name);
if (!node) return resolve();
let audioSource = node.getComponent(cc.AudioSource);
if (!audioSource) return resolve();
let audioClip = audioSource.clip;
if (!audioClip) return resolve();
cc.audioEngine.play(audioClip, false, 1);
resolve('');
});
},
length,
addStar() {
if (!this.length) {
this.length = 0;
}
this.curPage = 1
this.rightMove();
cc.audioEngine.play(this.audioBtn.clip, false, 0.5)
})
this.length++;
let length = this.length;
const starLayout = cc.find('Canvas/layout_stars');
starLayout.removeAllChildren();
const paddingY = starLayout.getComponent(cc.Layout).spacingY;
for (let i = 0; i < length; i++) {
const starBase = cc.instantiate(cc.find('Canvas/StarBase'));
starBase.name = `starBase_${i}`;
starBase.scale = this.Between(0.5, (starLayout.height / length - paddingY) / starBase.height, 1);
starBase.parent = starLayout;
}
this.currentStarIdx = 0;
},
leftMove() {
this._cantouch = false;
const len = this.pic1.parent.width;
cc.tween(this.pic1)
.to(1, { x: this.pic1.baseX }, { easing: 'cubicInOut' })
.start();
currentStarIdx: null,
showStar() {
if (!this.currentStarIdx) {
this.currentStarIdx = 0;
}
cc.tween(this.pic2)
.to(1, { x: this.pic2.baseX }, { easing: 'cubicInOut' })
.call(() => {
this._cantouch = true;
})
const starBase = cc.find(`Canvas/layout_stars/starBase_${this.currentStarIdx}`);
if (!starBase) {
return;
}
const star = starBase.getChildByName('Star');
const starBig = star.getChildByName('StarBig');
starBig.scale = 1;
star.active = true;
star.scaleX = 0.7 / starBase.scale;
star.scaleY = 1 / starBase.scale;
star.angle = 90;
const canvas = cc.find('Canvas');
const startPos = this.exchangeNodePos(star.parent, canvas, cc.v2(0, -canvas.height / 2));
const middlePos = this.exchangeNodePos(star.parent, canvas, cc.v2(0, -canvas.height / 4));
star.x = startPos.x;
star.y = startPos.y - starBig.height;
console.log('middlePos = ' + JSON.stringify(middlePos));
const time = 1;
cc.tween(star)
.to(0.3, { y: middlePos.y + 80 }, { easing: 'quadOut' })
.to(0.1, { y: middlePos.y + 40, scaleX: 1.2 / starBase.scale, scaleY: 0.8 / starBase.scale }, { easing: 'quadOut' })
.to(0.1, { y: middlePos.y, scaleX: 1 / starBase.scale, scaleY: 1 / starBase.scale }, { easing: 'quadOut' })
.delay(0.1)
.to(0.8, { angle: -720, scale: 1 })
.start();
},
rightMove() {
this._cantouch = false;
const len = this.pic1.parent.width;
cc.tween(this.pic1)
.to(1, { x: this.pic1.baseX - len }, { easing: 'cubicInOut' })
cc.tween(star)
.delay(0.6)
.to(0.8, { x: 0 }, { easing: 'quadIn' })
.start();
cc.tween(star)
.delay(0.6)
.to(0.8, { y: 0 }, { easing: 'quadOut' })
.start();
cc.tween(this.pic2)
.to(1, { x: this.pic2.baseX - len }, { easing: 'cubicInOut' })
cc.tween(starBig)
.delay(0.6)
.to(0.8, { scale: 0 }, { easing: 'quadOut' })
.call(() => {
this._cantouch = true;
// this.checkGameEnd();
})
.start();
},
// update (dt) {},
this.currentStarIdx++;
},
Between(a, b, c) {
return [a, b, c].sort()[1];
},
exchangeNodePos(targetNode, baseNode, basePos) {
return targetNode.convertToNodeSpaceAR(baseNode.convertToWorldSpaceAR(cc.v2(basePos.x, basePos.y)));
},
async showAllFirework(parentNode, nodeList) {
for (let i = 0; i < 6; i++) {
this.showFirework(cc.v2(0, -parentNode.height / 2), parentNode, nodeList, parentNode.width * 2 / 3, parentNode.height * 1.3);
await asyncDelay(0.1);
}
},
showFirework(pos, parentNode, nodeList, width = 200, height = 200, number = 30) {
for (let i = 0; i < number; i++) {
const quad = this.createQuads(pos, parentNode, nodeList);
const targetX = RandomInt(width / 2, -width / 2);
const targetY = RandomInt(height);
// ------------------------------------------------
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;
},
cc.tween(quad)
.by(0.5, { x: targetX })
.by(3, { x: targetX * 2 })
.start();
cc.tween(quad)
.by(0.5, { y: targetY }, { easing: 'quadOut' })
.to(4, { y: -parentNode.height * 2 }, { easing: 'quadIn' })
.removeSelf()
.start();
getSpriteFrimeByUrl(url, cb) {
cc.loader.load({ url }, (err, img) => {
const spriteFrame = new cc.SpriteFrame(img)
if (cb) {
cb(spriteFrame);
cc.tween(quad)
.delay(1)
.to(1.5, { opacity: 0 })
.start();
}
})
},
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);
}
createQuads(pos, parentNode, nodeList) {
const quadBase = cc.instantiate(nodeList[RandomInt(nodeList.length)]);
quadBase.x = pos.x;
quadBase.y = pos.y;
quadBase.z = pos.z;
quadBase.angle = RandomInt(180);
quadBase.parent = parentNode;
const quad = quadBase.getChildByName('quad');
quad.x = 0;
quad.y = 0;
quad.angle = RandomInt(180);
const paper = quad.getChildByName('paper');
paper.scaleX = Math.random() * 0.5 + 0.5;
paper.scaleY = Math.random() * 0.5 + 0.5;
quadBase.scaleX = Math.random();
cc.tween(quadBase)
.to((1 - quadBase.scaleX) * 0.3, { scaleX: 1 })
.call(() => {
const time = Math.random() * 0.2;
cc.tween(quadBase)
.to(0.1 + time, { scaleX: -1 })
.to(0.1 + time, { scaleX: 1 })
.union()
.repeatForever()
.start();
})
},
.start();
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();
});
}
});
}
return quadBase;
},
// ------------------------------------------
// 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;
// hyLoader.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);
// });
// hyLoader.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 = hyLoader.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, () => {
// hyLoader.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) {},
// ------------------------------------------
});
......@@ -5,8 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/
cc.sys.capabilities["touches"] = true;
!(function (global) {
"use strict";
......
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 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",
"uuid": "c857edee-430c-4a82-84aa-6ab34daaad76",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "6900b8d9-61fb-4b3a-9693-7d0e2595691a",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{"name":"right","version":"5.5","armature":[{"name":"Armature","slot":[{"name":"圆","color":{},"parent":"圆"},{"name":"星1","color":{},"z":1,"parent":"星1"},{"name":"星2","color":{},"z":2,"parent":"星2"},{"name":"星3","color":{},"z":3,"parent":"星3"},{"name":"星4","color":{},"z":4,"parent":"星4"},{"name":"星6","color":{},"z":5,"parent":"星6"},{"name":"星7","color":{},"displayIndex":1,"z":6,"parent":"星7"},{"name":"星8","color":{},"z":7,"parent":"星8"},{"name":"星9","color":{},"z":8,"parent":"星9"},{"name":"星61","color":{},"z":9,"parent":"星61"},{"name":"星31","color":{},"z":10,"parent":"星31"},{"name":"星11","color":{},"z":11,"parent":"星11"},{"name":"星71","color":{},"displayIndex":1,"z":12,"parent":"星71"},{"name":"星72","color":{},"displayIndex":1,"z":13,"parent":"星72"},{"name":"星711","color":{},"displayIndex":1,"z":14,"parent":"星711"}],"bone":[{"name":"root","transform":{}},{"name":"圆","transform":{"skY":-89.6569,"scX":0.1,"scY":0.1,"skX":-89.6569},"length":41,"parent":"root"},{"name":"星6","transform":{"x":0.1442,"y":-31.5107},"parent":"root"},{"name":"星8","transform":{"x":41.1298,"skY":135,"y":-39.776,"skX":135},"parent":"root"},{"name":"星3","transform":{"x":24.7785,"y":-4.3335},"parent":"root"},{"name":"星2","transform":{"x":24.8087,"y":-25.5917},"parent":"root"},{"name":"星4","transform":{"x":7.0488,"y":8.8215},"parent":"root"},{"name":"星7","transform":{"x":-20.4814,"skY":-135,"y":5.3537,"skX":-135},"parent":"root"},{"name":"星9","transform":{"x":-33.2434,"skY":-45,"y":-13.9017,"skX":-45},"parent":"root"},{"name":"星1","transform":{"x":-18.8442,"skY":180,"y":-17.612,"skX":180},"parent":"root"},{"name":"星61","transform":{"x":23.0639,"skY":32.5617,"y":-38.5822,"scX":0.7,"scY":0.7,"skX":32.5617},"parent":"root"},{"name":"星31","transform":{"x":3.6733,"skY":17.0044,"y":-5.783,"scX":0.8,"scY":0.8,"skX":17.0044},"parent":"root"},{"name":"星11","transform":{"x":0.7025,"skY":-14.3406,"y":-9.1509,"skX":-14.3406},"parent":"root"},{"name":"星71","transform":{"x":-2.2132,"skY":136.3452,"y":16.0506,"scX":0.6,"scY":0.6,"skX":136.3452},"parent":"root"},{"name":"星72","transform":{"x":-18.9634,"skY":73.3148,"y":-7.9725,"skX":73.3148},"parent":"root"},{"name":"星711","transform":{"x":-8.6825,"skY":-87.3096,"y":26.0182,"scX":0.8,"scY":0.8,"skX":-87.3096},"parent":"root"}],"ik":[],"aabb":{"x":-50.79338842975206,"height":126.53002406654821,"y":-72.32128078297362,"width":108.65871372436897},"defaultActions":[{"gotoAndPlay":"newAnimation"}],"skin":[{"name":"","slot":[{"name":"星72","display":[{"name":"1/星7","transform":{"x":-51.937,"skY":135,"y":13.4704,"skX":135},"type":"image","path":"1/星7"},{"name":"1/星5","transform":{"x":0.3889,"skY":135,"y":0.0354,"skX":135},"type":"image","path":"1/星5"}]},{"name":"星2","display":[{"name":"1/星2","transform":{"x":0.65,"y":1.1},"type":"image","path":"1/星2"}]},{"name":"星3","display":[{"name":"1/星3","transform":{"x":0.8,"y":-0.15},"type":"image","path":"1/星3"}]},{"name":"星4","display":[{"name":"1/星4","transform":{"x":1.1,"y":0.1},"type":"image","path":"1/星4"}]},{"name":"星71","display":[{"name":"1/星7","transform":{"x":-51.937,"skY":135,"y":13.4704,"skX":135},"type":"image","path":"1/星7"},{"name":"1/星5","transform":{"x":0.3889,"skY":135,"y":0.0354,"skX":135},"type":"image","path":"1/星5"}]},{"name":"星6","display":[{"name":"1/星6","transform":{"x":1.55,"y":0.3},"type":"image","path":"1/星6"}]},{"name":"星7","display":[{"name":"1/星7","transform":{"x":-51.937,"skY":135,"y":13.4704,"skX":135},"type":"image","path":"1/星7"},{"name":"1/星5","transform":{"x":0.3889,"skY":135,"y":0.0354,"skX":135},"type":"image","path":"1/星5"}]},{"name":"星8","display":[{"name":"1/星8","transform":{"x":0.0707,"skY":-135,"y":-0.495,"skX":-135},"type":"image","path":"1/星8"}]},{"name":"圆","display":[{"name":"1/圆","transform":{"skY":89.6569,"skX":89.6569},"type":"image","path":"1/圆"}]},{"name":"星61","display":[{"name":"1/星6","transform":{"x":1.55,"y":0.3},"type":"image","path":"1/星6"}]},{"name":"星31","display":[{"name":"1/星3","transform":{"x":0.8,"y":-0.15},"type":"image","path":"1/星3"}]},{"name":"星11","display":[{"name":"1/星1","transform":{"x":-0.65,"skY":180,"y":-0.55,"skX":180},"type":"image","path":"1/星1"}]},{"name":"星9","display":[{"name":"1/星9","transform":{"x":0.2475,"skY":45,"y":0.3889,"skX":45},"type":"image","path":"1/星9"}]},{"name":"星1","display":[{"name":"1/星1","transform":{"x":-0.65,"skY":180,"y":-0.55,"skX":180},"type":"image","path":"1/星1"}]},{"name":"星711","display":[{"name":"1/星7","transform":{"x":-51.937,"skY":135,"y":13.4704,"skX":135},"type":"image","path":"1/星7"},{"name":"1/星5","transform":{"x":0.3889,"skY":135,"y":0.0354,"skX":135},"type":"image","path":"1/星5"}]}]}],"frameRate":24,"type":"Armature","animation":[{"name":"newAnimation","frame":[],"bone":[{"name":"root","scaleFrame":[],"rotateFrame":[],"translateFrame":[]},{"name":"圆","scaleFrame":[{"tweenEasing":0,"duration":4},{"x":10,"y":10,"duration":22}],"rotateFrame":[],"translateFrame":[]},{"name":"星6","scaleFrame":[{"duration":4},{"tweenEasing":0,"duration":14},{"x":0.6,"y":0.6,"duration":8}],"rotateFrame":[{"duration":4,"curve":[0,0,0.5,1]},{"duration":22,"rotate":42.9161}],"translateFrame":[{"curve":[0,0,0.5,1],"duration":4},{"x":38.3058,"y":-60.5579,"duration":22}]},{"name":"星8","scaleFrame":[],"rotateFrame":[{"duration":4,"tweenEasing":0},{"duration":22,"rotate":-280.7822}],"translateFrame":[{"tweenEasing":0,"duration":4},{"x":38.0165,"y":-21.7975,"duration":22}]},{"name":"星3","scaleFrame":[{"duration":4},{"tweenEasing":0,"duration":14},{"x":0.7,"y":0.7,"duration":8}],"rotateFrame":[{"duration":4,"tweenEasing":0},{"duration":22,"rotate":74.0647}],"translateFrame":[{"tweenEasing":0,"duration":4},{"x":51.8802,"y":18.595,"duration":22}]},{"name":"星2","scaleFrame":[{"duration":4},{"tweenEasing":0,"duration":20},{"x":0.9,"y":0.9,"duration":2}],"rotateFrame":[{"duration":4,"curve":[0,0,0.5,1]},{"duration":22,"rotate":104.5284}],"translateFrame":[{"curve":[0,0,0.5,1],"duration":4},{"x":73.3471,"y":22.5,"duration":22}]},{"name":"星4","scaleFrame":[],"rotateFrame":[{"duration":4,"curve":[0,0,0.5,1]},{"duration":22,"rotate":-117.9757}],"translateFrame":[{"curve":[0,0,0.5,1],"duration":4},{"x":32.2727,"y":61.5496,"duration":22}]},{"name":"星7","scaleFrame":[{"duration":4},{"tweenEasing":0,"duration":20},{"x":0.6,"y":0.6,"duration":2}],"rotateFrame":[{"duration":4,"tweenEasing":0},{"duration":22,"rotate":88.876}],"translateFrame":[{"tweenEasing":0,"duration":4},{"x":-28.7877,"y":47.1525,"duration":22}]},{"name":"星9","scaleFrame":[{"duration":4},{"tweenEasing":0,"duration":16},{"x":0.9,"y":0.9,"duration":6}],"rotateFrame":[{"duration":4,"rotate":45,"curve":[0,0,0.5,1]},{"duration":22}],"translateFrame":[{"curve":[0,0,0.5,1],"duration":4},{"x":-36.4463,"y":-24.4835,"duration":22}]},{"name":"星1","scaleFrame":[{"duration":4},{"tweenEasing":0,"duration":18},{"x":0.6,"y":0.6,"duration":4}],"rotateFrame":[{"duration":4,"curve":[0,0,0.5,1]},{"duration":22,"rotate":-285.7677}],"translateFrame":[{"curve":[0,0,0.5,1],"duration":4},{"x":-34.5041,"y":-45.7025,"duration":22}]},{"name":"星61","scaleFrame":[{"duration":7},{"tweenEasing":0,"duration":11},{"x":0.6,"y":0.6,"duration":8}],"rotateFrame":[{"duration":7,"curve":[0,0,0.5,1]},{"duration":19,"rotate":42.9161}],"translateFrame":[{"curve":[0,0,0.5,1],"duration":7},{"x":38.3058,"y":-60.5579,"duration":19}]},{"name":"星31","scaleFrame":[{"duration":7},{"tweenEasing":0,"duration":11},{"x":0.7,"y":0.7,"duration":8}],"rotateFrame":[{"duration":7,"tweenEasing":0},{"duration":19,"rotate":74.0647}],"translateFrame":[{"tweenEasing":0,"duration":7},{"x":57.3337,"y":-18.0454,"duration":19}]},{"name":"星11","scaleFrame":[{"duration":7},{"tweenEasing":0,"duration":15},{"x":0.6,"y":0.6,"duration":4}],"rotateFrame":[{"duration":7,"curve":[0,0,0.5,1]},{"duration":19,"rotate":73.2489}],"translateFrame":[{"curve":[0,0,0.5,1],"duration":7},{"x":-11.969,"y":-56.4432,"duration":19}]},{"name":"星71","scaleFrame":[{"duration":7},{"tweenEasing":0,"duration":17},{"x":0.6,"y":0.6,"duration":2}],"rotateFrame":[{"duration":7,"tweenEasing":0},{"duration":19,"rotate":88.876}],"translateFrame":[{"tweenEasing":0,"duration":7},{"x":-33.9733,"y":54.6163,"duration":19}]},{"name":"星72","scaleFrame":[{"duration":7},{"tweenEasing":0,"duration":17},{"x":0.6,"y":0.6,"duration":2}],"rotateFrame":[{"duration":7,"tweenEasing":0},{"duration":19,"rotate":88.876}],"translateFrame":[{"tweenEasing":0,"duration":7},{"x":-50.0074,"y":17.3645,"duration":19}]},{"name":"星711","scaleFrame":[{"duration":7},{"tweenEasing":0,"duration":17},{"x":0.6,"y":0.6,"duration":2}],"rotateFrame":[{"duration":7,"tweenEasing":0},{"duration":19,"rotate":88.876}],"translateFrame":[{"tweenEasing":0,"duration":7},{"x":16.4033,"y":52.032,"duration":19}]}],"playTimes":0,"ffd":[],"slot":[{"name":"圆","displayFrame":[],"colorFrame":[{"duration":4},{"duration":8,"tweenEasing":0},{"duration":14,"color":{"aM":0}}]},{"name":"星1","displayFrame":[],"colorFrame":[{"duration":4},{"duration":18,"tweenEasing":0},{"duration":4,"color":{"aM":0}}]},{"name":"星2","displayFrame":[],"colorFrame":[{"duration":4},{"duration":20,"tweenEasing":0},{"duration":2,"color":{"aM":0}}]},{"name":"星3","displayFrame":[],"colorFrame":[{"duration":4},{"duration":14,"tweenEasing":0},{"duration":8,"color":{"aM":0}}]},{"name":"星4","displayFrame":[],"colorFrame":[{"duration":4},{"duration":22,"tweenEasing":0},{"duration":0,"color":{"aM":0}}]},{"name":"星6","displayFrame":[],"colorFrame":[{"duration":4},{"duration":14,"tweenEasing":0},{"duration":8,"color":{"aM":0}}]},{"name":"星7","displayFrame":[],"colorFrame":[{"duration":4},{"duration":20,"tweenEasing":0},{"duration":2,"color":{"aM":0}}]},{"name":"星8","displayFrame":[],"colorFrame":[{"duration":4},{"duration":18,"tweenEasing":0},{"duration":4,"color":{"aM":0}}]},{"name":"星9","displayFrame":[],"colorFrame":[{"duration":4},{"duration":16,"tweenEasing":0},{"duration":6,"color":{"aM":0}}]},{"name":"星61","displayFrame":[],"colorFrame":[{"duration":7},{"duration":11,"tweenEasing":0},{"duration":8,"color":{"aM":0}}]},{"name":"星31","displayFrame":[],"colorFrame":[{"duration":7},{"duration":11,"tweenEasing":0},{"duration":8,"color":{"aM":0}}]},{"name":"星11","displayFrame":[],"colorFrame":[{"duration":7},{"duration":15,"tweenEasing":0},{"duration":4,"color":{"aM":0}}]},{"name":"星71","displayFrame":[],"colorFrame":[{"duration":7},{"duration":17,"tweenEasing":0},{"duration":2,"color":{"aM":0}}]},{"name":"星72","displayFrame":[],"colorFrame":[{"duration":7},{"duration":17,"tweenEasing":0},{"duration":2,"color":{"aM":0}}]},{"name":"星711","displayFrame":[],"colorFrame":[{"duration":7},{"duration":17,"tweenEasing":0},{"duration":2,"color":{"aM":0}}]}],"ik":[],"duration":26}]}],"frameRate":24,"isGlobal":0}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "3e36e8af-4f6a-4ec8-a56c-411bcee09d53",
"subMetas": {}
}
\ No newline at end of file
{"name":"right","imagePath":"right_tex.png","SubTexture":[{"name":"1/圆","x":1,"height":98,"y":1,"width":98},{"name":"1/星1","x":66,"height":59,"y":172,"width":57},{"name":"1/星2","x":71,"height":45,"y":101,"width":43},{"name":"1/星3","x":1,"height":64,"y":172,"width":63},{"name":"1/星4","x":183,"height":45,"y":172,"width":45},{"name":"1/星6","x":1,"height":69,"y":101,"width":68},{"name":"1/星7","x":116,"height":40,"y":101,"width":37},{"name":"1/星5","x":125,"height":57,"y":172,"width":56},{"name":"1/星8","x":183,"height":33,"y":219,"width":32},{"name":"1/星9","x":155,"height":37,"y":101,"width":36}],"height":256,"width":256}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "4d4d9b71-e7f8-4683-93df-f145ba327b12",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "83b08d7c-c82f-4dc7-b6ea-4f8f6dec8a0e",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 256,
"height": 256,
"platformSettings": {},
"subMetas": {
"right_tex": {
"ver": "1.0.4",
"uuid": "aabe1819-f211-4c52-98e3-9baeb06e457c",
"rawTextureUuid": "83b08d7c-c82f-4dc7-b6ea-4f8f6dec8a0e",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -13.5,
"offsetY": 1.5,
"trimX": 1,
"trimY": 1,
"width": 227,
"height": 251,
"rawWidth": 256,
"rawHeight": 256,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "8a74de80-d2bd-438f-a9ee-1de6a165a134",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "e1b4d971-9876-4832-803a-5a321964a78b",
"uuid": "6ba0ab66-ad01-4b87-bb56-5966ab7f5744",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
......@@ -11,10 +11,10 @@
"height": 720,
"platformSettings": {},
"subMetas": {
"bg": {
"bg_bg": {
"ver": "1.0.4",
"uuid": "8288e3d4-4c75-4b27-8f01-f7014417f4dd",
"rawTextureUuid": "e1b4d971-9876-4832-803a-5a321964a78b",
"uuid": "d60de1cb-9c7d-4e45-8fa8-c10404cdfefd",
"rawTextureUuid": "6ba0ab66-ad01-4b87-bb56-5966ab7f5744",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
......
{
"ver": "2.3.5",
"uuid": "ab54f59a-8911-4422-8eb9-14d7eba06b3d",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 89,
"height": 42,
"platformSettings": {},
"subMetas": {
"bg_lowerright": {
"ver": "1.0.4",
"uuid": "0464b6d6-15d1-48b2-b668-f8aac578eac7",
"rawTextureUuid": "ab54f59a-8911-4422-8eb9-14d7eba06b3d",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 89,
"height": 42,
"rawWidth": 89,
"rawHeight": 42,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "5889a9cd-09b0-42b9-9540-82974635f420",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 217,
"height": 134,
"platformSettings": {},
"subMetas": {
"bg_upperleft": {
"ver": "1.0.4",
"uuid": "7a61878a-38ac-4c27-a1c0-6e5ae07274d9",
"rawTextureUuid": "5889a9cd-09b0-42b9-9540-82974635f420",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 217,
"height": 134,
"rawWidth": 217,
"rawHeight": 134,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "76439ee2-25b8-4feb-be8a-8e54d746066c",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 106,
"height": 80,
"platformSettings": {},
"subMetas": {
"btn_laba": {
"ver": "1.0.4",
"uuid": "7d28afb4-1a18-45af-bb78-26f677922825",
"rawTextureUuid": "76439ee2-25b8-4feb-be8a-8e54d746066c",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 106,
"height": 80,
"rawWidth": 106,
"rawHeight": 80,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "5743c786-68fe-4a92-955b-f73bb10ab0a0",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 106,
"height": 80,
"platformSettings": {},
"subMetas": {
"btn_laba1": {
"ver": "1.0.4",
"uuid": "ed28fe62-4b3c-432e-84c5-09492cc175e3",
"rawTextureUuid": "5743c786-68fe-4a92-955b-f73bb10ab0a0",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 18,
"offsetY": 0,
"trimX": 36,
"trimY": 0,
"width": 70,
"height": 80,
"rawWidth": 106,
"rawHeight": 80,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "0c9dfc8c-3c04-4fc7-a2f6-9a44933a79b9",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 106,
"height": 80,
"platformSettings": {},
"subMetas": {
"btn_laba2": {
"ver": "1.0.4",
"uuid": "4a765d5e-6fac-4d01-8ef6-f093daee7c4c",
"rawTextureUuid": "0c9dfc8c-3c04-4fc7-a2f6-9a44933a79b9",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 4,
"offsetY": 0,
"trimX": 8,
"trimY": 0,
"width": 98,
"height": 80,
"rawWidth": 106,
"rawHeight": 80,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "ca595bd6-9407-4e26-95e3-a61d5aff17d8",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 106,
"height": 80,
"platformSettings": {},
"subMetas": {
"btn_laba3": {
"ver": "1.0.4",
"uuid": "faa52f66-df1a-4db6-86ae-904b7c0a410a",
"rawTextureUuid": "ca595bd6-9407-4e26-95e3-a61d5aff17d8",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 106,
"height": 80,
"rawWidth": 106,
"rawHeight": 80,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "68f8a196-dc35-4234-a7c4-4b05cc36c4ba",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 303,
"height": 132,
"platformSettings": {},
"subMetas": {
"btn_replay": {
"ver": "1.0.4",
"uuid": "164513e6-2391-4105-909a-77e01894c447",
"rawTextureUuid": "68f8a196-dc35-4234-a7c4-4b05cc36c4ba",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 303,
"height": 132,
"rawWidth": 303,
"rawHeight": 132,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "02aa5267-253a-448a-8553-ff3a8696cc4e",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "83f8721d-e058-4f0d-9e75-58325c8ffdd0",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "45e38f9a-3251-42c2-8bb7-1a61efdc95a6",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 230,
"height": 252,
"platformSettings": {},
"subMetas": {
"bg_bian3": {
"ver": "1.0.4",
"uuid": "e16387eb-c1c2-4710-a0e3-ea42de412c20",
"rawTextureUuid": "45e38f9a-3251-42c2-8bb7-1a61efdc95a6",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 230,
"height": 252,
"rawWidth": 230,
"rawHeight": 252,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "efa5fa09-a4dd-4bfc-ab7e-17c19f85408f",
"uuid": "513b31d5-e9e1-45a2-ae65-882b4ea51db6",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 366,
"height": 336,
"width": 230,
"height": 252,
"platformSettings": {},
"subMetas": {
"1orange": {
"bg_card3": {
"ver": "1.0.4",
"uuid": "43d1e79d-6de8-4dcb-b8ce-d767df7913aa",
"rawTextureUuid": "efa5fa09-a4dd-4bfc-ab7e-17c19f85408f",
"uuid": "35bcb871-b832-41ca-94af-3e5fa53e8125",
"rawTextureUuid": "513b31d5-e9e1-45a2-ae65-882b4ea51db6",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": -0.5,
"trimX": 0,
"trimY": 1,
"width": 366,
"height": 335,
"rawWidth": 366,
"rawHeight": 336,
"trimX": 8,
"trimY": 8,
"width": 214,
"height": 237,
"rawWidth": 230,
"rawHeight": 252,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
......
{
"ver": "1.1.2",
"uuid": "55c34a3e-e570-46b3-b120-085860352776",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "3867d163-aa66-476a-ade1-ec60cabcae1e",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 314,
"height": 342,
"platformSettings": {},
"subMetas": {
"bg_bian2": {
"ver": "1.0.4",
"uuid": "53ec3cb5-71e9-4cb4-84e3-5d4591dfc410",
"rawTextureUuid": "3867d163-aa66-476a-ade1-ec60cabcae1e",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 314,
"height": 342,
"rawWidth": 314,
"rawHeight": 342,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "f7ac7858-07a9-4e4c-ab18-6787b7755a03",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 314,
"height": 342,
"platformSettings": {},
"subMetas": {
"bg_card2": {
"ver": "1.0.4",
"uuid": "9b1913e0-0eb8-4bd4-8fbe-69c13d2cc14a",
"rawTextureUuid": "f7ac7858-07a9-4e4c-ab18-6787b7755a03",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": -0.5,
"trimX": 8,
"trimY": 8,
"width": 298,
"height": 327,
"rawWidth": 314,
"rawHeight": 342,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "f8f0e0fc-057c-46aa-abe3-8c38149b96b9",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "43b58cb0-33f8-4727-924d-fea8b302f313",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 282,
"height": 304,
"platformSettings": {},
"subMetas": {
"bg_bian1": {
"ver": "1.0.4",
"uuid": "3da1269a-d7d3-419b-b2ba-6f0e19f7578c",
"rawTextureUuid": "43b58cb0-33f8-4727-924d-fea8b302f313",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 282,
"height": 304,
"rawWidth": 282,
"rawHeight": 304,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "dc71f8ac-8d34-414a-9c10-25d8d5d656aa",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 282,
"height": 304,
"platformSettings": {},
"subMetas": {
"bg_card1": {
"ver": "1.0.4",
"uuid": "6c6c588d-4e73-4903-9e3f-543e5c89e618",
"rawTextureUuid": "dc71f8ac-8d34-414a-9c10-25d8d5d656aa",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": -2.5,
"trimX": 8,
"trimY": 8,
"width": 266,
"height": 293,
"rawWidth": 282,
"rawHeight": 304,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "f8c6bce2-8db6-44ef-a78c-b77893f51923",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 278,
"height": 275,
"platformSettings": {},
"subMetas": {
"icon_bigstar": {
"ver": "1.0.4",
"uuid": "fe2e20a8-05ef-42a7-a284-80db3ccc0733",
"rawTextureUuid": "f8c6bce2-8db6-44ef-a78c-b77893f51923",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 278,
"height": 275,
"rawWidth": 278,
"rawHeight": 275,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "44825581-819a-4d73-8f81-9fa435f885ce",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 62,
"height": 69,
"platformSettings": {},
"subMetas": {
"icon_star": {
"ver": "1.0.4",
"uuid": "38ab7ad4-ce3f-44d7-bf5b-e31e4b5ba155",
"rawTextureUuid": "44825581-819a-4d73-8f81-9fa435f885ce",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 62,
"height": 69,
"rawWidth": 62,
"rawHeight": 69,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "d582359e-924e-4ee9-9964-1fc4bb417e71",
"uuid": "e992b78a-61ca-411f-b34e-b1e0d2a1ab5e",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 61,
"height": 67,
"width": 62,
"height": 69,
"platformSettings": {},
"subMetas": {
"btn_right": {
"icon_stardi": {
"ver": "1.0.4",
"uuid": "e5a2dbaa-a677-4a32-90d7-a1b057d7fb59",
"rawTextureUuid": "d582359e-924e-4ee9-9964-1fc4bb417e71",
"uuid": "bcc1e8bd-c557-491a-87c4-c17370c2645a",
"rawTextureUuid": "e992b78a-61ca-411f-b34e-b1e0d2a1ab5e",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -0.5,
"offsetY": 0.5,
"offsetX": 0,
"offsetY": 1.5,
"trimX": 0,
"trimY": 0,
"width": 60,
"width": 62,
"height": 66,
"rawWidth": 61,
"rawHeight": 67,
"rawWidth": 62,
"rawHeight": 69,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
......
{
"__type__": "cc.AnimationClip",
"_name": "laba",
"_objFlags": 0,
"_native": "",
"_duration": 0.3333333333333333,
"sample": 60,
"speed": 0.35,
"wrapMode": 2,
"curveData": {
"paths": {
"btn_laba": {
"props": {
"active": [
{
"frame": 0,
"value": false
},
{
"frame": 0.08333333333333333,
"value": false
},
{
"frame": 0.16666666666666666,
"value": false
},
{
"frame": 0.25,
"value": true
}
]
}
},
"btn_laba3": {
"props": {
"active": [
{
"frame": 0,
"value": false
},
{
"frame": 0.08333333333333333,
"value": false
},
{
"frame": 0.16666666666666666,
"value": true
},
{
"frame": 0.25,
"value": false
}
]
}
},
"btn_laba2": {
"props": {
"active": [
{
"frame": 0,
"value": false
},
{
"frame": 0.08333333333333333,
"value": true
},
{
"frame": 0.16666666666666666,
"value": false
},
{
"frame": 0.25,
"value": false
}
]
}
},
"btn_laba1": {
"props": {
"active": [
{
"frame": 0,
"value": true
},
{
"frame": 0.08333333333333333,
"value": false
},
{
"frame": 0.16666666666666666,
"value": false
},
{
"frame": 0.25,
"value": false
},
{
"frame": 0.3333333333333333,
"value": true
}
]
}
}
}
},
"events": []
}
\ No newline at end of file
{
"ver": "2.1.0",
"uuid": "5aef0251-2a6e-4f11-ba21-953a769c01d0",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "6a0f0fdf-1b7e-487b-a027-7f34150e59c5",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "da518f72-e19c-4130-8b32-f80c8ec5ff69",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 29,
"height": 29,
"platformSettings": {},
"subMetas": {
"Img_paper": {
"ver": "1.0.4",
"uuid": "6bed546e-5efa-4af6-859d-90a8c0afc027",
"rawTextureUuid": "da518f72-e19c-4130-8b32-f80c8ec5ff69",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 29,
"height": 29,
"rawWidth": 29,
"rawHeight": 29,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "9a79969a-0506-48d4-bc98-3c05d109b027",
"uuid": "cfc6ffbd-32c5-4ed7-84b4-4a26c6f3529f",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 61,
"height": 67,
"width": 36,
"height": 24,
"platformSettings": {},
"subMetas": {
"btn_left": {
"bg_sahua": {
"ver": "1.0.4",
"uuid": "ce19457d-e8f3-4c38-ae3e-d4b99208ddb5",
"rawTextureUuid": "9a79969a-0506-48d4-bc98-3c05d109b027",
"uuid": "e563d755-7640-4e80-9845-4e8e7e891845",
"rawTextureUuid": "cfc6ffbd-32c5-4ed7-84b4-4a26c6f3529f",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
......@@ -22,10 +22,10 @@
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 61,
"height": 67,
"rawWidth": 61,
"rawHeight": 67,
"width": 36,
"height": 24,
"rawWidth": 36,
"rawHeight": 24,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
......
{
"ver": "2.3.5",
"uuid": "0884ca03-555a-420e-8a4f-1d8165ae8067",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 278,
"height": 275,
"platformSettings": {},
"subMetas": {
"icon_bigstar": {
"ver": "1.0.4",
"uuid": "a7582b91-c35c-484d-af61-26dba567aaa5",
"rawTextureUuid": "0884ca03-555a-420e-8a4f-1d8165ae8067",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 278,
"height": 275,
"rawWidth": 278,
"rawHeight": 275,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "94828d7d-0bf7-42d5-ac21-bd7333ffb305",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 62,
"height": 69,
"platformSettings": {},
"subMetas": {
"icon_star": {
"ver": "1.0.4",
"uuid": "ceeeffbc-5d56-4ffb-a0db-587ececa68ae",
"rawTextureUuid": "94828d7d-0bf7-42d5-ac21-bd7333ffb305",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 62,
"height": 69,
"rawWidth": 62,
"rawHeight": 69,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "2ac76f4e-4982-48c8-91a1-f9907d9686c1",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 62,
"height": 69,
"platformSettings": {},
"subMetas": {
"icon_stardi": {
"ver": "1.0.4",
"uuid": "7d34919d-d0e8-4aaf-ad40-1994c1e2eb97",
"rawTextureUuid": "2ac76f4e-4982-48c8-91a1-f9907d9686c1",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 1.5,
"trimX": 0,
"trimY": 0,
"width": 62,
"height": 66,
"rawWidth": 62,
"rawHeight": 69,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ 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