mirror of
https://github.com/tidys/cc-inspector-chrome
synced 2025-04-18 07:58:40 +00:00
当没有发现cocos制作的游戏时,使用定时器检测每300ms检测一次
This commit is contained in:
parent
3e9d259b2c
commit
ed7de8cdae
65
cc-inspector/src/views/devtools/find.vue
Normal file
65
cc-inspector/src/views/devtools/find.vue
Normal file
@ -0,0 +1,65 @@
|
||||
<template>
|
||||
<div class="find-game">
|
||||
<span>no games created by cocos creator found!</span>
|
||||
<i class="fresh iconfont icon_refresh" @click="onBtnClickUpdatePage"></i>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { defineComponent, onMounted, onUnmounted } from "vue";
|
||||
import { Msg, RequestSupportData } from "../../core/types";
|
||||
import { bridge } from "./bridge";
|
||||
export default defineComponent({
|
||||
name: "find",
|
||||
setup(props) {
|
||||
let timer: NodeJS.Timer = null;
|
||||
onMounted(() => {
|
||||
timer = setInterval(() => {
|
||||
checkSupport();
|
||||
}, 300);
|
||||
});
|
||||
onUnmounted(() => {
|
||||
clearInterval(timer);
|
||||
});
|
||||
|
||||
function checkSupport() {
|
||||
bridge.send(Msg.RequestSupport, {} as RequestSupportData);
|
||||
}
|
||||
return {
|
||||
onBtnClickUpdatePage() {
|
||||
checkSupport();
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.find-game {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
user-select: none;
|
||||
|
||||
span {
|
||||
margin-right: 20px;
|
||||
color: white;
|
||||
font-size: 20px;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.fresh {
|
||||
cursor: pointer;
|
||||
color: white;
|
||||
font-size: 20px;
|
||||
|
||||
&:hover {
|
||||
color: #cef57b;
|
||||
}
|
||||
|
||||
&:active {
|
||||
color: #ffaa00;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
@ -29,10 +29,7 @@
|
||||
<Properties v-if="treeItemData" :data="treeItemData"></Properties>
|
||||
</div>
|
||||
</div>
|
||||
<div v-show="!isShowDebug" class="no-find">
|
||||
<span>no games created by cocos creator found!</span>
|
||||
<i class="fresh iconfont icon_refresh" @click="onBtnClickUpdatePage"></i>
|
||||
</div>
|
||||
<Find v-if="!isShowDebug"></Find>
|
||||
<CCDialog></CCDialog>
|
||||
<CCFootBar :version="version"></CCFootBar>
|
||||
</div>
|
||||
@ -45,10 +42,11 @@ import { Option } from "@xuyanfeng/cc-ui/types/cc-select/const";
|
||||
import { storeToRefs } from "pinia";
|
||||
import { defineComponent, nextTick, onMounted, reactive, ref, toRaw, watch } from "vue";
|
||||
import PluginConfig from "../../../cc-plugin.config";
|
||||
import { Msg, PluginEvent, RequestNodeInfoData, RequestSupportData, RequestTreeInfoData, RequestLogData, RequestObjectData, RequestUseFrameData, ResponseObjectData, ResponseSetPropertyData, ResponseSupportData } from "../../core/types";
|
||||
import { Msg, PluginEvent, RequestLogData, RequestNodeInfoData, RequestObjectData, RequestTreeInfoData, RequestUseFrameData, ResponseObjectData, ResponseSetPropertyData, ResponseSupportData } from "../../core/types";
|
||||
import { bridge } from "./bridge";
|
||||
import Bus, { BusMsg } from "./bus";
|
||||
import { EngineData, FrameDetails, NodeInfoData, ObjectData, TreeData } from "./data";
|
||||
import Find from "./find.vue";
|
||||
import { appStore, RefreshType } from "./store";
|
||||
import Test from "./test/test.vue";
|
||||
import Properties from "./ui/propertys.vue";
|
||||
@ -61,7 +59,7 @@ interface FrameInfo {
|
||||
}
|
||||
|
||||
export default defineComponent({
|
||||
components: { Test, CCFootBar, CCDialog, CCTree, CCDivider, CCButtonGroup, Properties, SettingsVue, CCInput, CCButton, CCInputNumber, CCSelect, CCCheckBox, CCColor },
|
||||
components: { Find, Test, CCFootBar, CCDialog, CCTree, CCDivider, CCButtonGroup, Properties, SettingsVue, CCInput, CCButton, CCInputNumber, CCSelect, CCCheckBox, CCColor },
|
||||
name: "devtools",
|
||||
props: {},
|
||||
setup(props, ctx) {
|
||||
@ -242,24 +240,14 @@ export default defineComponent({
|
||||
}
|
||||
}
|
||||
};
|
||||
msgFunctionMap[Msg.ResponseUpdateFrames] = (details: FrameDetails[]) => {
|
||||
// 先把iframes里面无效的清空了
|
||||
iframes.value = iframes.value.filter((item) => {
|
||||
details.find((el) => el.frameID === item.value);
|
||||
msgFunctionMap[Msg.ResponseUpdateFrames] = (resFrames: FrameDetails[]) => {
|
||||
iframes.value = resFrames.map((item) => {
|
||||
return {
|
||||
label: item.url,
|
||||
value: item.frameID,
|
||||
};
|
||||
});
|
||||
|
||||
// 同步配置
|
||||
details.forEach((item) => {
|
||||
let findItem = iframes.value.find((el) => el.value === item.frameID);
|
||||
if (findItem) {
|
||||
findItem.label = item.url;
|
||||
} else {
|
||||
iframes.value.push({
|
||||
label: item.url,
|
||||
value: item.frameID,
|
||||
});
|
||||
}
|
||||
});
|
||||
// 第一次获取到frame配置后,自动获取frame数据
|
||||
if (frameID === null && iframes.value.length > 0 && !iframes.value.find((el) => el.value === frameID.value)) {
|
||||
frameID.value = iframes[0].value;
|
||||
@ -455,9 +443,6 @@ export default defineComponent({
|
||||
}
|
||||
},
|
||||
|
||||
onBtnClickUpdatePage() {
|
||||
bridge.send(Msg.RequestSupport, {} as RequestSupportData);
|
||||
},
|
||||
onMemoryTest() {
|
||||
bridge.send(Msg.MemoryInfo);
|
||||
},
|
||||
@ -509,36 +494,6 @@ export default defineComponent({
|
||||
}
|
||||
}
|
||||
|
||||
.no-find {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
user-select: none;
|
||||
|
||||
span {
|
||||
margin-right: 20px;
|
||||
color: white;
|
||||
font-size: 20px;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.fresh {
|
||||
cursor: pointer;
|
||||
color: white;
|
||||
font-size: 20px;
|
||||
|
||||
&:hover {
|
||||
color: #cef57b;
|
||||
}
|
||||
|
||||
&:active {
|
||||
color: #ffaa00;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.find {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user