first commit
This commit is contained in:
2
assets/app/.app.md
Normal file
2
assets/app/.app.md
Normal file
@@ -0,0 +1,2 @@
|
||||
1、框架配置、生命周期及全局导出
|
||||
2、不可删除此文件夹
|
||||
33
assets/app/app.ts
Normal file
33
assets/app/app.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { Game, game } from 'cc';
|
||||
import { DEBUG, DEV, EDITOR } from 'cc/env';
|
||||
import Core from '../../extensions/app/assets/Core';
|
||||
import { IApp } from '../app-builtin/app-admin/executor';
|
||||
import { appInited, appReady, cccInited, cccReady } from './handle';
|
||||
|
||||
export class App extends Core<IApp> {
|
||||
protected static _inst: App | undefined;
|
||||
static get inst() {
|
||||
if (!this._inst) this._inst = new App();
|
||||
return this._inst;
|
||||
}
|
||||
|
||||
private constructor() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
export const app = App.inst;
|
||||
|
||||
if (DEBUG) {
|
||||
//@ts-ignore
|
||||
window['app'] = app;
|
||||
//@ts-ignore
|
||||
window['App'] = App;
|
||||
}
|
||||
|
||||
if (!EDITOR || DEV) {
|
||||
cccReady && cccReady(app);
|
||||
appReady && appReady(app);
|
||||
cccInited && game.once(Game.EVENT_ENGINE_INITED, function () { cccInited(app); });
|
||||
appInited && app.once(App.EventType.EVENT_APPINIT_FINISHED, function () { appInited(app); });
|
||||
}
|
||||
9
assets/app/app.ts.meta
Normal file
9
assets/app/app.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.24",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "121df84f-631d-4557-831a-19641e7deea8",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
34
assets/app/handle.ts
Normal file
34
assets/app/handle.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { game, sys } from 'cc';
|
||||
import { App } from './app';
|
||||
|
||||
/**
|
||||
* ccc除物理引擎等外的基础功能已经准备好了
|
||||
*/
|
||||
export function cccReady(app: App) {
|
||||
// 为了防止web环境中异常掉帧问题(关键代码在cc.game._pacer._handleRAF中)
|
||||
if (sys.isBrowser) {
|
||||
// game.frameRate = 100; // 在60、90帧率手机上满帧率运行,120帧率手机上以60帧率运行(可能不够流畅但省电)
|
||||
game.frameRate = 200; // 满帧率运行
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ccc全部功能都初始化完毕了
|
||||
*/
|
||||
export function cccInited(app: App) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* app除了用户自定义Manager未加载外,其它都已准备好了
|
||||
*/
|
||||
export function appReady(app: App) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* app全部功能都初始化完毕了
|
||||
*/
|
||||
export function appInited(app: App) {
|
||||
|
||||
}
|
||||
9
assets/app/handle.ts.meta
Normal file
9
assets/app/handle.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.24",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "8afaf85a-fbcd-4213-aacb-2e9337926fee",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
32
assets/app/setting.ts
Normal file
32
assets/app/setting.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { DEBUG } from 'cc/env';
|
||||
import { Logger } from 'db://app/lib/logger/logger';
|
||||
import { Storage } from 'db://app/lib/storage/storage';
|
||||
import SoundManager from 'db://app/manager/sound/SoundManager';
|
||||
import UIManager from 'db://app/manager/ui/UIManager';
|
||||
|
||||
// 如果需要加密内容,请设置密钥的值
|
||||
Storage.setting.secretKey = '';
|
||||
// 设置日志过滤
|
||||
Logger.setting.filter = DEBUG ? ['error', 'log', 'warn'] : ['error'];
|
||||
|
||||
// 预加载的UI列表
|
||||
UIManager.setting.preload = ['PageMain'];
|
||||
// 默认UI, 会在首屏流程后自动show
|
||||
UIManager.setting.defaultUI = 'PageMain'; // 通过App菜单创建Page类型的UI后,填入该UI的名称(会有自动提示与类型检查)
|
||||
// 是否自动适配分辨率策略
|
||||
UIManager.setting.autoFit = true; // 开启后,会弃用项目设置中的适配策略,并自动根据设备分辨率与设计分辨率计算出新的适配策略
|
||||
// 弹窗默认遮罩展现动画配置
|
||||
UIManager.setting.shade = {
|
||||
delay: 0,
|
||||
begin: 100,
|
||||
end: 200,
|
||||
speed: 400,
|
||||
blur: false
|
||||
};
|
||||
|
||||
// 预加载的音频(按数组顺序依次预加载)
|
||||
SoundManager.setting.preload = ['effect/click', 'effect/eff_finish', 'effect/eff_jump', 'effect/eff_start', 'effect/shaizi', 'music/bgm'];
|
||||
// 默认音乐, 会在首屏流程后自动播放
|
||||
SoundManager.setting.defaultMusicName = 'music/bgm';
|
||||
// 默认音效, 会在Button被点击后播放
|
||||
SoundManager.setting.defaultEffectName = 'effect/click';
|
||||
9
assets/app/setting.ts.meta
Normal file
9
assets/app/setting.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.24",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "9a8d2a40-9eb2-4058-8883-a7de0fedbd33",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
Reference in New Issue
Block a user