mirror of
				https://github.com/unanmed/HumanBreak.git
				synced 2025-10-31 12:12:58 +08:00 
			
		
		
		
	refactor: 处理循环引用
This commit is contained in:
		
							parent
							
								
									84d93422f7
								
							
						
					
					
						commit
						1522173be3
					
				| @ -2,8 +2,6 @@ import { KeyCode } from '@motajs/client-base'; | ||||
| import { gameKey, HotkeyJSON } from '@motajs/system-action'; | ||||
| import { hovered, mainUi, tip, openDanmakuPoster } from '@motajs/legacy-ui'; | ||||
| import { GameStorage } from '@motajs/legacy-system'; | ||||
| import { openStatistics } from '../render/ui/statistics'; | ||||
| import { MAIN_HEIGHT, MAIN_WIDTH, mainUIController, saveSave } from '../render'; | ||||
| 
 | ||||
| export const mainScope = Symbol.for('@key_main'); | ||||
| 
 | ||||
| @ -487,9 +485,6 @@ gameKey | ||||
|     .realize('book', () => { | ||||
|         core.openBook(true); | ||||
|     }) | ||||
|     .realize('save', () => { | ||||
|         saveSave(mainUIController, [0, 0, MAIN_WIDTH, MAIN_HEIGHT]); | ||||
|     }) | ||||
|     .realize('load', () => { | ||||
|         core.load(true); | ||||
|     }) | ||||
| @ -511,9 +506,6 @@ gameKey | ||||
|     .realize('shop', () => { | ||||
|         core.openQuickShop(true); | ||||
|     }) | ||||
|     .realize('statistics', () => { | ||||
|         openStatistics(mainUIController); | ||||
|     }) | ||||
|     .realize('viewMap', () => { | ||||
|         core.ui._drawViewMaps(); | ||||
|     }) | ||||
|  | ||||
| @ -17,5 +17,4 @@ export * from './audio'; | ||||
| export * from './fallback'; | ||||
| export * from './loader'; | ||||
| export * from './render'; | ||||
| export * from './utils'; | ||||
| export * from './weather'; | ||||
|  | ||||
							
								
								
									
										13
									
								
								packages-user/client-modules/src/render/action.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								packages-user/client-modules/src/render/action.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,13 @@ | ||||
| import { gameKey } from '@motajs/system-action'; | ||||
| import { MAIN_WIDTH, MAIN_HEIGHT } from './shared'; | ||||
| import { saveSave, mainUIController, openStatistics } from './ui'; | ||||
| 
 | ||||
| export function createAction() { | ||||
|     gameKey | ||||
|         .realize('save', () => { | ||||
|             saveSave(mainUIController, [0, 0, MAIN_WIDTH, MAIN_HEIGHT]); | ||||
|         }) | ||||
|         .realize('statistics', () => { | ||||
|             openStatistics(mainUIController); | ||||
|         }); | ||||
| } | ||||
| @ -5,12 +5,14 @@ import { createLayer, Layer, LayerGroup } from './layer'; | ||||
| import { createViewport } from './viewport'; | ||||
| import { Icon, Winskin } from './misc'; | ||||
| import { Animate } from './animate'; | ||||
| import { createItemDetail } from './itemDetail'; | ||||
| 
 | ||||
| export function createElements() { | ||||
|     createCache(); | ||||
|     createFrame(); | ||||
|     createLayer(); | ||||
|     createViewport(); | ||||
|     createItemDetail(); | ||||
| 
 | ||||
|     // ----- 注册标签
 | ||||
| 
 | ||||
|  | ||||
| @ -3,7 +3,11 @@ import { mainSetting } from '@motajs/legacy-ui'; | ||||
| import { hook } from '@user/data-base'; | ||||
| import { ItemState } from '@user/data-state'; | ||||
| import { Damage, DamageRenderable, FloorDamageExtends } from './damage'; | ||||
| import { ILayerGroupRenderExtends, LayerGroup, LayerGroupFloorBinder } from '.'; | ||||
| import { | ||||
|     ILayerGroupRenderExtends, | ||||
|     LayerGroup, | ||||
|     LayerGroupFloorBinder | ||||
| } from './layer'; | ||||
| 
 | ||||
| interface ItemDetailData { | ||||
|     x: number; | ||||
|  | ||||
| @ -4,12 +4,12 @@ import { UIController } from '@motajs/system-ui'; | ||||
| import { mainSceneUI } from './ui/main'; | ||||
| import { MAIN_HEIGHT, MAIN_WIDTH } from './shared'; | ||||
| import { hook } from '@user/data-base'; | ||||
| import { createItemDetail } from './elements/itemDetail'; | ||||
| import { createLoopMap } from './loopMap'; | ||||
| import { createGameCanvas } from './legacy/gameCanvas'; | ||||
| import { createElements } from './elements'; | ||||
| import { mainRenderer } from './renderer'; | ||||
| import { createUI } from './ui'; | ||||
| import { createAction } from './action'; | ||||
| import { createLegacy } from './legacy'; | ||||
| 
 | ||||
| export function createGameRenderer() { | ||||
|     const App = defineComponent(_props => { | ||||
| @ -38,16 +38,17 @@ export function createGameRenderer() { | ||||
| } | ||||
| 
 | ||||
| export function createRender() { | ||||
|     createUI(); | ||||
|     createGameCanvas(); | ||||
|     createItemDetail(); | ||||
|     createLoopMap(); | ||||
|     createElements(); | ||||
|     createLegacy(); | ||||
|     createUI(); | ||||
|     createAction(); | ||||
|     createLoopMap(); | ||||
| } | ||||
| 
 | ||||
| export * from './components'; | ||||
| export * from './elements'; | ||||
| export * from './ui'; | ||||
| export * from './utils'; | ||||
| export * from './renderer'; | ||||
| export * from './shared'; | ||||
| export * from './use'; | ||||
|  | ||||
							
								
								
									
										7
									
								
								packages-user/client-modules/src/render/legacy/index.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								packages-user/client-modules/src/render/legacy/index.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,7 @@ | ||||
| import { createGameCanvas } from './gameCanvas'; | ||||
| import { createShadow } from './shadow'; | ||||
| 
 | ||||
| export function createLegacy() { | ||||
|     createGameCanvas(); | ||||
|     createShadow(); | ||||
| } | ||||
| @ -1,8 +1,12 @@ | ||||
| import { mat4 } from 'gl-matrix'; | ||||
| import { logger } from '@motajs/common'; | ||||
| import { WebGLColorArray, createProgram, isWebGL2Supported } from './webgl'; | ||||
| import { | ||||
|     WebGLColorArray, | ||||
|     createProgram, | ||||
|     isWebGL2Supported | ||||
| } from '@motajs/legacy-ui'; | ||||
| import { Sprite } from '@motajs/render'; | ||||
| import { ILayerRenderExtends, Layer, HeroRenderer } from '@user/client-modules'; | ||||
| import { ILayerRenderExtends, Layer, HeroRenderer } from '../elements'; | ||||
| 
 | ||||
| /** | ||||
|  * 最大光源数量,必须设置,且光源数不能超过这个值,这个值决定了会预留多少的缓冲区,因此最好尽可能小,同时游戏过程中不可修改 | ||||
| @ -1,4 +1,4 @@ | ||||
| import { LayerShadowExtends } from '@motajs/legacy-ui'; | ||||
| import { LayerShadowExtends } from '../legacy/shadow'; | ||||
| import { Props, Font } from '@motajs/render'; | ||||
| import { WeatherController } from '../../weather'; | ||||
| import { defineComponent, onMounted, reactive, ref } from 'vue'; | ||||
|  | ||||
| @ -358,6 +358,7 @@ export async function saveSave( | ||||
|         } | ||||
|     }; | ||||
|     const index = await selectSave(controller, loc, validate, props); | ||||
|     if (index === -2) return; | ||||
|     core.doSL(index, 'save'); | ||||
| } | ||||
| 
 | ||||
| @ -370,5 +371,10 @@ export async function saveLoad( | ||||
|         return { message: '无效的存档!', valid: exist }; | ||||
|     }; | ||||
|     const index = await selectSave(controller, loc, validate, props); | ||||
|     core.doSL(index, 'load'); | ||||
|     if (index === -2) return; | ||||
|     if (index === -1) { | ||||
|         core.doSL('autosave', 'load'); | ||||
|     } else { | ||||
|         core.doSL(index, 'load'); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -17,7 +17,7 @@ import { mainUi } from '@motajs/legacy-ui'; | ||||
| import { gameKey } from '@motajs/system-action'; | ||||
| import { generateKeyboardEvent } from '@motajs/system-action'; | ||||
| import { getVitualKeyOnce } from '@motajs/legacy-ui'; | ||||
| import { getAllSavesData, getSaveData, syncFromServer } from '../../utils'; | ||||
| import { getAllSavesData, getSaveData, syncFromServer } from '../utils'; | ||||
| import { getInput } from '../components/input'; | ||||
| import { openStatistics } from './statistics'; | ||||
| 
 | ||||
|  | ||||
| @ -22,7 +22,7 @@ import { Progress } from '../components/misc'; | ||||
| import { generateBinary } from '@motajs/legacy-common'; | ||||
| import { SetupComponentOptions } from '@motajs/system-ui'; | ||||
| import { saveSave } from './save'; | ||||
| import { mainUIController } from '@user/client-modules'; | ||||
| import { mainUIController } from './controller'; | ||||
| import { MAIN_WIDTH, MAIN_HEIGHT } from '../shared'; | ||||
| 
 | ||||
| interface ToolbarProps extends DefaultProps { | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| import { compressToBase64, decompressFromBase64 } from 'lz-string'; | ||||
| import { getConfirm, waitbox } from '../render'; | ||||
| import { getConfirm, waitbox } from '../components'; | ||||
| import { IUIMountable } from '@motajs/system-ui'; | ||||
| import { SyncSaveFromServerResponse } from '@motajs/client-base'; | ||||
| 
 | ||||
| @ -1,5 +1,5 @@ | ||||
| import { onUnmounted } from 'vue'; | ||||
| import { WeatherController } from '../weather'; | ||||
| import { WeatherController } from '../../weather'; | ||||
| 
 | ||||
| let weatherId = 0; | ||||
| 
 | ||||
| @ -1,8 +1 @@ | ||||
| import { createShadow } from './shadow'; | ||||
| 
 | ||||
| export function createFx() { | ||||
|     createShadow(); | ||||
| } | ||||
| 
 | ||||
| export * from './shadow'; | ||||
| export * from './webgl'; | ||||
|  | ||||
| @ -1,8 +1,6 @@ | ||||
| import { createFx } from './fx'; | ||||
| import { createPreset } from './preset'; | ||||
| 
 | ||||
| export function create() { | ||||
|     createFx(); | ||||
|     createPreset(); | ||||
| } | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user