47 lines
1.5 KiB
TypeScript
47 lines
1.5 KiB
TypeScript
// //FYI: https://github.com/Tencent/puerts/blob/master/doc/unity/manual.md
|
||
|
||
import FairyGUI = CS.FairyGUI;
|
||
import FairyEditor = CS.FairyEditor;
|
||
import System = CS.System;
|
||
// import { genCode } from './GenCode_CSharp';
|
||
import { genCSCode } from './GenCode_CSharp';
|
||
import { runGenCodeCustom } from './GenCodeCustomInspector';
|
||
import { runLanguageCustom, languageDestroy } from './LanguageCustomInspector';
|
||
import genSetting from './GenCodeSettings'
|
||
const App = FairyEditor.App;
|
||
const File = System.IO.File;
|
||
// console.log(App.project.settingsPath+"/Adaptation.json");
|
||
// console.log(System.IO.File.ReadAllText(App.project.settingsPath+"/Adaptation.json"))
|
||
|
||
runGenCodeCustom()
|
||
runLanguageCustom()
|
||
|
||
function onPublish(handler: FairyEditor.PublishHandler) {
|
||
if (!handler.genCode) return;
|
||
handler.genCode = false; //prevent default output
|
||
|
||
console.log('Handling gen code in plugin 1');
|
||
|
||
genCSCode(handler);
|
||
}
|
||
|
||
var callBack = context => {
|
||
genSetting.packageItemChange(context);
|
||
}
|
||
|
||
function onDestroy() {
|
||
languageDestroy()
|
||
//do cleanup here
|
||
//App.project.
|
||
//console.error("坑爹的ts没法注销事件,刷新后请重启fgui")
|
||
//App.Off(FairyEditor.EditorEvents.PackageItemChanged, callBack)
|
||
}
|
||
//App.On(FairyEditor.EditorEvents.PackageItemChanged, callBack)
|
||
//console.log("packages count=", FairyEditor)
|
||
|
||
// for (let index = 0; index < App.project.allPackages.Count; index++) {
|
||
// let pkg: FairyEditor.FPackage = App.project.allPackages[index];
|
||
// console.log("package.items=", pkg)
|
||
// }
|
||
export { onPublish, onDestroy };
|