feat: 修复了找不到comTrans的问题

This commit is contained in:
honmono
2022-05-15 11:30:36 +08:00
parent 8a2274fb5b
commit fdb002d00a
9 changed files with 252 additions and 37 deletions

View File

@@ -6,7 +6,7 @@ import { ComTransform } from "../components/ComTransform";
import { ECSSystem } from "../lib/ECSSystem";
import { ECSWorld, GenFillterKey } from "../lib/ECSWorld";
const FILTER_ATTACKABLE = GenFillterKey([ComAttackable]);
const FILTER_ATTACKABLE = GenFillterKey([ComTransform, ComAttackable, ComRoleConfig]);
const FILTER_BEATTACKED = GenFillterKey([ComBeAttacked]);
export class SysAttack extends ECSSystem {
/** 连接 */

View File

@@ -54,8 +54,7 @@ export class SysCocosView extends ECSSystem implements ITouchProcessor {
let comRoleConfig = world.getComponent(entity, ComRoleConfig);
this._loadView(world, entity, comNodeConfig).then((node: cc.Node) => {
console.log('load view success');
console.log('load view success',comNodeConfig.prefabUrl);
});
return false;
});
@@ -75,6 +74,15 @@ export class SysCocosView extends ECSSystem implements ITouchProcessor {
return true;
});
let layer = cc.find('Canvas/Layers/0');
let count1 = 0, count2 = 0;
for(const node of layer.children) {
node.zIndex = node.y * -1;
if(node.name == 'Biker') count1++;
if(node.name == 'Cyborg') count2++;
}
cc.find('Canvas/a_role_count').getComponent(cc.Label).string = '' + count1;
cc.find('Canvas/b_role_count').getComponent(cc.Label).string = '' + count2;
}