diff --git a/cc-inspector/src/ga/type.ts b/cc-inspector/src/ga/type.ts
index 0103627..12c3946 100644
--- a/cc-inspector/src/ga/type.ts
+++ b/cc-inspector/src/ga/type.ts
@@ -79,6 +79,10 @@ export enum GA_EventName {
Inspector = "Inspector",
EngineVersion = "engine_version",
AppVersion = "app_version",
+ GamePlayer = "game_player",
+ GamePause = "game_pause",
+ GameStep = "game_step",
+ GameInspectorFilter = "game_inspector_filter",
/**
* 用户点击store广告链接
*/
@@ -94,7 +98,7 @@ export enum GA_EventName {
/**
* 用户主动使用inspector检查游戏节点
*/
- DoInspector = "do_inspector",
+ GameInspector = "game_inspector",
}
export enum GA_Button {
Github = "github",
diff --git a/cc-inspector/src/scripts/content/index.ts b/cc-inspector/src/scripts/content/index.ts
index f768f43..97860f5 100644
--- a/cc-inspector/src/scripts/content/index.ts
+++ b/cc-inspector/src/scripts/content/index.ts
@@ -58,7 +58,7 @@ document.addEventListener(DocumentEvent.Inject2Content, (event: CustomEvent) =>
connect.postMessage(data);
} else {
debugLog && console.log(...terminal.log(`connect is null`));
- throw new Error("connect is null");
+ console.log("connect is null");
}
} else {
throw new Error(`invalid data: ${event.detail}`);
diff --git a/cc-inspector/src/scripts/inject-view/app.vue b/cc-inspector/src/scripts/inject-view/app.vue
index 276b225..f3fb1f4 100644
--- a/cc-inspector/src/scripts/inject-view/app.vue
+++ b/cc-inspector/src/scripts/inject-view/app.vue
@@ -6,7 +6,7 @@
-
+
@@ -65,20 +65,22 @@ export default defineComponent({
},
{
icon: "icon_do_play",
- click: (event: MouseEvent, item: ListItem) => {},
- visible: true,
- txt: "game play",
- contextmenu: () => {
+ click: (event: MouseEvent, item: ListItem) => {
+ ga(GA_EventName.GamePlayer);
if (typeof cc !== "undefined") {
cc.game.resume();
}
},
+ visible: true,
+ txt: "game play",
+ contextmenu: () => {},
},
{
icon: "icon_do_pause",
visible: true,
txt: "game pause",
click: () => {
+ ga(GA_EventName.GamePause);
if (typeof cc !== "undefined") {
cc.game.pause();
}
@@ -90,6 +92,7 @@ export default defineComponent({
visible: true,
txt: "game step",
click: () => {
+ ga(GA_EventName.GameStep);
if (typeof cc !== "undefined") {
cc.game.step();
}
@@ -101,10 +104,12 @@ export default defineComponent({
txt: "Inspect Game",
visible: true,
click: () => {
- ga(GA_EventName.DoInspector);
- showBtns.value = false;
+ ga(GA_EventName.GameInspector);
+ if (config.value.autoHide) {
+ showBtns.value = false;
+ }
picking.value = true;
- if (false) {
+ if (typeof cc === "undefined") {
testInspector();
} else {
const event = new CustomEvent(DocumentEvent.GameInspectorBegan);
@@ -133,10 +138,19 @@ export default defineComponent({
};
});
ccui.menu.showMenuByMouseEvent(event, [
+ {
+ name: "Pick Top",
+ selected: config.value.pickTop,
+ callback: (menu: IUiMenuItem) => {
+ config.value.pickTop = !config.value.pickTop;
+ appStore().save();
+ },
+ },
{
name: "Filter Enabled",
selected: inspectTarget.enabled,
callback: (menu: IUiMenuItem) => {
+ ga(GA_EventName.GameInspectorFilter);
inspectTarget.enabled = !inspectTarget.enabled;
},
},
@@ -206,6 +220,9 @@ export default defineComponent({
clearTimeout(autoHideTimer);
showBtns.value = true;
},
+ onCocosLogoClick() {
+ showBtns.value = !showBtns.value;
+ },
onContextMenuRoot(event: MouseEvent) {
const arr: IUiMenuItem[] = [
{
@@ -264,19 +281,36 @@ export default defineComponent({