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

@@ -411,12 +411,12 @@
"ctor": "Float64Array",
"array": [
0,
50,
0,
0,
0,
0.6427876096865393,
0.766044443118978,
0,
0,
1,
1,
1,
1
@@ -426,7 +426,7 @@
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 80
"z": 0
},
"_skewX": 0,
"_skewY": 0,
@@ -532,7 +532,7 @@
{
"__type__": "cc.Node",
"_name": "DataBoard",
"_objFlags": 1536,
"_objFlags": 512,
"_parent": {
"__id__": 8
},
@@ -598,7 +598,7 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "b8IxWUbGBN4ZAK2hGc0mte"
"_id": "85BlQuDb9HZKuhEJxwyGF+"
},
{
"__type__": "cc.Node",
@@ -660,7 +660,7 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "c7vtJRZAJCQ4T0beA4GE98"
"_id": "49+qljSBFDb61/iC62OrLE"
},
{
"__type__": "cc.Sprite",
@@ -690,7 +690,7 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "c6k8j1YNNLH6iOBrpdN3kJ"
"_id": "6axJdFuntK570hv44oHwcH"
},
{
"__type__": "cc.Node",
@@ -734,8 +734,8 @@
0,
0,
0,
-0.6427876096865393,
0.766044443118978,
0,
1,
1,
1,
1
@@ -745,14 +745,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",
@@ -782,7 +782,7 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "66/N4fj+xMs5LA1EZkAegh"
"_id": "e7StEP5C5EIY76/7RYAGaS"
},
{
"__type__": "cc.Node",
@@ -844,7 +844,7 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "97SVMRHiZESKvhs6O6T+F6"
"_id": "67uLDk0kNPMLrmc4a+2Lcz"
},
{
"__type__": "cc.Sprite",
@@ -874,7 +874,7 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "0dYOQeFA1EubrzVCvgNCHr"
"_id": "19kjTk6vxDsqYAK8l1jO+n"
},
{
"__type__": "cc.Node",
@@ -904,8 +904,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 651,
"height": 462.72
"width": 618.97,
"height": 390.72
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -917,12 +917,12 @@
"ctor": "Float64Array",
"array": [
0,
150,
0,
0,
0,
0,
-0.6427876096865393,
0.766044443118978,
1,
1,
1,
1
@@ -932,14 +932,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",
@@ -956,8 +956,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,
@@ -972,7 +972,7 @@
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$cacheMode": 0,
"_id": "13p4urwflHk7m1T9Vqj5+5"
"_id": "357EdNN/VPTaPJCzr51Jj0"
},
{
"__type__": "cc.LabelOutline",
@@ -990,7 +990,7 @@
"a": 255
},
"_width": 6,
"_id": "f9RKPbYmBJLqgnT16oJjtk"
"_id": "b4ov1ei1RJaZNO5PGzLCHc"
},
{
"__type__": "9285eM4YhBJhL8+C569X294",
@@ -1030,11 +1030,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",
@@ -1075,7 +1075,7 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 713,
"width": 714.85,
"height": 268.8
},
"_anchorPoint": {

View File

@@ -96,7 +96,7 @@ export default class DataBoard extends cc.Component {
private set customLabelString(value: string) {
this._customLabelString = value;
this.customLabelStringSplit = value
.replace(/,/g, '_~_').replace(/:/g, '_!_').replace(/ /g, '_@_')
.replace(/,|/g, '_~_').replace(/:|/g, '_!_').replace(/ |\t/g, '_@_')
.replace(/_*\n_*/g, '_\n_').split('_');
}
@property
@@ -159,7 +159,7 @@ export default class DataBoard extends cc.Component {
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');
@@ -235,6 +235,11 @@ export default class DataBoard extends cc.Component {
protected update() {
if (!this.isCustomLabelActive) return;
if (!this.customLabelStringSplit) return;
let radian = -this.node.angle * Math.PI / 180;
let cos = Math.cos(radian);
let 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;
let str = '';
let strs = this.customLabelStringSplit;
if (!this.monitorComp && this.customComponentName) {
@@ -296,7 +301,8 @@ export default class DataBoard extends cc.Component {
private parseString(str: string) {
let strs = str.split('.');
let ret = this.monitorComp[strs[0]] || `#${strs[0]}`;
let ret = this.monitorComp[strs[0]];
ret === undefined && (ret = `#${strs[0]}`);
for (let i = 1, len = strs.length; i < len; ++i) {
if (ret[strs[i]] === undefined) {
return `${ret.name ? ret.name : ret}.${strs[i]}`;