mirror of
https://github.com/motajs/template.git
synced 2026-10-15 18:11:21 +08:00
- Move render/ui/controller.tsx -> src/ui/controller.tsx keeping only mainUIController + createMainController; import MainBackgroundUI from ./background - Move MainBackground/MainBackgroundUI/MainBackgroundProps ownership to src/ui/background.tsx; drop ../render import; add DefaultProps (render-vue) + IUIDefaultPropsBase (system) - Fix load.tsx/title.tsx props base: IUIDefaultPropsBase -> IUIPropsBase (own ./types); drop unused system import in title.tsx - Rewrite render capability imports from ../render barrel to ../render/use leaf (avoid render/index.tsx <-> ui cycle) - Complete barrel: + ./controller ./background ./func (7 same-dir exports) - Delete old render/ui/controller.tsx
25 lines
820 B
TypeScript
25 lines
820 B
TypeScript
import { GameUI, SetupComponentOptions, IUIDefaultPropsBase } from '@motajs/system';
|
|
import { DefaultProps } from '@motajs/render-vue';
|
|
import { defineComponent } from 'vue';
|
|
import { MAIN_WIDTH, MAIN_HEIGHT } from '../shared';
|
|
|
|
export interface MainBackgroundProps
|
|
extends DefaultProps, IUIDefaultPropsBase {}
|
|
|
|
const mainBackgroundProps = {
|
|
props: ['controller', 'instance']
|
|
} satisfies SetupComponentOptions<MainBackgroundProps>;
|
|
|
|
export const MainBackground = defineComponent<MainBackgroundProps>(() => {
|
|
return () => (
|
|
<g-rect
|
|
loc={[0, 0, MAIN_WIDTH, MAIN_HEIGHT]}
|
|
fill
|
|
fillStyle="rgba(0, 0, 0, 0.8)"
|
|
/>
|
|
);
|
|
}, mainBackgroundProps);
|
|
|
|
/** 主 UI 控制器的背景 UI */
|
|
export const MainBackgroundUI = new GameUI('main-background', MainBackground);
|