test.ts 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import { UIList } from "../Script/Core/Ui/UIDef";
  2. import { UILayerNames } from "../Script/Core/Ui/UILayers";
  3. import { UIMgr } from "../Script/Core/Ui/UIMgr";
  4. import { EConfigConst } from "../Script/game/cfg/ConfigDef";
  5. import { BulletItem } from "../Script/game/cfg/bulletItem";
  6. import { ConfigMgr } from "../Script/game/cfg/configMgr";
  7. import { Utils } from "../Script/game/common/utils";
  8. import { Barrage } from "../Script/game/nest/barrage";
  9. const {ccclass, property} = cc._decorator;
  10. @ccclass
  11. export default class test extends cc.Component {
  12. /*===========================自动绑定组件开始===========================*/
  13. /*自动生成*/
  14. @property({type:cc.Node, displayName:""})
  15. private $layer_node:cc.Node = null;
  16. /*自动生成*/
  17. @property({type:cc.Node, displayName:""})
  18. private $ui_node:cc.Node = null;
  19. /*===========================自动绑定组件结束===========================*/
  20. /*===========================自动生成按钮事件开始==========================*/
  21. /*===========================自动生成按钮事件结束==========================*/
  22. protected async onLoad() {
  23. await this.testCfg();
  24. UIMgr.inst.setup(this.$ui_node, UILayerNames.length, UILayerNames);
  25. UIMgr.inst.showUI(UIList.debug);
  26. let bulletItem = ConfigMgr.inst.getCfgClassById(EConfigConst.bullet, '4001', BulletItem);
  27. Barrage.inst.layer = this.$layer_node;
  28. Barrage.inst.createMonsterBullet({
  29. worldPos: this.node.convertToWorldSpaceAR(cc.v2(0,0)),
  30. dirction: cc.v2(0,1),
  31. atk:1,
  32. }, bulletItem);
  33. }
  34. async testCfg(){
  35. await ConfigMgr.inst.init();
  36. }
  37. }