This commit is contained in:
szrpf
2023-05-27 22:24:58 +08:00
parent 547cdbb04c
commit fb4107af45
19 changed files with 471 additions and 428 deletions

View File

@@ -154,7 +154,7 @@ var DataBoard = /** @class */ (function (_super) {
set: function (value) {
this._customLabelString = value;
this.customLabelStringSplit = value
.replace(/,/g, '_~_').replace(/:/g, '_!_').replace(/ /g, '_@_')
.replace(/,|/g, '_~_').replace(/:|/g, '_!_').replace(/ |\t/g, '_@_')
.replace(/_*\n_*/g, '_\n_').split('_');
},
enumerable: false,
@@ -203,12 +203,12 @@ var DataBoard = /** @class */ (function (_super) {
configurable: true
});
;
DataBoard.prototype.onLoad = function () {
DataBoard.prototype.start = function () {
this.boardNode = this.node.getChildByName('DataBoard');
if (!CC_EDITOR && !window['DATABOARD']) {
this.destroy();
return;
}
this.boardNode = this.node.getChildByName('DataBoard');
if (cc.isValid(this.boardNode)) {
this.boardNode.removeFromParent();
this.boardNode.destroy();
@@ -219,7 +219,7 @@ var DataBoard = /** @class */ (function (_super) {
this.boardNode.setParent(this.node);
this.boardNode.x = this.boardNode.y = 0;
this.boardNode.zIndex = cc.macro.MAX_ZINDEX;
this.boardNode['_objFlags'] |= cc.Object['Flags'].HideInHierarchy;
// this.boardNode['_objFlags'] |= cc.Object['Flags'].HideInHierarchy;
this.boardNode['_objFlags'] |= cc.Object['Flags'].LockedInEditor;
this.outlineBoxNode = new cc.Node('OutlineBox');
this.outlineBoxNode.setParent(this.boardNode);
@@ -287,6 +287,11 @@ var DataBoard = /** @class */ (function (_super) {
return;
if (!this.customLabelStringSplit)
return;
var radian = -this.node.angle * Math.PI / 180;
var cos = Math.cos(radian);
var sin = Math.sin(radian);
this.customLabelNode.x = this.customLabelOffset.x * cos - this.customLabelOffset.y * sin;
this.customLabelNode.y = this.customLabelOffset.x * sin + this.customLabelOffset.y * cos;
var str = '';
var strs = this.customLabelStringSplit;
if (!this.monitorComp && this.customComponentName) {
@@ -356,7 +361,8 @@ var DataBoard = /** @class */ (function (_super) {
};
DataBoard.prototype.parseString = function (str) {
var strs = str.split('.');
var ret = this.monitorComp[strs[0]] || "#" + strs[0];
var ret = this.monitorComp[strs[0]];
ret === undefined && (ret = "#" + strs[0]);
for (var i = 1, len = strs.length; i < len; ++i) {
if (ret[strs[i]] === undefined) {
return (ret.name ? ret.name : ret) + "." + strs[i];
@@ -370,7 +376,6 @@ var DataBoard = /** @class */ (function (_super) {
this.boardNode.removeFromParent();
this.boardNode.destroy();
}
;
this.node.targetOff(this);
};
__decorate([

File diff suppressed because one or more lines are too long

View File

@@ -412,12 +412,12 @@
"ctor": "Float64Array",
"array": [
0,
50,
0,
0,
0,
0.6427876096865393,
0.766044443118978,
0,
0,
1,
1,
1,
1
@@ -427,7 +427,7 @@
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 80
"z": 0
},
"_skewX": 0,
"_skewY": 0,
@@ -533,7 +533,7 @@
{
"__type__": "cc.Node",
"_name": "DataBoard",
"_objFlags": 1536,
"_objFlags": 512,
"_parent": {
"__id__": 8
},
@@ -599,7 +599,7 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "b8IxWUbGBN4ZAK2hGc0mte"
"_id": "85BlQuDb9HZKuhEJxwyGF+"
},
{
"__type__": "cc.Node",
@@ -661,7 +661,7 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "c7vtJRZAJCQ4T0beA4GE98"
"_id": "49+qljSBFDb61/iC62OrLE"
},
{
"__type__": "cc.Sprite",
@@ -691,7 +691,7 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "c6k8j1YNNLH6iOBrpdN3kJ"
"_id": "6axJdFuntK570hv44oHwcH"
},
{
"__type__": "cc.Node",
@@ -735,8 +735,8 @@
0,
0,
0,
-0.6427876096865393,
0.766044443118978,
0,
1,
1,
1,
1
@@ -746,14 +746,14 @@
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": -80
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "9aN+10CXdOSY8LkytqGrCE"
"_id": "66fiagvGZM17jxJS3e3R/O"
},
{
"__type__": "cc.Sprite",
@@ -783,7 +783,7 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "66/N4fj+xMs5LA1EZkAegh"
"_id": "e7StEP5C5EIY76/7RYAGaS"
},
{
"__type__": "cc.Node",
@@ -845,7 +845,7 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "97SVMRHiZESKvhs6O6T+F6"
"_id": "67uLDk0kNPMLrmc4a+2Lcz"
},
{
"__type__": "cc.Sprite",
@@ -875,7 +875,7 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "0dYOQeFA1EubrzVCvgNCHr"
"_id": "19kjTk6vxDsqYAK8l1jO+n"
},
{
"__type__": "cc.Node",
@@ -905,8 +905,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 651,
"height": 462.72
"width": 618.97,
"height": 390.72
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -918,12 +918,12 @@
"ctor": "Float64Array",
"array": [
0,
150,
0,
0,
0,
0,
-0.6427876096865393,
0.766044443118978,
1,
1,
1,
1
@@ -933,14 +933,14 @@
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": -80
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "abSX/4O+BGeKHeujiB3wJM"
"_id": "930hpjvLBPHbYO0z9MngLs"
},
{
"__type__": "cc.Label",
@@ -957,8 +957,8 @@
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "坐标:\t0.0,\t50.0\n角度:\t80.0°,\t弧度:\t0.4π\n世界坐标:\t540.0,\t1010.0\nhp:\t100.0\t\t\t\t\t\tmp:\t60.0\n小刀\n5.0",
"_N$string": "坐标:\t0.0,\t50.0\n角度:\t80.0°,\t弧度:\t0.4π\n世界坐标:\t540.0,\t1010.0\nhp:\t100.0\t\t\t\t\t\tmp:\t60.0\n小刀\n5.0",
"_string": "坐标:\t0.0,\t0.0\n角度:\t0.0°,\t弧度:\t0.0π\n世界坐标:\t540.0,\t960.0\nhp:\t100.0\t\t\t\t\t\tmp:\t60.0\n5.0",
"_N$string": "坐标:\t0.0,\t0.0\n角度:\t0.0°,\t弧度:\t0.0π\n世界坐标:\t540.0,\t960.0\nhp:\t100.0\t\t\t\t\t\tmp:\t60.0\n5.0",
"_fontSize": 60,
"_lineHeight": 72,
"_enableWrapText": true,
@@ -973,7 +973,7 @@
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$cacheMode": 0,
"_id": "13p4urwflHk7m1T9Vqj5+5"
"_id": "357EdNN/VPTaPJCzr51Jj0"
},
{
"__type__": "cc.LabelOutline",
@@ -991,7 +991,7 @@
"a": 255
},
"_width": 6,
"_id": "f9RKPbYmBJLqgnT16oJjtk"
"_id": "b4ov1ei1RJaZNO5PGzLCHc"
},
{
"__type__": "9285eM4YhBJhL8+C569X294",
@@ -1031,11 +1031,11 @@
"_collideBoxOpacity": 100,
"_isCustomLabelActive": true,
"customComponentName": "Hero",
"_customLabelString": "坐标:x,y\n角度:angle,弧度:radian\n世界坐标:wp\nhp:#hp mp:#mp\n#equip.sword\n#equip.shoe.attr.speed",
"_customLabelString": "坐标:x,y\n角度:angle,弧度:radian\n世界坐标:wp\nhp:#hp mp:#mp\n#equip.shoe.attr.speed",
"_customLabelOffset": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
"y": 150
},
"_customLabelColor": {
"__type__": "cc.Color",
@@ -1076,7 +1076,7 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 713,
"width": 714.85,
"height": 268.8
},
"_anchorPoint": {

View File

@@ -1 +1 @@
{"version":3,"sources":["assets\\Script\\Hero.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAM,IAAA,KAAsB,EAAE,CAAC,UAAU,EAAlC,OAAO,aAAA,EAAE,QAAQ,cAAiB,CAAC;AAG1C;IAAwC,8BAAY;IAApD;QAAA,qEAuBC;QAtBG,QAAE,GAAG,GAAG,CAAC;QACT,QAAE,GAAG,EAAE,CAAC;QACR,WAAK,GAAG;YACJ,IAAI,EAAC,IAAI;YACT,KAAK,EAAC;gBACF,IAAI,EAAC,IAAI;gBACT,MAAM,EAAC,EAAE;aACZ;YACD,IAAI,EAAC;gBACD,IAAI,EAAC,IAAI;gBACT,IAAI,EAAC;oBACD,IAAI,EAAC,IAAI;oBACT,KAAK,EAAC,CAAC;oBACP,OAAO,EAAC,GAAG;iBACd;aACJ;SACJ,CAAA;;IAML,CAAC;IAJG,2BAAM,GAAN,UAAQ,EAAE;QACN,IAAI,CAAC,EAAE,IAAI,GAAG,GAAC,EAAE,CAAC;QAClB,IAAI,CAAC,EAAE,IAAI,GAAG,GAAC,EAAE,CAAC;IACtB,CAAC;IAtBgB,UAAU;QAD9B,OAAO;OACa,UAAU,CAuB9B;IAAD,iBAAC;CAvBD,AAuBC,CAvBuC,EAAE,CAAC,SAAS,GAuBnD;kBAvBoB,UAAU","file":"","sourceRoot":"/","sourcesContent":["const {ccclass, property} = cc._decorator;\n\n@ccclass\nexport default class Helloworld extends cc.Component {\n hp = 100;\n mp = 60;\n equip = {\n name:'装备',\n sword:{\n name:'小刀',\n attack:30\n },\n shoe:{\n name:'草鞋',\n attr:{\n name:'属性',\n speed:5,\n durable:100\n }\n }\n }\n\n update (dt) {\n this.hp += 1.0*dt;\n this.mp += 0.5*dt;\n }\n}"]}
{"version":3,"sources":["assets\\Script\\Hero.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAM,IAAA,KAAsB,EAAE,CAAC,UAAU,EAAlC,OAAO,aAAA,EAAE,QAAQ,cAAiB,CAAC;AAG1C;IAAwC,8BAAY;IAApD;QAAA,qEAuBC;QAtBG,QAAE,GAAG,GAAG,CAAC;QACT,QAAE,GAAG,EAAE,CAAC;QACR,WAAK,GAAG;YACJ,IAAI,EAAC,IAAI;YACT,KAAK,EAAC;gBACF,IAAI,EAAC,IAAI;gBACT,MAAM,EAAC,EAAE;aACZ;YACD,IAAI,EAAC;gBACD,IAAI,EAAC,IAAI;gBACT,IAAI,EAAC;oBACD,IAAI,EAAC,IAAI;oBACT,KAAK,EAAC,CAAC;oBACP,OAAO,EAAC,GAAG;iBACd;aACJ;SACJ,CAAA;;IAML,CAAC;IAJG,2BAAM,GAAN,UAAQ,EAAE;QACN,IAAI,CAAC,EAAE,IAAI,GAAG,GAAC,EAAE,CAAC;QAClB,IAAI,CAAC,EAAE,IAAI,GAAG,GAAC,EAAE,CAAC;IACtB,CAAC;IAtBgB,UAAU;QAD9B,OAAO;OACa,UAAU,CAuB9B;IAAD,iBAAC;CAvBD,AAuBC,CAvBuC,EAAE,CAAC,SAAS,GAuBnD;kBAvBoB,UAAU","file":"","sourceRoot":"/","sourcesContent":["const {ccclass, property} = cc._decorator;\r\n\r\n@ccclass\r\nexport default class Helloworld extends cc.Component {\r\n hp = 100;\r\n mp = 60;\r\n equip = {\r\n name:'装备',\r\n sword:{\r\n name:'小刀',\r\n attack:30\r\n },\r\n shoe:{\r\n name:'草鞋',\r\n attr:{\r\n name:'属性',\r\n speed:5,\r\n durable:100\r\n }\r\n }\r\n }\r\n\r\n update (dt) {\r\n this.hp += 1.0*dt;\r\n this.mp += 0.5*dt;\r\n }\r\n}"]}