Commit ddf1ee56 authored by linzhiguo's avatar linzhiguo

+ 地鼠贴纸移到屏幕右上

parent 85b576e6
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
"__id__": 2 "__id__": 2
}, },
{ {
"__id__": 113 "__id__": 115
} }
], ],
"_active": false, "_active": false,
...@@ -117,25 +117,25 @@ ...@@ -117,25 +117,25 @@
"__id__": 93 "__id__": 93
}, },
{ {
"__id__": 99 "__id__": 101
}, },
{ {
"__id__": 101 "__id__": 103
}, },
{ {
"__id__": 108 "__id__": 110
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 110 "__id__": 112
}, },
{ {
"__id__": 111 "__id__": 113
}, },
{ {
"__id__": 112 "__id__": 114
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -869,9 +869,9 @@ ...@@ -869,9 +869,9 @@
"_enabled": true, "_enabled": true,
"_color": { "_color": {
"__type__": "cc.Color", "__type__": "cc.Color",
"r": 226, "r": 182,
"g": 141, "g": 94,
"b": 14, "b": 23,
"a": 255 "a": 255
}, },
"_width": 6, "_width": 6,
...@@ -4258,6 +4258,12 @@ ...@@ -4258,6 +4258,12 @@
"_components": [ "_components": [
{ {
"__id__": 98 "__id__": 98
},
{
"__id__": 99
},
{
"__id__": 100
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -4271,20 +4277,20 @@ ...@@ -4271,20 +4277,20 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 1280, "width": 780,
"height": 30 "height": 30
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
"x": 0.5, "x": 1,
"y": 0.5 "y": 0.5
}, },
"_trs": { "_trs": {
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
0, 640,
-341, 315,
0, 0,
0, 0,
0, 0,
...@@ -4306,7 +4312,7 @@ ...@@ -4306,7 +4312,7 @@
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"_id": "30xV2vpmdOeqx45F2iY36d" "_id": "52btPG45tL0InSMuKCrFxC"
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
...@@ -4345,7 +4351,7 @@ ...@@ -4345,7 +4351,7 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
-44, -50,
0, 0,
0, 0,
0, 0,
...@@ -4439,8 +4445,8 @@ ...@@ -4439,8 +4445,8 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
0, -93,
0, -1,
0, 0,
0, 0,
0, 0,
...@@ -4496,6 +4502,68 @@ ...@@ -4496,6 +4502,68 @@
"_atlas": null, "_atlas": null,
"_id": "06yCQ5yl5LDLPKtEid9n6V" "_id": "06yCQ5yl5LDLPKtEid9n6V"
}, },
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 93
},
"_enabled": false,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": null,
"_type": 1,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "379q3VZPxF35Y4uHraUMwZ"
},
{
"__type__": "cc.Layout",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 93
},
"_enabled": true,
"_layoutSize": {
"__type__": "cc.Size",
"width": 780,
"height": 30
},
"_resize": 0,
"_N$layoutType": 1,
"_N$cellSize": {
"__type__": "cc.Size",
"width": 40,
"height": 40
},
"_N$startAxis": 0,
"_N$paddingLeft": 0,
"_N$paddingRight": 30,
"_N$paddingTop": 0,
"_N$paddingBottom": 0,
"_N$spacingX": 2,
"_N$spacingY": 0,
"_N$verticalDirection": 1,
"_N$horizontalDirection": 1,
"_N$affectedByScale": true,
"_id": "b8BkZ+DQ1E3ZR93xOFmeZG"
},
{ {
"__type__": "cc.Widget", "__type__": "cc.Widget",
"_name": "", "_name": "",
...@@ -4506,11 +4574,11 @@ ...@@ -4506,11 +4574,11 @@
"_enabled": true, "_enabled": true,
"alignMode": 1, "alignMode": 1,
"_target": null, "_target": null,
"_alignFlags": 44, "_alignFlags": 33,
"_left": 0, "_left": 0,
"_right": 0, "_right": 0,
"_top": 0, "_top": 30,
"_bottom": 4, "_bottom": 0,
"_verticalCenter": 0, "_verticalCenter": 0,
"_horizontalCenter": 0, "_horizontalCenter": 0,
"_isAbsLeft": true, "_isAbsLeft": true,
...@@ -4519,9 +4587,9 @@ ...@@ -4519,9 +4587,9 @@
"_isAbsBottom": true, "_isAbsBottom": true,
"_isAbsHorizontalCenter": true, "_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true, "_isAbsVerticalCenter": true,
"_originalWidth": 1280, "_originalWidth": 0,
"_originalHeight": 0, "_originalHeight": 0,
"_id": "19tmH5uNFGIaSe/DxTiXGh" "_id": "ecMxksS+BCgIAF27fSd43e"
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
...@@ -4534,7 +4602,7 @@ ...@@ -4534,7 +4602,7 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 100 "__id__": 102
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -4590,7 +4658,7 @@ ...@@ -4590,7 +4658,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 99 "__id__": 101
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -4626,19 +4694,19 @@ ...@@ -4626,19 +4694,19 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 102 "__id__": 104
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 105 "__id__": 107
}, },
{ {
"__id__": 106 "__id__": 108
}, },
{ {
"__id__": 107 "__id__": 109
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -4694,16 +4762,16 @@ ...@@ -4694,16 +4762,16 @@
"_name": "timer1", "_name": "timer1",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 101 "__id__": 103
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 103 "__id__": 105
}, },
{ {
"__id__": 104 "__id__": 106
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -4759,7 +4827,7 @@ ...@@ -4759,7 +4827,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 102 "__id__": 104
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -4794,7 +4862,7 @@ ...@@ -4794,7 +4862,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 102 "__id__": 104
}, },
"_enabled": true, "_enabled": true,
"_color": { "_color": {
...@@ -4812,7 +4880,7 @@ ...@@ -4812,7 +4880,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 101 "__id__": 103
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -4847,7 +4915,7 @@ ...@@ -4847,7 +4915,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 101 "__id__": 103
}, },
"_enabled": true, "_enabled": true,
"_color": { "_color": {
...@@ -4865,7 +4933,7 @@ ...@@ -4865,7 +4933,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 101 "__id__": 103
}, },
"_enabled": true, "_enabled": true,
"alignMode": 1, "alignMode": 1,
...@@ -4898,7 +4966,7 @@ ...@@ -4898,7 +4966,7 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 109 "__id__": 111
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -4954,7 +5022,7 @@ ...@@ -4954,7 +5022,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 108 "__id__": 110
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -5057,10 +5125,10 @@ ...@@ -5057,10 +5125,10 @@
"__id__": 16 "__id__": 16
}, },
"timer": { "timer": {
"__id__": 105 "__id__": 107
}, },
"timer1": { "timer1": {
"__id__": 103 "__id__": 105
}, },
"_id": "e687yyoRBIzZAOVRL8Sseh" "_id": "e687yyoRBIzZAOVRL8Sseh"
}, },
...@@ -5073,10 +5141,10 @@ ...@@ -5073,10 +5141,10 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 114 "__id__": 116
}, },
{ {
"__id__": 119 "__id__": 121
} }
], ],
"_active": true, "_active": true,
...@@ -5134,12 +5202,9 @@ ...@@ -5134,12 +5202,9 @@
"_name": "img", "_name": "img",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 113
},
"_children": [
{
"__id__": 115 "__id__": 115
}, },
"_children": [
{ {
"__id__": 117 "__id__": 117
} }
...@@ -5199,13 +5264,17 @@ ...@@ -5199,13 +5264,17 @@
"_name": "icon_0", "_name": "icon_0",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 114 "__id__": 116
}, },
"_children": [], "_children": [
{
"__id__": 118
}
],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 116 "__id__": 120
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -5256,50 +5325,18 @@ ...@@ -5256,50 +5325,18 @@
"groupIndex": 0, "groupIndex": 0,
"_id": "74Mb5j32tA8ZlEVbMzM+Go" "_id": "74Mb5j32tA8ZlEVbMzM+Go"
}, },
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 115
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "f621cffd-d037-44bf-9a08-6255948a6102"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "8cj+HJcTZE7av8/qic6e4+"
},
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "icon_1", "_name": "icon_1",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 114 "__id__": 117
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 118 "__id__": 119
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -5325,7 +5362,7 @@ ...@@ -5325,7 +5362,7 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
178.913, 0,
0, 0,
0, 0,
0, 0,
...@@ -5355,9 +5392,9 @@ ...@@ -5355,9 +5392,9 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 117 "__id__": 118
}, },
"_enabled": true, "_enabled": false,
"_materials": [ "_materials": [
{ {
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
...@@ -5382,16 +5419,48 @@ ...@@ -5382,16 +5419,48 @@
"_atlas": null, "_atlas": null,
"_id": "76ASsItQpBOLgqPb+9Mf8Y" "_id": "76ASsItQpBOLgqPb+9Mf8Y"
}, },
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 117
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "f621cffd-d037-44bf-9a08-6255948a6102"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "8cj+HJcTZE7av8/qic6e4+"
},
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "audio", "_name": "audio",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 113 "__id__": 115
}, },
"_children": [ "_children": [
{ {
"__id__": 120 "__id__": 122
} }
], ],
"_active": true, "_active": true,
...@@ -5449,13 +5518,13 @@ ...@@ -5449,13 +5518,13 @@
"_name": "btn", "_name": "btn",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 119 "__id__": 121
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 121 "__id__": 123
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -5511,7 +5580,7 @@ ...@@ -5511,7 +5580,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 120 "__id__": 122
}, },
"_enabled": true, "_enabled": true,
"_clip": null, "_clip": null,
......
...@@ -233,24 +233,24 @@ cc.Class({ ...@@ -233,24 +233,24 @@ cc.Class({
flag_area.removeAllChildren(); flag_area.removeAllChildren();
let node = cc.find('res/img/icon_0'); let node = cc.find('res/img/icon_0');
let mouses = this.data.mouses; let mouses = this.data.mouses;
let item, len = mouses.length;
let space = 4;
let _w = node.width;
let starx = len * (_w + space) - space; let lyt = flag_area.getComponent(cc.Layout);
starx = (starx * 0.5) * -1 - _w/2; let width = flag_area.width - lyt.paddingRight;
let padding_x = lyt.spacingX;
let item, len = mouses.length;
for(let i = 0; i < len; i++){ for(let i = 0; i < len; i++){
item = cc.instantiate(node); item = cc.instantiate(node);
flag_area.addChild(item); flag_area.addChild(item);
item.y = 0; item.y = 0;
item.x = starx + i * (_w + space); item.scale = this.Between(0.5, (width/len - padding_x)/item.width, 1);
} }
this._flag_index = 0; this._flag_index = 0;
cb && cb(); cb && cb();
}, },
nextMouse(){ nextMouse(){
let item, len = this.mouses.length; let item, len = this.mouses.length;
let mouse_id = RandomInt(len) let mouse_id = RandomInt(len)
...@@ -329,11 +329,15 @@ cc.Class({ ...@@ -329,11 +329,15 @@ cc.Class({
updateFlag(){ updateFlag(){
if (this._flag_index >= this.data.mouses.length) if (this._flag_index >= this.data.mouses.length)
return; return;
let idx = this.data.mouses.length - this._flag_index - 1;
let area = cc.find('Canvas/flag_area'); let area = cc.find('Canvas/flag_area');
let flag = area.children[this._flag_index].getComponent(cc.Sprite); let flag = area.children[idx].getComponent(cc.Sprite);
let icon = cc.find('res/img/icon_1').getComponent(cc.Sprite); flag.enabled = false;
flag.spriteFrame = icon.spriteFrame;
cc.tween(flag.node) let flag1 = flag.node.children[0];
flag1.getComponent(cc.Sprite).enabled = true;
cc.tween(flag1)
.to(0.1, {scale: 1.2},{ easing: 'quadIn' }) .to(0.1, {scale: 1.2},{ easing: 'quadIn' })
.to(0.2, {scale: 0.8},{ easing: 'quadOut' }) .to(0.2, {scale: 0.8},{ easing: 'quadOut' })
.to(0.1, {scale: 1},{ easing: 'quadIn' }) .to(0.1, {scale: 1},{ easing: 'quadIn' })
...@@ -383,6 +387,9 @@ cc.Class({ ...@@ -383,6 +387,9 @@ cc.Class({
}, },
// update (dt) {}, // update (dt) {},
Between(a, b, c) {
return [a, b, c].sort()[1];
},
// ------------------------------------------------ // ------------------------------------------------
getSprNode(resName) { getSprNode(resName) {
......
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