-
Notifications
You must be signed in to change notification settings - Fork 115
Home
FECS 是基于 Node.js 的前端代码风格工具套件,包含对 JavaScript、CSS 与 HTML 的检查及格式化。
$ [sudo] npm install fecs -g
fecs-check 命令
语言 | 使用的工具 | 备注 |
---|---|---|
JavaScript | eslint | -- |
CSS | csshint | -- |
HTML | htmlcs | -- |
fecs-format 命令
语言 | 使用的工具 | 备注 |
---|---|---|
JavaScript | eslint 与 esformatter | -- |
CSS | cssbeautify 与 csscomb | -- |
HTML | htmlcs | -- |
// Learn TypeScript: // - https://docs.cocos.com/creator/manual/en/scripting/typescript.html // Learn Attribute: // - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html // Learn life-cycle callbacks: // - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
import AssetMgr from './framework/AssetMgr'; import AudioMgr from './framework/AudioMgr'; import EventMgr from './framework/EventMgr'; import ObjectPoolMgr from './framework/ObjectPoolMgr'; import TimerMgr from './framework/TimerMgr'; import UIMgr from './framework/UIMgr'; import Instance from './framework/utils/Instance'; import PropMgr from './logic/common/PropMgr'; import UserInfo from './logic/common/UserInfo'; import ArtDataMgr from './logic/data/ArtDataMgr'; import ConfigArtGroupMgr from './logic/data/ConfigArtGroupMgr'; import ConfigArtMgr from './logic/data/ConfigArtMgr'; import ConfigMgr from './logic/data/ConfigMgr'; import SaveDataMgr from './logic/data/SaveDataMgr'; import HttpLogicMgr from './logic/net/HttpLogicMgr'; import GridMgr from './logic/painting/GridMgr'; import PaintingGridDataMgr from './logic/painting/PaintingGridDataMgr'; import PaintingPaletteDataMgr from './logic/painting/PaintingPaletteDataMgr'; import StarBlinkEffectMgr from './logic/ui/effects/StarBlinkEffectMgr';
const { ccclass, property } = cc._decorator;
@ccclass export default class App extends cc.Component { static UIRoot: cc.Node = null; static timerMgr: TimerMgr = null; static eventMgr: EventMgr = null; static assetMgr: AssetMgr = null; static uiMgr: UIMgr = null; static poolMgr: ObjectPoolMgr = null; static httpMgr: HttpLogicMgr = null; static audioMgr: AudioMgr = null; static userInfo: UserInfo = null; static gridMgr: GridMgr = null; static paintingPaletteDataMgr: PaintingPaletteDataMgr = null; static saveDataMgr: SaveDataMgr = null; static paintingGridDataMgr: PaintingGridDataMgr = new PaintingGridDataMgr(); static propMgr: PropMgr = null; static artDataMgr: ArtDataMgr = null; private static configMgr: ConfigMgr = null; static configArtMgr: ConfigArtMgr = null; static configArtGroupMgr: ConfigArtGroupMgr = null;; /** * 测试网络开关 / static isOpenNetwork: boolean = true; /* * 是否是链接本地 / static isLocalNetwork: boolean = true; /* * 是否开启网络log */ static isOpenNetworkLog: boolean = true;
async onLoad() {
App.UIRoot = cc.find('Canvas/UIRoot');
// cc.debug.setDisplayStats(false);
// cc.game.setFrameRate(30)
// 注册单例
App.eventMgr = Instance.get(EventMgr);
App.timerMgr = Instance.get(TimerMgr);
App.assetMgr = Instance.get(AssetMgr);
App.poolMgr = Instance.get(ObjectPoolMgr);
App.httpMgr = Instance.get(HttpLogicMgr);
App.audioMgr = Instance.get(AudioMgr);
App.userInfo = Instance.get(UserInfo);
App.paintingGridDataMgr = Instance.get(PaintingGridDataMgr);
App.paintingPaletteDataMgr = Instance.get(PaintingPaletteDataMgr);
App.propMgr = Instance.get(PropMgr);
App.saveDataMgr = Instance.get(SaveDataMgr);
App.artDataMgr = Instance.get(ArtDataMgr);
App.gridMgr = Instance.get(GridMgr);
/** ----初始化数据库 */
const dbOk = await App.saveDataMgr.init(UserInfo.PaintingDataKey);// 增加新的数据表需要同时修改版本号
console.log('dbOk = ' + dbOk);
// App.userInfo.clearAllDatas()
/** ----加载数据 */
App.userInfo.loadData();
/** ----初始化ui管理 */
// 注册事件监听
App.eventMgr.registerOwner(UIMgr);
// 初始化ui管理类
App.uiMgr = Instance.get(UIMgr).init(App.UIRoot);
/** ----加载art数据 编辑器生成的 */
await App.artDataMgr.loadData();
await this.cacheViews(['PaintingView']);
/** ----初始化configs */
App.configMgr = Instance.get(ConfigMgr);
await App.configMgr.loadConfig('dataConfigs');
App.configArtGroupMgr = Instance.get(ConfigArtGroupMgr).init(App.configMgr.getTable('artGroup'));
App.configArtMgr = Instance.get(ConfigArtMgr).init(App.configMgr.getTable('art'));
/** ----初始化tile缓存 */
let prefab = await App.assetMgr.load('prefabs/TiledTile', cc.Prefab);
App.poolMgr.createObjectPool('TiledTile', (prefab as cc.Prefab), 110 * 110 * 4);
prefab = await App.assetMgr.loadPrefab('prefabs/StarArrayEffect');
App.poolMgr.createObjectPool('StarArrayEffect', (prefab as cc.Prefab), 110 * 110 * 4);
prefab = await App.assetMgr.loadPrefab('prefabs/StarBlinkEffect');
App.poolMgr.createObjectPool('StarBlinkEffect', (prefab as cc.Prefab), 300);
/** ----进入游戏 */
App.uiMgr.showView('HomeBottomView', 0);
cc.game.setFrameRate(30);
}
private async cacheViews(names: string[]) {
for (let index = 0; index < names.length; index++) {
const name = names[index];
const Prefab = await App.assetMgr.load(`ui/${name}`, cc.Prefab);
App.poolMgr.createObjectPool(name, (Prefab as cc.Prefab), 1);
}
}
update(dt) {
App.timerMgr.update(dt);
}
/**
* 显示绘制界面
* @param data
*/
static async GotoPainting(data: any) {
App.userInfo.paintingRecord(data.id);
App.userInfo.saveData();
await App.uiMgr.showView('PaintingView', data);
App.uiMgr.hideView('HomeBottomView');
App.uiMgr.hideView('CutImageView');
// cc.game.setFrameRate(60);
}
/**
* 回到主界面
*/
static async GotoHome() {
if (!App.uiMgr.isViewShow('HomeBottomView')) {
await App.uiMgr.showView('HomeBottomView');
}
}
}