← Return to tool
Log in with itch.io to leave a comment.
另外您打包的时候把mac的__MACOSX文件夹也打包进去了诶...
搓完了:
class CsvManager { static #parseCsv(text) { const rows = [] let row = [] let field = '' let insideQuotes = false let i = 0 while (i < text.length) { const char = text[i] const next = text[i + 1] if (insideQuotes) { if (char === '"') { if (next === '"') { field += '"' i++ } else { insideQuotes = false } } else { field += char } } else { if (char === '"') { insideQuotes = true } else if (char === ',') { row.push(field) field = '' } else if (char === '\n') { row.push(field) rows.push(row) row = [] field = '' } else if (char === '\r') { // skip or normalize \r\n if (next === '\n') { i++ } row.push(field) rows.push(row) row = [] field = '' } else { field += char } } i++ } if (field !== '' || insideQuotes || row.length > 0) { row.push(field) rows.push(row) } return rows } static async parseLang(fileName) { let translations = {}; LANG_LIST.forEach((langCode => {translations[`${langCode}`] = {}})); let colIndex = {}; LANG_LIST.forEach(((langCode, idx) => {colIndex[`${langCode}`] = idx + 2})); const fs = require("fs"); const str = await fs.promises.readFile(`./csv/${fileName}.csv`, "utf8"); const csv = CsvManager.#parseCsv(str) for (const line of csv) { const id = line[0]; for (const langCode in colIndex) { let cell = line[colIndex[langCode]].replaceAll(/\r\n|\r|\n/g, "\n"); translations[langCode][id] = cell } } return translations } };
大佬你好,請問為什麼我在遊戲測試中打開控制台會一直閃紅?(文字顯示正常,但是每次打開窗口或顯示文本時,就會這樣。)
我的log沒有清除掉,已經進行更新,
重新下載試試,感謝拉
再更新一次囉,感謝
好像漏砍了,拍謝沒留原本的程式碼有點盲改ha
16:00 更新一版,應該是可以了XD
← Return to tool
Comments
Log in with itch.io to leave a comment.
另外您打包的时候把mac的__MACOSX文件夹也打包进去了诶...
搓完了:
大佬你好,請問為什麼我在遊戲測試中打開控制台會一直閃紅?(文字顯示正常,但是每次打開窗口或顯示文本時,就會這樣。)
我的log沒有清除掉,已經進行更新,
重新下載試試,感謝拉
再更新一次囉,感謝
好像漏砍了,拍謝沒留原本的程式碼有點盲改ha
16:00 更新一版,應該是可以了XD