Commit 80a7f45c authored by tttal's avatar tttal

好好试一试

parent 4141dffc
<div class="model-content"> <div class="model-content">
<div style="padding: 10px;"> <div style="padding: 10px;">
<div style="width: 300px;" align='center'> <!-- <div style="width: 300px;" align='center'>
<span>图1: </span> <span>图1: </span>
<app-upload-image-with-preview <app-upload-image-with-preview
[picUrl]="item.pic_url" [picUrl]="item.pic_url"
...@@ -16,24 +16,28 @@ ...@@ -16,24 +16,28 @@
[picUrl]="item.pic_url_2" [picUrl]="item.pic_url_2"
(imageUploaded)="onImageUploadSuccess($event, 'pic_url_2')"> (imageUploaded)="onImageUploadSuccess($event, 'pic_url_2')">
</app-upload-image-with-preview> </app-upload-image-with-preview>
</div> </div> -->
<div style="width: 300px; margin-top: 15px;"> <div style="width: 300px; margin-top: 15px;">
<span>文本: </span> <span>标题(例如:A a): </span>
<input type="text" nz-input [(ngModel)]="item.text" (blur)="save()"> <input type="text" nz-input [(ngModel)]="item.text" (blur)="save()">
</div> </div>
<div style="width: 300px; margin-top: 15px;">
<span>正确的选项(将随机排列左右): </span>
<input type="text" nz-input [(ngModel)]="item.text1" (blur)="save()">
</div>
<div style="width: 300px; margin-top: 15px;">
<span>正确的选项(将随机排列左右): </span>
<input type="text" nz-input [(ngModel)]="item.text2" (blur)="save()">
</div>
<div style="margin-top: 5px"> <div style="margin-top: 5px">
<span>音频: </span> <span>音频: </span>
<app-audio-recorder <app-audio-recorder [audioUrl]="item.audio_url" (audioUploaded)="onAudioUploadSuccess($event, 'audio_url')">
[audioUrl]="item.audio_url" </app-audio-recorder>
(audioUploaded)="onAudioUploadSuccess($event, 'audio_url')"
></app-audio-recorder>
</div> </div>
</div> </div>
</div> </div>
\ No newline at end of file
{ {
"ver": "1.1.2", "ver": "1.1.2",
"uuid": "c35bb2f6-f24a-4850-ae44-643f2fdc7541", "uuid": "9f5b1874-e093-4a70-b88d-67830ff72702",
"isBundle": false, "isBundle": false,
"bundleName": "", "bundleName": "",
"priority": 1, "priority": 1,
......
{ {
"ver": "1.1.2", "ver": "1.1.2",
"uuid": "cb9fa4ea-66ca-45af-ad31-e445c7b0ef32", "uuid": "c0954f56-402f-481f-9dab-014a1b0d42d6",
"isBundle": false, "isBundle": false,
"bundleName": "", "bundleName": "",
"priority": 1, "priority": 1,
......
{ {
"ver": "2.0.1", "ver": "2.0.1",
"uuid": "f0680ae0-c079-45ef-abd7-9e63d90b982b", "uuid": "ad762edd-6df9-44f4-a9ac-197ca0bfb28f",
"downloadMode": 0, "downloadMode": 0,
"duration": 0.130612, "duration": 1.044898,
"subMetas": {} "subMetas": {}
} }
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "969087e8-6707-4fde-99da-3ff95308ff2e",
"downloadMode": 0,
"duration": 1.688,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "535d4d96-6b6c-48fe-8dd8-5075646af80f",
"downloadMode": 0,
"duration": 0.66275,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "8f9e5694-699e-4cef-9acb-3a8aab047170",
"downloadMode": 0,
"duration": 2.2052,
"subMetas": {}
}
\ No newline at end of file
{ {
"ver": "1.1.2", "ver": "1.1.2",
"uuid": "20185448-a1ca-4de2-8b37-7bf6cdfccbae", "uuid": "663e4b1f-921e-4009-b80f-3acd2efb5bf3",
"isBundle": false, "isBundle": false,
"bundleName": "", "bundleName": "",
"priority": 1, "priority": 1,
......
{ {
"ver": "1.1.0", "ver": "1.1.0",
"uuid": "c551970e-b095-45f3-9f1d-25cde8b8deb1", "uuid": "bf315d24-c28f-4c86-b794-feb5f228a459",
"subMetas": {} "subMetas": {}
} }
\ No newline at end of file
{ {
"ver": "1.1.2", "ver": "1.1.2",
"uuid": "0853721c-3f55-4eb2-873d-e3081cfadd4b", "uuid": "8e1f85f4-2bc9-41a9-90ae-8be441d64aa3",
"isBundle": false, "isBundle": false,
"bundleName": "", "bundleName": "",
"priority": 1, "priority": 1,
......
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "e1b4d971-9876-4832-803a-5a321964a78b", "uuid": "1342581e-5d86-483d-becb-ebc71892d138",
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
...@@ -11,10 +11,10 @@ ...@@ -11,10 +11,10 @@
"height": 720, "height": 720,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"bg": { "img1": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "8288e3d4-4c75-4b27-8f01-f7014417f4dd", "uuid": "faa0ff75-6ad5-4120-a209-b84db5910f22",
"rawTextureUuid": "e1b4d971-9876-4832-803a-5a321964a78b", "rawTextureUuid": "1342581e-5d86-483d-becb-ebc71892d138",
"trimType": "auto", "trimType": "auto",
"trimThreshold": 1, "trimThreshold": 1,
"rotated": false, "rotated": false,
......
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "efa5fa09-a4dd-4bfc-ab7e-17c19f85408f", "uuid": "b43a96ac-daed-4062-b4fa-9ccafdd86b82",
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": false,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 366, "width": 194,
"height": 336, "height": 424,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"1orange": { "img10": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "43d1e79d-6de8-4dcb-b8ce-d767df7913aa", "uuid": "8842ff4f-3e22-4d4e-acc7-cf38b4210bc7",
"rawTextureUuid": "efa5fa09-a4dd-4bfc-ab7e-17c19f85408f", "rawTextureUuid": "b43a96ac-daed-4062-b4fa-9ccafdd86b82",
"trimType": "auto", "trimType": "auto",
"trimThreshold": 1, "trimThreshold": 1,
"rotated": false, "rotated": false,
"offsetX": 0, "offsetX": 0,
"offsetY": -0.5, "offsetY": 33.5,
"trimX": 0, "trimX": 0,
"trimY": 1, "trimY": 0,
"width": 366, "width": 194,
"height": 335, "height": 357,
"rawWidth": 366, "rawWidth": 194,
"rawHeight": 336, "rawHeight": 424,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
{
"ver": "2.3.5",
"uuid": "11cf6542-2faa-4f93-bf59-26548371ef85",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 194,
"height": 424,
"platformSettings": {},
"subMetas": {
"img11": {
"ver": "1.0.4",
"uuid": "8e076d3e-ab8e-4eee-b2fc-e63f033805ad",
"rawTextureUuid": "11cf6542-2faa-4f93-bf59-26548371ef85",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 1.5,
"offsetY": -23,
"trimX": 10,
"trimY": 84,
"width": 177,
"height": 302,
"rawWidth": 194,
"rawHeight": 424,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "b9933632-e5d6-45e0-bdb4-8c9ac81561de",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 194,
"height": 424,
"platformSettings": {},
"subMetas": {
"img12": {
"ver": "1.0.4",
"uuid": "02d6a60f-6f79-44c7-961a-465247fe4d5d",
"rawTextureUuid": "b9933632-e5d6-45e0-bdb4-8c9ac81561de",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -1.5,
"offsetY": -87,
"trimX": 22,
"trimY": 174,
"width": 147,
"height": 250,
"rawWidth": 194,
"rawHeight": 424,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "d582359e-924e-4ee9-9964-1fc4bb417e71", "uuid": "59997c0e-c315-4ee2-bf29-3b45a84eace6",
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": false,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 61, "width": 924,
"height": 67, "height": 661,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"btn_right": { "img13": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "e5a2dbaa-a677-4a32-90d7-a1b057d7fb59", "uuid": "6338348b-d794-4fed-bbda-e1348bdefd1a",
"rawTextureUuid": "d582359e-924e-4ee9-9964-1fc4bb417e71", "rawTextureUuid": "59997c0e-c315-4ee2-bf29-3b45a84eace6",
"trimType": "auto", "trimType": "auto",
"trimThreshold": 1, "trimThreshold": 1,
"rotated": false, "rotated": false,
"offsetX": -0.5, "offsetX": 0,
"offsetY": 0.5, "offsetY": 0,
"trimX": 0, "trimX": 0,
"trimY": 0, "trimY": 0,
"width": 60, "width": 924,
"height": 66, "height": 661,
"rawWidth": 61, "rawWidth": 924,
"rawHeight": 67, "rawHeight": 661,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
{
"ver": "2.3.5",
"uuid": "0d902c0a-69d6-48bc-a933-a018365950b6",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 960,
"height": 240,
"platformSettings": {},
"subMetas": {
"img14": {
"ver": "1.0.4",
"uuid": "e1a3da9d-52f1-4634-becc-0f75ae9e350f",
"rawTextureUuid": "0d902c0a-69d6-48bc-a933-a018365950b6",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 960,
"height": 240,
"rawWidth": 960,
"rawHeight": 240,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "9a79969a-0506-48d4-bc98-3c05d109b027", "uuid": "d9220ebf-933a-4f47-8f76-ffaa2bf376b1",
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": false,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 61, "width": 202,
"height": 67, "height": 71,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"btn_left": { "img15": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "ce19457d-e8f3-4c38-ae3e-d4b99208ddb5", "uuid": "013d81f0-d669-46b4-a1f7-dfdf1d5592f9",
"rawTextureUuid": "9a79969a-0506-48d4-bc98-3c05d109b027", "rawTextureUuid": "d9220ebf-933a-4f47-8f76-ffaa2bf376b1",
"trimType": "auto", "trimType": "auto",
"trimThreshold": 1, "trimThreshold": 1,
"rotated": false, "rotated": false,
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
"offsetY": 0, "offsetY": 0,
"trimX": 0, "trimX": 0,
"trimY": 0, "trimY": 0,
"width": 61, "width": 202,
"height": 67, "height": 71,
"rawWidth": 61, "rawWidth": 202,
"rawHeight": 67, "rawHeight": 71,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "18d07592-51a9-421e-8972-0f67b68d29e1", "uuid": "2c87b5e2-7d7b-4776-86af-896c8fd1bcd7",
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": false,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 144, "width": 202,
"height": 144, "height": 71,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"icon": { "img2": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "6fbc30a8-3c49-44ae-8ba4-7f56f385b78a", "uuid": "9014b7ef-0e36-42a6-a5bf-5fd0581ac4af",
"rawTextureUuid": "18d07592-51a9-421e-8972-0f67b68d29e1", "rawTextureUuid": "2c87b5e2-7d7b-4776-86af-896c8fd1bcd7",
"trimType": "auto", "trimType": "auto",
"trimThreshold": 1, "trimThreshold": 1,
"rotated": false, "rotated": false,
"offsetX": 0, "offsetX": 0,
"offsetY": -0.5, "offsetY": -1.5,
"trimX": 3, "trimX": 0,
"trimY": 2, "trimY": 3,
"width": 138, "width": 202,
"height": 141, "height": 68,
"rawWidth": 144, "rawWidth": 202,
"rawHeight": 144, "rawHeight": 71,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
{
"ver": "2.3.5",
"uuid": "142e7bac-983a-433a-97d1-21b5ab378706",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 202,
"height": 71,
"platformSettings": {},
"subMetas": {
"img3": {
"ver": "1.0.4",
"uuid": "64fbc7c5-8c73-4ffa-ad76-99642af4bec9",
"rawTextureUuid": "142e7bac-983a-433a-97d1-21b5ab378706",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": -1.5,
"trimX": 0,
"trimY": 3,
"width": 202,
"height": 68,
"rawWidth": 202,
"rawHeight": 71,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "1c907df7-84d0-4d63-84ed-ab1f7dbe45f3",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 202,
"height": 71,
"platformSettings": {},
"subMetas": {
"img4": {
"ver": "1.0.4",
"uuid": "7bf33c98-35d9-49f8-8032-041e453f9ecb",
"rawTextureUuid": "1c907df7-84d0-4d63-84ed-ab1f7dbe45f3",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 202,
"height": 71,
"rawWidth": 202,
"rawHeight": 71,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "c9069dc9-4613-4ab9-b288-980f4180b39c",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1280,
"height": 720,
"platformSettings": {},
"subMetas": {
"img5": {
"ver": "1.0.4",
"uuid": "0163530c-1ab7-410f-be55-c8674889e7a4",
"rawTextureUuid": "c9069dc9-4613-4ab9-b288-980f4180b39c",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 15,
"offsetY": 31.5,
"trimX": 73,
"trimY": 0,
"width": 1164,
"height": 657,
"rawWidth": 1280,
"rawHeight": 720,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "f70f43e1-1afc-4bc6-82b7-464d96336aa3",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1280,
"height": 720,
"platformSettings": {},
"subMetas": {
"img6": {
"ver": "1.0.4",
"uuid": "9b068a49-cb00-4f66-bb61-470122a5b59a",
"rawTextureUuid": "f70f43e1-1afc-4bc6-82b7-464d96336aa3",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 1280,
"height": 720,
"rawWidth": 1280,
"rawHeight": 720,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "acfb8e6b-39b2-44de-829f-03d201eef53f",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 91,
"height": 91,
"platformSettings": {},
"subMetas": {
"img7": {
"ver": "1.0.4",
"uuid": "7aa551d4-48e6-4954-8a8c-fbe2788df036",
"rawTextureUuid": "acfb8e6b-39b2-44de-829f-03d201eef53f",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 91,
"height": 91,
"rawWidth": 91,
"rawHeight": 91,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "2025d3d8-2d86-44c1-82bc-4cad920f639a",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 91,
"height": 91,
"platformSettings": {},
"subMetas": {
"img8": {
"ver": "1.0.4",
"uuid": "904320de-d453-4c1b-a344-3d0a1f91c587",
"rawTextureUuid": "2025d3d8-2d86-44c1-82bc-4cad920f639a",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 91,
"height": 91,
"rawWidth": 91,
"rawHeight": 91,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "1635bf02-5964-4618-bb9e-161b7b4d1575",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 91,
"height": 91,
"platformSettings": {},
"subMetas": {
"img9": {
"ver": "1.0.4",
"uuid": "ec0ce13f-d2a5-4252-9b8d-5eb8e9563df6",
"rawTextureUuid": "1635bf02-5964-4618-bb9e-161b7b4d1575",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 91,
"height": 91,
"rawWidth": 91,
"rawHeight": 91,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{ {
"ver": "1.1.2", "ver": "1.1.2",
"uuid": "e8bd16b0-3804-45a9-a8ca-f52c02224f55", "uuid": "caf1bbff-c0f0-45ce-ab81-463698d692e0",
"isBundle": false, "isBundle": false,
"bundleName": "", "bundleName": "",
"priority": 1, "priority": 1,
......
{ {
"ver": "1.2.7", "ver": "1.2.7",
"uuid": "57ea7c61-9b8b-498a-b024-c98ee9124beb", "uuid": "276b3d57-2101-46ef-bad1-635feca1b522",
"asyncLoadAssets": false, "asyncLoadAssets": false,
"autoReleaseAssets": true, "autoReleaseAssets": true,
"subMetas": {} "subMetas": {}
......
{ {
"ver": "1.1.2", "ver": "1.1.2",
"uuid": "b0c008bc-cf92-463b-8360-0984e13c2e4d", "uuid": "ac280378-1a2a-4ab1-a7eb-263441e04a4d",
"isBundle": false, "isBundle": false,
"bundleName": "", "bundleName": "",
"priority": 1, "priority": 1,
......
cc.Class({
extends: cc.Component,
editor: {
executionOrder: -1,
},
properties: {
audio: [cc.AudioClip],
},
// LIFE-CYCLE CALLBACKS:
onLoad() {
cc.game.addPersistRootNode(this.node);
window.au = this;
this.list = {};
this.audio.forEach(function (key) {
this.list[key.name] = key;
}.bind(this));
},
play(name) {
if (local.getData('audio', true) == 0) {
return false;
}
cc.audioEngine.play(this.list[name], false, 1);
},
backAudio(name) {
if (this.back) {
if (local.getData('audio', true) == 0) {
cc.audioEngine.pauseMusic();
} else {
cc.audioEngine.resumeMusic();
}
} else {
if (local.getData('audio', true) == 0) {
} else {
cc.audioEngine.playMusic(this.list[name], true);
this.back = true;
}
}
},
start() {
},
// update (dt) {},
});
{ {
"ver": "1.0.8", "ver": "1.0.8",
"uuid": "ade7af40-d56d-4087-bbc6-2888fef55353", "uuid": "27bc995d-aea5-417f-b047-5484cc7a4565",
"isPlugin": false, "isPlugin": false,
"loadPluginInWeb": true, "loadPluginInWeb": true,
"loadPluginInNative": true, "loadPluginInNative": true,
......
// Learn cc.Class:
// - https://docs.cocos.com/creator/manual/en/scripting/class.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
const root = require("./root");
cc.Class({
extends: cc.Component,
properties: {
back_ground_light: cc.Node,
back_ground_1: cc.Node,
robot_body: cc.Node,
audio_button_list: cc.Node,
title_text: cc.Node,
title_text_shadow: cc.Node,
left_text: cc.Label,
right_text: cc.Label,
bottom_display: cc.Node,
},
// LIFE-CYCLE CALLBACKS:
onLoad() {
this.light_action();
this.lamp_action();
this.audio_button_update();
//文字数据加载部分
this.load_title(local.getTempData('text0'));
this.load_text(local.getTempData('text1'), local.getTempData('text2'));
},
start() {
au.play('audio4');
},
load_title(str) {
this.title_text.getComponent(cc.Label).string = str;
this.title_text_shadow.getComponent(cc.Label).string = str;
},
load_text(str1, str2) {
if (root.rand(50)) {
this.left_text.node.parent._tips = true;
this.right_text.node.parent._tips = false;
var s1 = str1;
var s2 = str2;
} else {
this.left_text.node.parent._tips = false;
this.right_text.node.parent._tips = true;
var s1 = str2;
var s2 = str1;
}
this.left_text.string = s1;
this.right_text.string = s2;
},
audio_on() {
local.setData('audio', 0);
this.audio_button_update();
},
audio_off() {
local.setData('audio', 1);
this.audio_button_update();
},
audio_button_update() {
if (local.getData('audio', true) == 1) {
cc.find('ON', this.audio_button_list).active = true;
cc.find('OFF', this.audio_button_list).active = false;
} else {
cc.find('OFF', this.audio_button_list).active = true;
cc.find('ON', this.audio_button_list).active = false;
}
},
light_action() {
cc.tween(this.back_ground_light)
.to(0.3, { opacity: 0 }, { easing: 'cubicIn' })
.to(0.3, { opacity: 255 }, { easing: 'cubicIn' })
.union()
.repeatForever()
.start();
cc.tween(this.back_ground_1)
.to(0.5, { opacity: 155 }, { easing: 'cubicIn' })
.to(0.5, { opacity: 255 }, { easing: 'cubicIn' })
.union()
.repeatForever()
.start();
},
lamp_action() {
//熄灭所有
this.robot_body.children.forEach(function (key) {
key.opacity = 0;
}.bind(this));
//每秒一个周期
var action = function () {
var index = 0;
this.robot_body.children.forEach(function (key) {
this.scheduleOnce(function () {
cc.tween(key)
.to(0.3, { opacity: 255 }, { easing: 'cubicIn' })
.to(0.3, { opacity: 0 }, { easing: 'cubicIn' })
.to(0.5, { opacity: 0 })
.union()
.repeatForever()
.start();
}.bind(this), 0.2 * index);
index++;
}.bind(this));
}.bind(this);
this.schedule(function () {
action();
}.bind(this), 5);
action();
},
left(res) {
this.action(res.target);
},
right(res) {
this.action(res.target);
},
action(node) {
cc.tween(this.bottom_display)
.to(0.05, { x: -10 })
.to(0.05, { x: 10 })
.to(0.05, { x: -10 })
.to(0.05, { x: 10 })
.to(0.05, { x: 0 })
.start();
au.play('audio3');
node.scale = 1;
cc.tween(node)
.to(0.5, { scaleY: 0.4 }, { easing: 'quintOut' })
.call(function () {
if (node._tips) {
au.play('audio1');
} else {
au.play('audio2');
}
cc.tween(node)
.to(0.3, { scaleY: 1 }, { easing: 'quintIn' })
.start();
}.bind(this))
.start();
},
// update (dt) {},
});
{ {
"ver": "1.0.8", "ver": "1.0.8",
"uuid": "d545f402-231b-417e-99e6-3269412a5a2c", "uuid": "4a11bb30-835f-4689-bd41-ac8a8f5c17f2",
"isPlugin": false, "isPlugin": false,
"loadPluginInWeb": true, "loadPluginInWeb": true,
"loadPluginInNative": true, "loadPluginInNative": true,
......
/**
* 客户端本地缓存组件
*/
window.root = require('root');
cc.Class({
extends: cc.Component,
editor: {
executionOrder: -20,
},
properties: {
cache: {
default: {},
},
queue: {
default: [],
},
local_name: '拳击机模板',
},
onLoad() {
cc.game.addPersistRootNode(this.node);
window.local = this;
this[this.local_name] = {
audio: '1',
};
this.init_local();
this.init_data();
},
init_data() {
try {
cc.find('Canvas').active = false;
window.courseware.getData(function (res) {
this.data = res;
cc.find('Canvas').active = true;
console.log(res);
}.bind(this));
} catch (error) {
console.error('没有查找到courseware.getData方法', error);
this.data = {
text0: 'A a',
text1: 'apple',
text2: 'bind',
};
cc.find('Canvas').active = true;
}
},
/**
* 获取预设数据
*/
getTempData(key) {
return (this.data[key]);
},
save() {
cc.sys.localStorage.setItem(this.local_name, JSON.stringify(this.cache));
},
init_local() {
if (!cc.sys.localStorage.getItem(this.local_name)) {
cc.sys.localStorage.setItem(this.local_name, JSON.stringify(this[this.local_name]));
}
this.cache = JSON.parse(cc.sys.localStorage.getItem(this.local_name));
},
getData(key, int = false) {
var value = this.cache[key];
if (int) {
return (parseInt(value));
} else {
return (value);
}
},
setData(key, value) {
this.cache[key] = value;
switch (key) {
case 'audio':
this.save();
break;
default:
break;
}
},
dataAdd(key, ins = 1) {
var value = this.getData(key);
value = parseInt(value);
this.setData(key, value + ins);
},
});
\ No newline at end of file
{ {
"ver": "1.0.8", "ver": "1.0.8",
"uuid": "f4ede462-f8d7-4069-ba80-915611c058ca", "uuid": "b33aa12d-392e-460f-b21e-b9372a94a88d",
"isPlugin": false, "isPlugin": false,
"loadPluginInWeb": true, "loadPluginInWeb": true,
"loadPluginInNative": true, "loadPluginInNative": true,
......
module.exports = {
gold_update() {
for (var key in this.gold_component) {
if (this.gold_component[key]) {
this.gold_component[key].getComponent(cc.Label).string = local.getData('gold');
}
}
},
resize(node, width, height) {
if (node.width / node.height <= width / height) {
node.height = node.height * width / node.width;
node.width = width;
} else {
node.width = node.width * height / node.height;
node.height = height;
}
},
load_image(container, url, call) {
url = 'https://sunleigame.oss-cn-hangzhou.aliyuncs.com/%E5%90%8D%E7%94%BB%E6%89%BE%E8%8C%AC%E8%B5%84%E6%BA%90/' + url + '.jpg';
cc.assetManager.loadRemote(url, function (err, texture) {
var sprite = new cc.SpriteFrame(texture);
container.spriteFrame = sprite;
call(container.node);
});
},
chinese_number(a) {
var arr = ['', '', '', '', '', '', '', '', '', '', '', '十一', '十二', '十三', '十四', '十五', '十六', '十七', '十八', '十九', '二十'];
return (arr[a]);
},
insert(prefab) {
var node = cc.instantiate(prefab);
node.parent = cc.find('Canvas');
var index = 0;
cc.find('content', node).children.forEach(function (key) {
key.scaleX = 0;
local.scheduleOnce(function () {
cc.tween(key)
.to(0.1, { scaleX: 1 })
.start();
}, index * 0.05);
index++;
});
return (node);
},
close(node) {
cc.tween(cc.find('content', node))
.to(0.1, { scaleX: 0 }, { easing: 'bounceInOut' })
.call(function () {
node.destroy();
})
.start();
},
click_audio() {
},
getRandIntArray(length = 1, a = 1, b = length) {
var array = Array();
for (var s = a; s <= b; s++) {
array.push(s);
}
array.sort(function () {
return 0.5 - Math.random();
});
for (var r = 1; r <= (b - length); r++) {
array.pop();
}
return (array);
},
getDate(time) {
var sun = this;
if (typeof (time) == "undefined") {
time = sun.getTime() * 1000;
} else {
time *= 1000;
}
var oDate = new Date(time);
var oYear = oDate.getFullYear();
var oMonth = oDate.getMonth() + 1;
var oDay = oDate.getDate();
var oTime = oYear + '-' + sun.getzf(oMonth) + '-' + sun.getzf(oDay);
return oTime;
},
getzf(num) {
if (parseInt(num) < 10) {
num = '0' + num;
}
return num;
},
rand: function (num) {
var array = Array();
for (var s = 1; s <= 100; s++) {
array.push(s);
}
var ins = array[Math.ceil(Math.random() * 100 - 1)];
if (ins <= num) {
return (true);
} else {
return (false);
}
},
randInt: function (min, max) {
return (min + Math.round(Math.random() * (max - min)));
},
getTime: function () {
return (Date.parse(new Date()) / 1000);
},
getMoveCoordinates(initialNode, targetNode) {
var initialNodeMat4 = cc.mat4();
var targetNodeMat4 = cc.mat4();
initialNode.getWorldMatrix(initialNodeMat4)
targetNode.getWorldMatrix(targetNodeMat4)
var position = new cc.v2(targetNodeMat4.m12 - initialNodeMat4.m12, targetNodeMat4.m13 - initialNodeMat4.m13);
return (position);
},
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "21b8b364-a1e0-4f65-afba-4f0a3154a1b0",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
// Learn cc.Class:
// - https://docs.cocos.com/creator/manual/en/scripting/class.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
cc.Class({
extends: cc.Component,
properties: {
},
// 生命周期 onLoad
onLoad() {
console.log('修改是成功的!');
this.initSceneData();
this.initSize();
},
_imageResList: null,
_audioResList: null,
_animaResList: null,
initSceneData() {
this._imageResList = [];
this._audioResList = [];
this._animaResList = [];
},
_designSize: null, // 设计分辨率
_frameSize: null, // 屏幕分辨率
_mapScaleMin: null, // 场景中常用缩放(取大值)
_mapScaleMax: null, // 场景中常用缩放(取小值)
_cocosScale: null, // cocos 自缩放 (较少用到)
initSize() {
// 注意cc.winSize只有在适配后(修改fitHeight/fitWidth后)才能获取到正确的值,因此使用cc.getFrameSize()来获取初始的屏幕大小
let screen_size = cc.view.getFrameSize().width / cc.view.getFrameSize().height
let design_size = cc.Canvas.instance.designResolution.width / cc.Canvas.instance.designResolution.height
let f = screen_size >= design_size
cc.Canvas.instance.fitHeight = f
cc.Canvas.instance.fitWidth = !f
const frameSize = cc.view.getFrameSize();
this._frameSize = frameSize;
this._designSize = cc.view.getDesignResolutionSize();
let sx = cc.winSize.width / frameSize.width;
let sy = cc.winSize.height / frameSize.height;
this._cocosScale = Math.min(sx, sy);
sx = frameSize.width / this._designSize.width;
sy = frameSize.height / this._designSize.height;
this._mapScaleMin = Math.min(sx, sy) * this._cocosScale;
this._mapScaleMax = Math.max(sx, sy) * this._cocosScale;
},
// 生命周期 start
start() {
let getData = this.getData.bind(this);
if (window && window.courseware) {
getData = window.courseware.getData;
}
getData((data) => {
console.log('data:', data);
this.data = data || this.getDefaultData();
this.data = JSON.parse(JSON.stringify(this.data))
this.preloadItem()
})
},
getData(cb) {
cb(this.getDefaultData());
},
getDefaultData() {
const dataJson = '{"pic_url":"http://staging-teach.cdn.ireadabc.com/ed94332a503c31e0908bd4c6923a2665.png","pic_url_2":"http://staging-teach.cdn.ireadabc.com/5fb60317ade0195d35ad8034d5370a7f.png","text":"This is a test label.","audio_url":"http://staging-teach.cdn.ireadabc.com/f47f1d7b5c160fe1c59500d180346240.mp3"}'
const data = JSON.parse(dataJson);
return data;
},
preloadItem() {
this.addPreloadImage();
this.addPreloadAudio();
this.addPreloadAnima();
this.preload();
},
addPreloadImage() {
this._imageResList.push({ url: this.data.pic_url });
this._imageResList.push({ url: this.data.pic_url_2 });
},
addPreloadAudio() {
this._audioResList.push({ url: this.data.audio_url });
},
addPreloadAnima() {
},
preload() {
const preloadArr = this._imageResList.concat(this._audioResList).concat(this._animaResList);
cc.assetManager.loadAny(preloadArr, null, null, (err, data) => {
this.loadEnd();
if (window && window["air"]) {
window["air"].hideAirClassLoading();
}
cc.debug.setDisplayStats(false);
});
},
loadEnd() {
this.initData();
this.initAudio();
this.initView();
// this.initListener();
},
_cantouch: null,
initData() {
// 所有全局变量 默认都是null
this._cantouch = true;
},
audioBtn: null,
initAudio() {
const audioNode = cc.find('Canvas/res/audio');
const getAudioByResName = (resName) => {
return audioNode.getChildByName(resName).getComponent(cc.AudioSource);
}
this.audioBtn = getAudioByResName('btn');
},
initView() {
this.initBg();
this.initPic();
this.initBtn();
this.initIcon();
},
initBg() {
const bgNode = cc.find('Canvas/bg');
bgNode.scale = this._mapScaleMax;
},
pic1: null,
pic2: null,
initPic() {
const canvas = cc.find('Canvas');
const maxW = canvas.width * 0.7;
this.getSprNodeByUrl(this.data.pic_url, (sprNode) => {
const picNode1 = sprNode;
picNode1.scale = maxW / picNode1.width;
picNode1.baseX = picNode1.x;
canvas.addChild(picNode1);
this.pic1 = picNode1;
const labelNode = new cc.Node();
labelNode.color = cc.Color.YELLOW;
const label = labelNode.addComponent(cc.Label);
label.string = this.data.text;
label.fontSize = 60;
label.lineHeight = 60;
label.font = cc.find('Canvas/res/font/BRLNSDB').getComponent('cc.Label').font;
picNode1.addChild(labelNode);
});
this.getSprNodeByUrl(this.data.pic_url_2, (sprNode) => {
const picNode2 = sprNode;
picNode2.scale = maxW / picNode2.width;
canvas.addChild(picNode2);
picNode2.x = canvas.width;
picNode2.baseX = picNode2.x;
this.pic2 = picNode2;
const labelNode = new cc.Node();
const label = labelNode.addComponent(cc.RichText);
const size = 60
label.font = cc.find('Canvas/res/font/BRLNSDB').getComponent(cc.Label).font;
label.string = `<outline color=#751e00 width=4><size=${size}><color=#ffffff>${this.data.text}</color></size></outline>`
label.lineHeight = size;
picNode2.addChild(labelNode);
});
},
initIcon() {
const iconNode = this.getSprNode('icon');
iconNode.zIndex = 5;
iconNode.anchorX = 1;
iconNode.anchorY = 1;
iconNode.parent = cc.find('Canvas');
iconNode.x = iconNode.parent.width / 2 - 10;
iconNode.y = iconNode.parent.height / 2 - 10;
iconNode.on(cc.Node.EventType.TOUCH_START, () => {
this.playAudioByUrl(this.data.audio_url);
})
},
curPage: null,
initBtn() {
this.curPage = 0;
const bottomPart = cc.find('Canvas/bottomPart');
bottomPart.zIndex = 5; // 提高层级
bottomPart.x = bottomPart.parent.width / 2;
bottomPart.y = -bottomPart.parent.height / 2;
const leftBtnNode = bottomPart.getChildByName('btn_left');
//节点中添加了button组件 则可以添加click事件监听
leftBtnNode.on('click', () => {
if (!this._cantouch) {
return;
}
if (this.curPage == 0) {
return;
}
this.curPage = 0
this.leftMove();
cc.audioEngine.play(this.audioBtn.clip, false, 0.8)
})
const rightBtnNode = bottomPart.getChildByName('btn_right');
//节点中添加了button组件 则可以添加click事件监听
rightBtnNode.on('click', () => {
if (!this._cantouch) {
return;
}
if (this.curPage == 1) {
return;
}
this.curPage = 1
this.rightMove();
cc.audioEngine.play(this.audioBtn.clip, false, 0.5)
})
},
leftMove() {
this._cantouch = false;
const len = this.pic1.parent.width;
cc.tween(this.pic1)
.to(1, { x: this.pic1.baseX }, { easing: 'cubicInOut' })
.start();
cc.tween(this.pic2)
.to(1, { x: this.pic2.baseX }, { easing: 'cubicInOut' })
.call(() => {
this._cantouch = true;
})
.start();
},
rightMove() {
this._cantouch = false;
const len = this.pic1.parent.width;
cc.tween(this.pic1)
.to(1, { x: this.pic1.baseX - len }, { easing: 'cubicInOut' })
.start();
cc.tween(this.pic2)
.to(1, { x: this.pic2.baseX - len }, { easing: 'cubicInOut' })
.call(() => {
this._cantouch = true;
})
.start();
},
// update (dt) {},
// ------------------------------------------------
getSprNode(resName) {
const sf = cc.find('Canvas/res/img/' + resName).getComponent(cc.Sprite).spriteFrame;
const node = new cc.Node();
node.addComponent(cc.Sprite).spriteFrame = sf;
return node;
},
getSpriteFrimeByUrl(url, cb) {
cc.loader.load({ url }, (err, img) => {
const spriteFrame = new cc.SpriteFrame(img)
if (cb) {
cb(spriteFrame);
}
})
},
getSprNodeByUrl(url, cb) {
const node = new cc.Node();
const spr = node.addComponent(cc.Sprite);
this.getSpriteFrimeByUrl(url, (sf) => {
spr.spriteFrame = sf;
if (cb) {
cb(node);
}
})
},
playAudioByUrl(audio_url, cb = null) {
if (audio_url) {
cc.assetManager.loadRemote(audio_url, (err, audioClip) => {
const audioId = cc.audioEngine.play(audioClip, false, 0.8);
if (cb) {
cc.audioEngine.setFinishCallback(audioId, () => {
cb();
});
}
});
}
},
// ------------------------------------------
});
export function getPosByAngle(angle, len) {
const radian = angle * Math.PI / 180;
const x = Math.sin(radian) * len;
const y = Math.cos(radian) * len;
return { x, y };
}
export function getAngleByPos(px, py, mx, my) {
const x = Math.abs(px - mx);
const y = Math.abs(py - my);
const z = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
const cos = y / z;
const radina = Math.acos(cos); // 用反三角函数求弧度
let angle = Math.floor(180 / (Math.PI / radina) * 100) / 100; // 将弧度转换成角度
if (mx > px && my > py) {// 鼠标在第四象限
angle = 180 - angle;
}
if (mx === px && my > py) {// 鼠标在y轴负方向上
angle = 180;
}
if (mx > px && my === py) {// 鼠标在x轴正方向上
angle = 90;
}
if (mx < px && my > py) {// 鼠标在第三象限
angle = 180 + angle;
}
if (mx < px && my === py) {// 鼠标在x轴负方向
angle = 270;
}
if (mx < px && my < py) {// 鼠标在第二象限
angle = 360 - angle;
}
// console.log('angle: ', angle);
return angle;
}
export function exchangeNodePos(baseNode, targetNode) {
return baseNode.convertToNodeSpaceAR(targetNode._parent.convertToWorldSpaceAR(cc.v2(targetNode.x, targetNode.y)));
}
export function RandomInt(a, b = 0) {
let max = Math.max(a, b);
let min = Math.min(a, b);
return Math.floor(Math.random() * (max - min) + min);
}
export function randomSortByArr(arr) {
const newArr = [];
const tmpArr = arr.concat();
while (tmpArr.length > 0) {
const randomIndex = Math.floor(tmpArr.length * Math.random());
newArr.push(tmpArr[randomIndex]);
tmpArr.splice(randomIndex, 1);
}
return newArr;
}
export function setSprNodeMaxLen(sprNode, maxW, maxH) {
const sx = maxW / sprNode.width;
const sy = maxH / sprNode.height;
const s = Math.min(sx, sy);
sprNode.scale = Math.round(s * 1000) / 1000;
}
export function localPosTolocalPos(baseNode, targetNode) {
const worldPos = targetNode.parent.convertToWorldSpaceAR(cc.v2(targetNode.x, targetNode.y));
const localPos = baseNode.parent.convertToNodeSpaceAR(cc.v2(worldPos.x, worldPos.y));
return localPos;
}
export function worldPosToLocalPos(worldPos, baseNode) {
const localPos = baseNode.parent.convertToNodeSpaceAR(cc.v2(worldPos.x, worldPos.y));
return localPos;
}
export function getScaleRateBy2Node(baseNode, targetNode, maxFlag = true) {
const worldRect1 = targetNode.getBoundingBoxToWorld();
const worldRect2 = baseNode.getBoundingBoxToWorld();
const sx = worldRect1.width / worldRect2.width;
const sy = worldRect1.height / worldRect2.height;
if (maxFlag) {
return Math.max(sx, sy);
} else {
return Math.min(sx, sy);
}
}
export function getDistance (start, end){
var pos = cc.v2(start.x - end.x, start.y - end.y);
var dis = Math.sqrt(pos.x*pos.x + pos.y*pos.y);
return dis;
}
export function playAudioByUrl(audio_url, cb=null) {
if (audio_url) {
cc.assetManager.loadRemote(audio_url, (err, audioClip) => {
const audioId = cc.audioEngine.play(audioClip, false, 0.8);
if (cb) {
cc.audioEngine.setFinishCallback(audioId, () => {
cb();
});
}
});
}
}
export function btnClickAnima(btn, time=0.15, rate=1.05) {
btn.tmpScale = btn.scale;
btn.on(cc.Node.EventType.TOUCH_START, () => {
cc.tween(btn)
.to(time / 2, {scale: btn.scale * rate})
.start()
})
btn.on(cc.Node.EventType.TOUCH_CANCEL, () => {
cc.tween(btn)
.to(time / 2, {scale: btn.tmpScale})
.start()
})
btn.on(cc.Node.EventType.TOUCH_END, () => {
cc.tween(btn)
.to(time / 2, {scale: btn.tmpScale})
.start()
})
}
\ No newline at end of file
This diff is collapsed.
{
"ver": "1.1.2",
"uuid": "8ba21262-178f-4fa5-afc9-2c1dd50ba3ab",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"compilerOptions": {
"module": "commonjs",
"lib": [ "es2015", "es2017", "dom" ],
"target": "es5",
"experimentalDecorators": true,
"skipLibCheck": true,
"outDir": "temp/vscode-dist",
"forceConsistentCasingInFileNames": true
},
"exclude": [
"node_modules",
"library",
"local",
"temp",
"build",
"settings"
]
}
\ 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