You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
1.9 KiB
72 lines
1.9 KiB
|
1 week ago
|
import path from "path";
|
||
|
|
|
||
|
|
const Fs = require('fs');
|
||
|
|
const Path = require('path');
|
||
|
|
|
||
|
|
// 获取项目路径
|
||
|
|
const projectPath = Editor.Project.path;
|
||
|
|
|
||
|
|
// 定义输出文件路径
|
||
|
|
const outputPath = path.join(projectPath, 'assets', 'res', 'font', 'str.txt');
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @en Registration method for the main process of Extension
|
||
|
|
* @zh 为扩展的主进程的注册方法
|
||
|
|
*/
|
||
|
|
export const methods: { [key: string]: (...any: any) => any } = {
|
||
|
|
/**
|
||
|
|
* @en A method that can be triggered by message
|
||
|
|
* @zh 通过 message 触发的方法
|
||
|
|
*/
|
||
|
|
showLog() {
|
||
|
|
console.log('Hello World');
|
||
|
|
},
|
||
|
|
createUIScript() {
|
||
|
|
Editor.Message.request('scene', 'execute-scene-script', {
|
||
|
|
name: 'tools',
|
||
|
|
method: 'uiScript',
|
||
|
|
args: []
|
||
|
|
});
|
||
|
|
},
|
||
|
|
printSpineAnim() {
|
||
|
|
Editor.Message.request('scene', 'execute-scene-script', {
|
||
|
|
name: 'tools',
|
||
|
|
method: 'printSpineAnim',
|
||
|
|
args: []
|
||
|
|
});
|
||
|
|
},
|
||
|
|
generateConfigBin() {
|
||
|
|
try {
|
||
|
|
// 复用构建钩子里的生成逻辑,避免两套实现不一致
|
||
|
|
const builder = require('./custom-builder');
|
||
|
|
if (builder?.onBeforeBuild) {
|
||
|
|
builder.onBeforeBuild({}, {});
|
||
|
|
console.log('[tools] 手动生成配置bin完成');
|
||
|
|
} else {
|
||
|
|
console.warn('[tools] 未找到 custom-builder.onBeforeBuild');
|
||
|
|
}
|
||
|
|
} catch (err) {
|
||
|
|
console.error('[tools] 手动生成配置bin失败:', err);
|
||
|
|
}
|
||
|
|
},
|
||
|
|
changeNodeName() {
|
||
|
|
Editor.Message.request('scene', 'execute-scene-script', {
|
||
|
|
name: 'tools',
|
||
|
|
method: 'changeNodeName',
|
||
|
|
args: []
|
||
|
|
});
|
||
|
|
}
|
||
|
|
};
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @en Method Triggered on Extension Startup
|
||
|
|
* @zh 扩展启动时触发的方法
|
||
|
|
*/
|
||
|
|
export function load() { }
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @en Method triggered when uninstalling the extension
|
||
|
|
* @zh 卸载扩展时触发的方法
|
||
|
|
*/
|
||
|
|
export function unload() { }
|