fsp显示隐藏

This commit is contained in:
xu_yanfeng 2025-01-14 18:33:28 +08:00
parent f014c62f75
commit 12ddbf8ac9
3 changed files with 48 additions and 5 deletions

View File

@ -93,6 +93,7 @@ export enum Msg {
ResponseMemoryInfo = "response-memory-info",
MemoryInfo = "memory-info",
VisibleFPS = "visible-fps",
/**
*
*/

View File

@ -26,6 +26,23 @@ export class Inspector extends InjectEvent {
this.updateTreeInfo();
break;
}
case Msg.VisibleFPS: {
const b = pluginEvent.data as boolean;
if (b) {
if (cc.profiler?.showStats) {
cc.profiler.showStats();
} else if (cc.debug?.setDisplayStats) {
cc.debug.setDisplayStats(true);
}
} else {
if (cc.profiler?.hideStats) {
cc.profiler.hideStats();
} else if (cc.debug?.setDisplayStats) {
cc.debug.setDisplayStats(false);
}
}
break;
}
case Msg.RequestGameInfo: {
const ret = new ResponseGameInfoData();
const atlasManager = cc?.dynamicAtlasManager || cc.internal?.dynamicAtlasManager || null;

View File

@ -39,12 +39,12 @@ export default defineComponent({
};
const funcEnableSchedule = (b: boolean) => {
if (b) {
timer.create();
timer_hierarchy.create();
} else {
timer.clean();
timer_hierarchy.clean();
}
};
const timer: Timer = new Timer(() => {
const timer_hierarchy: Timer = new Timer(() => {
updateTree();
});
let ins: MousetrapInstance | null = null;
@ -68,7 +68,7 @@ export default defineComponent({
Bus.on(BusMsg.ChangeContent, changeContent);
Bus.on(BusMsg.ShowPlace, funcShowPlace);
Bus.on(BusMsg.EnableSchedule, funcEnableSchedule);
timer.create();
timer_hierarchy.create();
});
onUnmounted(() => {
if (ins) {
@ -77,7 +77,7 @@ export default defineComponent({
Bus.off(BusMsg.ChangeContent, changeContent);
Bus.off(BusMsg.ShowPlace, funcShowPlace);
Bus.off(BusMsg.EnableSchedule, funcEnableSchedule);
timer.clean();
timer_hierarchy.clean();
});
function _expand(uuid: string) {
if (elTree.value) {
@ -215,6 +215,31 @@ export default defineComponent({
updateTree();
},
});
menus.push({
name: "fresh auto",
callback: () => {
timer_hierarchy.create();
},
});
menus.push({
name: "fresh manual",
callback: () => {
timer_hierarchy.clean();
},
});
menus.push({
name: "fps show",
callback: () => {
bridge.send(Msg.VisibleFPS, true);
},
});
menus.push({
name: "fps hide",
callback: () => {
bridge.send(Msg.VisibleFPS, false);
},
});
menus.push({
name: "game info",
callback() {