mirror of
https://github.com/motajs/template.git
synced 2026-11-14 23:54:31 +08:00
fix(09-05): adapt IUIController/UIController to required IGameUIPropsBase generic
- add <IGameUIPropsBase> to 16 IUIController annotation sites (client-modules + client-base)
This commit is contained in:
1 parent
1bcdcc3677
commit
3a49b37c25
10 files changed
+29
-23
No files matched your search
@@ -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<IGameUIPropsBase>();
|
||||
@@ -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<IGameUIPropsBase>,
|
||||
identifier: string
|
||||
): Promise<void> {
|
||||
if (!/^\d{6}\w{4}$/.test(identifier) && !/^\d{4}\w{3}$/.test(identifier)) {
|
||||
|
||||
@@ -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<IGameUIPropsBase>();
|
||||
|
||||
export function createMainController() {
|
||||
mainUIController.setBackground(MainBackgroundUI, {});
|
||||
|
||||
@@ -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<IGameUIPropsBase>,
|
||||
loc: ElementLocator,
|
||||
mode: SaveMode,
|
||||
validate?: SaveValidationFunction,
|
||||
@@ -542,7 +542,7 @@ export function selectSave(
|
||||
}
|
||||
|
||||
export async function saveSave(
|
||||
controller: IUIController,
|
||||
controller: IUIController<IGameUIPropsBase>,
|
||||
loc: ElementLocator,
|
||||
props?: SaveProps
|
||||
) {
|
||||
@@ -566,7 +566,7 @@ export async function saveSave(
|
||||
}
|
||||
|
||||
export async function saveLoad(
|
||||
controller: IUIController,
|
||||
controller: IUIController<IGameUIPropsBase>,
|
||||
loc: ElementLocator,
|
||||
props?: SaveProps
|
||||
) {
|
||||
@@ -590,7 +590,7 @@ export async function saveLoad(
|
||||
}
|
||||
|
||||
export async function saveWithExist(
|
||||
controller: IUIController,
|
||||
controller: IUIController<IGameUIPropsBase>,
|
||||
loc: ElementLocator,
|
||||
props?: SaveProps
|
||||
) {
|
||||
|
||||
@@ -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<IGameUIPropsBase>,
|
||||
loc: ElementLocator,
|
||||
props?: MainSettingsProps
|
||||
) {
|
||||
@@ -688,7 +689,7 @@ export function openSettings(
|
||||
}
|
||||
|
||||
export function openReplay(
|
||||
controller: IUIController,
|
||||
controller: IUIController<IGameUIPropsBase>,
|
||||
loc: ElementLocator,
|
||||
props?: MainSettingsProps
|
||||
) {
|
||||
|
||||
@@ -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<IGameUIPropsBase>) {
|
||||
const cal = Promise.resolve().then<StatisticsData>(() => {
|
||||
return new Promise(res => {
|
||||
const data = calculateStatistics();
|
||||
|
||||
@@ -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<ViewMapProps>(props => {
|
||||
export const ViewMapUI = new GameUI('view-map', ViewMap);
|
||||
|
||||
export function openViewMap(
|
||||
controller: IUIController,
|
||||
controller: IUIController<IGameUIPropsBase>,
|
||||
loc: ElementLocator,
|
||||
props?: ViewMapProps
|
||||
) {
|
||||
|
||||
Reference in new issue
Block a user