import { Utils } from "../../Script/game/common/utils"; const {ccclass, property, executeInEditMode, playOnFocus} = cc._decorator; @ccclass @executeInEditMode export class Draw extends cc.Component { protected start(): void { let debugDrawer = Utils.getCpt(cc.Graphics, this.node) debugDrawer.lineWidth = 5; debugDrawer.strokeColor = new cc.Color(255, 0, 0); debugDrawer.fillColor = new cc.Color(255, 0, 0); let size = this.node.getContentSize(); if(size.width == 0){ size = cc.size(10,10) } debugDrawer.moveTo(-size.width * 0.5 , -size.height * 0.5 ); debugDrawer.lineTo(-size.width * 0.5 , +size.height * 0.5 ); debugDrawer.lineTo(size.width * 0.5 , +size.height * 0.5 ); debugDrawer.lineTo(size.width * 0.5 , -size.height * 0.5 ); debugDrawer.lineTo(-size.width * 0.5 , -size.height * 0.5 ); debugDrawer.stroke(); } }