(function() { var nodeEnv = typeof require !== 'undefined' && typeof process !== 'undefined'; var __module = nodeEnv ? module : {exports:{}}; var __filename = 'preview-scripts/assets/Script/DataBoard.js'; var __require = nodeEnv ? function (request) { return cc.require(request); } : function (request) { return __quick_compile_project__.require(request, __filename); }; function __define (exports, require, module) { if (!nodeEnv) {__quick_compile_project__.registerModule(__filename, module);}"use strict"; cc._RF.push(module, '1c152bUhQpJ6J1jGhQVUYf8', 'DataBoard'); // Script/DataBoard.ts "use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; Object.defineProperty(exports, "__esModule", { value: true }); /******************************************************************************* * 创建: 2022年11月23日 * 作者: 水煮肉片饭(27185709@qq.com) * 描述: 数据看板 * 节点挂上该组件,就可以在游戏运行过程中,直观看到节点任意属性(包括节点脚本中的属性) * 可以图形化展示以下四种数据: * 轮廓盒子: 随节点旋转,代表节点的实时矩形 * 碰撞盒子: 不随节点旋转,一般代表碰撞范围 * 自定义参数: 节点自身属性,以及节点任意脚本中的属性 * 锚点: 锚点位置会显示一个小红点 * 自定义参数(配置想监控的数据): * wp: 世界坐标,即相对于屏幕左下角的坐标 * radian: 节点弧度,单位π * matrix: 变换矩阵 * parent: 父节点 * children: 子节点 * 自身属性: scale,width,opacity等 * 脚本属性: 脚本实例对象的属性 * ↓↓参数可以用3种分隔符隔开↓↓ * 英文逗号、英文冒号、空格 * ————————————————————————举个栗子———————————————————————— * 脚本: Hero * 参数: wp,scale,angle,#angle,#hp * 显示结果:世界坐标,节点scale,节点angle,Hero对象的angle,Hero对象的hp * ————————————————————————温馨提示———————————————————————— * 初始化的时候,设置全局变量window['DATABOARD'] = false可屏蔽本项目所有DataBoard,不会产生任何额外开销\n *******************************************************************************/ window['DATABOARD'] = true; var ANCHOR_SIZE = 20; //锚点的大小 var LINEHEIGHT = 1.2; //行高是字体大小的多少倍 var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property, executeInEditMode = _a.executeInEditMode, menu = _a.menu; var DataBoard = /** @class */ (function (_super) { __extends(DataBoard, _super); function DataBoard() { var _this = _super !== null && _super.apply(this, arguments) || this; _this._isOutlineBoxActive = false; _this._outlineBoxColor = new cc.Color(Math.random() * 255, Math.random() * 255, Math.random() * 255); _this._outlineBoxOpacity = 100; _this._isCollideBoxActive = true; _this._collideBoxColor = new cc.Color(Math.random() * 255, Math.random() * 255, Math.random() * 255); _this._collideBoxOpacity = 100; _this._isCustomLabelActive = true; _this.customComponentName = ''; _this._customLabelString = 'x,y'; _this._customLabelOffset = cc.v2(0, 100); _this._customLabelColor = new cc.Color(255, 255, 0); _this._customLabelSize = 60; _this._customLabelDigit = 0; _this.boardNode = null; _this.outlineBoxNode = null; _this.collideBoxNode = null; _this.anchorPointNode = null; _this.customLabelNode = null; _this.customLabel = null; _this.customLabelStringSplit = null; _this.monitorComp = null; return _this; } Object.defineProperty(DataBoard.prototype, "isOutlineBoxActive", { get: function () { return this._isOutlineBoxActive; }, set: function (value) { this._isOutlineBoxActive = value; this.outlineBoxNode.active = value; }, enumerable: false, configurable: true }); ; Object.defineProperty(DataBoard.prototype, "outlineBoxColor", { get: function () { return this._outlineBoxColor; }, set: function (value) { this._outlineBoxColor = value; this.outlineBoxNode.color = value; }, enumerable: false, configurable: true }); ; Object.defineProperty(DataBoard.prototype, "outlineBoxOpacity", { get: function () { return this._outlineBoxOpacity; }, set: function (value) { this._outlineBoxOpacity = value; this.outlineBoxNode.opacity = value; }, enumerable: false, configurable: true }); ; Object.defineProperty(DataBoard.prototype, "isCollideBoxActive", { get: function () { return this._isCollideBoxActive; }, set: function (value) { this._isCollideBoxActive = value; this.collideBoxNode.active = value; }, enumerable: false, configurable: true }); ; Object.defineProperty(DataBoard.prototype, "collideBoxColor", { get: function () { return this._collideBoxColor; }, set: function (value) { this._collideBoxColor = value; this.collideBoxNode.color = value; }, enumerable: false, configurable: true }); ; Object.defineProperty(DataBoard.prototype, "collideBoxOpacity", { get: function () { return this._collideBoxOpacity; }, set: function (value) { this._collideBoxOpacity = value; this.collideBoxNode.opacity = value; }, enumerable: false, configurable: true }); ; Object.defineProperty(DataBoard.prototype, "isCustomLabelActive", { get: function () { return this._isCustomLabelActive; }, set: function (value) { this._isCustomLabelActive = value; this.customLabelNode.active = value; }, enumerable: false, configurable: true }); ; Object.defineProperty(DataBoard.prototype, "customLabelString", { get: function () { return this._customLabelString; }, set: function (value) { this._customLabelString = value; this.customLabelStringSplit = value .replace(/,/g, '_~_').replace(/:/g, '_!_').replace(/ /g, '_@_') .replace(/(?