mirror of
https://github.com/tidys/cc-inspector-chrome
synced 2025-04-21 17:38:40 +00:00
class name
名字过长时,自动省略,点击显示全部
This commit is contained in:
parent
d3c3cadf7a
commit
6fc7997353
21
LICENSE
21
LICENSE
@ -1,21 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2018 Zaporozhets Yura
|
|
||||||
|
|
||||||
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.
|
|
@ -1,6 +1,6 @@
|
|||||||
#说明
|
#说明
|
||||||
|
|
||||||
inject在development模式下无法正常使用,暂时的解决办法,注释掉`vue-cli-plugin-browser-extension`代码中的
|
inject在development模式下无法正常使用,暂时的解决办法,注释掉`vue-cli-plugin-browser-extension/index.js`代码中的124行:
|
||||||
```
|
```
|
||||||
webpackConfig.plugin('extension-reloader').use(ExtensionReloader, [{ entries, ...extensionReloaderOptions }])
|
webpackConfig.plugin('extension-reloader').use(ExtensionReloader, [{ entries, ...extensionReloaderOptions }])
|
||||||
```
|
```
|
||||||
|
20
meta.json
20
meta.json
@ -1,20 +0,0 @@
|
|||||||
{
|
|
||||||
"prompts": {
|
|
||||||
"name": {
|
|
||||||
"type": "string",
|
|
||||||
"required": true,
|
|
||||||
"label": "Project name"
|
|
||||||
},
|
|
||||||
"description": {
|
|
||||||
"type": "string",
|
|
||||||
"required": true,
|
|
||||||
"label": "Project description",
|
|
||||||
"default": "A Vue.js project"
|
|
||||||
},
|
|
||||||
"author": {
|
|
||||||
"type": "string",
|
|
||||||
"label": "Author"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"completeMessage": "To get started:\n\n cd {{destDirName}}\n npm install # or yarn\n npm run dev # or yarn dev\n\n"
|
|
||||||
}
|
|
@ -15,7 +15,7 @@ import {
|
|||||||
Vec2Data,
|
Vec2Data,
|
||||||
Vec3Data
|
Vec3Data
|
||||||
} from "./data";
|
} from "./data";
|
||||||
import {Msg, Page, PluginEvent} from '@/core/types'
|
import {Msg, Page, PluginEvent} from "@/core/types"
|
||||||
|
|
||||||
// @ts-ignore typescript-eslint/no-namespace
|
// @ts-ignore typescript-eslint/no-namespace
|
||||||
declare namespace cc {
|
declare namespace cc {
|
||||||
@ -26,7 +26,7 @@ class CCInspector {
|
|||||||
inspectorGameMemoryStorage: Record<string, any> = {}
|
inspectorGameMemoryStorage: Record<string, any> = {}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
console.log('cc-inspector init ~~~');
|
console.log("cc-inspector init ~~~");
|
||||||
let timer = setInterval(() => {
|
let timer = setInterval(() => {
|
||||||
if (this._isCocosGame()) {
|
if (this._isCocosGame()) {
|
||||||
clearInterval(timer)
|
clearInterval(timer)
|
||||||
@ -44,7 +44,7 @@ class CCInspector {
|
|||||||
}
|
}
|
||||||
let pluginEvent: PluginEvent = event.data;
|
let pluginEvent: PluginEvent = event.data;
|
||||||
if (PluginEvent.check(pluginEvent, Page.Content, Page.Inject)) {
|
if (PluginEvent.check(pluginEvent, Page.Content, Page.Inject)) {
|
||||||
console.log(`%c[Inject] ${JSON.stringify(pluginEvent)}`, 'color:green;');
|
console.log(`%c[Inject] ${JSON.stringify(pluginEvent)}`, "color:green;");
|
||||||
PluginEvent.finish(pluginEvent)
|
PluginEvent.finish(pluginEvent)
|
||||||
switch (pluginEvent.msg) {
|
switch (pluginEvent.msg) {
|
||||||
case Msg.UrlChange:
|
case Msg.UrlChange:
|
||||||
@ -114,7 +114,7 @@ class CCInspector {
|
|||||||
|
|
||||||
if (!draw) {
|
if (!draw) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
let node = new cc.Node('draw-node');
|
let node = new cc.Node("draw-node");
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
cc.director.getScene().addChild(node);
|
cc.director.getScene().addChild(node);
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
@ -123,7 +123,7 @@ class CCInspector {
|
|||||||
draw.clear()
|
draw.clear()
|
||||||
draw.lineWidth = 10;
|
draw.lineWidth = 10;
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
draw.strokeColor = new cc.Color().fromHEX('#ff0000')
|
draw.strokeColor = new cc.Color().fromHEX("#ff0000")
|
||||||
const {anchorX, anchorY, width, height, x, y} = node;
|
const {anchorX, anchorY, width, height, x, y} = node;
|
||||||
let halfWidth = width / 2;
|
let halfWidth = width / 2;
|
||||||
let halfHeight = height / 2;
|
let halfHeight = height / 2;
|
||||||
@ -192,7 +192,7 @@ class CCInspector {
|
|||||||
rotation: ["rotationX", "rotationY"],
|
rotation: ["rotationX", "rotationY"],
|
||||||
anchor: ["anchorX", "anchorY"],
|
anchor: ["anchorX", "anchorY"],
|
||||||
size: ["width", "height"],
|
size: ["width", "height"],
|
||||||
skew: ['skewX', 'skewY'],
|
skew: ["skewX", "skewY"],
|
||||||
position: ["x", "y", "z"],
|
position: ["x", "y", "z"],
|
||||||
scale: ["scaleX", "scaleY", "scaleZ"],
|
scale: ["scaleX", "scaleY", "scaleZ"],
|
||||||
designResolution: ["width", "height"], // 这个比较特殊,在key下边,其他的都不是在key下
|
designResolution: ["width", "height"], // 这个比较特殊,在key下边,其他的都不是在key下
|
||||||
@ -240,7 +240,7 @@ class CCInspector {
|
|||||||
const data: ImageData = options.data;
|
const data: ImageData = options.data;
|
||||||
const path: Array<string> = options.path;
|
const path: Array<string> = options.path;
|
||||||
if (ctor && value instanceof ctor) {
|
if (ctor && value instanceof ctor) {
|
||||||
if (value.hasOwnProperty('_textureFilename')) {
|
if (value.hasOwnProperty("_textureFilename")) {
|
||||||
data.path = path;
|
data.path = path;
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
data.data = `${window.location.origin}/${value._textureFilename}`;
|
data.data = `${window.location.origin}/${value._textureFilename}`;
|
||||||
@ -287,7 +287,7 @@ class CCInspector {
|
|||||||
ctor: cc.Vec3,
|
ctor: cc.Vec3,
|
||||||
path: path,
|
path: path,
|
||||||
data: new Vec3Data(),
|
data: new Vec3Data(),
|
||||||
keys: ['x', 'y', 'z'],
|
keys: ["x", "y", "z"],
|
||||||
value: propertyValue,
|
value: propertyValue,
|
||||||
}))
|
}))
|
||||||
!info && (info = this._buildVecData({
|
!info && (info = this._buildVecData({
|
||||||
@ -295,7 +295,7 @@ class CCInspector {
|
|||||||
ctor: cc.Vec2,
|
ctor: cc.Vec2,
|
||||||
path: path,
|
path: path,
|
||||||
data: new Vec2Data(),
|
data: new Vec2Data(),
|
||||||
keys: ['x', 'y'],
|
keys: ["x", "y"],
|
||||||
value: propertyValue
|
value: propertyValue
|
||||||
}))
|
}))
|
||||||
!info && (info = this._buildImageData({
|
!info && (info = this._buildImageData({
|
||||||
@ -308,7 +308,7 @@ class CCInspector {
|
|||||||
if (!info) {
|
if (!info) {
|
||||||
if (typeof propertyValue === "object") {
|
if (typeof propertyValue === "object") {
|
||||||
let ctorName = propertyValue.constructor.name;
|
let ctorName = propertyValue.constructor.name;
|
||||||
if (ctorName.startsWith('cc_')) {
|
if (ctorName.startsWith("cc_")) {
|
||||||
info = new EngineData();
|
info = new EngineData();
|
||||||
info.engineType = ctorName;
|
info.engineType = ctorName;
|
||||||
info.engineName = propertyValue.name;
|
info.engineName = propertyValue.name;
|
||||||
@ -341,7 +341,7 @@ class CCInspector {
|
|||||||
let data: ObjectData | ArrayData = options.data;
|
let data: ObjectData | ArrayData = options.data;
|
||||||
let keys: Array<string> = options.keys;
|
let keys: Array<string> = options.keys;
|
||||||
// 剔除_开头的属性
|
// 剔除_开头的属性
|
||||||
keys = keys.filter(key => !key.toString().startsWith('_'));
|
keys = keys.filter(key => !key.toString().startsWith("_"));
|
||||||
for (let i = 0; i < keys.length; i++) {
|
for (let i = 0; i < keys.length; i++) {
|
||||||
let key = keys[i];
|
let key = keys[i];
|
||||||
let propPath = path.concat(key.toString());
|
let propPath = path.concat(key.toString());
|
||||||
@ -353,8 +353,23 @@ class CCInspector {
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private getCompName(comp: any): string {
|
||||||
|
const nameKeys = [
|
||||||
|
"__classname__", // 2.4.0 验证通过
|
||||||
|
];
|
||||||
|
for (let i = 0; i < nameKeys.length; i++) {
|
||||||
|
let key = nameKeys[i];
|
||||||
|
// 一般来说,这里的name是不会出现假值
|
||||||
|
if (comp[key]) {
|
||||||
|
return comp[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return comp.constructor.name;
|
||||||
|
}
|
||||||
|
|
||||||
_getGroupData(node: any) {
|
_getGroupData(node: any) {
|
||||||
let nodeGroup = new Group(node.constructor.name);
|
const name = this.getCompName(node);
|
||||||
|
let nodeGroup = new Group(name);
|
||||||
let keys = this._getNodeKeys(node);
|
let keys = this._getNodeKeys(node);
|
||||||
for (let i = 0; i < keys.length;) {
|
for (let i = 0; i < keys.length;) {
|
||||||
let key = keys[i];
|
let key = keys[i];
|
||||||
|
@ -83,6 +83,7 @@ export default class properties extends Vue {
|
|||||||
user-select: none;
|
user-select: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border-bottom: 1px #6d6d6d solid;
|
border-bottom: 1px #6d6d6d solid;
|
||||||
|
background-color: #1da1f7;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header:hover {
|
.header:hover {
|
||||||
|
@ -10,7 +10,13 @@
|
|||||||
:class="fold?'el-icon-caret-right':'el-icon-caret-bottom'"
|
:class="fold?'el-icon-caret-right':'el-icon-caret-bottom'"
|
||||||
:style="{'visibility':isArrayOrObject()?'visible':'hidden','margin-left':indent*10+'px'}">
|
:style="{'visibility':isArrayOrObject()?'visible':'hidden','margin-left':indent*10+'px'}">
|
||||||
</i>
|
</i>
|
||||||
<div class="text">{{ name }}</div>
|
<div class="text">
|
||||||
|
<el-popover placement="top" trigger="click">
|
||||||
|
<div>{{ name }}</div>
|
||||||
|
<span slot="reference">{{ name }}</span>
|
||||||
|
</el-popover>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="value">
|
<div class="value">
|
||||||
<el-input v-if="isString()" v-model="value.data"
|
<el-input v-if="isString()" v-model="value.data"
|
||||||
@ -117,10 +123,10 @@
|
|||||||
|
|
||||||
import Vue from "vue"
|
import Vue from "vue"
|
||||||
import {Component, Prop} from "vue-property-decorator"
|
import {Component, Prop} from "vue-property-decorator"
|
||||||
import {DataType, Info, EngineData} from './data'
|
import {DataType, Info, EngineData} from "./data"
|
||||||
import {connectBackground} from "@/devtools/connectBackground";
|
import {connectBackground} from "@/devtools/connectBackground";
|
||||||
import {Msg} from "@/core/types";
|
import {Msg} from "@/core/types";
|
||||||
import Bus, {BusMsg} from './bus'
|
import Bus, {BusMsg} from "./bus"
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
components: {}
|
components: {}
|
||||||
@ -200,17 +206,17 @@ export default class UiProp extends Vue {
|
|||||||
getEngineTypeIcon() {
|
getEngineTypeIcon() {
|
||||||
const value = this.value as EngineData;
|
const value = this.value as EngineData;
|
||||||
switch (value.engineType) {
|
switch (value.engineType) {
|
||||||
case 'cc_Sprite': {
|
case "cc_Sprite": {
|
||||||
return 'el-icon-picture-outline';
|
return "el-icon-picture-outline";
|
||||||
}
|
}
|
||||||
case 'cc_Label': {
|
case "cc_Label": {
|
||||||
return 'el-icon-third-text';
|
return "el-icon-third-text";
|
||||||
}
|
}
|
||||||
case 'cc_Node': {
|
case "cc_Node": {
|
||||||
return 'el-icon-third-node'
|
return "el-icon-third-node"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 'el-icon-third-unknow';
|
return "el-icon-third-unknow";
|
||||||
}
|
}
|
||||||
|
|
||||||
getName(isArray: boolean, arr: UiProp) {
|
getName(isArray: boolean, arr: UiProp) {
|
||||||
@ -232,7 +238,7 @@ export default class UiProp extends Vue {
|
|||||||
try {
|
try {
|
||||||
return JSON.stringify(this.value.data)
|
return JSON.stringify(this.value.data)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return ''
|
return ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,7 +273,7 @@ export default class UiProp extends Vue {
|
|||||||
colorReverse(OldColorValue: string) {
|
colorReverse(OldColorValue: string) {
|
||||||
OldColorValue = "0x" + OldColorValue.replace(/#/g, "");
|
OldColorValue = "0x" + OldColorValue.replace(/#/g, "");
|
||||||
var str = "000000" + (0xFFFFFF - parseInt(OldColorValue)).toString(16);
|
var str = "000000" + (0xFFFFFF - parseInt(OldColorValue)).toString(16);
|
||||||
return '#' + str.substring(str.length - 6, str.length);
|
return "#" + str.substring(str.length - 6, str.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
_onSelect() {
|
_onSelect() {
|
||||||
@ -331,9 +337,19 @@ export default class UiProp extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.text {
|
.text {
|
||||||
|
flex: 1;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
margin: 3px;
|
margin: 3px;
|
||||||
|
|
||||||
|
span{
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -419,9 +435,6 @@ export default class UiProp extends Vue {
|
|||||||
display: block;
|
display: block;
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
flex: unset;
|
flex: unset;
|
||||||
|
|
||||||
.text {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user