Commit ec2478ab authored by 唐鑫's avatar 唐鑫

xiugai

parent 1a8fe252
This diff is collapsed.
...@@ -9,7 +9,9 @@ cc.Class({ ...@@ -9,7 +9,9 @@ cc.Class({
handAnim: cc.Animation, handAnim: cc.Animation,
sprite: cc.Sprite, sprite: cc.Sprite,
tipClip: cc.AudioClip, tipClip: cc.AudioClip,
btnX: cc.Node btnX: cc.Node,
icon_play: cc.Node,
icon_stop: cc.Node,
}, },
data: null, data: null,
......
...@@ -21,7 +21,7 @@ cc.Class({ ...@@ -21,7 +21,7 @@ cc.Class({
tools.getSpriteFrimeByUrl(data.bgItem.url, (sp) => { tools.getSpriteFrimeByUrl(data.bgItem.url, (sp) => {
let rect = sp.getRect() let rect = sp.getRect()
let scale = rect.width / rect.height let scale = rect.width / rect.height
let originRect = cc.size(1280, 720) let originRect = cc.size(1084, 630)
let originScale = originRect.width / originRect.height let originScale = originRect.width / originRect.height
if (scale < originScale) { if (scale < originScale) {
scale = rect.height / originRect.height scale = rect.height / originRect.height
...@@ -38,17 +38,18 @@ cc.Class({ ...@@ -38,17 +38,18 @@ cc.Class({
this.node.width = originRect.width this.node.width = originRect.width
this.node.height = originRect.height this.node.height = originRect.height
} }
this.borders[0].active = true // this.borders[0].active = true
this.borders[1].active = true // this.borders[1].active = true
this.borders[0].x = -this.node.width / 2 // this.borders[0].x = -this.node.width / 2
this.borders[1].x = this.node.width / 2 // this.borders[1].x = this.node.width / 2
this._sprite.spriteFrame = sp this._sprite.spriteFrame = sp
this._sprite.node.width = this.node.width this._sprite.node.width = this.node.width
this._sprite.node.height = this.node.height this._sprite.node.height = this.node.height
this._items.width = this.node.width this._items.width = this.node.width
this._items.height = this.node.height this._items.height = this.node.height
this._items.x = -this.node.width / 2 this._items.x = -this.node.width / 2
this._items.y = this.node.height / 2 this._sprite.node.y = 30;
this._items.y = this.node.height / 2 + this._sprite.node.y;
scale = data.bgItem.rect.width / this.node.width scale = data.bgItem.rect.width / this.node.width
//初始化点击区域 //初始化点击区域
let node, comp let node, comp
......
This diff is collapsed.
const tools = require("./tools"); // const tools = require("./tools");
cc.Class({ cc.Class({
extends: cc.Component, extends: cc.Component,
...@@ -220,9 +220,18 @@ cc.Class({ ...@@ -220,9 +220,18 @@ cc.Class({
cc.audioEngine.play(this.btnClip, false, 0.8) cc.audioEngine.play(this.btnClip, false, 0.8)
}, },
//绑定音频按钮,点击按钮播放,再次点击按钮暂停
onClickAudio(e) {
let target = e.target;
let btn_loop = target.getComponent("btn_loop");//找到btn_loop
if (this.isPlaying) {
this.isPlaying = false;
btn_loop.stopPlay();//执行暂停的方法
} else {
this.isPlaying = true;
btn_loop.startPlay();//执行播放的方法
}
},
/** 左移动 */ /** 左移动 */
leftMove() { leftMove() {
this.stopAudio() this.stopAudio()
......
// 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
// function test() {
// let arr = [];
// let count = -1;
// for (let i = 0; i < 100; i++) {
// if(count>1){
// count=-1
// }
// count = count + 1;
// console.log(i%3);
// }
// }
// test();
cc.Class({
extends: cc.Component,
properties: {
btn0: cc.Node,
btn1: cc.Node,
btn2: cc.Node,
// foo: {
// // ATTRIBUTES:
// default: null, // The default value will be used only when the component attaching
// // to a node for the first time
// type: cc.SpriteFrame, // optional, default is typeof default
// serializable: true, // optional, default is true
// },
// bar: {
// get () {
// return this._bar;
// },
// set (value) {
// this._bar = value;
// }
// },
},
// LIFE-CYCLE CALLBACKS:
//初始播放动画状态为关闭
onLoad() {
this.isPlaying = false;
this.count = -1;
},
startPlay() {
this.isPlaying = true;
},
stopPlay() {
this.isPlaying = false;
},
start() {
},
update(dt) {//循环播放0 1 2 三种状态
if (this.isPlaying) {
if (this.count / 20 % 3 == 0) {//播放20次0
this.btn0.active = true;
this.btn1.active = false;
this.btn2.active = false;
} else if (this.count / 20 % 3 == 1) {
this.btn0.active = false;
this.btn1.active = true;
this.btn2.active = false;
} else if (this.count / 20 % 3 == 2) {
this.btn0.active = false;
this.btn1.active = false;
this.btn2.active = true;
}
this.count = this.count + 1;
} else {
this.btn0.active = false;
this.btn1.active = false;
this.btn2.active = true;
}
},
});
{
"ver": "1.0.8",
"uuid": "5bb7a09d-4f64-4b49-860b-21bdb3d09e82",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "dc1af8ba-e6cf-4bbe-bd79-540d98b20e68",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1334,
"height": 132,
"platformSettings": {},
"subMetas": {
"bg_background0": {
"ver": "1.0.4",
"uuid": "606a9bca-a472-422e-a8d7-a57fe4a2e057",
"rawTextureUuid": "dc1af8ba-e6cf-4bbe-bd79-540d98b20e68",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 1334,
"height": 132,
"rawWidth": 1334,
"rawHeight": 132,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "c6da2114-acd6-4f8b-87fe-5b2b7d5a02db",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1160,
"height": 700,
"platformSettings": {},
"subMetas": {
"bg_book0": {
"ver": "1.0.4",
"uuid": "98663708-7ead-4cfb-bc2c-d15c44652c61",
"rawTextureUuid": "c6da2114-acd6-4f8b-87fe-5b2b7d5a02db",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 1160,
"height": 700,
"rawWidth": 1160,
"rawHeight": 700,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "9c68c485-b823-4392-8f2d-dee9b2c825b3",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1334,
"height": 663,
"platformSettings": {},
"subMetas": {
"bg_desk0": {
"ver": "1.0.4",
"uuid": "d150fd14-dc63-4157-bdda-456f1b3588ed",
"rawTextureUuid": "9c68c485-b823-4392-8f2d-dee9b2c825b3",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 1334,
"height": 663,
"rawWidth": 1334,
"rawHeight": 663,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "88ec0572-2ab8-4f4c-af0d-0f5df7a968a5",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 138,
"height": 48,
"platformSettings": {},
"subMetas": {
"bg_number0": {
"ver": "1.0.4",
"uuid": "2424ba66-21df-4845-b4a8-ea1441eb9193",
"rawTextureUuid": "88ec0572-2ab8-4f4c-af0d-0f5df7a968a5",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 138,
"height": 48,
"rawWidth": 138,
"rawHeight": 48,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "09ebb784-8fac-4f56-9d65-6b12ab67ae51",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 170,
"height": 170,
"platformSettings": {},
"subMetas": {
"bg_quan_huang": {
"ver": "1.0.4",
"uuid": "4b7d087b-846b-42be-a0fd-0680a9428b88",
"rawTextureUuid": "09ebb784-8fac-4f56-9d65-6b12ab67ae51",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 35,
"trimY": 35,
"width": 100,
"height": 100,
"rawWidth": 170,
"rawHeight": 170,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "fc6bcab9-f306-4af9-b3d7-851ad3863338",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 170,
"height": 170,
"platformSettings": {},
"subMetas": {
"bg_quan_lan": {
"ver": "1.0.4",
"uuid": "7651dd7c-f921-4f71-8006-4f25714d24b9",
"rawTextureUuid": "fc6bcab9-f306-4af9-b3d7-851ad3863338",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -1,
"offsetY": 0,
"trimX": 34,
"trimY": 35,
"width": 100,
"height": 100,
"rawWidth": 170,
"rawHeight": 170,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "bbea58e0-92b7-4c14-808b-c3eb31e6b7ed",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 82,
"height": 65,
"platformSettings": {},
"subMetas": {
"btn_audio-play1": {
"ver": "1.0.4",
"uuid": "95405bae-c056-4368-93dc-809e1b3ed61c",
"rawTextureUuid": "bbea58e0-92b7-4c14-808b-c3eb31e6b7ed",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 82,
"height": 65,
"rawWidth": 82,
"rawHeight": 65,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "360bebb8-8b1d-4481-ac96-bd5d7bf47abe",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 82,
"height": 65,
"platformSettings": {},
"subMetas": {
"btn_audio-play2": {
"ver": "1.0.4",
"uuid": "988da25a-9911-46e1-849e-e233aa555827",
"rawTextureUuid": "360bebb8-8b1d-4481-ac96-bd5d7bf47abe",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 82,
"height": 65,
"rawWidth": 82,
"rawHeight": 65,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "b93de2a3-ead5-4a4b-b274-21e1a0d63c58",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 82,
"height": 65,
"platformSettings": {},
"subMetas": {
"btn_audio-play3": {
"ver": "1.0.4",
"uuid": "1116d523-c1d0-4fb3-a8ac-73b80db6c10c",
"rawTextureUuid": "b93de2a3-ead5-4a4b-b274-21e1a0d63c58",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 82,
"height": 65,
"rawWidth": 82,
"rawHeight": 65,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "d5e34f59-e0ec-45f7-80b7-6793a7022dfd",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 82,
"height": 65,
"platformSettings": {},
"subMetas": {
"btn_return0": {
"ver": "1.0.4",
"uuid": "e54faa95-6e77-48f7-8c37-b1dbff667c1b",
"rawTextureUuid": "d5e34f59-e0ec-45f7-80b7-6793a7022dfd",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 82,
"height": 65,
"rawWidth": 82,
"rawHeight": 65,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "8093d7cd-7644-4cc6-80c7-b8b45907e2e1",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 52,
"height": 50,
"platformSettings": {},
"subMetas": {
"icon_hand0": {
"ver": "1.0.4",
"uuid": "243e71ab-eb67-4dd0-8abd-5ca1104903df",
"rawTextureUuid": "8093d7cd-7644-4cc6-80c7-b8b45907e2e1",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 52,
"height": 50,
"rawWidth": 52,
"rawHeight": 50,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "82b719db-f613-486c-8b09-27a0807665ee",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 42,
"height": 25,
"platformSettings": {},
"subMetas": {
"icon_play": {
"ver": "1.0.4",
"uuid": "5a28d645-d8aa-42a0-8119-62a72e96f854",
"rawTextureUuid": "82b719db-f613-486c-8b09-27a0807665ee",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 42,
"height": 25,
"rawWidth": 42,
"rawHeight": 25,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "974c57fd-70f1-44a7-ade0-4c6f50db8ed0",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 42,
"height": 25,
"platformSettings": {},
"subMetas": {
"icon_stop": {
"ver": "1.0.4",
"uuid": "a6e37a08-80d7-4efa-8256-8c925ad9063d",
"rawTextureUuid": "974c57fd-70f1-44a7-ade0-4c6f50db8ed0",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 42,
"height": 25,
"rawWidth": 42,
"rawHeight": 25,
"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