mirror of
https://github.com/tidys/cc-inspector-chrome
synced 2025-04-17 23:48:41 +00:00
增加刷新游戏的快捷键
This commit is contained in:
parent
6c5a6c84ce
commit
dada072624
@ -283,7 +283,7 @@ export default defineComponent({
|
|||||||
const picking = ref(false);
|
const picking = ref(false);
|
||||||
|
|
||||||
const keydownFunc = (e: KeyboardEvent) => {
|
const keydownFunc = (e: KeyboardEvent) => {
|
||||||
const { shortKeyPick, shortKeyGameStep, shortKeyGamePauseResume } = config.value;
|
const { shortKeyPick, shortKeyGameFresh, shortKeyGameStep, shortKeyGamePauseResume } = config.value;
|
||||||
switch (e.code) {
|
switch (e.code) {
|
||||||
case shortKeyPick: {
|
case shortKeyPick: {
|
||||||
if (picking.value === false) {
|
if (picking.value === false) {
|
||||||
@ -304,6 +304,20 @@ export default defineComponent({
|
|||||||
showGameTip.value = !!cc.game.isPaused();
|
showGameTip.value = !!cc.game.isPaused();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case shortKeyGameFresh: {
|
||||||
|
const url = new URL(window.location.href);
|
||||||
|
const port = Number(url.port) || 7456;
|
||||||
|
fetch(`http://localhost:${port}/asset-db/refresh`)
|
||||||
|
.then((res) => {
|
||||||
|
res.text().then((a: string) => {
|
||||||
|
if (a === "success") {
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.then((data) => {});
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
/**是否显示游戏暂停的提示 */
|
/**是否显示游戏暂停的提示 */
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
<CCProp name="Node Pick"> <CCSelect @change="onChangePick" :value="config.shortKeyPick" :data="keyOptions"></CCSelect> </CCProp>
|
<CCProp name="Node Pick"> <CCSelect @change="onChangePick" :value="config.shortKeyPick" :data="keyOptions"></CCSelect> </CCProp>
|
||||||
<CCProp name="Game Pause/Resume"> <CCSelect @change="onChangeGamePauseResume" :value="config.shortKeyGamePauseResume" :data="keyOptions"></CCSelect> </CCProp>
|
<CCProp name="Game Pause/Resume"> <CCSelect @change="onChangeGamePauseResume" :value="config.shortKeyGamePauseResume" :data="keyOptions"></CCSelect> </CCProp>
|
||||||
<CCProp name="Game Step"> <CCSelect @change="onChangeGameStep" :value="config.shortKeyGameStep" :data="keyOptions"></CCSelect> </CCProp>
|
<CCProp name="Game Step"> <CCSelect @change="onChangeGameStep" :value="config.shortKeyGameStep" :data="keyOptions"></CCSelect> </CCProp>
|
||||||
|
<CCProp name="Game Fresh"> <CCSelect @change="onChangeGameFresh" :value="config.shortKeyGameFresh" :data="keyOptions"></CCSelect> </CCProp>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
@ -47,6 +48,10 @@ export default defineComponent({
|
|||||||
config.value.shortKeyGameStep = v;
|
config.value.shortKeyGameStep = v;
|
||||||
appStore().save();
|
appStore().save();
|
||||||
},
|
},
|
||||||
|
onChangeGameFresh(v: string) {
|
||||||
|
config.value.shortKeyGameFresh = v;
|
||||||
|
appStore().save();
|
||||||
|
},
|
||||||
onChangeGamePauseResume(v: string) {
|
onChangeGamePauseResume(v: string) {
|
||||||
config.value.shortKeyGamePauseResume = v;
|
config.value.shortKeyGamePauseResume = v;
|
||||||
appStore().save();
|
appStore().save();
|
||||||
|
@ -18,6 +18,7 @@ export class ConfigData {
|
|||||||
shortKeyPick: string = "Escape";
|
shortKeyPick: string = "Escape";
|
||||||
shortKeyGameStep: string = "F8";
|
shortKeyGameStep: string = "F8";
|
||||||
shortKeyGamePauseResume: string = "Space";
|
shortKeyGamePauseResume: string = "Space";
|
||||||
|
shortKeyGameFresh: string = "F1";
|
||||||
}
|
}
|
||||||
|
|
||||||
export const appStore = defineStore("app", () => {
|
export const appStore = defineStore("app", () => {
|
||||||
@ -34,6 +35,7 @@ export const appStore = defineStore("app", () => {
|
|||||||
config.value.shortKeyPick = data.shortKeyPick;
|
config.value.shortKeyPick = data.shortKeyPick;
|
||||||
config.value.shortKeyGameStep = data.shortKeyGameStep;
|
config.value.shortKeyGameStep = data.shortKeyGameStep;
|
||||||
config.value.shortKeyGamePauseResume = data.shortKeyGamePauseResume;
|
config.value.shortKeyGamePauseResume = data.shortKeyGamePauseResume;
|
||||||
|
config.value.shortKeyGameFresh = data.shortKeyGameFresh;
|
||||||
},
|
},
|
||||||
save() {
|
save() {
|
||||||
const cfg = toRaw(config.value);
|
const cfg = toRaw(config.value);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user