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.
31 lines
809 B
31 lines
809 B
3 years ago
|
//FYI: https://github.com/Tencent/puerts/blob/master/doc/unity/manual.md
|
||
|
|
||
|
import { FairyEditor } from 'csharp';
|
||
|
import { CodeGenConfig } from './CodeGenConfig';
|
||
|
import { fuiCodeGenerator } from './FUICodeGenerator';
|
||
|
import { normalCodeGenerator } from './NormalCodeGenerator';
|
||
|
|
||
|
function onPublish(handler: FairyEditor.PublishHandler) {
|
||
|
if (!handler.genCode) return;
|
||
|
handler.genCode = false; //prevent default output
|
||
|
|
||
|
|
||
|
console.log('Handling gen code in plugin');
|
||
|
|
||
|
if (CodeGenConfig.NormalAutoGeneratePkgs.includes(handler.pkg.name))
|
||
|
{
|
||
|
normalCodeGenerator.Handle(handler);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
fuiCodeGenerator.Handle(handler);
|
||
|
}
|
||
|
|
||
|
console.log('Handling gen code in plugin end');
|
||
|
}
|
||
|
|
||
|
function onDestroy() {
|
||
|
//do cleanup here
|
||
|
}
|
||
|
|
||
|
export { onPublish, onDestroy };
|