From 35cfef71a968967809befb0c780156ce515a4358 Mon Sep 17 00:00:00 2001 From: cptbtptpbcptdtptp Date: Tue, 14 Jan 2025 15:10:19 +0800 Subject: [PATCH] feat: udpate code --- packages/ui/src/component/index.ts | 11 ++++++++++ packages/ui/src/index.ts | 35 +++++------------------------- 2 files changed, 16 insertions(+), 30 deletions(-) create mode 100644 packages/ui/src/component/index.ts diff --git a/packages/ui/src/component/index.ts b/packages/ui/src/component/index.ts new file mode 100644 index 0000000000..1f89431265 --- /dev/null +++ b/packages/ui/src/component/index.ts @@ -0,0 +1,11 @@ +export { UICanvas } from "./UICanvas"; +export { UIGroup } from "./UIGroup"; +export { UIRenderer } from "./UIRenderer"; +export { UITransform } from "./UITransform"; +export { Button } from "./advanced/Button"; +export { Image } from "./advanced/Image"; +export { Text } from "./advanced/Text"; +export { ColorTransition } from "./interactive/transition/ColorTransition"; +export { ScaleTransition } from "./interactive/transition/ScaleTransition"; +export { SpriteTransition } from "./interactive/transition/SpriteTransition"; +export { Transition } from "./interactive/transition/Transition"; diff --git a/packages/ui/src/index.ts b/packages/ui/src/index.ts index 623179cef6..40ace96d19 100644 --- a/packages/ui/src/index.ts +++ b/packages/ui/src/index.ts @@ -14,29 +14,10 @@ import { Shader, ShaderPass } from "@galacean/engine"; -import { UICanvas } from "."; -import { UIGroup } from "./component/UIGroup"; -import { UITransform } from "./component/UITransform"; -import { Button } from "./component/advanced/Button"; -import { Image } from "./component/advanced/Image"; -import { Text } from "./component/advanced/Text"; -import { ColorTransition } from "./component/interactive/transition/ColorTransition"; -import { ScaleTransition } from "./component/interactive/transition/ScaleTransition"; -import { SpriteTransition } from "./component/interactive/transition/SpriteTransition"; +import * as GUIComponent from "./component"; import uiDefaultFs from "./shader/uiDefault.fs.glsl"; import uiDefaultVs from "./shader/uiDefault.vs.glsl"; - -export { UICanvas } from "./component/UICanvas"; -export { UIGroup } from "./component/UIGroup"; -export { UIRenderer } from "./component/UIRenderer"; -export { UITransform } from "./component/UITransform"; -export { Button } from "./component/advanced/Button"; -export { Image } from "./component/advanced/Image"; -export { Text } from "./component/advanced/Text"; -export { ColorTransition } from "./component/interactive/transition/ColorTransition"; -export { ScaleTransition } from "./component/interactive/transition/ScaleTransition"; -export { SpriteTransition } from "./component/interactive/transition/SpriteTransition"; -export { Transition } from "./component/interactive/transition/Transition"; +export * from "./component"; export { CanvasRenderMode } from "./enums/CanvasRenderMode"; export { ResolutionAdaptationMode } from "./enums/ResolutionAdaptationMode"; export { UIPointerEventEmitter } from "./input/UIPointerEventEmitter"; @@ -126,13 +107,7 @@ ReflectionParser.registerCustomParseComponent("Text", async (instance: any, item * Register GUI components for the editor. */ export function registerGUI() { - Loader.registerClass("Text", Text); - Loader.registerClass("Image", Image); - Loader.registerClass("Button", Button); - Loader.registerClass("UIGroup", UIGroup); - Loader.registerClass("UICanvas", UICanvas); - Loader.registerClass("UITransform", UITransform); - Loader.registerClass("ScaleTransition", ScaleTransition); - Loader.registerClass("ColorTransition", ColorTransition); - Loader.registerClass("SpriteTransition", SpriteTransition); + for (let key in GUIComponent) { + Loader.registerClass(key, GUIComponent[key]); + } }