mirror of
https://github.com/tidys/cc-inspector-chrome
synced 2025-04-16 07:01:03 +00:00
丢失链接,未发现cocos游戏给出详细的提示
This commit is contained in:
parent
f51162db06
commit
6ec242e57c
@ -1,4 +1,4 @@
|
|||||||
import { Msg, Page, PluginEvent, RequestTreeInfoData, RequestUseFrameData } from "../../core/types";
|
import { Msg, Page, PluginEvent, RequestTreeInfoData, RequestUseFrameData, ResponseSupportData } from "../../core/types";
|
||||||
import { PortMan } from "./portMan";
|
import { PortMan } from "./portMan";
|
||||||
import { portMgr } from "./portMgr";
|
import { portMgr } from "./portMgr";
|
||||||
|
|
||||||
@ -26,6 +26,8 @@ export class PortDevtools extends PortMan {
|
|||||||
const port = portMgr.getCurrentUsePort();
|
const port = portMgr.getCurrentUsePort();
|
||||||
if (!port) {
|
if (!port) {
|
||||||
console.warn(`not find any port`);
|
console.warn(`not find any port`);
|
||||||
|
const e = new PluginEvent(Page.Background, Page.Devtools, Msg.ResponseSupport, { support: false, msg: "disconnect with game, please refresh page" } as ResponseSupportData);
|
||||||
|
this.send(e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
port.send(data);
|
port.send(data);
|
||||||
|
@ -65,7 +65,7 @@ function checkGame() {
|
|||||||
let gameCanvas = document.querySelector("#GameCanvas");
|
let gameCanvas = document.querySelector("#GameCanvas");
|
||||||
const sendData = new PluginEvent(Page.Content, Page.Devtools, Msg.ResponseSupport, {
|
const sendData = new PluginEvent(Page.Content, Page.Devtools, Msg.ResponseSupport, {
|
||||||
support: !!gameCanvas,
|
support: !!gameCanvas,
|
||||||
msg: "未发现GameCanvas,不支持调试游戏!",
|
msg: "",
|
||||||
} as ResponseSupportData);
|
} as ResponseSupportData);
|
||||||
if (connect) {
|
if (connect) {
|
||||||
connect.postMessage(sendData);
|
connect.postMessage(sendData);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// eval 注入脚本的代码,变量尽量使用var,后来发现在import之后,let会自动变为var
|
// eval 注入脚本的代码,变量尽量使用var,后来发现在import之后,let会自动变为var
|
||||||
import { uniq } from "lodash";
|
import { uniq } from "lodash";
|
||||||
import { debugLog, Msg, PluginEvent, RequestLogData, RequestNodeInfoData, RequestSetPropertyData, ResponseNodeInfoData, ResponseSetPropertyData, ResponseSupportData, ResponseTreeInfoData } from "../../core/types";
|
import { Msg, PluginEvent, RequestLogData, RequestNodeInfoData, RequestSetPropertyData, ResponseNodeInfoData, ResponseSetPropertyData, ResponseSupportData, ResponseTreeInfoData } from "../../core/types";
|
||||||
import { ArrayData, BoolData, ColorData, DataType, EngineData, Group, ImageData, Info, InvalidData, NodeInfoData, NumberData, ObjectCircleData, ObjectData, Property, StringData, TreeData, Vec2Data, Vec3Data, Vec4Data } from "../../views/devtools/data";
|
import { ArrayData, BoolData, ColorData, DataType, EngineData, Group, ImageData, Info, InvalidData, NodeInfoData, NumberData, ObjectCircleData, ObjectData, Property, StringData, TreeData, Vec2Data, Vec3Data, Vec4Data } from "../../views/devtools/data";
|
||||||
import { InjectEvent } from "./event";
|
import { InjectEvent } from "./event";
|
||||||
import { getValue, trySetValueWithConfig } from "./setValue";
|
import { getValue, trySetValueWithConfig } from "./setValue";
|
||||||
@ -81,7 +81,7 @@ export class Inspector extends InjectEvent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
init() {
|
init() {
|
||||||
debugLog && console.log(...this.terminal.init());
|
console.log(...this.terminal.init());
|
||||||
this.watchIsCocosGame();
|
this.watchIsCocosGame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,10 +23,20 @@ export enum CompType {
|
|||||||
ToggleContainer = "cc.ToggleContainer",
|
ToggleContainer = "cc.ToggleContainer",
|
||||||
Toggle = "cc.Toggle",
|
Toggle = "cc.Toggle",
|
||||||
Button = "cc.Button",
|
Button = "cc.Button",
|
||||||
|
BlockInputEvents = "cc.BlockInputEvents",
|
||||||
|
Scene = "cc.Scene",
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getSimpleProperties(typeName: string): string[] {
|
export function getSimpleProperties(typeName: string): string[] {
|
||||||
const config = {};
|
const config = {};
|
||||||
|
config[CompType.Scene] = [
|
||||||
|
"autoReleaseAssets",
|
||||||
|
"position",
|
||||||
|
"scale",
|
||||||
|
"rotation",
|
||||||
|
"color", //
|
||||||
|
];
|
||||||
|
config[CompType.BlockInputEvents] = ["enabled"];
|
||||||
config[CompType.Button] = [
|
config[CompType.Button] = [
|
||||||
"target", //
|
"target", //
|
||||||
"interactable",
|
"interactable",
|
||||||
|
@ -1,16 +1,32 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="find-game">
|
<div class="find-game">
|
||||||
<span>no games created by cocos creator found!</span>
|
<div style="display: flex; flex-direction: column">
|
||||||
|
<span>no games created by cocos creator found!</span>
|
||||||
|
<span>{{ msg }}</span>
|
||||||
|
</div>
|
||||||
<i class="fresh iconfont icon_refresh" @click="onBtnClickUpdatePage"></i>
|
<i class="fresh iconfont icon_refresh" @click="onBtnClickUpdatePage"></i>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent } from "vue";
|
import { defineComponent, ref } from "vue";
|
||||||
|
import { Msg, PluginEvent, ResponseSupportData } from "../../core/types";
|
||||||
|
import { bridge } from "./bridge";
|
||||||
import { checkSupport } from "./util";
|
import { checkSupport } from "./util";
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "find",
|
name: "find",
|
||||||
setup(props) {
|
setup(props) {
|
||||||
|
bridge.on(Msg.ResponseSupport, (event: PluginEvent) => {
|
||||||
|
let data: ResponseSupportData = event.data;
|
||||||
|
const b: boolean = data.support;
|
||||||
|
if (b) {
|
||||||
|
msg.value = "";
|
||||||
|
} else {
|
||||||
|
msg.value = data.msg;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const msg = ref<string>("");
|
||||||
return {
|
return {
|
||||||
|
msg,
|
||||||
onBtnClickUpdatePage() {
|
onBtnClickUpdatePage() {
|
||||||
checkSupport();
|
checkSupport();
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user