Skip to content

Commit 7f8ffdc

Browse files
committed
更新使用方式为左键功能右键返回
1 parent d4a1d9f commit 7f8ffdc

File tree

8 files changed

+63
-47
lines changed

8 files changed

+63
-47
lines changed

env.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const ISAAC_SOCKET_OFFICIAL_MOD_NAME = "IsaacSocket"
1313
const ISAAC_SOCKET_MOD_NAME = "IsaacSocket(auto installed)"
1414
const TARGET_ISAAC_SOCKET_MOD_VERSION = "1.0"
1515

16-
1716
const compareVersion = (v1, v2) => {
1817
const v1Arr = v1.split('.')
1918
const v2Arr = v2.split('.')

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<title>Isaac's Box</title>
88
</head>
99

10-
<body>
10+
<body oncontextmenu="return false">
1111
<div id="loading">LOADING</div>
1212
<div id="app"></div>
1313
<script type="module" src="/src/main.js"></script>

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "isaac-box",
33
"private": true,
4-
"version": "1.0.0",
4+
"version": "1.1.0",
55
"main": "main.js",
66
"author": "NOTF-API",
77
"description": "Isaac's Console Client based on IsaacSocket",

src/components/CardsList/CardItem.vue

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<template>
2-
<div class="item card" :class="{ 'list-styled': props.isListStyled }"
3-
@click.left="handleSpawn(pocketItemsData[props.gid].id)" @click.right="handleGive(props.gid)">
2+
<div class="item card" :class="{ 'list-styled': props.isListStyled }" @click="handleClick($event)">
43
<div class="gid" v-show="props.showId">{{ props.gid }}</div>
54
<div class="image">
65
<div class="sprite" :style="{ backgroundPosition: `${-data[gid].left * 32}px ${-data[gid].top * 32}px` }"></div>
@@ -18,13 +17,13 @@ import data from './cards.js'
1817
const props = defineProps(['gid', 'isListStyled', 'showId'])
1918
const pocketItemsData = window._resource.pocketItems
2019
21-
const handleSpawn = (id) => {
22-
emit("COMMAND", `spawn 5.300.${id}`);
23-
}
24-
25-
26-
const handleGive = (gid) => {
27-
emit("COMMAND", `g ${gid}`);
20+
const handleClick = ($event) => {
21+
const gid = props.gid
22+
if ($event.ctrlKey) {
23+
emit("COMMAND", `g ${gid}`);
24+
} else {
25+
emit("COMMAND", `spawn 5.300.${pocketItemsData[gid].id}`);
26+
}
2827
}
2928
</script>
3029

src/components/CollectiblesList/CollectibleItem.vue

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<template>
2-
<div class="item" :class="{ 'list-styled': props.isListStyled }" @click.left="handleSpawn(item.id)"
3-
@click.right="handleGive(item._gid)">
2+
<div class="item" :class="{ 'list-styled': props.isListStyled }" @click="handleClick($event, item)">
43
<div class="quality" v-show="props.showQuality" :class="'level' + item.quality"></div>
54
<div class="image" :style="getImageSource(item.gfx)"></div>
65
<div class="id" v-show="props.showId">{{ item._gid }}</div>
@@ -14,12 +13,20 @@ import { emit } from "@/utils/ws"
1413
1514
const props = defineProps(['item', 'isListStyled', 'showQuality', 'showId'])
1615
17-
const handleSpawn = (id) => {
18-
emit("COMMAND", `spawn 5.100.${id}`);
19-
}
2016
21-
const handleGive = (gid) => {
22-
emit("COMMAND", `g ${gid}`);
17+
/**
18+
* Handles the click event.
19+
*
20+
* @param {MouseEvent} $event - The click event object.
21+
* @param {Object} item - The item object.
22+
*/
23+
const handleClick = ($event, item) => {
24+
const { id, _gid } = item
25+
if ($event.ctrlKey) {
26+
emit("COMMAND", `g ${_gid}`);
27+
} else {
28+
emit("COMMAND", `spawn 5.100.${id}`);
29+
}
2330
}
2431
2532
const getImageSource = (gfx) => {

src/components/MainMenu/MainMenu.vue

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,28 +35,19 @@ const handleClear = () => {
3535
searchInput.value = ""
3636
}
3737
38+
window.addEventListener("mousedown", (event) => {
39+
if (event.button === 2) {
40+
handleReturn();
41+
}
42+
})
43+
3844
window.addEventListener("keydown", (event) => {
3945
if (event.key === "Escape") {
40-
if (isLanguageSelectVisible.value) {
41-
isLanguageSelectVisible.value = false;
42-
return;
43-
}
44-
if (searchInput.value.length !== 0) {
45-
searchInput.value = ""
46-
return;
47-
}
48-
submenus.forEach((submenu) => {
49-
if (submenu.active.value) {
50-
submenu.active.value === false
51-
}
52-
});
53-
isMainActive.value = true;
54-
transform.x = 0;
55-
transform.y = 0;
46+
handleReturn();
5647
}
5748
else if (/^[a-zA-Z0-9\x20\.]{1}$$/.test(event.key)) {
5849
searchInput.value += event.key;
59-
} else if (event.key === "Backspace") {
50+
} else if (event.key === "Backspace" || event.key === "Delete") {
6051
if (searchInput.value.length === 0) {
6152
return;
6253
} else {
@@ -65,6 +56,25 @@ window.addEventListener("keydown", (event) => {
6556
}
6657
});
6758
59+
const handleReturn = () => {
60+
if (isLanguageSelectVisible.value) {
61+
isLanguageSelectVisible.value = false;
62+
return;
63+
}
64+
if (searchInput.value.length !== 0) {
65+
searchInput.value = ""
66+
return;
67+
}
68+
submenus.forEach((submenu) => {
69+
if (submenu.active.value) {
70+
submenu.active.value === false
71+
}
72+
});
73+
isMainActive.value = true;
74+
transform.x = 0;
75+
transform.y = 0;
76+
}
77+
6878
const isMainActive = ref(true);
6979
const transform = reactive({
7080
x: 0,

src/components/TrinketsList/TrinketItem.vue

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
<template>
22
<div v-if="!props.isGolden" class="item" :class="{ 'list-styled': props.isListStyled }"
3-
@click.left="handleSpawn(props.item.id)" @click.right="handleGive(props.item._gid)">
3+
@click="handleClick($event, false)">
44
<div class="id" v-show="showId">{{ props.item._gid }}</div>
55
<div class="name">{{ props.item.name }}</div>
66
<div class="description">{{ props.item.description }}</div>
77
<div class="image" :style="getImageSource(props.item.gfx)"></div>
88
</div>
9-
<div v-else class="golden item" :class="{ 'list-styled': props.isListStyled }"
10-
@click.left="handleSpawn(parseInt(props.item.id) + 32768)"
11-
@click.right="handleGive(props.item._gid.toUpperCase())">
9+
<div v-else class="golden item" :class="{ 'list-styled': props.isListStyled }" @click="handleClick($event, true)">
1210
<div class="id" v-show="showId">{{ 'T' + (parseInt(props.item.id) + 32768) }}</div>
1311
<div class="name">{{ props.item.name }}</div>
1412
<div class="description">{{ props.item.description }}</div>
@@ -21,13 +19,16 @@ import { emit } from "@/utils/ws"
2119
2220
const props = defineProps(['item', 'isGolden', 'showId', 'isListStyled'])
2321
24-
const handleSpawn = (id) => {
25-
emit("COMMAND", `spawn 5.350.${id}`);
22+
const handleClick = ($event, isLarge) => {
23+
if ($event.ctrlKey) {
24+
const gid = props.item._gid
25+
emit("COMMAND", `g ${isLarge ? gid.toUpperCase() : gid}`);
26+
} else {
27+
const id = parseInt(props.item.id);
28+
emit("COMMAND", `spawn 5.300.${isLarge ? id + 32768 : id}`);
29+
}
2630
}
2731
28-
const handleGive = (gid) => {
29-
emit("COMMAND", `g ${gid}`);
30-
}
3132
const getImageSource = (gfx) => {
3233
return {
3334
backgroundImage: `url('${gfx}')`

0 commit comments

Comments
 (0)