import { UIList } from "../Script/Core/Ui/UIDef"; import { UILayerNames } from "../Script/Core/Ui/UILayers"; import { UIMgr } from "../Script/Core/Ui/UIMgr"; import { EConfigConst } from "../Script/game/cfg/ConfigDef"; import { BulletItem } from "../Script/game/cfg/bulletItem"; import { ConfigMgr } from "../Script/game/cfg/configMgr"; import { Utils } from "../Script/game/common/utils"; import { Barrage } from "../Script/game/nest/barrage"; import { EffectMgr } from "../Script/game/nest/effectMgr"; import { NestPlay } from "../Script/game/nest/nestPlay"; import { Draw } from "./test/draw"; const {ccclass, property} = cc._decorator; @ccclass export default class test extends cc.Component { /*===========================自动绑定组件开始===========================*/ /*自动生成*/ @property({type:cc.Node, displayName:""}) private $content_node:cc.Node = null; /*自动生成*/ @property({type:cc.Node, displayName:""}) private $layer_node:cc.Node = null; /*自动生成*/ @property({type:cc.Node, displayName:""}) private $top_node:cc.Node = null; /*自动生成*/ @property({type:cc.Node, displayName:""}) private $ui_node:cc.Node = null; /*自动生成*/ @property({type:cc.Button, displayName:""}) private $refresh_btn:cc.Button = null; /*自动生成*/ @property({type:cc.EditBox, displayName:""}) private $nest_edit:cc.EditBox = null; /*===========================自动绑定组件结束===========================*/ /*===========================自动生成按钮事件开始==========================*/ onRefreshTouchEnd(){ let id = this.$nest_edit.string; this.createNest(id); } /*===========================自动生成按钮事件结束==========================*/ protected async onLoad() { await ConfigMgr.inst.init(); this.$content_node.addComponent(Draw); this.$nest_edit.string = '101'; Barrage.inst.layer = this.$layer_node; EffectMgr.inst.layer = this.$ui_node; } createNest(id: string){ this.$top_node.destroyAllChildren(); let nestNode = Utils.createNode(this.$top_node, `nest`); nestNode.addComponent(Draw); let nestPlay = nestNode.addComponent(NestPlay); nestPlay.init(id,1); } async testCfg(){ await ConfigMgr.inst.init(); } async testBullet(){ await this.testCfg(); UIMgr.inst.setup(this.$ui_node, UILayerNames.length, UILayerNames); UIMgr.inst.showUI(UIList.debug); let bulletItem = ConfigMgr.inst.getCfgClassById(EConfigConst.bullet, '4001', BulletItem); Barrage.inst.layer = this.$layer_node; Barrage.inst.createMonsterBullet({ worldPos: this.node.convertToWorldSpaceAR(cc.v2(0,0)), dirction: cc.v2(0,1), atk:80, zooid: 1, }, bulletItem); } }