Commit 8287645a authored by Chunchi Che's avatar Chunchi Che

migrate sql.js

parent 138fbc82
Pipeline #19736 passed with stages
in 3 minutes and 39 seconds
......@@ -40,6 +40,10 @@ export default async function (action: sqliteAction) {
const [SQL, buffer] = await Promise.all([sqlPromise, dataPromise]);
YGODB = new SQL.Database(new Uint8Array(buffer));
console.info("YGODB inited!");
} else {
console.warn("init YGODB action without initInfo");
}
break;
......
......@@ -80,7 +80,7 @@ export function createAsyncMetaThunk(name: string): AsyncThunk<
}) => {
const code = param.code;
const meta = await fetchCard(code);
const meta = await fetchCard(code, true);
const response = {
controler: param.controler,
sequence: param.sequence,
......@@ -110,7 +110,7 @@ export function createAsyncRepeatedMetaThunk(
if (id == 0) {
return { id, data: {}, text: {} };
} else {
return await fetchCard(id);
return await fetchCard(id, true);
}
})
);
......
......@@ -29,7 +29,7 @@ export const fetchSelectPlaceHintMeta = createAsyncThunk(
const player = param[0];
const hintData = param[1];
const hintMeta = (await fetchCard(hintData)).text.name || "[?]";
const hintMeta = (await fetchCard(hintData, true)).text.name || "[?]";
const response: [number, string] = [player, hintMeta];
return response;
......
......@@ -58,7 +58,7 @@ export const fetchCheckCardMeta = createAsyncThunk(
tagName: string;
option: { code: number; response: number; effectDescCode?: number };
}) => {
const meta = await fetchCard(param.option.code);
const meta = await fetchCard(param.option.code, true);
const effectDesc = param.option.effectDescCode
? getCardStr(meta, param.option.effectDescCode & 0xf)
: undefined;
......
......@@ -59,7 +59,7 @@ export const fetchCheckCardMetasV2 = createAsyncThunk(
}) => {
const metas = await Promise.all(
param.options.map(async (option) => {
return await fetchCard(option.code);
return await fetchCard(option.code, true);
})
);
const response = {
......
......@@ -23,7 +23,7 @@ export const resetOptionModalImpl: CaseReducer<DuelState> = (state) => {
export const fetchOptionMeta = createAsyncThunk(
"duel/fetchOptionMeta",
async (param: { code: number; response: number }) => {
const meta = await fetchCard(param.code >> 4);
const meta = await fetchCard(param.code >> 4, true);
const msg = getCardStr(meta, param.code & 0xf) || "[?]";
const response = { msg, response: param.response };
......
......@@ -32,7 +32,7 @@ export const fetchYesNoMeta = createAsyncThunk(
) => string;
}) => {
const desc = await fetchStrings("!system", param.descCode);
const meta = await fetchCard(param.code);
const meta = await fetchCard(param.code, true);
// TODO: 国际化文案
return param.textGenerator(desc, meta, param.location);
......
......@@ -50,7 +50,10 @@ export default function WaitRoom() {
}
// 初始化sqlite
sqliteMiddleWare({ cmd: sqliteCmd.INIT });
sqliteMiddleWare({
cmd: sqliteCmd.INIT,
initInfo: { dbUrl: "/ygopro-database/locales/zh-CN/cards.cdb" },
});
}, []);
const joined = useAppSelector(selectJoined);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment