Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/webgal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"@icon-park/react": "^1.4.2",
"@reduxjs/toolkit": "^1.8.1",
"angular-expressions": "^1.4.3",
"ani-cursor.js": "^1.0.2",
"axios": "^1.13.5",
"cloudlogjs": "^1.0.9",
"gifuct-js": "^2.1.2",
Expand Down
26 changes: 24 additions & 2 deletions packages/webgal/src/Core/util/coreInitialFunction/infoFetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { getFastSaveFromStorage, getSavesFromStorage } from '@/Core/controller/s
import { logger } from '@/Core/util/logger';
import axios from 'axios';
import { IGameVar } from '@/Core/Modules/stage/stageInterface';
import { setANICursor } from 'ani-cursor.js';

/**
* 获取游戏信息
Expand All @@ -21,7 +22,7 @@ export const infoFetcher = (url: string): Promise<IGameVar> => {
let gameConfig = WebgalParser.parseConfig(gameConfigRaw);
logger.info('获取到游戏信息', gameConfig);
// 先把 key 找到并设置了
const keyItem = gameConfig.find((e) => e.command === 'Game_key');
const keyItem = gameConfig.find((e: any) => e.command === 'Game_key');
WebGAL.gameKey = (keyItem?.args?.[0] as string) ?? '';
initKey();
await getStorageAsync();
Expand All @@ -30,7 +31,7 @@ export const infoFetcher = (url: string): Promise<IGameVar> => {
// 存储 config.txt 中的配置,用于清除所有数据时还原配置
const gameConfigInit: IGameVar = {};
// 按照游戏的配置开始设置对应的状态
gameConfig.forEach((e) => {
gameConfig.forEach((e: any) => {
const { command, args } = e;
if (args.length > 0) {
if (args.length > 1) {
Expand Down Expand Up @@ -67,6 +68,27 @@ export const infoFetcher = (url: string): Promise<IGameVar> => {
const appId = String(res);
WebGAL.steam.initialize(appId);
}
// 自定义光标
if (command === 'Custom_Corsur') {
const group = String(res)
.split(/\s+/)
.filter((e) => e);
for (const token of group) {
const arr = token.split(',').map((e) => e.trim());
const url = `/game/${arr[0]}`;
const type = arr?.[1] ?? 'auto';
if (String(arr[0]).endsWith('.ani')) {
const width = parseInt(arr?.[2] ?? '32');
const height = parseInt(arr?.[3] ?? '32');
setANICursor('html *', url, type, width, height);
} else {
const hotspot = `${arr?.[2] ?? ''} ${arr?.[3] ?? ''}`;
const cursorCss = document.createElement('style');
cursorCss.innerHTML = `html * { cursor: url(${arr[0]}) ${hotspot}, ${type} !important; }`;
document.head.appendChild(cursorCss);
}
}
}
Comment thread
xiaoxustudio marked this conversation as resolved.
}
}
});
Expand Down
49 changes: 48 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1723,6 +1723,14 @@ angular-expressions@^1.4.3:
resolved "https://registry.yarnpkg.com/angular-expressions/-/angular-expressions-1.4.3.tgz#24fb9e8e9e0278885dd0f7e28512ac88a74037f6"
integrity sha512-r7j+dqOuHy0OYiR5AazDixU/Us3TDN2FfuxGX4Dq6d61Y2MhBQHMdUNBfkkLPjDqVm2Is394h31gC3bcBwy9zw==

ani-cursor.js@^1.0.2:
version "1.0.2"
resolved "https://registry.npmmirror.com/ani-cursor.js/-/ani-cursor.js-1.0.2.tgz#891342a98873e12e662699315a8c33285acb87a2"
integrity sha512-spNSKKZJxr9fj2uG27Hh9zxe025uK59KNEVLoAgtUk/CPOdzQOHPB612qwAI0GawwxZdp8lU5QEph7C8QeiY8g==
dependencies:
buffer "^6.0.3"
riff-file "^1.0.3"

ansi-escapes@^4.3.0:
version "4.3.2"
resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e"
Expand Down Expand Up @@ -2056,11 +2064,28 @@ buffer@^5.5.0:
base64-js "^1.3.1"
ieee754 "^1.1.13"

buffer@^6.0.3:
version "6.0.3"
resolved "https://registry.npmmirror.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6"
integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==
dependencies:
base64-js "^1.3.1"
ieee754 "^1.2.1"

builtin-modules@^3.3.0:
version "3.3.0"
resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.3.0.tgz#cae62812b89801e9656336e46223e030386be7b6"
integrity sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==

byte-data@^18.0.3:
version "18.1.1"
resolved "https://registry.npmmirror.com/byte-data/-/byte-data-18.1.1.tgz#4eed09970921bf7d786b250e56615d8314bb6746"
integrity sha512-Kv/B0r7adgnCcrs/y703sac2XFLdHW5kPfis1j8+Ij/hmEcWhBKf+1pNTv+vsNqXb207Uiyri8bpnogNxR/4Lg==
dependencies:
endianness "^8.0.2"
ieee754-buffer "^2.0.0"
utf8-buffer "^1.0.0"

bytes@3.1.2:
version "3.1.2"
resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5"
Expand Down Expand Up @@ -2594,6 +2619,11 @@ end-of-stream@^1.1.0, end-of-stream@^1.4.1:
dependencies:
once "^1.4.0"

endianness@^8.0.2:
version "8.0.2"
resolved "https://registry.npmmirror.com/endianness/-/endianness-8.0.2.tgz#e35d16bbe80b6ff94fbc199168dd234d9f78168e"
integrity sha512-IU+77+jJ7lpw2qZ3NUuqBZFy3GuioNgXUdsL1L9tooDNTaw0TgOnwNuc+8Ns+haDaTifK97QLzmOANJtI/rGvw==

error-ex@^1.3.1:
version "1.3.2"
resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf"
Expand Down Expand Up @@ -3606,7 +3636,12 @@ iconv-lite@0.4.24:
dependencies:
safer-buffer ">= 2.1.2 < 3"

ieee754@^1.1.13:
ieee754-buffer@^2.0.0:
version "2.0.0"
resolved "https://registry.npmmirror.com/ieee754-buffer/-/ieee754-buffer-2.0.0.tgz#5648050d1a037df59a6cc68f441c6b0b467314f8"
integrity sha512-AXUAT0nMEi7h1Is8HXGXof3eejl/GabZFKSj8Ym6kVRUSwrAb52EkAXywiCQYSHGQMRn7lvfY7vhPMjVc+Kybg==

ieee754@^1.1.13, ieee754@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352"
integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==
Expand Down Expand Up @@ -5231,6 +5266,13 @@ rfdc@^1.3.0:
resolved "https://registry.yarnpkg.com/rfdc/-/rfdc-1.3.1.tgz#2b6d4df52dffe8bb346992a10ea9451f24373a8f"
integrity sha512-r5a3l5HzYlIC68TpmYKlxWjmOP6wiPJ1vWv2HeLhNsRZMrCkxeqxiHlQ21oXmQ4F3SiryXBHhAD7JZqvOJjFmg==

riff-file@^1.0.3:
version "1.0.3"
resolved "https://registry.npmmirror.com/riff-file/-/riff-file-1.0.3.tgz#95589f787e0c5fb2fa2937fc0a0e5e5d3131242b"
integrity sha512-Vv8wwGr0BCks7VMI3Lv0houZee4DaHFjjTT0LMhMJKio2YmLncLeIVpK63ydSverngNk8XQPU3fbeP3bWgSIig==
dependencies:
byte-data "^18.0.3"

rimraf@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a"
Expand Down Expand Up @@ -6079,6 +6121,11 @@ use-sync-external-store@^1.0.0:
resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz#7dbefd6ef3fe4e767a0cf5d7287aacfb5846928a"
integrity sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==

utf8-buffer@^1.0.0:
version "1.0.0"
resolved "https://registry.npmmirror.com/utf8-buffer/-/utf8-buffer-1.0.0.tgz#457e7d848d4d9cd873772b710d150565f6e543d9"
integrity sha512-ueuhzvWnp5JU5CiGSY4WdKbiN/PO2AZ/lpeLiz2l38qwdLy/cW40XobgyuIWucNyum0B33bVB0owjFCeGBSLqg==

util-deprecate@^1.0.1, util-deprecate@~1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
Expand Down
Loading