[add] All
21
preview-templates/ccc-devtools/LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
76
preview-templates/ccc-devtools/README.md
Normal file
@@ -0,0 +1,76 @@
|
||||
# ccc-devtools
|
||||
Cocos Creator 网页调试工具,运行时查看、修改节点树,实时更新节点属性,可视化缓存资源。
|
||||
|
||||
## 功能
|
||||
|
||||
- 场景节点树实时显示,节点、组件属性实时显示更改
|
||||
|
||||

|
||||
|
||||
- 可视化缓存资源
|
||||
|
||||

|
||||
|
||||
- 标记场景中节点位置
|
||||
|
||||

|
||||
|
||||
- 输出节点、组件引用到控制台
|
||||
|
||||

|
||||
|
||||
- cc控制台功能扩展
|
||||
|
||||

|
||||
|
||||
## 全局使用
|
||||
|
||||
1. 点击 Creator 右上角进入编辑器 resources 目录,再依次进入`static/preview-templates`目录
|
||||
|
||||

|
||||
|
||||
2. 根据creator版本将本项目对应分支clone到上面的目录下,**如果使用下载压缩包的方式记得把后缀名-branchname去掉**
|
||||
|
||||

|
||||
|
||||
3. 打开 `index.jade`,找到 `body` 将中间部分替换为 `include ./ccc-devtools/index.html`,**注意用tab键对齐**
|
||||
|
||||

|
||||
|
||||
## 项目使用
|
||||
|
||||
Cocos Creator 从 v2.2 开始新增了自定义网页预览功能。
|
||||
|
||||
1. 重复上面的操作步骤,将修改后的 `preview-templates` 目录拷贝到项目根目录
|
||||
|
||||
2. 将 `ccc-devtools/index.html` 里所有引用的资源路径 `app/editor/static/preview-templates/ccc-devtools/...` 替换为 `ccc-devtools/...`
|
||||
|
||||
3. 重启 Cocos Creator
|
||||
|
||||
## 自定义
|
||||
|
||||
- 本项目使用了 vue 和 vuetify,可根据 [vuetify 文档](https://vuetifyjs.com/en/getting-started/quick-start/) 对页面进行修改
|
||||
|
||||
- 节点、组件显示属性可在 `config.js` 里配置,目前支持 text,number,textarea,color,bool 几种类型
|
||||
|
||||
## 需求、更新
|
||||
|
||||
https://github.com/potato47/ccc-devtools
|
||||
|
||||
如果没有更改源码,可直接在目录下 git pull
|
||||
|
||||
论坛讨论地址:https://forum.cocos.com/t/creator-20190201/71578
|
||||
|
||||
## 贡献指南
|
||||
|
||||
- 版本号命名规则 https://semver.org/lang/zh-CN/ ,简单来讲,新功能第二位加一,修复bug第三位加一
|
||||
|
||||
- 如果新增功能请在README中添加预览截图说明
|
||||
|
||||
- 记得更新version.json中的版本号
|
||||
|
||||
## 前人种树
|
||||
|
||||
- https://github.com/vuejs/vue
|
||||
|
||||
- https://github.com/vuetifyjs/vuetify
|
54
preview-templates/ccc-devtools/config.js
Normal file
@@ -0,0 +1,54 @@
|
||||
const NEX_CONFIG = {
|
||||
nodeSchema: {
|
||||
node2d: {
|
||||
title: 'Node',
|
||||
key: 'cc.Node',
|
||||
rows: [
|
||||
{ name: 'Name', key: 'name', type: 'text' },
|
||||
{ name: 'X', key: 'x', type: 'number' },
|
||||
{ name: 'Y', key: 'y', type: 'number' },
|
||||
{ name: 'Width', key: 'width', type: 'number' },
|
||||
{ name: 'Height', key: 'height', type: 'number' },
|
||||
{ name: 'Angle', key: 'angle', type: 'number' },
|
||||
{ name: 'ScaleX', key: 'scaleX', type: 'number' },
|
||||
{ name: 'ScaleY', key: 'scaleY', type: 'number' },
|
||||
{ name: 'Opacity', key: 'opacity', type: 'number' },
|
||||
{ name: 'Color', key: 'hex_color', type: 'color' },
|
||||
{ name: 'Group', key: 'group', type: 'text' },
|
||||
]
|
||||
},
|
||||
node3d: {
|
||||
title: 'Node',
|
||||
key: 'cc.Node',
|
||||
rows: [
|
||||
// TODO:
|
||||
]
|
||||
},
|
||||
},
|
||||
componentsSchema: {
|
||||
'cc.Camera': {
|
||||
title: 'cc.Camera',
|
||||
key: 'cc.Camera',
|
||||
rows: [
|
||||
{ name: 'Zoom Ratio', key: 'zoomRatio', type: 'number' },
|
||||
{ name: 'Depth', key: 'depth', type: 'number' },
|
||||
{ name: 'Bacground Color', key: 'hex_backgroundColor', rawKey: 'backgroundColor', type: 'color' },
|
||||
{ name: 'Align with Screen', key: 'alignWithScreen', type: 'bool' },
|
||||
]
|
||||
},
|
||||
'cc.Sprite': {
|
||||
key: 'cc.Sprite',
|
||||
title: 'cc.Sprite',
|
||||
rows: []
|
||||
},
|
||||
'cc.Label': {
|
||||
title: 'cc.Label',
|
||||
key: 'cc.Label',
|
||||
rows: [
|
||||
{ name: 'String', key: 'string', type: 'textarea' },
|
||||
{ name: 'Font Size', key: 'fontSize', type: 'number' },
|
||||
{ name: 'Line Height', key: 'lineHeight', type: 'number' },
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
248
preview-templates/ccc-devtools/index.html
Normal file
@@ -0,0 +1,248 @@
|
||||
<link href="ccc-devtools/libs/css/materialdesignicons.min.css" rel="stylesheet" type="text/css">
|
||||
<link href="ccc-devtools/libs/css/vuetify.min.css" rel="stylesheet" type="text/css">
|
||||
<style>
|
||||
html {
|
||||
overflow-y: auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
<v-app id="app">
|
||||
<v-app-bar app clipped-left color="gray" dense v-if="isShowTop">
|
||||
<v-app-bar-nav-icon @click.stop="drawer = !drawer"></v-app-bar-nav-icon>
|
||||
<div id="recompiling"><span>Recompiling...</span></div>
|
||||
<v-spacer></v-spacer>
|
||||
<div class="toolbar">
|
||||
<div class="item">
|
||||
<select id="opts-device">
|
||||
<option value="0">Default</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="item">
|
||||
<v-btn id="btn-rotate" small height="25"><span style="color: #aaa;">Rotate</span></v-btn>
|
||||
</div>
|
||||
<span style="font-size: small;display: none;" class="item">Debug Mode:</span>
|
||||
<div class="item" style="display: none;">
|
||||
<select id="opts-debug-mode">
|
||||
<option value="0">None</option>
|
||||
<option value="1">Info</option>
|
||||
<option value="2">Warn</option>
|
||||
<option value="3">Error</option>
|
||||
<option value="4">Info For Web Page</option>
|
||||
<option value="5">Warn For Web Page</option>
|
||||
<option value="6">Error For Web Page</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="item">
|
||||
<v-btn id="btn-show-fps" small height="25"><span style="color: #aaa;">Show FPS</span></v-btn>
|
||||
</div>
|
||||
<div class="item">
|
||||
<span style="font-size: small;color: #aaa;" class="item">FPS:</span><input id="input-set-fps"
|
||||
type="number" />
|
||||
</div>
|
||||
<div style="margin-right: 0px;" class="item">
|
||||
<v-btn id="btn-pause" small height="25"><span style="color: #aaa;">Pause</span></v-btn>
|
||||
</div>
|
||||
<div class="item">
|
||||
<v-btn id="btn-step" style="display: none;" small height="25">
|
||||
<span style="color: #aaa;">Step</span>
|
||||
</v-btn>
|
||||
</div>
|
||||
<div class="item">
|
||||
<v-btn id="btn-recompile" small height="25"><span style="color: #aaa;">Recompile</span></v-btn>
|
||||
</div>
|
||||
<v-icon @click="openCocosDocs" small>mdi-cloud-search</v-icon>
|
||||
<v-icon @click="openCocosForum" small>mdi-forum</v-icon>
|
||||
<v-icon @click="openCacheDialog" small>mdi-table</v-icon>
|
||||
<v-icon @click="openGithub" small>mdi-home</v-icon>
|
||||
</div>
|
||||
</v-app-bar>
|
||||
|
||||
<div v-if="!isShowTop">
|
||||
<div id="recompiling"><span>Recompiling...</span></div>
|
||||
<div class="toolbar">
|
||||
<div class="item">
|
||||
<select id="opts-device">
|
||||
<option value="0">Default</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="item">
|
||||
<v-btn id="btn-rotate" small height="25"><span style="color: #aaa;">Rotate</span></v-btn>
|
||||
</div>
|
||||
<span style="font-size: small;display: none;" class="item">Debug Mode:</span>
|
||||
<div class="item" style="display: none;">
|
||||
<select id="opts-debug-mode">
|
||||
<option value="0">None</option>
|
||||
<option value="1">Info</option>
|
||||
<option value="2">Warn</option>
|
||||
<option value="3">Error</option>
|
||||
<option value="4">Info For Web Page</option>
|
||||
<option value="5">Warn For Web Page</option>
|
||||
<option value="6">Error For Web Page</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="item">
|
||||
<v-btn id="btn-show-fps" small height="25"><span style="color: #aaa;">Show FPS</span></v-btn>
|
||||
</div>
|
||||
<div class="item">
|
||||
<span style="font-size: small;color: #aaa;" class="item">FPS:</span><input id="input-set-fps"
|
||||
type="number" />
|
||||
</div>
|
||||
<div style="margin-right: 0px;" class="item">
|
||||
<v-btn id="btn-pause" small height="25"><span style="color: #aaa;">Pause</span></v-btn>
|
||||
</div>
|
||||
<div class="item">
|
||||
<v-btn id="btn-step" style="display: none;" small height="25">
|
||||
<span style="color: #aaa;">Step</span>
|
||||
</v-btn>
|
||||
</div>
|
||||
<div class="item">
|
||||
<v-btn id="btn-recompile" small height="25"><span style="color: #aaa;">Recompile</span></v-btn>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<v-navigation-drawer v-model="drawer" app clipped fixed width="512" v-if="isShowTop">
|
||||
<v-container style="height: 50%;overflow: auto;">
|
||||
<v-text-field v-model="treeSearchText" dense label="Search Node or Component" dark flat solo-inverted
|
||||
hide-details clearable clear-icon="mdi-close-circle-outline"></v-text-field>
|
||||
<v-treeview :items="treeData" item-key="id" dense activatable :search="treeSearchText"
|
||||
:active.sync="selectedNodes">
|
||||
<template v-slot:label="{ item, active }">
|
||||
<label v-if="item.active" style="color: white;">{{ item.name }}</label>
|
||||
<label v-else style="color: gray;">{{ item.name }}</label>
|
||||
</template>
|
||||
</v-treeview>
|
||||
</v-container>
|
||||
<v-container style="border-top: 2px solid darkgray;height: 50%;overflow-y: auto;">
|
||||
<template v-if="selectedNode">
|
||||
<!-- Node -->
|
||||
<table style="width: 100%;color: white;" border="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2" style="text-align: left; padding: 10px;">
|
||||
<div class="float-left" style="display:inline-flex;">
|
||||
<v-simple-checkbox v-model="selectedNode.active"></v-simple-checkbox>
|
||||
<span style="margin-left: 10px;">{{ nodeSchema.title }}</span>
|
||||
</div>
|
||||
<div class="float-right">
|
||||
<v-icon style="margin-left: 10px;margin-right: 10px;" @click="drawNodeRect()">
|
||||
mdi-adjust</v-icon>
|
||||
<v-icon @click="outputNodeHandler()">mdi-send</v-icon>
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="row in nodeSchema.rows" :key="row.key">
|
||||
<td style="padding: 10px;width: 40%;">{{ row.name }}</td>
|
||||
<td style="width: 60%;">
|
||||
<v-color-picker v-if="row.type == 'color'" class="ma-2" canvas-height="80" width="259"
|
||||
v-model="selectedNode[row.key]"></v-color-picker>
|
||||
<v-simple-checkbox v-else-if="row.type == 'bool'" v-model="selectedNode[row.key]"
|
||||
style="padding: 10px;width: 100%;"></v-simple-checkbox>
|
||||
<input v-else :type="row.type" v-model="selectedNode[row.key]"
|
||||
style="padding: 10px;width: 100%;"></input>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- Components -->
|
||||
<table v-for="component in componentsSchema" style="width: 100%;color: white;" border="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2" style="text-align: left; padding: 10px;">
|
||||
<div class="float-left" style="display:inline-flex;">
|
||||
<v-simple-checkbox v-model="selectedNode[component.key].enabled">
|
||||
</v-simple-checkbox>
|
||||
<span style="margin-left: 10px;">{{ component.title }}</span>
|
||||
</div>
|
||||
<div class="float-right">
|
||||
<v-icon @click="outputComponentHandler(component.key)">mdi-send</v-icon>
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="row in component.rows" :key="row.key">
|
||||
<td style="padding: 10px;width: 40%;">{{ row.name }}</td>
|
||||
<td style="width: 60%;">
|
||||
<v-color-picker v-if="row.type == 'color'" class="ma-2" canvas-height="80" width="259"
|
||||
v-model="selectedNode[component.key][row.key]"></v-color-picker>
|
||||
<textarea v-else-if="row.type == 'textarea'" rows="1"
|
||||
v-model="selectedNode[component.key][row.key]" style="padding: 10px;width: 100%;">
|
||||
</textarea>
|
||||
<v-simple-checkbox v-else-if="row.type == 'bool'"
|
||||
v-model="selectedNode[component.key][row.key]" style="padding: 10px;width: 100%;">
|
||||
</v-simple-checkbox>
|
||||
<input v-else :type="row.type" v-model="selectedNode[component.key][row.key]"
|
||||
style="padding: 10px;width: 100%;"></input>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</template>
|
||||
</v-container>
|
||||
</v-navigation-drawer>
|
||||
|
||||
<v-content>
|
||||
<v-container fill-height>
|
||||
<div id="content" class="content">
|
||||
<div class="contentWrap">
|
||||
<div id="GameDiv" class="wrapper"><canvas id="GameCanvas"></canvas>
|
||||
<div id="splash">
|
||||
<div class="progress-bar stripes"><span></span></div>
|
||||
</div>
|
||||
<div id="bulletin">
|
||||
<div id="sceneIsEmpty" class="inner">预览场景中啥都没有,加点什么,或在编辑器中打开其它场景吧</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</v-container>
|
||||
</v-content>
|
||||
|
||||
<v-dialog v-model="cacheDialog" persistent scrollable>
|
||||
<v-card>
|
||||
<v-card-title>
|
||||
{{ cacheTitle }}
|
||||
<v-spacer></v-spacer>
|
||||
<v-text-field v-model="cacheSearchText" append-icon="mdi-magnify" label="Search" single-line
|
||||
hide-details>
|
||||
</v-text-field>
|
||||
</v-card-title>
|
||||
<v-divider></v-divider>
|
||||
<v-card-text>
|
||||
<v-data-table :headers="cacheHeaders" :items="cacheData" :search="cacheSearchText" :sort-by="['size']"
|
||||
:sort-desc="[true]" :footer-props="{
|
||||
showFirstLastPage: true,
|
||||
firstIcon: 'mdi-chevron-double-left',
|
||||
lastIcon: 'mdi-chevron-double-right',
|
||||
}">
|
||||
<template v-slot:item.size="{ item }">
|
||||
{{ item.size == -1 ? '_' : (item.size +'MB') }}
|
||||
</template>
|
||||
<template v-slot:item.preview="{ item }">
|
||||
<div style="height: 60px;display: flex;align-items: center;">
|
||||
<img :src="window.location.protocol + '//' + window.location.host + '/' + item.preview"
|
||||
style="max-height: 60px;max-width: 120px;" v-if="item.preview">
|
||||
<template v-else>_</template>
|
||||
</div>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</v-card-text>
|
||||
<v-divider></v-divider>
|
||||
<v-card-actions>
|
||||
<v-btn color="blue darken-1" text @click="cacheDialog = false">Close</v-btn>
|
||||
<v-spacer></v-spacer>
|
||||
<v-switch v-model="cacheOnlyTexture" label="只显示纹理"></v-switch>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
|
||||
</v-app>
|
||||
|
||||
<script src="ccc-devtools/libs/js/vue.min.js"></script>
|
||||
<script src="ccc-devtools/libs/js/vuetify.js"></script>
|
||||
<script src="ccc-devtools/config.js"></script>
|
||||
<script src="ccc-devtools/libs/js/cc-console-utils.js"></script>
|
||||
<script src="ccc-devtools/preview.js"></script>
|
336
preview-templates/ccc-devtools/libs/css/googlefonts.css
Normal file
@@ -0,0 +1,336 @@
|
||||
/* cyrillic-ext */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 100;
|
||||
src: local('Roboto Thin'), local('Roboto-Thin'), url(../fonts/googlefonts-base.woff2) format('woff2');
|
||||
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
|
||||
}
|
||||
/* cyrillic */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 100;
|
||||
src: local('Roboto Thin'), local('Roboto-Thin'), url(../fonts/googlefonts-base.woff22) format('woff2');
|
||||
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
/* greek-ext */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 100;
|
||||
src: local('Roboto Thin'), local('Roboto-Thin'), url(../fonts/googlefonts-base.woff22) format('woff2');
|
||||
unicode-range: U+1F00-1FFF;
|
||||
}
|
||||
/* greek */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 100;
|
||||
src: local('Roboto Thin'), local('Roboto-Thin'), url(../fonts/googlefonts-base.woff22) format('woff2');
|
||||
unicode-range: U+0370-03FF;
|
||||
}
|
||||
/* vietnamese */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 100;
|
||||
src: local('Roboto Thin'), local('Roboto-Thin'), url(../fonts/googlefonts-base.woff22) format('woff2');
|
||||
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
|
||||
}
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 100;
|
||||
src: local('Roboto Thin'), local('Roboto-Thin'), url(../fonts/googlefonts-base.woff22) format('woff2');
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 100;
|
||||
src: local('Roboto Thin'), local('Roboto-Thin'), url(../fonts/googlefonts-base.woff2format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
/* cyrillic-ext */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
src: local('Roboto Light'), local('Roboto-Light'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
|
||||
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
|
||||
}
|
||||
/* cyrillic */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
src: local('Roboto Light'), local('Roboto-Light'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
|
||||
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
/* greek-ext */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
src: local('Roboto Light'), local('Roboto-Light'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
|
||||
unicode-range: U+1F00-1FFF;
|
||||
}
|
||||
/* greek */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
src: local('Roboto Light'), local('Roboto-Light'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
|
||||
unicode-range: U+0370-03FF;
|
||||
}
|
||||
/* vietnamese */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
src: local('Roboto Light'), local('Roboto-Light'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
|
||||
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
|
||||
}
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
src: local('Roboto Light'), local('Roboto-Light'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
src: local('Roboto Light'), local('Roboto-Light'), url(../fonts/googlefonts-base.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
/* cyrillic-ext */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Roboto'), local('Roboto-Regular'), url(../fonts/googlefonts-base.woff2format('woff2');
|
||||
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
|
||||
}
|
||||
/* cyrillic */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Roboto'), local('Roboto-Regular'), url(../fonts/googlefonts-base.woff2format('woff2');
|
||||
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
/* greek-ext */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Roboto'), local('Roboto-Regular'), url(../fonts/googlefonts-base.woff2format('woff2');
|
||||
unicode-range: U+1F00-1FFF;
|
||||
}
|
||||
/* greek */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Roboto'), local('Roboto-Regular'), url(../fonts/googlefonts-base.woff2format('woff2');
|
||||
unicode-range: U+0370-03FF;
|
||||
}
|
||||
/* vietnamese */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Roboto'), local('Roboto-Regular'), url(../fonts/googlefonts-base.woff2format('woff2');
|
||||
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
|
||||
}
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Roboto'), local('Roboto-Regular'), url(../fonts/googlefonts-base.woff2format('woff2');
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Roboto'), local('Roboto-Regular'), url(../fonts/googlefonts-base.woff2rmat('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
/* cyrillic-ext */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
src: local('Roboto Medium'), local('Roboto-Medium'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
|
||||
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
|
||||
}
|
||||
/* cyrillic */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
src: local('Roboto Medium'), local('Roboto-Medium'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
|
||||
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
/* greek-ext */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
src: local('Roboto Medium'), local('Roboto-Medium'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
|
||||
unicode-range: U+1F00-1FFF;
|
||||
}
|
||||
/* greek */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
src: local('Roboto Medium'), local('Roboto-Medium'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
|
||||
unicode-range: U+0370-03FF;
|
||||
}
|
||||
/* vietnamese */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
src: local('Roboto Medium'), local('Roboto-Medium'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
|
||||
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
|
||||
}
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
src: local('Roboto Medium'), local('Roboto-Medium'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
src: local('Roboto Medium'), local('Roboto-Medium'), url(../fonts/googlefonts-base.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
/* cyrillic-ext */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: local('Roboto Bold'), local('Roboto-Bold'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
|
||||
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
|
||||
}
|
||||
/* cyrillic */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: local('Roboto Bold'), local('Roboto-Bold'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
|
||||
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
/* greek-ext */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: local('Roboto Bold'), local('Roboto-Bold'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
|
||||
unicode-range: U+1F00-1FFF;
|
||||
}
|
||||
/* greek */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: local('Roboto Bold'), local('Roboto-Bold'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
|
||||
unicode-range: U+0370-03FF;
|
||||
}
|
||||
/* vietnamese */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: local('Roboto Bold'), local('Roboto-Bold'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
|
||||
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
|
||||
}
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: local('Roboto Bold'), local('Roboto-Bold'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: local('Roboto Bold'), local('Roboto-Bold'), url(../fonts/googlefonts-base.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
/* cyrillic-ext */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 900;
|
||||
src: local('Roboto Black'), local('Roboto-Black'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
|
||||
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
|
||||
}
|
||||
/* cyrillic */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 900;
|
||||
src: local('Roboto Black'), local('Roboto-Black'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
|
||||
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
/* greek-ext */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 900;
|
||||
src: local('Roboto Black'), local('Roboto-Black'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
|
||||
unicode-range: U+1F00-1FFF;
|
||||
}
|
||||
/* greek */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 900;
|
||||
src: local('Roboto Black'), local('Roboto-Black'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
|
||||
unicode-range: U+0370-03FF;
|
||||
}
|
||||
/* vietnamese */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 900;
|
||||
src: local('Roboto Black'), local('Roboto-Black'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
|
||||
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
|
||||
}
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 900;
|
||||
src: local('Roboto Black'), local('Roboto-Black'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
font-style: normal;
|
||||
font-weight: 900;
|
||||
src: local('Roboto Black'), local('Roboto-Black'), url(../fonts/googlefonts-base.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
1
preview-templates/ccc-devtools/libs/css/materialdesignicons.min.css
vendored
Normal file
8
preview-templates/ccc-devtools/libs/css/vuetify.min.css
vendored
Normal file
BIN
preview-templates/ccc-devtools/libs/fonts/googlefonts-base.woff2
Normal file
165
preview-templates/ccc-devtools/libs/js/cc-console-utils.js
Normal file
@@ -0,0 +1,165 @@
|
||||
const initConsoleUtil = function () {
|
||||
if (cc.tree) return;
|
||||
cc.tree = function (key) {
|
||||
let index = key || 0;
|
||||
let treeNode = function (node) {
|
||||
let nameStyle =
|
||||
`color: ${node.parent === null || node.activeInHierarchy ? 'green' : 'grey'}; font-size: 14px;font-weight:bold`;
|
||||
let propStyle =
|
||||
`color: black; background: lightgrey;margin-left: 5px;border-radius:3px;padding: 0 3px;font-size: 10px;font-weight:bold`;
|
||||
let indexStyle =
|
||||
`color: orange; background: black;margin-left: 5px;border-radius:3px;padding:0 3px;fonrt-size: 10px;font-weight:bold;`
|
||||
let nameValue = `%c${node.name}`;
|
||||
let propValue =
|
||||
`%c${node.x.toFixed(0) + ',' + node.y.toFixed(0) + ',' + node.width.toFixed(0) + ',' + node.height.toFixed(0) + ',' + node.scale.toFixed(1)}`
|
||||
let indexValue = `%c${index++}`;
|
||||
if (node.childrenCount > 0) {
|
||||
console.groupCollapsed(nameValue + propValue + indexValue, nameStyle,
|
||||
propStyle, indexStyle);
|
||||
for (let i = 0; i < node.childrenCount; i++) {
|
||||
treeNode(node.children[i]);
|
||||
}
|
||||
console.groupEnd();
|
||||
} else {
|
||||
console.log(nameValue + propValue + indexValue, nameStyle, propStyle,
|
||||
indexStyle);
|
||||
}
|
||||
}
|
||||
if (key) {
|
||||
let node = cc.cat(key);
|
||||
index = node['tempIndex'];
|
||||
treeNode(node);
|
||||
} else {
|
||||
let scene = cc.director.getScene();
|
||||
treeNode(scene);
|
||||
}
|
||||
return '属性依次为x,y,width,height,scale.使用cc.cat(id)查看详细属性.';
|
||||
}
|
||||
cc.cat = function (key) {
|
||||
let index = 0;
|
||||
let target;
|
||||
let sortId = function (node) {
|
||||
if (target) return;
|
||||
if (cc.js.isNumber(key)) {
|
||||
if (key === index++) {
|
||||
target = node;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (key.toLowerCase() === node.name.toLowerCase()) {
|
||||
target = node;
|
||||
return;
|
||||
} else {
|
||||
index++;
|
||||
}
|
||||
}
|
||||
if (node.childrenCount > 0) {
|
||||
for (let i = 0; i < node.childrenCount; i++) {
|
||||
sortId(node.children[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
let scene = cc.director.getScene();
|
||||
sortId(scene);
|
||||
target['tempIndex'] = cc.js.isNumber(key) ? key : index;
|
||||
return target;
|
||||
}
|
||||
cc.list = function (key) {
|
||||
let targets = [];
|
||||
let step = function (node) {
|
||||
if (node.name.toLowerCase().indexOf(key.toLowerCase()) > -1) {
|
||||
targets.push(node);
|
||||
}
|
||||
if (node.childrenCount > 0) {
|
||||
for (let i = 0; i < node.childrenCount; i++) {
|
||||
step(node.children[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
let scene = cc.director.getScene();
|
||||
step(scene);
|
||||
if (targets.length === 1) {
|
||||
return targets[0];
|
||||
} else {
|
||||
return targets;
|
||||
}
|
||||
}
|
||||
cc.where = function (key) {
|
||||
let target = key.name ? key : cc.cat(key);
|
||||
if (!target) {
|
||||
return null;
|
||||
}
|
||||
let rect = target.getBoundingBoxToWorld();
|
||||
let bgNode = new cc.Node();
|
||||
let graphics = bgNode.addComponent(cc.Graphics);
|
||||
let scene = cc.director.getScene();
|
||||
scene.addChild(bgNode);
|
||||
bgNode.position = rect.center;
|
||||
bgNode.group = target.group;
|
||||
bgNode.zIndex = cc.macro.MAX_ZINDEX;
|
||||
let isZeroSize = rect.width === 0 || rect.height === 0;
|
||||
if (isZeroSize) {
|
||||
graphics.circle(0, 0, 100);
|
||||
graphics.fillColor = cc.Color.GREEN;
|
||||
graphics.fill();
|
||||
} else {
|
||||
bgNode.width = rect.width;
|
||||
bgNode.height = rect.height;
|
||||
graphics.rect(-bgNode.width / 2, -bgNode.height / 2, bgNode.width, bgNode.height);
|
||||
graphics.fillColor = new cc.Color().fromHEX('#E91E6390');
|
||||
graphics.fill();
|
||||
}
|
||||
setTimeout(() => {
|
||||
if (cc.isValid(bgNode)) {
|
||||
bgNode.destroy();
|
||||
}
|
||||
}, 2000);
|
||||
return target;
|
||||
}
|
||||
cc.cache = function () {
|
||||
let rawCacheData = cc.assetManager.assets._map;
|
||||
let cacheData = [];
|
||||
let totalTextureSize = 0;
|
||||
for (let k in rawCacheData) {
|
||||
let item = rawCacheData[k];
|
||||
if (item.type !== 'js' && item.type !== 'json') {
|
||||
let itemName = '_';
|
||||
let preview = '';
|
||||
let content = item.__classname__;
|
||||
let formatSize = -1;
|
||||
if (item.type === 'png' || item.type === 'jpg') {
|
||||
let texture = rawCacheData[k.replace('.' + item.type, '.json')];
|
||||
if (texture && texture._owner && texture._owner._name) {
|
||||
itemName = texture._owner._name;
|
||||
preview = texture.content.url;
|
||||
}
|
||||
} else {
|
||||
if (item.name) {
|
||||
itemName = item.name;
|
||||
} else if (item._owner) {
|
||||
itemName = (item._owner && item._owner.name) || '_';
|
||||
}
|
||||
if (content === 'cc.Texture2D') {
|
||||
preview = item.nativeUrl;
|
||||
let textureSize = item.width * item.height * ((item._native === '.jpg' ? 3 : 4) / 1024 / 1024);
|
||||
totalTextureSize += textureSize;
|
||||
// sizeStr = textureSize.toFixed(3) + 'M';
|
||||
formatSize = Math.round(textureSize * 1000) / 1000;
|
||||
} else if (content === 'cc.SpriteFrame') {
|
||||
preview = item._texture.nativeUrl;
|
||||
}
|
||||
}
|
||||
cacheData.push({
|
||||
queueId: item.queueId,
|
||||
type: content,
|
||||
name: itemName,
|
||||
preview: preview,
|
||||
id: item._uuid,
|
||||
size: formatSize
|
||||
});
|
||||
}
|
||||
}
|
||||
let cacheTitle = `缓存 [文件总数:${cacheData.length}][纹理缓存:${totalTextureSize.toFixed(2) + 'M'}]`;
|
||||
return [cacheData, cacheTitle];
|
||||
}
|
||||
}
|
6
preview-templates/ccc-devtools/libs/js/vue.min.js
vendored
Normal file
41498
preview-templates/ccc-devtools/libs/js/vuetify.js
Normal file
192
preview-templates/ccc-devtools/preview.js
Normal file
@@ -0,0 +1,192 @@
|
||||
const app = new Vue({
|
||||
el: '#app',
|
||||
vuetify: new Vuetify({
|
||||
theme: { dark: true }
|
||||
}),
|
||||
data: {
|
||||
isShowTop: true,
|
||||
drawer: false,
|
||||
cacheDialog: false,
|
||||
cacheTitle: '',
|
||||
cacheHeaders: [
|
||||
{ text: 'Type', value: 'type' },
|
||||
{ text: 'Name', value: 'name' },
|
||||
{ text: 'Preivew', value: 'preview' },
|
||||
{ text: 'ID', value: 'id' },
|
||||
{ text: 'Size', value: 'size' },
|
||||
],
|
||||
cacheRawData: [],
|
||||
cacheData: [],
|
||||
cacheSearchText: null,
|
||||
cacheOnlyTexture: true,
|
||||
treeData: [],
|
||||
selectedNodes: [],
|
||||
intervalId: -1,
|
||||
treeSearchText: null,
|
||||
nodeSchema: {},
|
||||
componentsSchema: [],
|
||||
},
|
||||
created() {
|
||||
if (window.innerHeight === window.outerHeight) { // 手机端,chrome device模式
|
||||
this.isShowTop = false;
|
||||
}
|
||||
this.waitCCInit().then(() => {
|
||||
if (this.isShowTop) {
|
||||
this.startUpdateTree();
|
||||
}
|
||||
initConsoleUtil();
|
||||
});
|
||||
},
|
||||
watch: {
|
||||
cacheOnlyTexture() {
|
||||
this.updateCacheData();
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
treeFilter() {
|
||||
return (item, search, textKey) => item[textKey].indexOf(search) > -1;
|
||||
},
|
||||
selectedNode() {
|
||||
if (!this.selectedNodes.length) return undefined
|
||||
let node = getNodeById(this.selectedNodes[0]);
|
||||
if (node) {
|
||||
if (!node.hex_color) {
|
||||
cc.js.getset(node, 'hex_color', () => {
|
||||
return '#' + node.color.toHEX('#rrggbb');
|
||||
}, (hex) => {
|
||||
node.color = new cc.Color().fromHEX(hex);
|
||||
}, false, true);
|
||||
}
|
||||
|
||||
let superPreLoad = node._onPreDestroy;
|
||||
node._onPreDestroy = () => {
|
||||
superPreLoad.apply(node);
|
||||
if (this.selectedNodes.length > 0 && this.selectedNodes[0] === node._id) {
|
||||
this.selectedNodes.pop();
|
||||
}
|
||||
}
|
||||
this.nodeSchema = NEX_CONFIG.nodeSchema.node2d;
|
||||
let componentsSchema = [];
|
||||
for (let component of node._components) {
|
||||
let schema = NEX_CONFIG.componentsSchema[component.__classname__];
|
||||
if (schema) {
|
||||
node[schema.key] = node.getComponent(schema.key);
|
||||
for (let i = 0; i < schema.rows.length; i++) {
|
||||
if (schema.rows[i].type === 'color') {
|
||||
if (!node[schema.key][schema.rows[i].key]) {
|
||||
cc.js.getset(node[schema.key], schema.rows[i].key, () => {
|
||||
return '#' + node.getComponent(schema.key)[schema.rows[i].rawKey].toHEX('#rrggbb');
|
||||
}, (hex) => {
|
||||
node.getComponent(schema.key)[schema.rows[i].rawKey] = new cc.Color().fromHEX(hex);
|
||||
}, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
schema = {
|
||||
title: component.__classname__,
|
||||
key: component.__classname__
|
||||
};
|
||||
node[schema.key] = node.getComponent(schema.key);
|
||||
}
|
||||
componentsSchema.push(schema);
|
||||
}
|
||||
this.componentsSchema = componentsSchema;
|
||||
}
|
||||
return node;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
waitCCInit() {
|
||||
return new Promise((resolve, reject) => {
|
||||
let id = setInterval(() => {
|
||||
if (window.cc) {
|
||||
resolve();
|
||||
clearInterval(id);
|
||||
}
|
||||
}, 500);
|
||||
});
|
||||
},
|
||||
refreshTree: function () {
|
||||
if (!this.$data.drawer || !window.cc || !cc.director.getScene() || !cc.director.getScene().children) return;
|
||||
this.$data.treeData = getChildren(cc.director.getScene());
|
||||
},
|
||||
startUpdateTree: function () {
|
||||
this.$data.intervalId = setInterval(() => {
|
||||
this.refreshTree();
|
||||
}, 200);
|
||||
},
|
||||
stopUpdateTree: function () {
|
||||
clearInterval(this.$data.intervalId);
|
||||
},
|
||||
outputNodeHandler(id) {
|
||||
let i = 1;
|
||||
while (window['temp' + i] !== undefined) {
|
||||
i++;
|
||||
}
|
||||
window['temp' + i] = this.selectedNode;
|
||||
console.log('temp' + i);
|
||||
console.log(window['temp' + i]);
|
||||
},
|
||||
outputComponentHandler(component) {
|
||||
let i = 1;
|
||||
while (window['temp' + i] !== undefined) {
|
||||
i++;
|
||||
}
|
||||
window['temp' + i] = this.selectedNode.getComponent(component);
|
||||
console.log('temp' + i);
|
||||
console.log(window['temp' + i]);
|
||||
},
|
||||
drawNodeRect() {
|
||||
cc.where(this.selectedNode);
|
||||
},
|
||||
updateCacheData() {
|
||||
if (this.$data.cacheOnlyTexture) {
|
||||
this.$data.cacheData = this.$data.cacheRawData.filter(item => item.type === 'cc.Texture2D');
|
||||
} else {
|
||||
this.$data.cacheData = this.$data.cacheRawData;
|
||||
}
|
||||
},
|
||||
openCacheDialog() {
|
||||
[this.$data.cacheRawData, this.$data.cacheTitle] = cc.cache();
|
||||
this.updateCacheData();
|
||||
this.$data.cacheDialog = true;
|
||||
},
|
||||
openGithub() {
|
||||
window.open('https://github.com/potato47/ccc-devtools');
|
||||
},
|
||||
openCocosForum() {
|
||||
window.open('https://forum.cocos.com/');
|
||||
},
|
||||
openCocosDocs() {
|
||||
window.open('https://docs.cocos.com/');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function getChildren(node) {
|
||||
return node.children.map(child => {
|
||||
let children = (child.children && child.children.length > 0) ? getChildren(child) : [];
|
||||
return { id: child._id, name: child.name, active: child.activeInHierarchy, children };
|
||||
});
|
||||
}
|
||||
|
||||
function getNodeById(id) {
|
||||
let target;
|
||||
const search = function (node) {
|
||||
if (node._id === id) {
|
||||
target = node;
|
||||
return;
|
||||
}
|
||||
if (node.childrenCount) {
|
||||
for (let i = 0; i < node.childrenCount; i++) {
|
||||
if (!target) {
|
||||
search(node.children[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const scene = cc.director.getScene();
|
||||
search(scene);
|
||||
return target;
|
||||
}
|
BIN
preview-templates/ccc-devtools/screenshots/preview1.gif
Normal file
After Width: | Height: | Size: 849 KiB |
BIN
preview-templates/ccc-devtools/screenshots/preview2.png
Normal file
After Width: | Height: | Size: 121 KiB |
BIN
preview-templates/ccc-devtools/screenshots/preview3.png
Normal file
After Width: | Height: | Size: 119 KiB |
BIN
preview-templates/ccc-devtools/screenshots/preview4.png
Normal file
After Width: | Height: | Size: 205 KiB |
BIN
preview-templates/ccc-devtools/screenshots/preview5.png
Normal file
After Width: | Height: | Size: 189 KiB |
BIN
preview-templates/ccc-devtools/screenshots/t1.png
Normal file
After Width: | Height: | Size: 9.2 KiB |
BIN
preview-templates/ccc-devtools/screenshots/t2.png
Normal file
After Width: | Height: | Size: 45 KiB |
BIN
preview-templates/ccc-devtools/screenshots/t3.png
Normal file
After Width: | Height: | Size: 211 KiB |
6
preview-templates/ccc-devtools/version.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "ccc-devtools",
|
||||
"version": "2d-v2.4",
|
||||
"author": "Next",
|
||||
"repo": "https://github.com/potato47/ccc-devtools.git"
|
||||
}
|