取消Extension改为linq.List以避免forin污染

This commit is contained in:
yhh
2020-11-30 13:50:18 +08:00
parent 4c329881a1
commit 0137309d3a
21 changed files with 1642 additions and 771 deletions

View File

@@ -343,10 +343,10 @@ module es {
* 获取类型T的第一个组件并返回它。如果没有找到组件将创建组件。
* @param type
*/
public getOrCreateComponent<T extends Component>(type: T) {
let comp = this.components.getComponent<T>(TypeUtils.getType(type), true);
public getOrCreateComponent<T extends Component>(type) {
let comp = this.components.getComponent<T>(type, true);
if (!comp) {
comp = this.addComponent<T>(type);
comp = this.addComponent<T>(new type());
}
return comp;