test.ts 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. import { NestPlay } from "../Script/game/nest/nestPlay";
  10. import { Draw } from "./test/draw";
  11. const {ccclass, property} = cc._decorator;
  12. @ccclass
  13. export default class test extends cc.Component {
  14. /*===========================自动绑定组件开始===========================*/
  15. /*自动生成*/
  16. @property({type:cc.Node, displayName:""})
  17. private $content_node:cc.Node = null;
  18. /*自动生成*/
  19. @property({type:cc.Node, displayName:""})
  20. private $layer_node:cc.Node = null;
  21. /*自动生成*/
  22. @property({type:cc.Node, displayName:""})
  23. private $top_node:cc.Node = null;
  24. /*自动生成*/
  25. @property({type:cc.Node, displayName:""})
  26. private $ui_node:cc.Node = null;
  27. /*===========================自动绑定组件结束===========================*/
  28. /*===========================自动生成按钮事件开始==========================*/
  29. /*===========================自动生成按钮事件结束==========================*/
  30. protected async onLoad() {
  31. await ConfigMgr.inst.init();
  32. this.$content_node.addComponent(Draw);
  33. let nestNode = Utils.createNode(this.$top_node, `nest`);
  34. nestNode.addComponent(Draw);
  35. let nestPlay = nestNode.addComponent(NestPlay);
  36. nestPlay.init('101',1);
  37. }
  38. async testCfg(){
  39. await ConfigMgr.inst.init();
  40. }
  41. async testBullet(){
  42. await this.testCfg();
  43. UIMgr.inst.setup(this.$ui_node, UILayerNames.length, UILayerNames);
  44. UIMgr.inst.showUI(UIList.debug);
  45. let bulletItem = ConfigMgr.inst.getCfgClassById(EConfigConst.bullet, '4001', BulletItem);
  46. Barrage.inst.layer = this.$layer_node;
  47. Barrage.inst.createMonsterBullet({
  48. worldPos: this.node.convertToWorldSpaceAR(cc.v2(0,0)),
  49. dirction: cc.v2(0,1),
  50. atk:80,
  51. }, bulletItem);
  52. }
  53. }