简化 getItemsByType 方法

This commit is contained in:
王金平 2020-12-03 11:34:24 +08:00 committed by GitHub
parent e7d5cfac29
commit 4677645b2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -266,9 +266,7 @@ function Game(id,params){
//获取对象列表 //获取对象列表
Stage.prototype.getItemsByType = function(type){ Stage.prototype.getItemsByType = function(type){
return this.items.filter(function(item){ return this.items.filter(function(item){
if(item.type==type){ return item.type == type;
return item;
}
}); });
}; };
//添加地图 //添加地图