mirror of
https://github.com/ZZZure/ZZZ-Plugin.git
synced 2025-12-16 21:27:47 +00:00
feat: 角色命座
This commit is contained in:
parent
5830178362
commit
73715f015f
12 changed files with 324 additions and 14 deletions
|
|
@ -7,3 +7,5 @@ export const ZZZ_CHARACTER = HAKUSH_API + '/character',
|
|||
export const ZZZ_NEW = `${HAKUSH_BASE}/new.json`,
|
||||
ZZZ_ALL_CHAR = `${HAKUSH_BASE}/data/character.json`,
|
||||
ZZZ_ALL_WEAPON = `${HAKUSH_BASE}/data/weapon.json`;
|
||||
|
||||
export const ZZZ_UI = `${HAKUSH_BASE}/UI`;
|
||||
|
|
|
|||
|
|
@ -165,3 +165,13 @@ export const getHakushWeapon = async weaponId => {
|
|||
);
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取Hakush UI
|
||||
* @param {string} filename
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
export const getHakushUI = async filename => {
|
||||
const result = await downloadHakushFile('ZZZ_UI', 'HAKUSH_UI_PATH', filename);
|
||||
return result;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -21,4 +21,5 @@ export const HAKUSH_CHARACTER_DATA_PATH = path.join(
|
|||
dataResourcesPath,
|
||||
'hakush/data/character'
|
||||
),
|
||||
HAKUSH_WEAPON_DATA_PATH = path.join(dataResourcesPath, 'hakush/data/weapon');
|
||||
HAKUSH_WEAPON_DATA_PATH = path.join(dataResourcesPath, 'hakush/data/weapon'),
|
||||
HAKUSH_UI_PATH = path.join(imageResourcesPath, 'hakush/ui');
|
||||
|
|
|
|||
|
|
@ -74,7 +74,12 @@ export const downloadHakushFile = async (base, localBase, filename = '') => {
|
|||
// 关闭文件
|
||||
fs.closeSync(file);
|
||||
// 返回文件内容
|
||||
return JSON.parse(content.toString());
|
||||
// 如果是JSON文件,返回JSON对象
|
||||
if (filename.endsWith('.json')) {
|
||||
return JSON.parse(content.toString());
|
||||
} else {
|
||||
return filepath;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue