feat: 管理指令

This commit is contained in:
bietiaop 2024-08-01 16:52:48 +08:00
parent f08f149fa6
commit be1c00db59
8 changed files with 283 additions and 31 deletions

View file

@ -53,24 +53,24 @@ export const charNameToSprite = name => {
};
/**
* @param {string} atlas
* @param {string} alias
* @returns string | null
*/
export const atlasToName = _atlas => {
const atlas = settings.getConfig('atlas');
for (const [id, data] of Object.entries(atlas)) {
if (id === _atlas) return id;
if (data.includes(_atlas)) return id;
export const aliasToName = _alias => {
const alias = settings.getConfig('alias');
for (const [id, data] of Object.entries(alias)) {
if (id === _alias) return id;
if (data.includes(_alias)) return id;
}
return null;
};
/**
* @param {string} _atlas
* @param {string} _alias
* @returns string | null
*/
export const atlasToSprite = _atlas => {
const name = atlasToName(name);
export const aliasToSprite = _alias => {
const name = aliasToName(_alias);
return charNameToSprite(name);
};
@ -78,8 +78,8 @@ export const atlasToSprite = _atlas => {
* @param {string} name
* @returns number | null
*/
export const atlasToID = name => {
const _name = atlasToName(name);
export const aliasToID = name => {
const _name = aliasToName(name);
const id = charNameToID(_name);
return id;
};