mirror of
https://github.com/tidys/cc-inspector-chrome
synced 2025-05-15 21:44:00 +00:00
支持2.x的游戏刷新
This commit is contained in:
parent
8f859c7f9e
commit
a4eec2b4b5
@ -305,13 +305,28 @@ export default defineComponent({
|
||||
break;
|
||||
}
|
||||
case shortKeyGameFresh: {
|
||||
let router = "";
|
||||
let isCreator2X = false;
|
||||
if (typeof cc !== "undefined" && cc && typeof cc.ENGINE_VERSION !== "undefined") {
|
||||
if (cc.ENGINE_VERSION.startsWith("3.")) {
|
||||
isCreator2X = false;
|
||||
router = "asset-db/refresh";
|
||||
} else {
|
||||
isCreator2X = true;
|
||||
router = "update-db";
|
||||
}
|
||||
}
|
||||
const url = new URL(window.location.href);
|
||||
const port = Number(url.port) || 7456;
|
||||
fetch(`http://localhost:${port}/asset-db/refresh`)
|
||||
fetch(`http://localhost:${port}/${router}`)
|
||||
.then((res) => {
|
||||
res.text().then((a: string) => {
|
||||
if (a === "success") {
|
||||
window.location.reload();
|
||||
if (isCreator2X === false && a === "success") {
|
||||
// 3.x
|
||||
}
|
||||
if (isCreator2X === true && a === "Changes submitted") {
|
||||
// 2.x
|
||||
}
|
||||
});
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user