mirror of
https://github.com/tidys/cc-inspector-chrome
synced 2025-11-05 05:46:41 +00:00
完成大致的版本
This commit is contained in:
@@ -50,65 +50,6 @@ export default class NodeBaseProperty extends Vue {
|
||||
}
|
||||
}
|
||||
|
||||
changeSizeActionWidth(step: number) {
|
||||
let w = parseFloat(this.itemData.width);
|
||||
// this.itemData.width = w + step;
|
||||
this.changeSize();
|
||||
}
|
||||
|
||||
|
||||
changeSizeActionHeight(step: number) {
|
||||
let h = parseFloat(this.itemData.height);
|
||||
// this.itemData.height = h + step;
|
||||
this.changeSize();
|
||||
}
|
||||
|
||||
|
||||
changePositionActionX(step: number) {
|
||||
let x = parseFloat(this.itemData.x);
|
||||
// this.itemData.x = x + step;
|
||||
this.changePosition();
|
||||
}
|
||||
|
||||
|
||||
changePositionActionY(step: number) {
|
||||
let y = parseFloat(this.itemData.y);
|
||||
// this.itemData.y = y + step;
|
||||
this.changePosition();
|
||||
}
|
||||
|
||||
|
||||
changePosition() {
|
||||
this._evalCode(
|
||||
"window.ccinspector.pluginSetNodePosition(" +
|
||||
"'" + this.itemData.uuid + "'," +
|
||||
"'" + this.itemData.x + "'," +
|
||||
"'" + this.itemData.y + "'" +
|
||||
")");
|
||||
this._freshNode();
|
||||
}
|
||||
|
||||
|
||||
changeSize() {
|
||||
this._evalCode(
|
||||
"window.ccinspector.pluginSetNodeSize(" +
|
||||
"'" + this.itemData.uuid + "'," +
|
||||
"'" + this.itemData.width + "'," +
|
||||
"'" + this.itemData.height + "'" +
|
||||
")");
|
||||
this._freshNode();
|
||||
}
|
||||
|
||||
|
||||
changeRotation() {
|
||||
console.log("change rotation:" + this.itemData.rotation);
|
||||
this._evalCode(
|
||||
"window.ccinspector.pluginSetNodeRotation('" +
|
||||
this.itemData.uuid + "','" +
|
||||
this.itemData.rotation + "')");
|
||||
this._freshNode();
|
||||
}
|
||||
|
||||
|
||||
changeColor() {
|
||||
let color = this.itemData.color;
|
||||
@@ -120,27 +61,6 @@ export default class NodeBaseProperty extends Vue {
|
||||
this._freshNode();
|
||||
}
|
||||
|
||||
|
||||
onBtnClickNodeHide() {
|
||||
let uuid = this.itemData.uuid;
|
||||
if (uuid !== undefined) {
|
||||
let code = "window.ccinspector.pluginSetNodeActive('" + uuid + "', 0);";
|
||||
this._evalCode(code);
|
||||
this._freshNode();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
onBtnClickNodeShow() {
|
||||
let uuid = this.itemData.uuid;
|
||||
if (uuid !== undefined) {
|
||||
let code = "window.ccinspector.pluginSetNodeActive('" + uuid + "', 1);";
|
||||
this._evalCode(code);
|
||||
this._freshNode();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
_freshNode() {
|
||||
let uuid = this.itemData.uuid;
|
||||
let code2 = "window.ccinspector.getNodeInfo('" + uuid + "')";
|
||||
@@ -155,8 +75,6 @@ export default class NodeBaseProperty extends Vue {
|
||||
console.log(code);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -7,6 +7,9 @@ export enum DataType {
|
||||
Enum,
|
||||
Bool,
|
||||
Color,
|
||||
NullOrUndefined,
|
||||
Array, // 暂时在控制台打印下
|
||||
Object,
|
||||
}
|
||||
|
||||
class Info {
|
||||
@@ -21,6 +24,28 @@ export class TextData extends Info {
|
||||
}
|
||||
}
|
||||
|
||||
export class ArrayData extends Info {
|
||||
constructor() {
|
||||
super();
|
||||
this.type = DataType.Array;
|
||||
}
|
||||
}
|
||||
|
||||
export class ObjectData extends Info {
|
||||
constructor() {
|
||||
super();
|
||||
this.type = DataType.Object;
|
||||
}
|
||||
}
|
||||
|
||||
export class NullOrUndefinedData extends Info {
|
||||
constructor() {
|
||||
super();
|
||||
this.type = DataType.NullOrUndefined;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
export class ColorData extends Info {
|
||||
constructor(color: string) {
|
||||
super();
|
||||
|
||||
@@ -4,6 +4,7 @@ import "element-ui/lib/theme-chalk/index.css"
|
||||
import "./global.less"
|
||||
import index from "./index.vue";
|
||||
import './register-panel';
|
||||
|
||||
Vue.use(ElementUI, {size: "mini"});
|
||||
new Vue({
|
||||
el: "#app",
|
||||
|
||||
@@ -11,6 +11,9 @@ if (chrome && chrome.devtools) {
|
||||
chrome.devtools.panels.create("Cocos", "icons/48.png", Manifest.devtools_page, (panel: chrome.devtools.panels.ExtensionPanel) => {
|
||||
console.log("[CC-Inspector] Dev Panel Created!");
|
||||
let conn = chrome.runtime.connect({name: PluginMsg.Page.DevToolsPanel});
|
||||
conn.onDisconnect.addListener(() => {
|
||||
console.log(`%c[Connect-Dis]`, 'color:red;')
|
||||
})
|
||||
conn.onMessage.addListener((event, sender) => {
|
||||
console.log(`[Message] ${JSON.stringify(event)}`);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user