fix bug 2.0.9反复点击相同节点报错
# Conflicts:
#	js/app.js
This commit is contained in:
hjx 2019-05-17 11:50:56 +08:00
parent 6a3f5cbf5b
commit b4acfa5612

View File

@ -160,11 +160,14 @@ let app = new Vue({
handleNodeClick(node) { handleNodeClick(node) {
if (node) { if (node) {
this.$data.node = node; this.$data.node = node;
if (!node.hex_color) {
cc.js.getset(node, 'hex_color', () => { cc.js.getset(node, 'hex_color', () => {
return '#' + node.color.toHEX('#rrggbb'); return '#' + node.color.toHEX('#rrggbb');
}, (hex) => { }, (hex) => {
node.color = new cc.Color().fromHEX(hex); node.color = new cc.Color().fromHEX(hex);
}, false, true); }, false, true);
}
let superPreLoad = node._onPreDestroy; let superPreLoad = node._onPreDestroy;
node._onPreDestroy = () => { node._onPreDestroy = () => {
superPreLoad.apply(node); superPreLoad.apply(node);
@ -182,6 +185,7 @@ let app = new Vue({
for (let i = 0; i < schema.rows.length; i++) { for (let i = 0; i < schema.rows.length; i++) {
for (let j = 0; j < schema.rows[i].length; j++) { for (let j = 0; j < schema.rows[i].length; j++) {
if (schema.rows[i][j].type === 'color') { if (schema.rows[i][j].type === 'color') {
if (!node[schema.key][schema.rows[i][j].field]) {
cc.js.getset(node[schema.key], schema.rows[i][j].field, () => { cc.js.getset(node[schema.key], schema.rows[i][j].field, () => {
return '#' + node.getComponent(schema.key)[schema.rows[i][j] return '#' + node.getComponent(schema.key)[schema.rows[i][j]
.rawField].toHEX('#rrggbb'); .rawField].toHEX('#rrggbb');
@ -192,6 +196,7 @@ let app = new Vue({
} }
} }
} }
}
} else { } else {
schema = { schema = {
title: component.__classname__, title: component.__classname__,
@ -301,11 +306,14 @@ let app = new Vue({
}, },
openDevMode() { openDevMode() {
setTimeout(() => { setTimeout(() => {
if (!cc.Node.prototype.isLeaf) {
cc.js.getset(cc.Node.prototype, 'isLeaf', function() { cc.js.getset(cc.Node.prototype, 'isLeaf', function() {
return this.childrenCount === 0; return this.childrenCount === 0;
}, function(value) { }, function(value) {
}, false, true); }, false, true);
}
let top = document.getElementById('top') let top = document.getElementById('top')
top.appendChild(document.getElementsByClassName('toolbar')[0]); top.appendChild(document.getElementsByClassName('toolbar')[0]);
document.getElementById('game_panel').appendChild(document.getElementById('content')); document.getElementById('game_panel').appendChild(document.getElementById('content'));