mirror of
https://github.com/motajs/template.git
synced 2026-11-05 08:44:30 +08:00
refactor: 插件系统结构
This commit is contained in:
1 parent
3cc97e5ed3
commit
e6f4346924
30 files changed
+260
-169
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { MAIN_HEIGHT, MAIN_WIDTH } from './ui';
|
||||
import { MAIN_HEIGHT, MAIN_WIDTH } from './uiConstant';
|
||||
|
||||
// 本文件是游戏的底层核心配置,如果不懂的话千万不要动
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
export * from './constant';
|
||||
export * from './entry';
|
||||
export * from './initialize';
|
||||
export * from './uiConstant';
|
||||
@@ -16,7 +16,7 @@ import { ExcitationVariator } from '@motajs/animate';
|
||||
|
||||
export class MainClientPlugin implements IClientPluginDefine {
|
||||
id: string = 'main-client-plugin';
|
||||
dependencies: readonly string[] = [];
|
||||
clientDeps: readonly string[] = [];
|
||||
|
||||
awake(state: IClientCore): void {
|
||||
// 渲染调试配置
|
||||
|
||||
@@ -10,7 +10,8 @@ export interface IClientShopPlugin extends IClientPluginDefine {
|
||||
|
||||
export class ClientShopPlugin implements IClientShopPlugin {
|
||||
id: string = 'client-shop-plugin';
|
||||
dependencies: readonly string[] = [];
|
||||
clientDeps: readonly string[] = [];
|
||||
dataDeps: readonly string[] = [];
|
||||
|
||||
Shop: typeof Shop = Shop;
|
||||
ShopUI: typeof ShopUI = ShopUI;
|
||||
|
||||
@@ -4,9 +4,9 @@ import { Font } from '@motajs/render';
|
||||
import { Scroll, TextContent } from '@user/client-base';
|
||||
import { IHeroState } from '@user/data-base';
|
||||
import { IHeroAttr } from '@user/data-common';
|
||||
import { FULL_LOC, IUIPropsBase, MAIN_WIDTH } from '@user/client-modules';
|
||||
import { IUIPropsBase } from '@user/client-modules';
|
||||
import { IShopState, IShopSystem } from '@dp/shop';
|
||||
import { RENDER_WIDTH } from '@/constant';
|
||||
import { FULL_LOC, MAIN_WIDTH, RENDER_WIDTH } from '@/client';
|
||||
|
||||
export interface IShopProps extends IUIPropsBase {
|
||||
/** 商店状态对象 */
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
} from '@motajs/system';
|
||||
import { DefaultProps } from '@motajs/render-vue';
|
||||
import { defineComponent } from 'vue';
|
||||
import { MAIN_HEIGHT, MAIN_WIDTH } from './constant';
|
||||
import { MAIN_HEIGHT, MAIN_WIDTH } from '@/client';
|
||||
|
||||
export interface MainBackgroundProps
|
||||
extends DefaultProps, IUIDefaultPropsBase {}
|
||||
|
||||
@@ -7,7 +7,7 @@ import { IEnemyView } from '@user/data-system';
|
||||
import { IReadonlyEnemy } from '@user/data-base';
|
||||
import { IEnemyAttr } from '@user/data-common';
|
||||
import { BookDetailUI } from './bookDetail';
|
||||
import { FULL_LOC, MAIN_HEIGHT, MAIN_WIDTH } from './constant';
|
||||
import { FULL_LOC, MAIN_HEIGHT, MAIN_WIDTH } from '@/client';
|
||||
import { IUIPropsBase } from '@user/client-modules';
|
||||
|
||||
export interface BookProps extends IUIPropsBase {}
|
||||
|
||||
@@ -6,7 +6,7 @@ import { Scroll, TextContent } from '@user/client-base';
|
||||
import { IEnemyCritical, IEnemyView, EnemyView } from '@user/data-system';
|
||||
import { IEnemy, IReadonlyEnemy } from '@user/data-base';
|
||||
import { IEnemyAttr } from '@user/data-common';
|
||||
import { FULL_LOC, MAIN_HEIGHT, MAIN_WIDTH } from './constant';
|
||||
import { FULL_LOC, MAIN_HEIGHT, MAIN_WIDTH } from '@/client';
|
||||
import { IUIPropsBase } from '@user/client-modules';
|
||||
|
||||
/** 详情当前展示的属性模式 */
|
||||
|
||||
@@ -5,7 +5,7 @@ import { Font } from '@motajs/render';
|
||||
import { Scroll, TextContent } from '@user/client-base';
|
||||
import { EquipStatus, IHeroState } from '@user/data-base';
|
||||
import { IHeroAttr } from '@user/data-common';
|
||||
import { FULL_LOC, MAIN_HEIGHT, MAIN_WIDTH } from './constant';
|
||||
import { FULL_LOC, MAIN_HEIGHT, MAIN_WIDTH } from '@/client';
|
||||
import { IUIPropsBase } from '@user/client-modules';
|
||||
|
||||
interface IHeroAttrItem {
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
import { DefaultProps } from '@motajs/render-vue';
|
||||
import { GameUI, SetupComponentOptions } from '@motajs/system';
|
||||
import { defineComponent } from 'vue';
|
||||
import { FULL_LOC, MAIN_HEIGHT, MAIN_WIDTH } from './constant';
|
||||
import { FULL_LOC, MAIN_HEIGHT, MAIN_WIDTH } from '@/client';
|
||||
import { ElementLocator, Font, MotaOffscreenCanvas2D } from '@motajs/render';
|
||||
import { transitioned } from '../../../packages-user/client-modules/src/render/use';
|
||||
import { cosh, CurveMode, linear } from '@motajs/animate';
|
||||
import { clamp } from 'lodash-es';
|
||||
import { sleep } from '@motajs/common';
|
||||
import { GameTitleUI } from './title';
|
||||
import { IUIPropsBase } from '@user/client-modules';
|
||||
import { IUIPropsBase, transitioned } from '@user/client-modules';
|
||||
|
||||
/** 加载界面的任务进度条半径 */
|
||||
export const LOAD_TASK_RADIUS = Math.min(MAIN_WIDTH, MAIN_HEIGHT) / 6;
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
RIGHT_STATUS_POS,
|
||||
STATUS_BAR_HEIGHT,
|
||||
STATUS_BAR_WIDTH
|
||||
} from './constant';
|
||||
} from '@/client';
|
||||
import { LeftStatusBar, RightStatusBar } from './statusBar';
|
||||
import { isNil } from 'lodash-es';
|
||||
import { IUIPropsBase, using } from '@user/client-modules';
|
||||
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
IGameUIPropsBase,
|
||||
MAP_BLOCK_WIDTH
|
||||
} from '@user/client-base';
|
||||
import { HALF_HEIGHT, HALF_WIDTH, MAP_WIDTH, POP_BOX_WIDTH } from './constant';
|
||||
import { HALF_HEIGHT, HALF_WIDTH, MAP_WIDTH, POP_BOX_WIDTH } from '@/client';
|
||||
import { adjustGrid, IGridLayoutData } from '@user/client-base';
|
||||
import { getSave, IUIPropsBase, SaveData, useKey } from '@user/client-modules';
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import { openStatistics } from './statistics';
|
||||
import { saveWithExist } from './save';
|
||||
import { compressToBase64 } from 'lz-string';
|
||||
import { ViewMapUI } from './viewmap';
|
||||
import { CENTER_LOC, FULL_LOC, MAIN_HEIGHT, POP_BOX_WIDTH } from './constant';
|
||||
import { CENTER_LOC, FULL_LOC, MAIN_HEIGHT, POP_BOX_WIDTH } from '@/client';
|
||||
import { IUIPropsBase, useKey } from '@user/client-modules';
|
||||
|
||||
export interface MainSettingsProps extends Partial<ChoicesProps>, IUIPropsBase {
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
MAIN_WIDTH,
|
||||
STATUS_BAR_HEIGHT,
|
||||
STATUS_BAR_WIDTH
|
||||
} from './constant';
|
||||
} from '@/client';
|
||||
import { IUIPropsBase } from '@user/client-modules';
|
||||
import { DefaultProps } from '@motajs/render-vue';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { DefaultProps } from '@motajs/render-vue';
|
||||
import { GameUI, SetupComponentOptions } from '@motajs/system';
|
||||
import { defineComponent, nextTick, onMounted, ref } from 'vue';
|
||||
import { HALF_HEIGHT, HALF_WIDTH, MAIN_HEIGHT, MAIN_WIDTH } from './constant';
|
||||
import { HALF_HEIGHT, HALF_WIDTH, MAIN_HEIGHT, MAIN_WIDTH } from '@/client';
|
||||
import { ElementLocator, Font } from '@motajs/render';
|
||||
import {
|
||||
ExitFullscreen,
|
||||
|
||||
@@ -13,12 +13,12 @@ import {
|
||||
} from '@user/client-base';
|
||||
import { gameKey, generateKeyboardEvent } from '@motajs/system';
|
||||
import { linear } from 'mutate-animate';
|
||||
import { KeyCode } from '@motajs/client-base';
|
||||
import { KeyCode } from '@motajs/system';
|
||||
import { Progress } from '@user/client-base';
|
||||
import { generateBinary } from '@motajs/legacy-common';
|
||||
import { SetupComponentOptions } from '@motajs/system';
|
||||
import { saveSave, saveLoad } from './save';
|
||||
import { MAIN_HEIGHT, FULL_LOC, POP_BOX_WIDTH, CENTER_LOC } from './constant';
|
||||
import { MAIN_HEIGHT, FULL_LOC, POP_BOX_WIDTH, CENTER_LOC } from '@/client';
|
||||
import { openReplay, openSettings } from './settings';
|
||||
import { openViewMap } from './viewmap';
|
||||
import { DefaultProps } from '@motajs/render-vue';
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Font } from '@motajs/render';
|
||||
import { Scroll, TextContent } from '@user/client-base';
|
||||
import { IHeroItemState, IHeroState } from '@user/data-base';
|
||||
import { IHeroAttr } from '@user/data-common';
|
||||
import { FULL_LOC, MAIN_HEIGHT, MAIN_WIDTH } from './constant';
|
||||
import { FULL_LOC, MAIN_HEIGHT, MAIN_WIDTH } from '@/client';
|
||||
import { IUIPropsBase } from '@user/client-modules';
|
||||
|
||||
export interface ToolBoxProps extends IUIPropsBase {
|
||||
|
||||
@@ -38,7 +38,7 @@ import {
|
||||
RIGHT_STATUS_POS,
|
||||
STATUS_BAR_HEIGHT,
|
||||
STATUS_BAR_WIDTH
|
||||
} from './constant';
|
||||
} from '@/client';
|
||||
import { useKey } from '@user/client-modules';
|
||||
|
||||
export interface ViewMapProps extends IUIDefaultPropsBase, BaseProps {
|
||||
|
||||
File renamed without changes.
@@ -16,7 +16,7 @@ import { initializeHooks } from './hook';
|
||||
|
||||
export class MainDataPlugin implements IDataMainPlugin {
|
||||
readonly id: string = 'main-data-plugin';
|
||||
readonly dependencies: string[] = [];
|
||||
readonly dataDeps: string[] = [];
|
||||
|
||||
weak!: ICombatWeakHandler;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { ShopSystem } from './system';
|
||||
|
||||
export class DataShopPlugin implements IShopPlugin {
|
||||
id: string = 'data-shop-plugin';
|
||||
dependencies: string[] = [];
|
||||
dataDeps: string[] = [];
|
||||
|
||||
shop!: IShopSystem;
|
||||
manager!: IShopManager;
|
||||
|
||||
@@ -1,7 +1,19 @@
|
||||
{
|
||||
"name": "@user/main",
|
||||
"dependencies": {
|
||||
"@motajs/animate": "workspace:*",
|
||||
"@motajs/anon-tokyo": "workspace:*",
|
||||
"@motajs/audio": "workspace:*",
|
||||
"@motajs/common": "workspace:*",
|
||||
"@motajs/loader": "workspace:*",
|
||||
"@motajs/render": "workspace:*",
|
||||
"@motajs/render-vue": "workspace:*",
|
||||
"@motajs/system": "workspace:*",
|
||||
"@user/client-base": "workspace:*",
|
||||
"@user/client-modules": "workspace:*",
|
||||
"@user/data-common": "workspace:*",
|
||||
"@user/data-base": "workspace:*",
|
||||
"@user/data-system": "workspace:*",
|
||||
"@user/data-state": "workspace:*"
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user