diff --git a/AquaNet/src/components/settings/ChuniSettings.svelte b/AquaNet/src/components/settings/ChuniSettings.svelte index 40a6e0fe..f1e84f3f 100644 --- a/AquaNet/src/components/settings/ChuniSettings.svelte +++ b/AquaNet/src/components/settings/ChuniSettings.svelte @@ -92,7 +92,7 @@ user = u return fetchData() }).catch((e) => { loading = false; error = e.message }); - + let DDSreader: DDS | undefined; let USERBOX_PROGRESS = 0; @@ -150,7 +150,7 @@ if (databaseExists || USERBOX_URL_STATE.value) { DDSreader = new DDS(ddsDB); USERBOX_INSTALLED = databaseExists || USERBOX_URL_STATE.value != ""; - } + } }) @@ -183,10 +183,10 @@ {:else}
- userboxSelected = "nameplateId"} chuniCharacter={userbox.characterId} chuniLevel={userbox.level.toString()} chuniRating={userbox.playerRating / 100} + userboxSelected = "nameplateId"} chuniCharacter={userbox.characterId} chuniLevel={userbox.level.toString()} chuniRating={userbox.playerRating / 100} chuniNameplate={userbox.nameplateId} chuniName={userbox.userName} chuniTrophyName={allItems.trophy[userbox.trophyId].name}> -
@@ -258,26 +258,11 @@

- {/if} + {/if} -
{/if} - + {#if USERBOX_SETUP_RUN && !error}
@@ -328,7 +313,7 @@ p.notice opacity: 0.6 margin-top: 0 -.progress +.progress width: 100% height: 10px box-shadow: 0 0 1px 1px vars.$ov-lighter @@ -463,10 +448,10 @@ p.notice &.focused filter: brightness(75%) -.chuni-userbox +.chuni-userbox width: calc(100% - 20px) height: 350px - + display: flex flex-direction: row flex-wrap: wrap diff --git a/AquaNet/src/libs/generalTypes.ts b/AquaNet/src/libs/generalTypes.ts index d0d11942..99e72948 100644 --- a/AquaNet/src/libs/generalTypes.ts +++ b/AquaNet/src/libs/generalTypes.ts @@ -161,4 +161,4 @@ export interface ChusanMatchingOption { matching: string reflector: string coop: string[] -} \ No newline at end of file +} diff --git a/AquaNet/src/libs/i18n/zh.ts b/AquaNet/src/libs/i18n/zh.ts index 8eaae91e..dbc7e8ed 100644 --- a/AquaNet/src/libs/i18n/zh.ts +++ b/AquaNet/src/libs/i18n/zh.ts @@ -102,7 +102,7 @@ const zhHome: typeof EN_REF_HOME = { 'home.linkcard.account-card': "账户卡", 'home.linkcard.registered': "注册于", 'home.linkcard.lastused': "上次使用", - 'home.linkcard.enter-info': "请输入以下信息", + 'home.linkcard.enter-info': "请输入以下信息,或将 aime.txt / felica.txt 文件拖放到此区域", 'home.linkcard.access-code': "卡背面的20位卡号 (如果没有, 请尝试在游戏中扫描您的卡, 并输入屏幕上显示的卡号)", 'home.linkcard.enter-sn1': "在您的手机", 'home.linkcard.enter-sn2': "上下载 NFC Tools 并扫描您的卡。然后输入显示的 SN 号。", @@ -148,10 +148,14 @@ const zhSettings: typeof EN_REF_SETTINGS = { 'settings.fields.waccaInfiniteWp.desc': '将 WP 设置为 999999', 'settings.fields.waccaAlwaysVip.name': 'Wacca: 永久会员', 'settings.fields.waccaAlwaysVip.desc': '将 VIP 到期时间设置为 2077-01-01', - 'settings.fields.chusanTeamName.name': '中二: 队伍名称', + 'settings.fields.chusanTeamName.name': '队伍名称', 'settings.fields.chusanTeamName.desc': '自定义显示在个人资料顶部的文本。', - 'settings.fields.chusanInfinitePenguins.name': '中二: 无限企鹅', + 'settings.fields.chusanInfinitePenguins.name': '我是桐谷遥', 'settings.fields.chusanInfinitePenguins.desc': '将角色界限突破的企鹅雕像数量设置为 999。', + 'settings.fields.chusanMatchingReflector.name': '全国对战 Reflector', + 'settings.fields.chusanMatchingReflector.desc': '全国对战服务器的 UDP 反射服务器的 URL', + 'settings.fields.chusanMatchingServer.name': '全国对战服务器', + 'settings.fields.chusanMatchingServer.desc': '全国对战服务器的 URL', 'settings.fields.rounding.name': '分数舍入', 'settings.fields.rounding.desc': '把分数四舍五入到一位小数', 'settings.fields.optOutOfLeaderboard.name': '不参与排行榜', @@ -168,10 +172,12 @@ const zhSettings: typeof EN_REF_SETTINGS = { 'settings.profile.unset': '未设置', 'settings.profile.unchanged': '未更改', 'settings.export': '导出玩家数据', + 'settings.cabNotice': '注意:下面这些设置只会影响你自己的机器,如果你是在其他人的机器上玩的话,请联系机主来改设置' } export const zhUserbox: typeof EN_REF_USERBOX = { 'userbox.header.general': '游戏设置', + 'userbox.header.matching': '全国对战', 'userbox.header.userbox': 'UserBox 设置', 'userbox.header.preview': 'UserBox 预览', 'userbox.nameplateId': '名牌', @@ -189,7 +195,15 @@ export const zhUserbox: typeof EN_REF_USERBOX = { 'userbox.preview.notice': '「生存战略」:为了尊重版权,我们不会提供游戏内物品的图片。但是如果你认识其他愿意提供图床的人,在这里输入 URL 就可以显示出预览。', 'userbox.preview.url': '图床 URL', 'userbox.error.nodata': '未找到中二数据', - + + 'userbox.matching.select': '选择对战服务器', + 'userbox.matching.select.sub': '选择你想加入的跨服全国对战服务器', + 'userbox.matching.option.ui': '房间列表', + 'userbox.matching.option.guide': '教程', + 'userbox.matching.option.collab': '合作伙伴', + 'userbox.matching.custom.name': '自定义', + 'userbox.matching.custom.sub': '输入其他的匹配 URL', + 'userbox.new.name': 'AquaBox', 'userbox.new.setup': '将 Chuni(Lumi 或更高版本)的游戏文件夹拖放到下方区域,以显示带有名牌和头像的 UserBox。所有文件都在浏览器中处理。', 'userbox.new.setup.processing_file': '正在处理文件', diff --git a/AquaNet/src/libs/sdk.ts b/AquaNet/src/libs/sdk.ts index 9b495f76..9761e99e 100644 --- a/AquaNet/src/libs/sdk.ts +++ b/AquaNet/src/libs/sdk.ts @@ -312,4 +312,6 @@ export const SETTING = { post('/api/v2/settings/get', {}), set: (key: string, value: any) => post('/api/v2/settings/set', { key, value: `${value}` }), + detailSet: (game: string, field: string, value: any) => + post(`/api/v2/game/${game}/user-detail-set`, { field, value }), } diff --git a/AquaNet/src/libs/userbox/userbox.ts b/AquaNet/src/libs/userbox/userbox.ts index 1a1a573a..6162105d 100644 --- a/AquaNet/src/libs/userbox/userbox.ts +++ b/AquaNet/src/libs/userbox/userbox.ts @@ -25,7 +25,7 @@ const validateDirectories = async (base: FileSystemDirectoryEntry, path: string) let newDirectory = await getDirectory(directory, part).catch(_ => null); if (newDirectory && isDirectory(newDirectory)) { directory = newDirectory; - } else + } else return false; }; return true @@ -38,7 +38,7 @@ const getDirectoryFromPath = async (base: FileSystemDirectoryEntry, path: string let newDirectory = await getDirectory(directory, part).catch(_ => null); if (newDirectory && isDirectory(newDirectory)) { directory = newDirectory; - } else + } else return null; }; return directory; @@ -81,7 +81,7 @@ const DIRECTORY_PATHS = ([ processName: "Surfboard Textures", useFileName: true, path: "surfboard", - filter: (name: string) => + filter: (name: string) => ([ "CHU_UI_Common_Avatar_body_00.dds", "CHU_UI_Common_Avatar_face_00.dds", @@ -134,7 +134,7 @@ export const scanOptionFolder = async (optionFolder: FileSystemDirectoryEntry, p let objectStore = transaction.objectStore('dds'); for (let object of data) objectStore.put(object) - + // await transaction completion await new Promise(r => transaction.addEventListener("complete", r, {once: true})) }; @@ -163,7 +163,7 @@ export function initializeDb() : Promise { export async function userboxFileProcess(folder: FileSystemEntry, progressUpdate: (progress: number, progressString: string) => void): Promise { if (!isDirectory(folder)) return t("userbox.new.error.invalidFolder") - if (!(await validateDirectories(folder, "bin/option")) || !(await validateDirectories(folder, "data/A000"))) + if (!(await validateDirectories(folder, "bin/option")) && !(await validateDirectories(folder, "data/A000"))) return t("userbox.new.error.invalidFolder"); initializeDb(); @@ -179,4 +179,4 @@ export async function userboxFileProcess(folder: FileSystemEntry, progressUpdate location.reload(); return null -} \ No newline at end of file +} diff --git a/AquaNet/src/pages/Home/LinkCard.svelte b/AquaNet/src/pages/Home/LinkCard.svelte index 77ce9218..8c9e4dde 100644 --- a/AquaNet/src/pages/Home/LinkCard.svelte +++ b/AquaNet/src/pages/Home/LinkCard.svelte @@ -161,13 +161,10 @@ let inputAC = "" let errorAC = "" - function inputACChange(e: any) { - e = e as InputEvent + function inputACChange() { // Add spaces to the input const old = inputAC - if (e.inputType === "insertText" && inputAC.length % 5 === 4 && inputAC.length < 24) - inputAC += " " - inputAC = inputAC.slice(0, 24) + inputAC = inputAC.replace(/\D/g, '').replace(/(.{4})/g, '$1 ').replace(/ $/, '') if (inputAC !== old) errorAC = "" } @@ -176,13 +173,10 @@ let inputSN = "" let errorSN = "" - function inputSNChange(e: any) { - e = e as InputEvent + function inputSNChange() { // Add colons to the input const old = inputSN - if (e.inputType === "insertText" && inputSN.length % 3 === 2 && inputSN.length < 23) - inputSN += ":" - inputSN = inputSN.toUpperCase().slice(0, 23) + inputSN = inputSN.toUpperCase().replace(/[^0-9A-F]/g, '').replace(/(.{2})/g, '$1:').replace(/:$/, '') if (inputSN !== old) errorSN = "" } @@ -209,9 +203,29 @@ function isInput(e: KeyboardEvent) { return e.key.length === 1 && !e.altKey && !e.ctrlKey && !e.metaKey && !e.shiftKey } + + async function dropFile(e: DragEvent) { + e.preventDefault() + e.stopPropagation() + const file = e.dataTransfer?.files[0] + if (!file) return + switch (file.name.toLowerCase()) { + case "aime.txt": + inputSN = "" + inputAC = await file.text() + inputACChange() + break + case "felica.txt": + inputAC = "" + inputSN = await file.text() + inputSNChange() + break + } + } -