mirror of
https://github.com/motajs/template.git
synced 2026-11-21 04:04:30 +08:00
refactor: UI 系统
This commit is contained in:
1 parent
3e22e3e14a
commit
46cad94aff
26 files changed
+1164
-451
No files matched your search
@@ -2,7 +2,7 @@ import { DefaultProps } from '@motajs/render-vue';
|
||||
import {
|
||||
GameUI,
|
||||
SetupComponentOptions,
|
||||
UIComponentProps,
|
||||
IUIDefaultPropsBase,
|
||||
UIController
|
||||
} from '@motajs/system';
|
||||
import { defineComponent } from 'vue';
|
||||
@@ -10,7 +10,8 @@ import { MAIN_HEIGHT, MAIN_WIDTH } from '../../shared';
|
||||
|
||||
export const mainUIController = new UIController('main-ui');
|
||||
|
||||
export interface MainBackgroundProps extends DefaultProps, UIComponentProps {}
|
||||
export interface MainBackgroundProps
|
||||
extends DefaultProps, IUIDefaultPropsBase {}
|
||||
|
||||
const mainBackgroundProps = {
|
||||
props: ['controller', 'instance']
|
||||
|
||||
@@ -2,7 +2,7 @@ import { DefaultProps } from '@motajs/render-vue';
|
||||
import {
|
||||
GameUI,
|
||||
SetupComponentOptions,
|
||||
UIComponentProps
|
||||
IUIDefaultPropsBase
|
||||
} from '@motajs/system';
|
||||
import { defineComponent } from 'vue';
|
||||
import {
|
||||
@@ -26,7 +26,7 @@ import { sleep } from '@motajs/common';
|
||||
import { GameTitleUI } from './title';
|
||||
import { client } from '../../core';
|
||||
|
||||
export interface ILoadProps extends UIComponentProps, DefaultProps {}
|
||||
export interface ILoadProps extends IUIDefaultPropsBase, DefaultProps {}
|
||||
|
||||
const loadSceneProps = {
|
||||
props: ['controller', 'instance']
|
||||
|
||||
@@ -2,9 +2,9 @@ import { ElementLocator, IWheelEvent, Font } from '@motajs/render';
|
||||
import { DefaultProps } from '@motajs/render-vue';
|
||||
import {
|
||||
GameUI,
|
||||
IUIMountable,
|
||||
IUIController,
|
||||
SetupComponentOptions,
|
||||
UIComponentProps
|
||||
IUIDefaultPropsBase
|
||||
} from '@motajs/system';
|
||||
import {
|
||||
defineComponent,
|
||||
@@ -37,7 +37,7 @@ export const enum SaveMode {
|
||||
Other
|
||||
}
|
||||
|
||||
export interface SaveProps extends UIComponentProps, DefaultProps {
|
||||
export interface SaveProps extends IUIDefaultPropsBase, DefaultProps {
|
||||
loc: ElementLocator;
|
||||
mode: SaveMode;
|
||||
}
|
||||
@@ -492,7 +492,7 @@ export type SaveValidationFunction = (
|
||||
* @returns 选择的存档索引
|
||||
*/
|
||||
export function selectSave(
|
||||
controller: IUIMountable,
|
||||
controller: IUIController,
|
||||
loc: ElementLocator,
|
||||
mode: SaveMode,
|
||||
validate?: SaveValidationFunction,
|
||||
@@ -542,7 +542,7 @@ export function selectSave(
|
||||
}
|
||||
|
||||
export async function saveSave(
|
||||
controller: IUIMountable,
|
||||
controller: IUIController,
|
||||
loc: ElementLocator,
|
||||
props?: SaveProps
|
||||
) {
|
||||
@@ -566,7 +566,7 @@ export async function saveSave(
|
||||
}
|
||||
|
||||
export async function saveLoad(
|
||||
controller: IUIMountable,
|
||||
controller: IUIController,
|
||||
loc: ElementLocator,
|
||||
props?: SaveProps
|
||||
) {
|
||||
@@ -590,7 +590,7 @@ export async function saveLoad(
|
||||
}
|
||||
|
||||
export async function saveWithExist(
|
||||
controller: IUIMountable,
|
||||
controller: IUIController,
|
||||
loc: ElementLocator,
|
||||
props?: SaveProps
|
||||
) {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { ElementLocator } from '@motajs/render';
|
||||
import {
|
||||
GameUI,
|
||||
IUIMountable,
|
||||
IUIController,
|
||||
SetupComponentOptions,
|
||||
UIComponentProps
|
||||
IUIDefaultPropsBase
|
||||
} from '@motajs/system';
|
||||
import { defineComponent } from 'vue';
|
||||
import {
|
||||
@@ -28,7 +28,7 @@ import { useKey } from '../use';
|
||||
import { client } from '../../core';
|
||||
|
||||
export interface MainSettingsProps
|
||||
extends Partial<ChoicesProps>, UIComponentProps {
|
||||
extends Partial<ChoicesProps>, IUIDefaultPropsBase {
|
||||
loc: ElementLocator;
|
||||
}
|
||||
|
||||
@@ -681,7 +681,7 @@ export const ClearSaveSelectUI = new GameUI(
|
||||
);
|
||||
|
||||
export function openSettings(
|
||||
controller: IUIMountable,
|
||||
controller: IUIController,
|
||||
loc: ElementLocator,
|
||||
props?: MainSettingsProps
|
||||
) {
|
||||
@@ -692,7 +692,7 @@ export function openSettings(
|
||||
}
|
||||
|
||||
export function openReplay(
|
||||
controller: IUIMountable,
|
||||
controller: IUIController,
|
||||
loc: ElementLocator,
|
||||
props?: MainSettingsProps
|
||||
) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import {
|
||||
GameUI,
|
||||
IUIMountable,
|
||||
IUIController,
|
||||
SetupComponentOptions,
|
||||
UIComponentProps
|
||||
IUIDefaultPropsBase
|
||||
} from '@motajs/system';
|
||||
import { defineComponent } from 'vue';
|
||||
import { waitbox, ListPage, TextContent } from '@user/client-base';
|
||||
@@ -38,7 +38,7 @@ export interface StatisticsData {
|
||||
potionGem: StatisticsDataPotionGem;
|
||||
}
|
||||
|
||||
export interface StatisticsProps extends UIComponentProps, DefaultProps {
|
||||
export interface StatisticsProps extends IUIDefaultPropsBase, DefaultProps {
|
||||
data: StatisticsData;
|
||||
}
|
||||
|
||||
@@ -280,7 +280,7 @@ export function calculateStatistics(): StatisticsData {
|
||||
* 打开数据统计界面
|
||||
* @param controller 要在哪个 UI 控制器上打开
|
||||
*/
|
||||
export async function openStatistics(controller: IUIMountable) {
|
||||
export async function openStatistics(controller: IUIController) {
|
||||
const cal = Promise.resolve().then<StatisticsData>(() => {
|
||||
return new Promise(res => {
|
||||
const data = calculateStatistics();
|
||||
|
||||
@@ -2,7 +2,7 @@ import { DefaultProps } from '@motajs/render-vue';
|
||||
import {
|
||||
GameUI,
|
||||
SetupComponentOptions,
|
||||
UIComponentProps
|
||||
IUIDefaultPropsBase
|
||||
} from '@motajs/system';
|
||||
import { defineComponent, nextTick, onMounted, ref } from 'vue';
|
||||
import {
|
||||
@@ -57,7 +57,7 @@ interface ButtonOption {
|
||||
colorTrans: ITransitionedController<string>;
|
||||
}
|
||||
|
||||
export interface GameTitleProps extends DefaultProps, UIComponentProps {}
|
||||
export interface GameTitleProps extends DefaultProps, IUIDefaultPropsBase {}
|
||||
|
||||
const gameTitleProps = {
|
||||
props: ['controller', 'instance']
|
||||
|
||||
@@ -9,9 +9,9 @@ import {
|
||||
import { BaseProps } from '@motajs/render-vue';
|
||||
import {
|
||||
GameUI,
|
||||
IUIMountable,
|
||||
IUIController,
|
||||
SetupComponentOptions,
|
||||
UIComponentProps
|
||||
IUIDefaultPropsBase
|
||||
} from '@motajs/system';
|
||||
import {
|
||||
computed,
|
||||
@@ -41,7 +41,7 @@ import {
|
||||
STATUS_BAR_WIDTH
|
||||
} from '../../shared';
|
||||
|
||||
export interface ViewMapProps extends UIComponentProps, BaseProps {
|
||||
export interface ViewMapProps extends IUIDefaultPropsBase, BaseProps {
|
||||
loc: ElementLocator;
|
||||
floorId?: FloorIds;
|
||||
}
|
||||
@@ -556,7 +556,7 @@ export const ViewMap = defineComponent<ViewMapProps>(props => {
|
||||
export const ViewMapUI = new GameUI('view-map', ViewMap);
|
||||
|
||||
export function openViewMap(
|
||||
controller: IUIMountable,
|
||||
controller: IUIController,
|
||||
loc: ElementLocator,
|
||||
props?: ViewMapProps
|
||||
) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { compressToBase64, decompressFromBase64 } from 'lz-string';
|
||||
import { getConfirm, waitbox } from '@user/client-base';
|
||||
import { IUIMountable } from '@motajs/system';
|
||||
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: IUIMountable,
|
||||
controller: IUIController,
|
||||
identifier: string
|
||||
): Promise<void> {
|
||||
if (!/^\d{6}\w{4}$/.test(identifier) && !/^\d{4}\w{3}$/.test(identifier)) {
|
||||
|
||||
Reference in new issue
Block a user