Commit 9fa39321 authored by 范雪寒's avatar 范雪寒

fix: 背景灰色问题

parent 2a15d45b
...@@ -6101,7 +6101,7 @@ ...@@ -6101,7 +6101,7 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 169.94, "width": 171.94,
"height": 63 "height": 63
}, },
"_anchorPoint": { "_anchorPoint": {
...@@ -6178,8 +6178,8 @@ ...@@ -6178,8 +6178,8 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
-84.97, -85.97,
-34.5, -35.5,
0, 0,
0, 0,
0, 0,
...@@ -6202,7 +6202,7 @@ ...@@ -6202,7 +6202,7 @@
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"showInEditor": false, "showInEditor": false,
"_id": "61VnAvvX5LTrGlELL7dpjG" "_id": "c5nhbNI4RMSbrFL6Kl78xV"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
...@@ -6235,7 +6235,7 @@ ...@@ -6235,7 +6235,7 @@
"_N$fontFamily": "Arial", "_N$fontFamily": "Arial",
"_N$overflow": 0, "_N$overflow": 0,
"_N$cacheMode": 0, "_N$cacheMode": 0,
"_id": "64IcTsDClPL6tJzp5yaFTX" "_id": "66U1JfBjFO5rncAeX2Ov5r"
}, },
{ {
"__type__": "cc.LabelOutline", "__type__": "cc.LabelOutline",
...@@ -6253,7 +6253,7 @@ ...@@ -6253,7 +6253,7 @@
"a": 255 "a": 255
}, },
"_width": 4, "_width": 4,
"_id": "945K0hEm5MUJgW0D/KxZg3" "_id": "61gASl8RlGlaPPAh7bEgpu"
}, },
{ {
"__type__": "cc.RichText", "__type__": "cc.RichText",
...@@ -6406,7 +6406,7 @@ ...@@ -6406,7 +6406,7 @@
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"showInEditor": false, "showInEditor": false,
"_id": "c1HCQ9yRhMc62pH8ixjJs5" "_id": "6519AK19JAhJXLOi4dFd2h"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
...@@ -6439,7 +6439,7 @@ ...@@ -6439,7 +6439,7 @@
"_N$fontFamily": "Arial", "_N$fontFamily": "Arial",
"_N$overflow": 0, "_N$overflow": 0,
"_N$cacheMode": 0, "_N$cacheMode": 0,
"_id": "45IA8ovq9O4InvquvEzW+F" "_id": "e8Kme7caNFjL7+pxPMNnLu"
}, },
{ {
"__type__": "cc.LabelOutline", "__type__": "cc.LabelOutline",
...@@ -6457,7 +6457,7 @@ ...@@ -6457,7 +6457,7 @@
"a": 255 "a": 255
}, },
"_width": 7, "_width": 7,
"_id": "14WKYLGNhI6JidrYDym2ws" "_id": "43ZSQAavtNObMkCb2P3gb/"
}, },
{ {
"__type__": "cc.RichText", "__type__": "cc.RichText",
...@@ -9354,7 +9354,7 @@ ...@@ -9354,7 +9354,7 @@
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"showInEditor": false, "showInEditor": false,
"_id": "91sTYQJbpNC5KUXsh3LcVQ" "_id": "2d4u3leZhDyaTXwhq8ut96"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
...@@ -9387,7 +9387,7 @@ ...@@ -9387,7 +9387,7 @@
"_N$fontFamily": "Arial", "_N$fontFamily": "Arial",
"_N$overflow": 0, "_N$overflow": 0,
"_N$cacheMode": 0, "_N$cacheMode": 0,
"_id": "74mBEzHspBq4bH6fyH7Nna" "_id": "17UytODGRPNr8c66k16WqB"
}, },
{ {
"__type__": "cc.LabelOutline", "__type__": "cc.LabelOutline",
...@@ -9405,7 +9405,7 @@ ...@@ -9405,7 +9405,7 @@
"a": 255 "a": 255
}, },
"_width": 7, "_width": 7,
"_id": "a59I5drERMHYXbbKWVe9NG" "_id": "70SB178G9D6JQ8zMisfLu8"
}, },
{ {
"__type__": "cc.RichText", "__type__": "cc.RichText",
...@@ -9457,7 +9457,7 @@ ...@@ -9457,7 +9457,7 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 169.94, "width": 171.94,
"height": 63 "height": 63
}, },
"_anchorPoint": { "_anchorPoint": {
...@@ -9534,8 +9534,8 @@ ...@@ -9534,8 +9534,8 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
-84.97, -85.97,
-34.5, -35.5,
0, 0,
0, 0,
0, 0,
...@@ -9558,7 +9558,7 @@ ...@@ -9558,7 +9558,7 @@
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"showInEditor": false, "showInEditor": false,
"_id": "fcaIrD2NVHLqn0ZMDMK8Wc" "_id": "89VHvdT8VP+KKH3m7SaEdD"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
...@@ -9591,7 +9591,7 @@ ...@@ -9591,7 +9591,7 @@
"_N$fontFamily": "Arial", "_N$fontFamily": "Arial",
"_N$overflow": 0, "_N$overflow": 0,
"_N$cacheMode": 0, "_N$cacheMode": 0,
"_id": "e2v39LqAtIuZU7JeZs16JJ" "_id": "7auYzlTQlBZ6wN8GAtE3Ed"
}, },
{ {
"__type__": "cc.LabelOutline", "__type__": "cc.LabelOutline",
...@@ -9609,7 +9609,7 @@ ...@@ -9609,7 +9609,7 @@
"a": 255 "a": 255
}, },
"_width": 4, "_width": 4,
"_id": "dd5Ncb7mxFYoDBLzRDRosh" "_id": "71PZSk0RpLu4hrNvuuzvxg"
}, },
{ {
"__type__": "cc.RichText", "__type__": "cc.RichText",
...@@ -12700,7 +12700,7 @@ ...@@ -12700,7 +12700,7 @@
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"showInEditor": false, "showInEditor": false,
"_id": "aca/VnCzVLyrCGoIQNnXFv" "_id": "52eIuWxMhGiprY7PFz/rJi"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
...@@ -12733,7 +12733,7 @@ ...@@ -12733,7 +12733,7 @@
"_N$fontFamily": "Arial", "_N$fontFamily": "Arial",
"_N$overflow": 0, "_N$overflow": 0,
"_N$cacheMode": 0, "_N$cacheMode": 0,
"_id": "49KFfESrxAAZH2RCAfuTOA" "_id": "63ew3iWOFFr56J17PZvYHc"
}, },
{ {
"__type__": "cc.LabelOutline", "__type__": "cc.LabelOutline",
...@@ -12751,7 +12751,7 @@ ...@@ -12751,7 +12751,7 @@
"a": 255 "a": 255
}, },
"_width": 7, "_width": 7,
"_id": "55Kf8Po6JMBJtsT2eK1jvJ" "_id": "1dlBIXpvpNPoyWrHQTgd5G"
}, },
{ {
"__type__": "cc.RichText", "__type__": "cc.RichText",
...@@ -12803,7 +12803,7 @@ ...@@ -12803,7 +12803,7 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 169.94, "width": 171.94,
"height": 63 "height": 63
}, },
"_anchorPoint": { "_anchorPoint": {
...@@ -12880,8 +12880,8 @@ ...@@ -12880,8 +12880,8 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
-84.97, -85.97,
-34.5, -35.5,
0, 0,
0, 0,
0, 0,
...@@ -12904,7 +12904,7 @@ ...@@ -12904,7 +12904,7 @@
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"showInEditor": false, "showInEditor": false,
"_id": "7azYyrwh5NgaDQuXEX+iDv" "_id": "ffmER+TB9CGYSP0PY4qLpL"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
...@@ -12937,7 +12937,7 @@ ...@@ -12937,7 +12937,7 @@
"_N$fontFamily": "Arial", "_N$fontFamily": "Arial",
"_N$overflow": 0, "_N$overflow": 0,
"_N$cacheMode": 0, "_N$cacheMode": 0,
"_id": "a9WT0IpX9DRozKfxAs9Bln" "_id": "e0TwyF3IFOtKh1Yy8XjYrQ"
}, },
{ {
"__type__": "cc.LabelOutline", "__type__": "cc.LabelOutline",
...@@ -12955,7 +12955,7 @@ ...@@ -12955,7 +12955,7 @@
"a": 255 "a": 255
}, },
"_width": 4, "_width": 4,
"_id": "0axwP33XJEr5B6H2jxUjCh" "_id": "26Sdk0FuFPC7TSL9dYFk1j"
}, },
{ {
"__type__": "cc.RichText", "__type__": "cc.RichText",
...@@ -16049,7 +16049,7 @@ ...@@ -16049,7 +16049,7 @@
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"showInEditor": false, "showInEditor": false,
"_id": "5aieC4clpHr7ypqSmJJ9AB" "_id": "06v63HcOpBeJKL76s51TeH"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
...@@ -16082,7 +16082,7 @@ ...@@ -16082,7 +16082,7 @@
"_N$fontFamily": "Arial", "_N$fontFamily": "Arial",
"_N$overflow": 0, "_N$overflow": 0,
"_N$cacheMode": 0, "_N$cacheMode": 0,
"_id": "92YAQoy1ZF4Yqa5BfpY7Pu" "_id": "f3HwTnvqJI7L9yaqHOuODb"
}, },
{ {
"__type__": "cc.LabelOutline", "__type__": "cc.LabelOutline",
...@@ -16100,7 +16100,7 @@ ...@@ -16100,7 +16100,7 @@
"a": 255 "a": 255
}, },
"_width": 7, "_width": 7,
"_id": "fa85pFg0FLO6+ESUeTOQtA" "_id": "58INBkg4lBU4mi9TUaKD9o"
}, },
{ {
"__type__": "cc.RichText", "__type__": "cc.RichText",
...@@ -16152,7 +16152,7 @@ ...@@ -16152,7 +16152,7 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 169.94, "width": 171.94,
"height": 63 "height": 63
}, },
"_anchorPoint": { "_anchorPoint": {
...@@ -16229,8 +16229,8 @@ ...@@ -16229,8 +16229,8 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
-84.97, -85.97,
-34.5, -35.5,
0, 0,
0, 0,
0, 0,
...@@ -16253,7 +16253,7 @@ ...@@ -16253,7 +16253,7 @@
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"showInEditor": false, "showInEditor": false,
"_id": "7cysiQubhKtKXSsb/NUwr4" "_id": "82f0AkhsJJlK/gCoi2Lngu"
}, },
{ {
"__type__": "cc.Label", "__type__": "cc.Label",
...@@ -16286,7 +16286,7 @@ ...@@ -16286,7 +16286,7 @@
"_N$fontFamily": "Arial", "_N$fontFamily": "Arial",
"_N$overflow": 0, "_N$overflow": 0,
"_N$cacheMode": 0, "_N$cacheMode": 0,
"_id": "afNH1dvCdHNrsJLS4NJaiA" "_id": "f5VgEKr+ZKk58g2sBAPwJf"
}, },
{ {
"__type__": "cc.LabelOutline", "__type__": "cc.LabelOutline",
...@@ -16304,7 +16304,7 @@ ...@@ -16304,7 +16304,7 @@
"a": 255 "a": 255
}, },
"_width": 4, "_width": 4,
"_id": "6fuMXLHPNLjIpQ/5/k/dSr" "_id": "d5J049HKVOs6lNMWzjrzYi"
}, },
{ {
"__type__": "cc.RichText", "__type__": "cc.RichText",
...@@ -16402,9 +16402,6 @@ ...@@ -16402,9 +16402,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,
...@@ -16701,7 +16698,7 @@ ...@@ -16701,7 +16698,7 @@
"width": 1280, "width": 1280,
"height": 720 "height": 720
}, },
"_fitWidth": true, "_fitWidth": false,
"_fitHeight": true, "_fitHeight": true,
"_id": "25Ey4w3bRJfKxUwBuWGsp3" "_id": "25Ey4w3bRJfKxUwBuWGsp3"
}, },
......
...@@ -66,42 +66,60 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -66,42 +66,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 variant1 = cc.MaterialVariant.create(material, sprite);
// sprite.setMaterial(0, variant1);
} }
let material = cc.Material.createWithBuiltin('2d-sprite', 0);
const sprite = node.getComponent(cc.Sprite);
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