mirror of
https://github.com/potato47/ccc-devtools.git
synced 2024-12-26 03:39:16 +00:00
不开启节点树时也可以cc.tree
This commit is contained in:
parent
25a40ab5f4
commit
66e6d4db4a
40
index.html
40
index.html
@ -362,8 +362,7 @@
|
||||
return node.name.toLowerCase().indexOf(value.toLowerCase()) !== -1;
|
||||
},
|
||||
openDevMode() {
|
||||
let initWin = () => {
|
||||
if (window.cc) {
|
||||
setTimeout(() => {
|
||||
cc.js.getset(cc.Node.prototype, 'isLeaf', function () {
|
||||
return this.childrenCount === 0;
|
||||
}, function (value) {
|
||||
@ -384,15 +383,8 @@
|
||||
this.$data.sceneTreeData = [];
|
||||
this.$data.treeParam = [];
|
||||
}, this);
|
||||
this.initConsoleUtil();
|
||||
clearInterval(this.$data.intervalId);
|
||||
} else {
|
||||
// console.log('cc is not init');
|
||||
}
|
||||
}
|
||||
this.$data.intervalId = setInterval(initWin, 500);
|
||||
setTimeout(initWin, 0);
|
||||
localStorage.setItem('isDevMode', 1);
|
||||
}, 0);
|
||||
},
|
||||
closeDevMode() {
|
||||
this.$data.node = null;
|
||||
@ -449,6 +441,17 @@
|
||||
}
|
||||
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() {
|
||||
if (cc.tree) return;
|
||||
cc.tree = function (key) {
|
||||
@ -577,6 +580,12 @@
|
||||
created: function () {
|
||||
this.checkVersion();
|
||||
document.body.insertBefore(document.getElementById('app'), document.body.firstChild);
|
||||
|
||||
let onCCInit = () => {
|
||||
this.initConsoleUtil();
|
||||
if (cc.sys.isMobile) {
|
||||
this.fitFullScreen();
|
||||
}
|
||||
if (localStorage.getItem('isDevMode') === '1') {
|
||||
this.$data.isDevMode = true;
|
||||
this.openDevMode();
|
||||
@ -589,6 +598,17 @@
|
||||
setTimeout(() => {
|
||||
this.handleChangeStats();
|
||||
}, 0);
|
||||
}
|
||||
let checkCC = () => {
|
||||
if (window.cc) {
|
||||
onCCInit();
|
||||
clearInterval(this.$data.intervalId);
|
||||
} else {
|
||||
// console.log('cc is not init');
|
||||
}
|
||||
}
|
||||
this.$data.intervalId = setInterval(checkCC, 500);
|
||||
setTimeout(checkCC, 0);
|
||||
},
|
||||
});
|
||||
</script>
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ccc-devtools",
|
||||
"version": "2.1.0",
|
||||
"version": "2.1.1",
|
||||
"author": "Next",
|
||||
"repo": "https://github.com/potato47/ccc-devtools.git"
|
||||
}
|
Loading…
Reference in New Issue
Block a user