Files
cocos4/cocos/core/renderer/config.ts
T
pandamicro 9f89b0ef24 New module division (#5285)
* Temp

* temp

* move ui core

* Arrange ui and terrain

* Fix import path for all modules except core

* Move primitives into core

* Fix debug.getError

* Move audio-downloader to audio module

* export game from game.ts

* Migrate load-pipeline to ts

* Fix core modules and cleanup

* Move animation into core

* Fix module exports

* Fix director issue

* Remove most cc.director usage

* Fix ts issues

* Fix issues for unit test and editor running

* Revert removing deprecated import

* tweaks

* tweaks

* Fix ci

* Fix ci

* Add modules in module division

* Upgrade coordinates-converts-utils
2019-08-30 11:35:22 +08:00

38 lines
770 B
TypeScript

// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
let _stageOffset = 0;
const _name2stageID = {};
export default {
addStage (name) {
// already added
if (_name2stageID[name] !== undefined) {
return;
}
const stageID = 1 << _stageOffset;
_name2stageID[name] = stageID;
_stageOffset += 1;
},
stageID (name) {
const id = _name2stageID[name];
if (id === undefined) {
return -1;
}
return id;
},
stageIDs (nameList) {
let key = 0;
for (const name of nameList) {
const id = _name2stageID[name];
if (id !== undefined) {
key |= id;
}
}
return key;
},
};