1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- /** @format */
- import {Data, GameControl, Mgr} from '../GameControl'
- import {Log} from '../utils/LogUtils'
- import {ccUtils} from '../utils/ccUtils'
- import {UI} from '../enums/UI'
- /** @format */
- const {ccclass, property} = cc._decorator
- @ccclass
- export default class TestScene extends cc.Component {
- async onLoad() {
- await this.startGame()
- }
- async startGame() {
- //开启动态合图
- cc.macro.CLEANUP_IMAGE_CACHE = false
- let isInit = await GameControl.init()
- if (!isInit) {
- Log.error('游戏初始化失败')
- return
- }
- Data.game.gameBundle = await ccUtils.getBundleAsync('game')
- Data.main.texBundle = await ccUtils.getBundleAsync('texture')
- //加载所有角色spine
- Data.main.texBundle.loadDir('Public/role/spine', sp.SkeletonData, (error, assets: sp.SkeletonData[]) => {
- if (error) {
- Log.error(error)
- } else {
- for (let i = 0; i < assets.length; i++) {
- Data.main.roleSpineMap.set(assets[i].name, assets[i])
- //近战spine释放
- assets[i]['_ref'] = Infinity
- }
- Mgr.ui.show(UI.GameLoadingUI)
- }
- })
- }
- }
|