diff --git a/packages-user/client-base/src/components/choices.tsx b/packages-user/client-base/src/components/choices.tsx index cb03a85..2de1e71 100644 --- a/packages-user/client-base/src/components/choices.tsx +++ b/packages-user/client-base/src/components/choices.tsx @@ -9,6 +9,7 @@ import { GameUI, IUIController, SetupComponentOptions } from '@motajs/system'; import { useKey } from '../use'; import { sleep } from 'mutate-animate'; import { DefaultProps } from '@motajs/render-vue'; +import { IGameUIPropsBase } from '../types'; export interface ConfirmBoxProps extends DefaultProps, TextContentProps { /** 确认框的提示文本内容 */ @@ -595,7 +596,7 @@ export const Choices = defineComponent< * @param props 额外的 props,参考 {@link ConfirmBoxProps} */ export function getConfirm( - controller: IUIController, + controller: IUIController, text: string, loc: ElementLocator, width: number, @@ -648,7 +649,7 @@ export function getConfirm( * @param props 额外的 props,参考 {@link ChoicesProps} */ export function getChoice( - controller: IUIController, + controller: IUIController, choices: ChoiceItem[], loc: ElementLocator, width: number, @@ -707,7 +708,7 @@ function getChoiceRoute(defaults: number) { * @param props 额外的 props,参考 {@link ConfirmBoxProps} */ export async function routedConfirm( - controller: IUIController, + controller: IUIController, text: string, loc: ElementLocator, width: number, @@ -762,7 +763,7 @@ export async function routedConfirm( * @param props 额外的 props,参考 {@link ChoicesProps} */ export async function routedChoices( - controller: IUIController, + controller: IUIController, choices: ChoiceItem[], loc: ElementLocator, width: number, diff --git a/packages-user/client-base/src/components/input.tsx b/packages-user/client-base/src/components/input.tsx index bc71d08..5fd6c92 100644 --- a/packages-user/client-base/src/components/input.tsx +++ b/packages-user/client-base/src/components/input.tsx @@ -17,6 +17,7 @@ import { linear } from 'mutate-animate'; import { Background, Selection } from './misc'; import { GameUI, IUIController, SetupComponentOptions } from '@motajs/system'; import { KeyCode } from '@motajs/client-base'; +import { IGameUIPropsBase } from '../types'; export interface InputProps extends DefaultProps, Partial { /** 输入框的提示内容 */ @@ -544,7 +545,7 @@ export const InputBox = defineComponent< * @param props 额外的 props,参考 {@link ConfirmBoxProps} */ export function getInput( - controller: IUIController, + controller: IUIController, text: string, loc: ElementLocator, width: number, @@ -581,7 +582,7 @@ export function getInput( * @param props 额外的 props,参考 {@link ConfirmBoxProps} */ export async function getInputNumber( - controller: IUIController, + controller: IUIController, text: string, loc: ElementLocator, width: number, diff --git a/packages-user/client-base/src/components/misc.tsx b/packages-user/client-base/src/components/misc.tsx index 48dfa81..07a9983 100644 --- a/packages-user/client-base/src/components/misc.tsx +++ b/packages-user/client-base/src/components/misc.tsx @@ -15,6 +15,7 @@ import { clamp } from 'lodash-es'; // @ts-expect-error render/renderer 按 D-54 留在实现层,本文件已移入系统层,按 D-59 暂以标注记录,不反向引用、不解耦 import { using } from '../renderer'; import { cosh, CurveMode } from '@motajs/animate'; +import { IGameUIPropsBase } from '../types'; interface ProgressProps extends DefaultProps { /** 进度条的位置 */ @@ -568,7 +569,7 @@ export const WaitBox = defineComponent< * @param props 额外的 props,参考 {@link WaitBoxProps} */ export function waitbox( - controller: IUIController, + controller: IUIController, loc: ElementLocator, width: number, promise: Promise, diff --git a/packages-user/client-modules/src/render/scene.ts b/packages-user/client-modules/src/render/scene.ts index 93df39f..956e152 100644 --- a/packages-user/client-modules/src/render/scene.ts +++ b/packages-user/client-modules/src/render/scene.ts @@ -1,3 +1,4 @@ import { UIController } from '@motajs/system'; +import { IGameUIPropsBase } from '@user/client-base'; -export const sceneController = new UIController('main-scene'); +export const sceneController = new UIController(); diff --git a/packages-user/client-modules/src/render/utils/saves.ts b/packages-user/client-modules/src/render/utils/saves.ts index 3037e88..4a8a32c 100644 --- a/packages-user/client-modules/src/render/utils/saves.ts +++ b/packages-user/client-modules/src/render/utils/saves.ts @@ -1,5 +1,5 @@ import { compressToBase64, decompressFromBase64 } from 'lz-string'; -import { getConfirm, waitbox } from '@user/client-base'; +import { getConfirm, waitbox, IGameUIPropsBase } from '@user/client-base'; import { IUIController } from '@motajs/system'; import { SyncSaveFromServerResponse } from '@motajs/client-base'; import { CENTER_LOC, POP_BOX_WIDTH } from '../../shared'; @@ -122,7 +122,7 @@ async function syncLoad(id: string, password: string) { } export async function syncFromServer( - controller: IUIController, + controller: IUIController, identifier: string ): Promise { if (!/^\d{6}\w{4}$/.test(identifier) && !/^\d{4}\w{3}$/.test(identifier)) { diff --git a/packages-user/client-modules/src/ui/controller.tsx b/packages-user/client-modules/src/ui/controller.tsx index cdd8919..1a9df1f 100644 --- a/packages-user/client-modules/src/ui/controller.tsx +++ b/packages-user/client-modules/src/ui/controller.tsx @@ -1,7 +1,8 @@ import { UIController } from '@motajs/system'; +import { IGameUIPropsBase } from '@user/client-base'; import { MainBackgroundUI } from './background'; -export const mainUIController = new UIController('main-ui'); +export const mainUIController = new UIController(); export function createMainController() { mainUIController.setBackground(MainBackgroundUI, {}); diff --git a/packages-user/client-modules/src/ui/save.tsx b/packages-user/client-modules/src/ui/save.tsx index e16e0ed..8818a72 100644 --- a/packages-user/client-modules/src/ui/save.tsx +++ b/packages-user/client-modules/src/ui/save.tsx @@ -13,7 +13,7 @@ import { onMounted, shallowReactive } from 'vue'; -import { getConfirm, Page, PageExpose, Thumbnail } from '@user/client-base'; +import { getConfirm, Page, PageExpose, Thumbnail, IGameUIPropsBase } from '@user/client-base'; import { useKey } from '../render/use'; import { HALF_HEIGHT, @@ -492,7 +492,7 @@ export type SaveValidationFunction = ( * @returns 选择的存档索引 */ export function selectSave( - controller: IUIController, + controller: IUIController, loc: ElementLocator, mode: SaveMode, validate?: SaveValidationFunction, @@ -542,7 +542,7 @@ export function selectSave( } export async function saveSave( - controller: IUIController, + controller: IUIController, loc: ElementLocator, props?: SaveProps ) { @@ -566,7 +566,7 @@ export async function saveSave( } export async function saveLoad( - controller: IUIController, + controller: IUIController, loc: ElementLocator, props?: SaveProps ) { @@ -590,7 +590,7 @@ export async function saveLoad( } export async function saveWithExist( - controller: IUIController, + controller: IUIController, loc: ElementLocator, props?: SaveProps ) { diff --git a/packages-user/client-modules/src/ui/settings.tsx b/packages-user/client-modules/src/ui/settings.tsx index 008cede..cdc1416 100644 --- a/packages-user/client-modules/src/ui/settings.tsx +++ b/packages-user/client-modules/src/ui/settings.tsx @@ -7,7 +7,8 @@ import { Choices, ChoicesProps, getConfirm, - waitbox + waitbox, + IGameUIPropsBase } from '@user/client-base'; import { mainUi } from '@motajs/legacy-ui'; import { gameKey, generateKeyboardEvent } from '@motajs/system'; @@ -677,7 +678,7 @@ export const ClearSaveSelectUI = new GameUI( ); export function openSettings( - controller: IUIController, + controller: IUIController, loc: ElementLocator, props?: MainSettingsProps ) { @@ -688,7 +689,7 @@ export function openSettings( } export function openReplay( - controller: IUIController, + controller: IUIController, loc: ElementLocator, props?: MainSettingsProps ) { diff --git a/packages-user/client-modules/src/ui/statistics.tsx b/packages-user/client-modules/src/ui/statistics.tsx index 89f1ea6..ab990d1 100644 --- a/packages-user/client-modules/src/ui/statistics.tsx +++ b/packages-user/client-modules/src/ui/statistics.tsx @@ -5,7 +5,7 @@ import { IUIDefaultPropsBase } from '@motajs/system'; import { defineComponent } from 'vue'; -import { waitbox, ListPage, TextContent } from '@user/client-base'; +import { waitbox, ListPage, TextContent, IGameUIPropsBase } from '@user/client-base'; import { DefaultProps } from '@motajs/render-vue'; // @ts-expect-error 需要重构 import { ItemState } from '@user/data-state'; @@ -280,7 +280,7 @@ export function calculateStatistics(): StatisticsData { * 打开数据统计界面 * @param controller 要在哪个 UI 控制器上打开 */ -export async function openStatistics(controller: IUIController) { +export async function openStatistics(controller: IUIController) { const cal = Promise.resolve().then(() => { return new Promise(res => { const data = calculateStatistics(); diff --git a/packages-user/client-modules/src/ui/viewmap.tsx b/packages-user/client-modules/src/ui/viewmap.tsx index 1b45793..884b03c 100644 --- a/packages-user/client-modules/src/ui/viewmap.tsx +++ b/packages-user/client-modules/src/ui/viewmap.tsx @@ -26,7 +26,7 @@ import { import { FloorSelector } from '@user/client-base'; import { clamp, mean } from 'lodash-es'; import { StatisticsDataOneFloor } from './statistics'; -import { Tip, TipExpose } from '@user/client-base'; +import { Tip, TipExpose, IGameUIPropsBase } from '@user/client-base'; import { useKey } from '../render/use'; import { ENABLE_RIGHT_STATUS_BAR, @@ -556,7 +556,7 @@ export const ViewMap = defineComponent(props => { export const ViewMapUI = new GameUI('view-map', ViewMap); export function openViewMap( - controller: IUIController, + controller: IUIController, loc: ElementLocator, props?: ViewMapProps ) {