mirror of
https://github.com/potato47/ccc-devtools.git
synced 2024-12-26 19:59:14 +00:00
不开启节点树时也可以cc.tree
This commit is contained in:
parent
25a40ab5f4
commit
66e6d4db4a
100
index.html
100
index.html
@ -362,37 +362,29 @@
|
|||||||
return node.name.toLowerCase().indexOf(value.toLowerCase()) !== -1;
|
return node.name.toLowerCase().indexOf(value.toLowerCase()) !== -1;
|
||||||
},
|
},
|
||||||
openDevMode() {
|
openDevMode() {
|
||||||
let initWin = () => {
|
setTimeout(() => {
|
||||||
if (window.cc) {
|
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'));
|
||||||
let scene = cc.director.getScene();
|
let scene = cc.director.getScene();
|
||||||
if (scene) {
|
if (scene) {
|
||||||
this.updateTreeData();
|
this.updateTreeData();
|
||||||
}
|
|
||||||
cc.director.on(cc.Director.EVENT_AFTER_SCENE_LAUNCH, () => {
|
|
||||||
this.updateTreeData();
|
|
||||||
}, this);
|
|
||||||
cc.director.on(cc.Director.EVENT_BEFORE_SCENE_LOADING, () => {
|
|
||||||
this.$data.node = null;
|
|
||||||
this.$data.sceneTreeData = [];
|
|
||||||
this.$data.treeParam = [];
|
|
||||||
}, this);
|
|
||||||
this.initConsoleUtil();
|
|
||||||
clearInterval(this.$data.intervalId);
|
|
||||||
} else {
|
|
||||||
// console.log('cc is not init');
|
|
||||||
}
|
}
|
||||||
}
|
cc.director.on(cc.Director.EVENT_AFTER_SCENE_LAUNCH, () => {
|
||||||
this.$data.intervalId = setInterval(initWin, 500);
|
this.updateTreeData();
|
||||||
setTimeout(initWin, 0);
|
}, this);
|
||||||
localStorage.setItem('isDevMode', 1);
|
cc.director.on(cc.Director.EVENT_BEFORE_SCENE_LOADING, () => {
|
||||||
|
this.$data.node = null;
|
||||||
|
this.$data.sceneTreeData = [];
|
||||||
|
this.$data.treeParam = [];
|
||||||
|
}, this);
|
||||||
|
localStorage.setItem('isDevMode', 1);
|
||||||
|
}, 0);
|
||||||
},
|
},
|
||||||
closeDevMode() {
|
closeDevMode() {
|
||||||
this.$data.node = null;
|
this.$data.node = null;
|
||||||
@ -449,6 +441,17 @@
|
|||||||
}
|
}
|
||||||
animate();
|
animate();
|
||||||
},
|
},
|
||||||
|
fitFullScreen() {
|
||||||
|
document.getElementsByClassName('toolbar')[0].style.display = 'none';
|
||||||
|
let gameDiv = document.getElementById('GameDiv');
|
||||||
|
let gameContainer = document.getElementById('Cocos2dGameContainer');
|
||||||
|
let gameCanvas = document.getElementById('GameCanvas');
|
||||||
|
gameDiv.style.width = '100%';
|
||||||
|
gameDiv.style.height = '100%';
|
||||||
|
gameCanvas.style.width = '100%';
|
||||||
|
gameCanvas.style.height = '100%';
|
||||||
|
// document.body.style.cssText+="-webkit-transform: rotate(-90deg);-moz-transform: rotate(-90deg)";
|
||||||
|
},
|
||||||
initConsoleUtil() {
|
initConsoleUtil() {
|
||||||
if (cc.tree) return;
|
if (cc.tree) return;
|
||||||
cc.tree = function (key) {
|
cc.tree = function (key) {
|
||||||
@ -577,18 +580,35 @@
|
|||||||
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);
|
||||||
if (localStorage.getItem('isDevMode') === '1') {
|
|
||||||
this.$data.isDevMode = true;
|
let onCCInit = () => {
|
||||||
this.openDevMode();
|
this.initConsoleUtil();
|
||||||
} else {
|
if (cc.sys.isMobile) {
|
||||||
this.$data.isDevMode = false;
|
this.fitFullScreen();
|
||||||
|
}
|
||||||
|
if (localStorage.getItem('isDevMode') === '1') {
|
||||||
|
this.$data.isDevMode = true;
|
||||||
|
this.openDevMode();
|
||||||
|
} else {
|
||||||
|
this.$data.isDevMode = false;
|
||||||
|
}
|
||||||
|
this.$data.isShowFPS = localStorage.getItem('isShowFPS') === '1';
|
||||||
|
this.$data.isShowMS = localStorage.getItem('isShowMS') === '1';
|
||||||
|
this.$data.isShowMB = localStorage.getItem('isShowMB') === '1';
|
||||||
|
setTimeout(() => {
|
||||||
|
this.handleChangeStats();
|
||||||
|
}, 0);
|
||||||
}
|
}
|
||||||
this.$data.isShowFPS = localStorage.getItem('isShowFPS') === '1';
|
let checkCC = () => {
|
||||||
this.$data.isShowMS = localStorage.getItem('isShowMS') === '1';
|
if (window.cc) {
|
||||||
this.$data.isShowMB = localStorage.getItem('isShowMB') === '1';
|
onCCInit();
|
||||||
setTimeout(() => {
|
clearInterval(this.$data.intervalId);
|
||||||
this.handleChangeStats();
|
} else {
|
||||||
}, 0);
|
// console.log('cc is not init');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.$data.intervalId = setInterval(checkCC, 500);
|
||||||
|
setTimeout(checkCC, 0);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ccc-devtools",
|
"name": "ccc-devtools",
|
||||||
"version": "2.1.0",
|
"version": "2.1.1",
|
||||||
"author": "Next",
|
"author": "Next",
|
||||||
"repo": "https://github.com/potato47/ccc-devtools.git"
|
"repo": "https://github.com/potato47/ccc-devtools.git"
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user