Commit a776f360 authored by 范雪寒's avatar 范雪寒

fix: 背景灰色问题

parent d6fd626a
...@@ -5029,7 +5029,7 @@ ...@@ -5029,7 +5029,7 @@
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"showInEditor": false, "showInEditor": false,
"_id": "a0DI3wnSlDtoX/5+8lj8A9" "_id": "fbT3/HD7BM3ZIRrqTwg7pM"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
...@@ -5064,7 +5064,7 @@ ...@@ -5064,7 +5064,7 @@
"_N$fontFamily": "Arial", "_N$fontFamily": "Arial",
"_N$overflow": 0, "_N$overflow": 0,
"_N$cacheMode": 0, "_N$cacheMode": 0,
"_id": "86pwtkSJlGGbSXuOS4QhBY" "_id": "b58LYowIRKhIoOK3R4ONO0"
}, },
{ {
"__type__": "cc.LabelOutline", "__type__": "cc.LabelOutline",
...@@ -5082,7 +5082,7 @@ ...@@ -5082,7 +5082,7 @@
"a": 255 "a": 255
}, },
"_width": 3, "_width": 3,
"_id": "66RHBQcZBPbbdBJncRyyou" "_id": "dab7maOSFFP5ymL2UZruJu"
}, },
{ {
"__type__": "cc.RichText", "__type__": "cc.RichText",
...@@ -5136,7 +5136,7 @@ ...@@ -5136,7 +5136,7 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 80.53, "width": 88.53,
"height": 151.2 "height": 151.2
}, },
"_anchorPoint": { "_anchorPoint": {
...@@ -5213,8 +5213,8 @@ ...@@ -5213,8 +5213,8 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
-40.265, -44.265,
-78.6, -82.6,
0, 0,
0, 0,
0, 0,
...@@ -5237,7 +5237,7 @@ ...@@ -5237,7 +5237,7 @@
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"showInEditor": false, "showInEditor": false,
"_id": "e5KH327XhGXLYaumqnfyAY" "_id": "abqpSzikhIBblwpQihEpm2"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
...@@ -5272,7 +5272,7 @@ ...@@ -5272,7 +5272,7 @@
"_N$fontFamily": "Arial", "_N$fontFamily": "Arial",
"_N$overflow": 0, "_N$overflow": 0,
"_N$cacheMode": 0, "_N$cacheMode": 0,
"_id": "a08HIlwp9GeoKjWSA3RZc5" "_id": "714egPTAJMFLuvy8uQ/5BZ"
}, },
{ {
"__type__": "cc.LabelOutline", "__type__": "cc.LabelOutline",
...@@ -5290,7 +5290,7 @@ ...@@ -5290,7 +5290,7 @@
"a": 255 "a": 255
}, },
"_width": 7, "_width": 7,
"_id": "1fgZsTY/VFA72Rl0Y4HxZJ" "_id": "fbl63dcs5L470d+TZyH6y2"
}, },
{ {
"__type__": "cc.RichText", "__type__": "cc.RichText",
...@@ -8580,7 +8580,7 @@ ...@@ -8580,7 +8580,7 @@
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"showInEditor": false, "showInEditor": false,
"_id": "b5rbBDSPpDEIoriOEcjh2g" "_id": "67KTW7PZxFcaiol2lKWqNh"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
...@@ -8615,7 +8615,7 @@ ...@@ -8615,7 +8615,7 @@
"_N$fontFamily": "Arial", "_N$fontFamily": "Arial",
"_N$overflow": 0, "_N$overflow": 0,
"_N$cacheMode": 0, "_N$cacheMode": 0,
"_id": "93VZFnW7hHnr/ZLiwGlQBd" "_id": "00hZVuF/RFPakORS8zwxMU"
}, },
{ {
"__type__": "cc.LabelOutline", "__type__": "cc.LabelOutline",
...@@ -8633,7 +8633,7 @@ ...@@ -8633,7 +8633,7 @@
"a": 255 "a": 255
}, },
"_width": 7, "_width": 7,
"_id": "49hYKyxC9A4Jw3G+WTj2q+" "_id": "33MpJ6N7dLmJU379gOczOo"
}, },
{ {
"__type__": "cc.RichText", "__type__": "cc.RichText",
...@@ -8788,7 +8788,7 @@ ...@@ -8788,7 +8788,7 @@
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"showInEditor": false, "showInEditor": false,
"_id": "d1j+3y5aBFmKRqw2ktqJ+d" "_id": "065tofagVGeb+7B9QHif8f"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
...@@ -8823,7 +8823,7 @@ ...@@ -8823,7 +8823,7 @@
"_N$fontFamily": "Arial", "_N$fontFamily": "Arial",
"_N$overflow": 0, "_N$overflow": 0,
"_N$cacheMode": 0, "_N$cacheMode": 0,
"_id": "275l3QI3pH0aRKVOnV5AAV" "_id": "d9yLf1Pn9GRpwWXhycQIms"
}, },
{ {
"__type__": "cc.LabelOutline", "__type__": "cc.LabelOutline",
...@@ -8841,7 +8841,7 @@ ...@@ -8841,7 +8841,7 @@
"a": 255 "a": 255
}, },
"_width": 3, "_width": 3,
"_id": "b08rU8eMNKVJ3/jkqtJaaw" "_id": "fbrDrcS5ZH179b6hMrWvAB"
}, },
{ {
"__type__": "cc.RichText", "__type__": "cc.RichText",
...@@ -11934,7 +11934,7 @@ ...@@ -11934,7 +11934,7 @@
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"showInEditor": false, "showInEditor": false,
"_id": "86xZBlSghHmpHtNv4qsgWE" "_id": "8fZ/4AQ8lK7KCAiU3vfvC4"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
...@@ -11969,7 +11969,7 @@ ...@@ -11969,7 +11969,7 @@
"_N$fontFamily": "Arial", "_N$fontFamily": "Arial",
"_N$overflow": 0, "_N$overflow": 0,
"_N$cacheMode": 0, "_N$cacheMode": 0,
"_id": "40sdCdlGVJtYw9Vp6pgF6p" "_id": "f8BZmE9lZJ8LqfUVpLvDIE"
}, },
{ {
"__type__": "cc.LabelOutline", "__type__": "cc.LabelOutline",
...@@ -11987,7 +11987,7 @@ ...@@ -11987,7 +11987,7 @@
"a": 255 "a": 255
}, },
"_width": 7, "_width": 7,
"_id": "d3+M8qHABHpqGYXVv708o0" "_id": "b1kBVGcZlC0KtbA24pVthy"
}, },
{ {
"__type__": "cc.RichText", "__type__": "cc.RichText",
...@@ -12142,7 +12142,7 @@ ...@@ -12142,7 +12142,7 @@
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"showInEditor": false, "showInEditor": false,
"_id": "9fsf/afhVA06iMwa+RbRYD" "_id": "81fG5rb9NJKa6+g7rFPVHF"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
...@@ -12177,7 +12177,7 @@ ...@@ -12177,7 +12177,7 @@
"_N$fontFamily": "Arial", "_N$fontFamily": "Arial",
"_N$overflow": 0, "_N$overflow": 0,
"_N$cacheMode": 0, "_N$cacheMode": 0,
"_id": "41oBcQ2sFDxqrrhXDFsawQ" "_id": "38FEBOkAdDcaTNokqxUrF9"
}, },
{ {
"__type__": "cc.LabelOutline", "__type__": "cc.LabelOutline",
...@@ -12195,7 +12195,7 @@ ...@@ -12195,7 +12195,7 @@
"a": 255 "a": 255
}, },
"_width": 3, "_width": 3,
"_id": "f03sDb1nlOEpvDgGbc2uRp" "_id": "2aq3zwdnlLDZnfKo+5Mjy8"
}, },
{ {
"__type__": "cc.RichText", "__type__": "cc.RichText",
...@@ -15485,7 +15485,7 @@ ...@@ -15485,7 +15485,7 @@
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"showInEditor": false, "showInEditor": false,
"_id": "d9dJv0B9RHwZ5kUIdyLA25" "_id": "b84OetcPZMyLtRMUxWsY3o"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
...@@ -15520,7 +15520,7 @@ ...@@ -15520,7 +15520,7 @@
"_N$fontFamily": "Arial", "_N$fontFamily": "Arial",
"_N$overflow": 0, "_N$overflow": 0,
"_N$cacheMode": 0, "_N$cacheMode": 0,
"_id": "373/HIpnZDJ4fbrTkSacY/" "_id": "67VvFCAjFODrsBhLZ2PAnh"
}, },
{ {
"__type__": "cc.LabelOutline", "__type__": "cc.LabelOutline",
...@@ -15538,7 +15538,7 @@ ...@@ -15538,7 +15538,7 @@
"a": 255 "a": 255
}, },
"_width": 7, "_width": 7,
"_id": "03cKy3e+dLKoPC7ecRc+pS" "_id": "63FC+oLghB7ajwIsfCh/pL"
}, },
{ {
"__type__": "cc.RichText", "__type__": "cc.RichText",
...@@ -15693,7 +15693,7 @@ ...@@ -15693,7 +15693,7 @@
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"showInEditor": false, "showInEditor": false,
"_id": "19uyisRrtP5Zi9P+nhFxCc" "_id": "1d8kuo6OZLUp3kGmcesdCf"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
...@@ -15728,7 +15728,7 @@ ...@@ -15728,7 +15728,7 @@
"_N$fontFamily": "Arial", "_N$fontFamily": "Arial",
"_N$overflow": 0, "_N$overflow": 0,
"_N$cacheMode": 0, "_N$cacheMode": 0,
"_id": "a4A/t40b1CzLAPBCNlZYPV" "_id": "02j/QHq85A/ow6PXCF6AaQ"
}, },
{ {
"__type__": "cc.LabelOutline", "__type__": "cc.LabelOutline",
...@@ -15746,7 +15746,7 @@ ...@@ -15746,7 +15746,7 @@
"a": 255 "a": 255
}, },
"_width": 3, "_width": 3,
"_id": "de4lc1p+JJ46ez8wQ5p4tJ" "_id": "99GZDoCdFE5aao2T6koJee"
}, },
{ {
"__type__": "cc.RichText", "__type__": "cc.RichText",
...@@ -15846,9 +15846,6 @@ ...@@ -15846,9 +15846,6 @@
"_materials": [ "_materials": [
{ {
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
},
{
"__uuid__": "3a7bb79f-32fd-422e-ada2-96f518fed422"
} }
], ],
"_srcBlendFactor": 770, "_srcBlendFactor": 770,
...@@ -16149,7 +16146,7 @@ ...@@ -16149,7 +16146,7 @@
"width": 1280, "width": 1280,
"height": 720 "height": 720
}, },
"_fitWidth": true, "_fitWidth": false,
"_fitHeight": true, "_fitHeight": true,
"_id": "59Cd0ovbdF4byw5sbjJDx7" "_id": "59Cd0ovbdF4byw5sbjJDx7"
}, },
......
...@@ -65,42 +65,60 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -65,42 +65,60 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
async initView() { async initView() {
const touchboard = cc.find('Canvas/touchboard');
const contant = cc.find('Canvas/touchboard/contant');
const scale = touchboard.height / contant.height;
contant.width = 4400 * scale;
contant.height = 720 * scale;
contant.scale = scale;
contant.x = contant.width / 2 - touchboard.width / 2;
const bg = cc.find('Canvas/touchboard/contant/bg'); const bg = cc.find('Canvas/touchboard/contant/bg');
for (let i = 0; i < 36; i++) { for (let i = 0; i < 36; i++) {
const btn = seekChildByName(bg, `btn_${i}`); const btn = seekChildByName(bg, `btn_${i}`);
const row = this.rows[i]; const row = this.rows[i];
if (row && !row.locked) { if (row && !row.locked) {
this.changeNodeColor(btn); this.setSpriteColor(btn, cc.color(255, 255, 255));
this.changeNodeColor(btn.getChildByName('icon'));
this.changeNodeColor(btn.getChildByName('icon1'));
this.changeNodeColor(btn.getChildByName('icon2'));
} else { } else {
this.changeNodeGray(btn); this.setSpriteColor(btn, cc.color(200, 200, 200));
this.changeNodeGray(btn.getChildByName('icon'));
this.changeNodeGray(btn.getChildByName('icon1'));
this.changeNodeGray(btn.getChildByName('icon2'));
} }
} }
} }
changeNodeGray(node) { changeNodeGray(node) {
const sprite: cc.Sprite = node.getComponent(cc.Sprite); if (!node) {
if (sprite) { return;
node.color = cc.color(200, 200, 200);
// let material = cc.Material.createWithBuiltin('2d-gray-sprite', 0);
// let variant1 = cc.MaterialVariant.create(material, sprite);
// sprite.setMaterial(0, variant1);
} }
let material = cc.Material.createWithBuiltin('2d-gray-sprite', 0);
node.children.forEach(child => { const sprite = node.getComponent(cc.Sprite);
this.changeNodeGray(child); let variant1 = cc.MaterialVariant.create(material, sprite);
}); sprite.setMaterial(0, variant1);
} }
changeNodeColor(node) { changeNodeColor(node) {
const sprite: cc.Sprite = node.getComponent(cc.Sprite); if (!node) {
if (sprite) { return;
node.color = cc.color(255, 255, 255); }
// let material = cc.Material.createWithBuiltin('2d-sprite', 0); let material = cc.Material.createWithBuiltin('2d-sprite', 0);
// let variant1 = cc.MaterialVariant.create(material, sprite); const sprite = node.getComponent(cc.Sprite);
// sprite.setMaterial(0, variant1); let variant1 = cc.MaterialVariant.create(material, sprite);
sprite.setMaterial(0, variant1);
} }
setSpriteColor(node, color) {
node.color = cc.color(color.r, color.g, color.b);
node.children.forEach(child => { node.children.forEach(child => {
this.changeNodeColor(child); if (child.getComponent(cc.Sprite)) {
this.setSpriteColor(child, color);
}
if (child.getComponent(cc.RichText)) {
this.setSpriteColor(child, color);
}
}); });
} }
......
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