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", ResponseMemoryInfo = "response-memory-info",
MemoryInfo = "memory-info", MemoryInfo = "memory-info",
VisibleFPS = "visible-fps",
/** /**
* *
*/ */

View File

@ -26,6 +26,23 @@ export class Inspector extends InjectEvent {
this.updateTreeInfo(); this.updateTreeInfo();
break; 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: { case Msg.RequestGameInfo: {
const ret = new ResponseGameInfoData(); const ret = new ResponseGameInfoData();
const atlasManager = cc?.dynamicAtlasManager || cc.internal?.dynamicAtlasManager || null; const atlasManager = cc?.dynamicAtlasManager || cc.internal?.dynamicAtlasManager || null;

View File

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