mirror of
https://github.com/potato47/ccc-devtools.git
synced 2024-12-26 03:39:16 +00:00
Merge branch 'master' of https://github.com/potato47/ccc-devtools
fix bug 2.0.9反复点击相同节点报错 # Conflicts: # js/app.js
This commit is contained in:
parent
6a3f5cbf5b
commit
b4acfa5612
66
js/app.js
66
js/app.js
@ -78,7 +78,7 @@ let app = new Vue({
|
|||||||
sortable: true,
|
sortable: true,
|
||||||
width: 120,
|
width: 120,
|
||||||
align: 'center'
|
align: 'center'
|
||||||
},{
|
}, {
|
||||||
title: 'Action',
|
title: 'Action',
|
||||||
slot: 'cache_action',
|
slot: 'cache_action',
|
||||||
width: 150,
|
width: 150,
|
||||||
@ -89,9 +89,9 @@ let app = new Vue({
|
|||||||
cacheDataLoading: false
|
cacheDataLoading: false
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
api: function (url, cb) {
|
api: function(url, cb) {
|
||||||
let xhr = new XMLHttpRequest();
|
let xhr = new XMLHttpRequest();
|
||||||
xhr.onreadystatechange = function () {
|
xhr.onreadystatechange = function() {
|
||||||
if (xhr.readyState == 4 && (xhr.status >= 200 && xhr.status < 400)) {
|
if (xhr.readyState == 4 && (xhr.status >= 200 && xhr.status < 400)) {
|
||||||
let response = xhr.responseText;
|
let response = xhr.responseText;
|
||||||
cb(JSON.parse(xhr.responseText));
|
cb(JSON.parse(xhr.responseText));
|
||||||
@ -100,7 +100,7 @@ let app = new Vue({
|
|||||||
xhr.open("GET", url, true);
|
xhr.open("GET", url, true);
|
||||||
xhr.send();
|
xhr.send();
|
||||||
},
|
},
|
||||||
compareVersion: function (localVersion, remoteVersion) {
|
compareVersion: function(localVersion, remoteVersion) {
|
||||||
let vL = localVersion.split('.');
|
let vL = localVersion.split('.');
|
||||||
let vR = remoteVersion.split('.');
|
let vR = remoteVersion.split('.');
|
||||||
for (let i = 0; i < vL.length; ++i) {
|
for (let i = 0; i < vL.length; ++i) {
|
||||||
@ -120,7 +120,7 @@ let app = new Vue({
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
checkVersion: function () {
|
checkVersion: function() {
|
||||||
this.api('https://raw.githubusercontent.com/potato47/ccc-devtools/master/version.json', (
|
this.api('https://raw.githubusercontent.com/potato47/ccc-devtools/master/version.json', (
|
||||||
data) => {
|
data) => {
|
||||||
let remoteVersion = data.version;
|
let remoteVersion = data.version;
|
||||||
@ -160,11 +160,14 @@ let app = new Vue({
|
|||||||
handleNodeClick(node) {
|
handleNodeClick(node) {
|
||||||
if (node) {
|
if (node) {
|
||||||
this.$data.node = node;
|
this.$data.node = node;
|
||||||
cc.js.getset(node, 'hex_color', () => {
|
if (!node.hex_color) {
|
||||||
return '#' + node.color.toHEX('#rrggbb');
|
cc.js.getset(node, 'hex_color', () => {
|
||||||
}, (hex) => {
|
return '#' + node.color.toHEX('#rrggbb');
|
||||||
node.color = new cc.Color().fromHEX(hex);
|
}, (hex) => {
|
||||||
}, false, true);
|
node.color = new cc.Color().fromHEX(hex);
|
||||||
|
}, false, true);
|
||||||
|
}
|
||||||
|
|
||||||
let superPreLoad = node._onPreDestroy;
|
let superPreLoad = node._onPreDestroy;
|
||||||
node._onPreDestroy = () => {
|
node._onPreDestroy = () => {
|
||||||
superPreLoad.apply(node);
|
superPreLoad.apply(node);
|
||||||
@ -182,13 +185,15 @@ 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') {
|
||||||
cc.js.getset(node[schema.key], schema.rows[i][j].field, () => {
|
if (!node[schema.key][schema.rows[i][j].field]) {
|
||||||
return '#' + node.getComponent(schema.key)[schema.rows[i][j]
|
cc.js.getset(node[schema.key], schema.rows[i][j].field, () => {
|
||||||
.rawField].toHEX('#rrggbb');
|
return '#' + node.getComponent(schema.key)[schema.rows[i][j]
|
||||||
}, (hex) => {
|
.rawField].toHEX('#rrggbb');
|
||||||
node.getComponent(schema.key)[schema.rows[i][j].rawField] =
|
}, (hex) => {
|
||||||
new cc.Color().fromHEX(hex);
|
node.getComponent(schema.key)[schema.rows[i][j].rawField] =
|
||||||
}, false, true);
|
new cc.Color().fromHEX(hex);
|
||||||
|
}, false, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -301,11 +306,14 @@ let app = new Vue({
|
|||||||
},
|
},
|
||||||
openDevMode() {
|
openDevMode() {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
cc.js.getset(cc.Node.prototype, 'isLeaf', function () {
|
if (!cc.Node.prototype.isLeaf) {
|
||||||
return this.childrenCount === 0;
|
cc.js.getset(cc.Node.prototype, 'isLeaf', function() {
|
||||||
}, function (value) {
|
return this.childrenCount === 0;
|
||||||
|
}, 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'));
|
||||||
@ -409,9 +417,9 @@ let app = new Vue({
|
|||||||
},
|
},
|
||||||
initConsoleUtil() {
|
initConsoleUtil() {
|
||||||
if (cc.tree) return;
|
if (cc.tree) return;
|
||||||
cc.tree = function (key) {
|
cc.tree = function(key) {
|
||||||
let index = key || 0;
|
let index = key || 0;
|
||||||
let treeNode = function (node) {
|
let treeNode = function(node) {
|
||||||
let nameStyle =
|
let nameStyle =
|
||||||
`color: ${node.parent === null || node.activeInHierarchy ? 'green' : 'grey'}; font-size: 14px;font-weight:bold`;
|
`color: ${node.parent === null || node.activeInHierarchy ? 'green' : 'grey'}; font-size: 14px;font-weight:bold`;
|
||||||
let propStyle =
|
let propStyle =
|
||||||
@ -444,10 +452,10 @@ let app = new Vue({
|
|||||||
}
|
}
|
||||||
return '属性依次为x,y,width,height,scale.使用cc.cat(id)查看详细属性.';
|
return '属性依次为x,y,width,height,scale.使用cc.cat(id)查看详细属性.';
|
||||||
}
|
}
|
||||||
cc.cat = function (key) {
|
cc.cat = function(key) {
|
||||||
let index = 0;
|
let index = 0;
|
||||||
let target;
|
let target;
|
||||||
let sortId = function (node) {
|
let sortId = function(node) {
|
||||||
if (target) return;
|
if (target) return;
|
||||||
if (cc.js.isNumber(key)) {
|
if (cc.js.isNumber(key)) {
|
||||||
if (key === index++) {
|
if (key === index++) {
|
||||||
@ -473,9 +481,9 @@ let app = new Vue({
|
|||||||
target['tempIndex'] = cc.js.isNumber(key) ? key : index;
|
target['tempIndex'] = cc.js.isNumber(key) ? key : index;
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
cc.list = function (key) {
|
cc.list = function(key) {
|
||||||
let targets = [];
|
let targets = [];
|
||||||
let step = function (node) {
|
let step = function(node) {
|
||||||
if (node.name.toLowerCase().indexOf(key.toLowerCase()) > -1) {
|
if (node.name.toLowerCase().indexOf(key.toLowerCase()) > -1) {
|
||||||
targets.push(node);
|
targets.push(node);
|
||||||
}
|
}
|
||||||
@ -493,7 +501,7 @@ let app = new Vue({
|
|||||||
return targets;
|
return targets;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cc.where = function (key) {
|
cc.where = function(key) {
|
||||||
let target = key.name ? key : cc.cat(key);
|
let target = key.name ? key : cc.cat(key);
|
||||||
if (!target) {
|
if (!target) {
|
||||||
return null;
|
return null;
|
||||||
@ -534,7 +542,7 @@ let app = new Vue({
|
|||||||
// console.log(val);
|
// console.log(val);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created: function () {
|
created: function() {
|
||||||
this.checkVersion();
|
this.checkVersion();
|
||||||
document.body.insertBefore(document.getElementById('app'), document.body.firstChild);
|
document.body.insertBefore(document.getElementById('app'), document.body.firstChild);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user