Skip to content

Instantly share code, notes, and snippets.

@daichangxin
Created February 7, 2021 01:41
Show Gist options
  • Save daichangxin/6d509e08d67fe2603656d59d329a1549 to your computer and use it in GitHub Desktop.
Save daichangxin/6d509e08d67fe2603656d59d329a1549 to your computer and use it in GitHub Desktop.
覆盖fairygui的getChild方法,提高性能
// 初始化Fairygui时调用
const rawNewObject = fgui.UIObjectFactory.newObject;
fgui.UIObjectFactory.newObject = (pi: fgui.PackageItem): fgui.GObject => {
if (!pi.extensionType && pi.objectType === fgui.ObjectType.Component) {
const skin = new FairySkinBase();
skin.packageItem = pi;
return skin;
}
return rawNewObject(pi);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment