Commit decbabd3 authored by 唐鑫's avatar 唐鑫

游戏调整完成

parent ec2478ab
......@@ -33,13 +33,10 @@
"__id__": 20
},
{
"__id__": 23
},
{
"__id__": 26
"__id__": 24
},
{
"__id__": 29
"__id__": 28
},
{
"__id__": 32
......@@ -738,10 +735,13 @@
"_components": [
{
"__id__": 21
},
{
"__id__": 22
}
],
"_prefab": {
"__id__": 22
"__id__": 23
},
"_opacity": 255,
"_color": {
......@@ -765,8 +765,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-29.336,
73.964,
-175.806,
81.931,
0,
0,
0,
......@@ -822,6 +822,33 @@
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 20
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 9,
"_left": -21.30600000000001,
"_right": 0,
"_top": -47.931,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
......@@ -844,11 +871,14 @@
"_active": false,
"_components": [
{
"__id__": 24
"__id__": 25
},
{
"__id__": 26
}
],
"_prefab": {
"__id__": 25
"__id__": 27
},
"_opacity": 255,
"_color": {
......@@ -872,8 +902,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-29.648,
74.275,
-176.078,
82.067,
0,
0,
0,
......@@ -902,7 +932,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 23
"__id__": 24
},
"_enabled": true,
"_materials": [
......@@ -930,110 +960,30 @@
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "2ce7d58d-b6fe-4ef7-a128-de76f672a803"
},
"fileId": "bdj7Z5C1hG9ZUpslIq23db",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "bg_quan_huang",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 27
}
],
"_prefab": {
"__id__": 28
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 130,
"height": 130
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
14.364,
-2.917,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 26
"__id__": 24
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "4b7d087b-846b-42be-a0fd-0680a9428b88"
},
"_type": 0,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"alignMode": 1,
"_target": null,
"_alignFlags": 9,
"_left": -21.578000000000003,
"_right": 0,
"_top": -48.06699999999999,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": ""
},
{
......@@ -1044,7 +994,7 @@
"asset": {
"__uuid__": "2ce7d58d-b6fe-4ef7-a128-de76f672a803"
},
"fileId": "f94BWi8LJI7LZb1nnh8wI/",
"fileId": "bdj7Z5C1hG9ZUpslIq23db",
"sync": false
},
{
......@@ -1057,6 +1007,9 @@
"_children": [],
"_active": false,
"_components": [
{
"__id__": 29
},
{
"__id__": 30
}
......@@ -1074,8 +1027,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 130,
"height": 130
"width": 397,
"height": 139
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......@@ -1086,8 +1039,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
14.364,
-3.482,
0,
0,
0,
0,
0,
......@@ -1116,7 +1069,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 29
"__id__": 28
},
"_enabled": true,
"_materials": [
......@@ -1143,6 +1096,33 @@
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 28
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 45,
"_left": -23,
"_right": -23,
"_top": -23,
"_bottom": -23,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 170,
"_originalHeight": 100,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
......@@ -1618,7 +1598,7 @@
},
"_enabled": true,
"quan": {
"__id__": 29
"__id__": 28
},
"tipsAnim": {
"__id__": 4
......@@ -1639,7 +1619,13 @@
"__id__": 20
},
"icon_stop": {
"__id__": 23
"__id__": 24
},
"quan_lan": {
"__uuid__": "7651dd7c-f921-4f71-8006-4f25714d24b9"
},
"quan_huang": {
"__uuid__": "4b7d087b-846b-42be-a0fd-0680a9428b88"
},
"_id": ""
},
......
......@@ -12,6 +12,8 @@ cc.Class({
btnX: cc.Node,
icon_play: cc.Node,
icon_stop: cc.Node,
quan_lan: cc.SpriteFrame,
quan_huang: cc.SpriteFrame
},
data: null,
......@@ -21,7 +23,8 @@ cc.Class({
this.quan.active = false
this.tipsAnim.node.active = false
this.handAnim.node.active = false
this.btnX.active = false
// this.btnX.active = false
this.icon_stop.active = false
},
onEnable() {
......@@ -52,46 +55,67 @@ cc.Class({
},
onTouchStart() {
if (this._playing) return
if (this.audioId) return
if (this.data) {
this.btnX.active = true
if (this.data.pic_url && this.data.gIdx == 0) {
tools.getSpriteFrimeByUrl(this.data.pic_url, (sp) => {
this.sprite.spriteFrame = sp
this.sprite.node.width = this.node.width
this.sprite.node.height = this.node.height
this.sprite.node.active = true
})
}
if (this.data.useBorder) {
this.quan.active = true
}
this.handAnim.stop()
this.handAnim.node.active = false
if (!this._playing) {
this._playing = true
cc.systemEvent.once('stopMusic', this.onStopAudio, this)
let id = cc.audioEngine.play(this.tipClip)
cc.audioEngine.setFinishCallback(id, () => {
if (onlyOne != this) {
this._playing = false
return
}
let url = this.data.audio_url
if (url && url != '') {
this.playAudio(url)
} else {
this._playing = false
}
})
return new Promise((resolve, reject) => {
if (this._playing || this.audioId) {
//增加暂停功能。
this._playing = false;
//播放切换
this.icon_play.active = true;
this.icon_stop.active = false;
if (!this.audioId) return;
cc.audioEngine.stop(this.audioId);
return
}
if (this.data) {
this.quan.getComponent(cc.Sprite).spriteFrame = this.quan_lan;
// this.btnX.active = true
this.icon_stop.active = true
this.icon_play.active = false;
if (this.data.pic_url && this.data.gIdx == 0) {
tools.getSpriteFrimeByUrl(this.data.pic_url, (sp) => {
this.sprite.spriteFrame = sp
this.sprite.node.width = this.node.width
this.sprite.node.height = this.node.height
this.sprite.node.active = true
})
}
if (this.data.useBorder) {
this.quan.active = true
}
this.handAnim.stop()
this.handAnim.node.active = false
if (!this._playing) {
this._playing = true
cc.systemEvent.once('stopMusic', this.onStopAudio, this)
let id = cc.audioEngine.play(this.tipClip)
cc.audioEngine.setFinishCallback(id, () => {
if (onlyOne != this) {
this._playing = false
return
}
let url = this.data.audio_url
if (url && url != '') {
this.playAudio(url)
} else {
this._playing = false
}
})
}
if (onlyOne && onlyOne != this) {
onlyOne.hideBox()
if (onlyOne && onlyOne != this) {
onlyOne.hideBox()
}
onlyOne = this
}
onlyOne = this
}
if (this.timer) clearInterval(this.timer);
this.timer = setInterval(() => {
if (!this._playing) {
if (this.timer) clearInterval(this.timer);
this.timer = null;
resolve('');
}
}, 60);
});
},
onClickHide() {
......@@ -102,7 +126,8 @@ cc.Class({
/**隐藏边框 */
hideBox() {
this.quan.active = false
this.btnX.active = false
// this.btnX.active = false
this.icon_stop.active = false
this.stopAudio()
},
......@@ -113,8 +138,8 @@ cc.Class({
if (!this._playing) return
this.audioId = cc.audioEngine.play(audioClip, false, 0.8);
cc.audioEngine.setFinishCallback(this.audioId, this.stopAudio.bind(this));
this.tipsAnim.node.active = true
this.tipsAnim.play()
// this.tipsAnim.node.active = true
// this.tipsAnim.play()
});
},
......@@ -128,8 +153,11 @@ cc.Class({
cc.audioEngine.stop(this.audioId)
this.audioId = null
}
this.tipsAnim.stop()
this.tipsAnim.node.active = false
// this.tipsAnim.stop()
// this.tipsAnim.node.active = false
//变成黄色框框
this.quan.getComponent(cc.Sprite).spriteFrame = this.quan_huang;
this.icon_stop.active = false;
cc.systemEvent.off('stopMusic', this.onStopAudio, this)
},
/** 音频id */
......
......@@ -62,7 +62,28 @@ cc.Class({
}
})
},
autoTouchAll() {
if (!this.autoPlay) {
this.autoPlay = true;
this.items = this._items.children;
this.count = 0;
this.play();
}
},
play() {
if (!this.autoPlay) return cc.systemEvent.emit('stopAutoPlay');
let item = this.items[this.count++];
if (!item) return cc.systemEvent.emit('stopAutoPlay');
item.getComponent('hitItem').onTouchStart().then(() => {
this.play()
});
},
stopTouchAll() {
if (this.autoPlay) {
this.autoPlay = false;
cc.systemEvent.emit('stopMusic')
}
},
/** 清除item */
clearItems() {
this._items.removeAllChildren(true)
......
......@@ -84,28 +84,31 @@
"__id__": 16
},
{
"__id__": 26
"__id__": 18
},
{
"__id__": 36
"__id__": 28
},
{
"__id__": 45
"__id__": 38
},
{
"__id__": 57
"__id__": 47
},
{
"__id__": 59
}
],
"_active": true,
"_components": [
{
"__id__": 59
"__id__": 63
},
{
"__id__": 60
"__id__": 64
},
{
"__id__": 61
"__id__": 65
}
],
"_prefab": null,
......@@ -700,7 +703,7 @@
},
{
"__type__": "cc.Node",
"_name": "btn_return0",
"_name": "movepage",
"_objFlags": 0,
"_parent": {
"__id__": 2
......@@ -721,6 +724,138 @@
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1280,
"height": 720
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "e4V8YQBbRNI51k6GFgtuXT"
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 14
},
"_enabled": true,
"_normalMaterial": null,
"_grayMaterial": null,
"duration": 0.1,
"zoomScale": 1.2,
"clickEvents": [],
"_N$interactable": true,
"_N$enableAutoGrayEffect": false,
"_N$transition": 0,
"transition": 0,
"_N$normalColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"_N$hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$disabledColor": {
"__type__": "cc.Color",
"r": 124,
"g": 124,
"b": 124,
"a": 255
},
"_N$normalSprite": null,
"_N$pressedSprite": null,
"pressedSprite": null,
"_N$hoverSprite": null,
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": {
"__id__": 14
},
"_id": "96AjuET6lOZqCrE/JpgXnK"
},
{
"__type__": "cc.Node",
"_name": "btn_return0",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 17
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 82,
......@@ -765,7 +900,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 14
"__id__": 16
},
"_enabled": true,
"_materials": [
......@@ -800,23 +935,23 @@
"__id__": 2
},
"_children": [
{
"__id__": 17
},
{
"__id__": 19
},
{
"__id__": 21
},
{
"__id__": 23
}
],
"_active": true,
"_components": [
{
"__id__": 23
"__id__": 25
},
{
"__id__": 24
"__id__": 26
}
],
"_prefab": null,
......@@ -872,13 +1007,13 @@
"_name": "0",
"_objFlags": 0,
"_parent": {
"__id__": 16
"__id__": 18
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 18
"__id__": 20
}
],
"_prefab": null,
......@@ -934,7 +1069,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 17
"__id__": 19
},
"_enabled": true,
"_materials": [
......@@ -966,13 +1101,13 @@
"_name": "1",
"_objFlags": 0,
"_parent": {
"__id__": 16
"__id__": 18
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 20
"__id__": 22
}
],
"_prefab": null,
......@@ -1028,7 +1163,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 19
"__id__": 21
},
"_enabled": true,
"_materials": [
......@@ -1060,13 +1195,13 @@
"_name": "2",
"_objFlags": 0,
"_parent": {
"__id__": 16
"__id__": 18
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 22
"__id__": 24
}
],
"_prefab": null,
......@@ -1122,7 +1257,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 21
"__id__": 23
},
"_enabled": true,
"_materials": [
......@@ -1154,17 +1289,17 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 16
"__id__": 18
},
"_enabled": true,
"btn0": {
"__id__": 17
"__id__": 19
},
"btn1": {
"__id__": 19
"__id__": 21
},
"btn2": {
"__id__": 21
"__id__": 23
},
"_id": "e8TJXgO+9BVaJxqHj7bagF"
},
......@@ -1173,7 +1308,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 16
"__id__": 18
},
"_enabled": true,
"_normalMaterial": null,
......@@ -1182,7 +1317,7 @@
"zoomScale": 1.2,
"clickEvents": [
{
"__id__": 25
"__id__": 27
}
],
"_N$interactable": true,
......@@ -1238,7 +1373,7 @@
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": {
"__id__": 16
"__id__": 18
},
"_id": "ede/L01tZPn5z0KzF82UmH"
},
......@@ -1261,22 +1396,22 @@
},
"_children": [
{
"__id__": 27
"__id__": 29
},
{
"__id__": 30
"__id__": 32
},
{
"__id__": 31
"__id__": 33
},
{
"__id__": 33
"__id__": 35
}
],
"_active": true,
"_components": [
{
"__id__": 35
"__id__": 37
}
],
"_prefab": null,
......@@ -1332,16 +1467,16 @@
"_name": "icon",
"_objFlags": 0,
"_parent": {
"__id__": 26
"__id__": 28
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 28
"__id__": 30
},
{
"__id__": 29
"__id__": 31
}
],
"_prefab": null,
......@@ -1397,7 +1532,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 27
"__id__": 29
},
"_enabled": true,
"_materials": [
......@@ -1427,7 +1562,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 27
"__id__": 29
},
"_enabled": true,
"alignMode": 1,
......@@ -1454,7 +1589,7 @@
"_name": "items",
"_objFlags": 0,
"_parent": {
"__id__": 26
"__id__": 28
},
"_children": [],
"_active": true,
......@@ -1512,13 +1647,13 @@
"_name": "bg_move",
"_objFlags": 0,
"_parent": {
"__id__": 26
"__id__": 28
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 32
"__id__": 34
}
],
"_prefab": null,
......@@ -1574,7 +1709,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 31
"__id__": 33
},
"_enabled": true,
"_materials": [
......@@ -1606,13 +1741,13 @@
"_name": "bg_move",
"_objFlags": 0,
"_parent": {
"__id__": 26
"__id__": 28
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 34
"__id__": 36
}
],
"_prefab": null,
......@@ -1668,7 +1803,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 33
"__id__": 35
},
"_enabled": true,
"_materials": [
......@@ -1700,7 +1835,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 26
"__id__": 28
},
"_enabled": true,
"hitPre": {
......@@ -1708,10 +1843,10 @@
},
"borders": [
{
"__id__": 31
"__id__": 33
},
{
"__id__": 33
"__id__": 35
}
],
"_id": "25htXxEOZC+47ROkvoLV/U"
......@@ -1724,23 +1859,23 @@
"__id__": 2
},
"_children": [
{
"__id__": 37
},
{
"__id__": 39
},
{
"__id__": 40
"__id__": 41
},
{
"__id__": 42
},
{
"__id__": 44
}
],
"_active": true,
"_components": [
{
"__id__": 44
"__id__": 46
}
],
"_prefab": null,
......@@ -1796,13 +1931,13 @@
"_name": "icon",
"_objFlags": 0,
"_parent": {
"__id__": 36
"__id__": 38
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 38
"__id__": 40
}
],
"_prefab": null,
......@@ -1858,7 +1993,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 37
"__id__": 39
},
"_enabled": true,
"_materials": [
......@@ -1888,7 +2023,7 @@
"_name": "items",
"_objFlags": 0,
"_parent": {
"__id__": 36
"__id__": 38
},
"_children": [],
"_active": true,
......@@ -1946,13 +2081,13 @@
"_name": "bg_move",
"_objFlags": 0,
"_parent": {
"__id__": 36
"__id__": 38
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 41
"__id__": 43
}
],
"_prefab": null,
......@@ -2008,7 +2143,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 40
"__id__": 42
},
"_enabled": true,
"_materials": [
......@@ -2040,13 +2175,13 @@
"_name": "bg_move",
"_objFlags": 0,
"_parent": {
"__id__": 36
"__id__": 38
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 43
"__id__": 45
}
],
"_prefab": null,
......@@ -2102,7 +2237,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 42
"__id__": 44
},
"_enabled": true,
"_materials": [
......@@ -2134,7 +2269,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 36
"__id__": 38
},
"_enabled": true,
"hitPre": {
......@@ -2142,10 +2277,10 @@
},
"borders": [
{
"__id__": 40
"__id__": 42
},
{
"__id__": 42
"__id__": 44
}
],
"_id": "89aCQ7yHtOn4s8onn5MbAu"
......@@ -2159,19 +2294,19 @@
},
"_children": [
{
"__id__": 46
"__id__": 48
},
{
"__id__": 48
"__id__": 50
},
{
"__id__": 52
"__id__": 54
}
],
"_active": false,
"_components": [
{
"__id__": 56
"__id__": 58
}
],
"_prefab": null,
......@@ -2227,13 +2362,13 @@
"_name": "bg_bottom",
"_objFlags": 0,
"_parent": {
"__id__": 45
"__id__": 47
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 47
"__id__": 49
}
],
"_prefab": null,
......@@ -2289,7 +2424,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 46
"__id__": 48
},
"_enabled": true,
"_materials": [
......@@ -2321,16 +2456,16 @@
"_name": "btn_left",
"_objFlags": 0,
"_parent": {
"__id__": 45
"__id__": 47
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 49
"__id__": 51
},
{
"__id__": 51
"__id__": 53
}
],
"_prefab": null,
......@@ -2386,7 +2521,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 48
"__id__": 50
},
"_enabled": true,
"_normalMaterial": null,
......@@ -2395,7 +2530,7 @@
"zoomScale": 1.1,
"clickEvents": [
{
"__id__": 50
"__id__": 52
}
],
"_N$interactable": true,
......@@ -2468,7 +2603,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 48
"__id__": 50
},
"_enabled": true,
"_materials": [
......@@ -2500,16 +2635,16 @@
"_name": "btn_right",
"_objFlags": 0,
"_parent": {
"__id__": 45
"__id__": 47
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 53
"__id__": 55
},
{
"__id__": 55
"__id__": 57
}
],
"_prefab": null,
......@@ -2565,7 +2700,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 52
"__id__": 54
},
"_enabled": true,
"_normalMaterial": null,
......@@ -2574,7 +2709,7 @@
"zoomScale": 1.1,
"clickEvents": [
{
"__id__": 54
"__id__": 56
}
],
"_N$interactable": true,
......@@ -2647,7 +2782,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 52
"__id__": 54
},
"_enabled": true,
"_materials": [
......@@ -2679,7 +2814,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 45
"__id__": 47
},
"_enabled": true,
"alignMode": 1,
......@@ -2703,16 +2838,20 @@
},
{
"__type__": "cc.Node",
"_name": "bg_number0",
"_name": "page_num",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_children": [
{
"__id__": 60
}
],
"_active": true,
"_components": [
{
"__id__": 58
"__id__": 62
}
],
"_prefab": null,
......@@ -2763,12 +2902,107 @@
"groupIndex": 0,
"_id": "eagih76nJLMIM22wP2xG+F"
},
{
"__type__": "cc.Node",
"_name": "text",
"_objFlags": 0,
"_parent": {
"__id__": 59
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 61
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 55.61,
"height": 50.4
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "01qjlAGBlFLIsw1+YXE8rw"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 60
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "0/3",
"_N$string": "0/3",
"_fontSize": 40,
"_lineHeight": 40,
"_enableWrapText": true,
"_N$file": null,
"_isSystemFontUsed": true,
"_spacingX": 0,
"_batchAsBitmap": false,
"_styleFlags": 0,
"_underlineHeight": 0,
"_N$horizontalAlign": 1,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$cacheMode": 0,
"_id": "40jyz+uNtMWr+P2HAs9938"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 57
"__id__": 59
},
"_enabled": true,
"_materials": [
......@@ -2848,16 +3082,25 @@
},
"_enabled": true,
"picNode": {
"__id__": 26
"__id__": 28
},
"picTempNode": {
"__id__": 36
"__id__": 38
},
"leftNode": {
"__id__": 48
"__id__": 50
},
"rightNode": {
"__id__": 52
"__id__": 54
},
"pageNumNode": {
"__id__": 59
},
"movepageNode": {
"__id__": 14
},
"btn_audio": {
"__id__": 18
},
"btnClip": {
"__uuid__": "39ef1939-3bf9-4d21-a67a-bc1dede521a9"
......
......@@ -20,6 +20,18 @@ cc.Class({
type: cc.Node,
default: null
},
pageNumNode: {
type: cc.Node,
default: null
},
movepageNode: {
type: cc.Node,
default: null
},
btn_audio: {
type: cc.Node,
default: null
},
btnClip: cc.AudioClip
},
......@@ -156,6 +168,11 @@ cc.Class({
initView() {
this.initBg();
this.initPic();
this.initEvent();
},
initEvent() {
this.movepageNode.on(cc.Node.EventType.TOUCH_END, this.onTouchEnd, this)
cc.systemEvent.on('stopAutoPlay', this.stopAll, this);
},
initBg() {
......@@ -182,12 +199,25 @@ cc.Class({
},
curPage: null,
onTouchEnd(e) {
let touch = e.touch;
let startPoint = touch.getStartLocation();
let endPoint = touch.getLocation();
let moveX = endPoint.x - startPoint.x;
if (moveX < -100) {
this.onClickRight();
} else if (moveX > 100) {
this.onClickLeft();
}
},
onClickRight() {
if (!this._cantouch) {
return;
}
this.curPage += 1
if (this.curPage == this.data.length) this.curPage = 0;
if (this.curPage == 1) {
this.leftNode.active = true
......@@ -220,18 +250,26 @@ cc.Class({
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();//执行暂停的方法
this.stopAll();
} else {
this.isPlaying = true;
btn_loop.startPlay();//执行播放的方法
this.playAll();
}
},
playAll() {
this.isPlaying = true;
let btn_loop = this.btn_audio.getComponent("btn_loop");//找到btn_loop
btn_loop.startPlay();//执行播放的方法
this.picNode.getComponent('picNode').autoTouchAll()
},
stopAll() {
this.isPlaying = false;
let btn_loop = this.btn_audio.getComponent("btn_loop");//找到btn_loop
btn_loop.stopPlay();//执行暂停的方法
this.picNode.getComponent('picNode').stopTouchAll()
},
/** 左移动 */
leftMove() {
this.stopAudio()
......@@ -289,7 +327,11 @@ cc.Class({
return
}
picNode.getComponent('picNode').initWithData(data)
}
},
// ------------------------------------------
update() {
this.pageNumNode.getChildByName("text").getComponent(cc.Label).string = (this.curPage % this.data.length + 1) + "/" + this.data.length
}
});
//3.自动连读
\ 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