feat(ibox): 实现信息弹窗背景自适应高度功能
1. 重构IBoxComp组件,移除旧的标题名称渲染逻辑 2. 添加动态背景节点,根据RichText内容自动调整高度 3. 优化cardbg和herobox预制体样式,调整尺寸与透明度 4. 新增通用背景预制体hbg,支持多配色快速复用 5. 重写ibox预制体结构,适配新的组件逻辑
This commit is contained in:
1681
assets/resources/gui/auie/hbg.prefab
Normal file
1681
assets/resources/gui/auie/hbg.prefab
Normal file
File diff suppressed because it is too large
Load Diff
13
assets/resources/gui/auie/hbg.prefab.meta
Normal file
13
assets/resources/gui/auie/hbg.prefab.meta
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"ver": "1.1.50",
|
||||
"importer": "prefab",
|
||||
"imported": true,
|
||||
"uuid": "57e33de6-9b39-4744-90ac-987944a47da8",
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"syncNodeName": "hbg"
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -420,7 +420,7 @@
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 120
|
||||
"a": 255
|
||||
},
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@6c895",
|
||||
@@ -615,8 +615,8 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 280,
|
||||
"height": 280
|
||||
"width": 300,
|
||||
"height": 300
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
@@ -737,8 +737,8 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 140,
|
||||
"height": 140
|
||||
"width": 150,
|
||||
"height": 150
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
@@ -765,9 +765,9 @@
|
||||
},
|
||||
"_alignFlags": 41,
|
||||
"_target": null,
|
||||
"_left": 15,
|
||||
"_right": 15,
|
||||
"_top": 15,
|
||||
"_left": 10,
|
||||
"_right": 10,
|
||||
"_top": 10,
|
||||
"_bottom": 115,
|
||||
"_horizontalCenter": 0,
|
||||
"_verticalCenter": 0,
|
||||
@@ -938,7 +938,7 @@
|
||||
"__id__": 57
|
||||
}
|
||||
],
|
||||
"_active": false,
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 71
|
||||
@@ -1258,7 +1258,7 @@
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 120
|
||||
"a": 255
|
||||
},
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@6c895",
|
||||
@@ -1453,8 +1453,8 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 280,
|
||||
"height": 280
|
||||
"width": 300,
|
||||
"height": 300
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
@@ -1575,8 +1575,8 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 140,
|
||||
"height": 140
|
||||
"width": 150,
|
||||
"height": 150
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
@@ -1603,9 +1603,9 @@
|
||||
},
|
||||
"_alignFlags": 41,
|
||||
"_target": null,
|
||||
"_left": 15,
|
||||
"_right": 15,
|
||||
"_top": 15,
|
||||
"_left": 10,
|
||||
"_right": 10,
|
||||
"_top": 10,
|
||||
"_bottom": 115,
|
||||
"_horizontalCenter": 0,
|
||||
"_verticalCenter": 0,
|
||||
@@ -1776,7 +1776,7 @@
|
||||
"__id__": 95
|
||||
}
|
||||
],
|
||||
"_active": false,
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 109
|
||||
@@ -2096,7 +2096,7 @@
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 120
|
||||
"a": 255
|
||||
},
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@6c895",
|
||||
@@ -2291,8 +2291,8 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 280,
|
||||
"height": 280
|
||||
"width": 300,
|
||||
"height": 300
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
@@ -2413,8 +2413,8 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 140,
|
||||
"height": 140
|
||||
"width": 150,
|
||||
"height": 150
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
@@ -2441,9 +2441,9 @@
|
||||
},
|
||||
"_alignFlags": 41,
|
||||
"_target": null,
|
||||
"_left": 15,
|
||||
"_right": 15,
|
||||
"_top": 15,
|
||||
"_left": 10,
|
||||
"_right": 10,
|
||||
"_top": 10,
|
||||
"_bottom": 115,
|
||||
"_horizontalCenter": 0,
|
||||
"_verticalCenter": 0,
|
||||
@@ -2614,7 +2614,7 @@
|
||||
"__id__": 133
|
||||
}
|
||||
],
|
||||
"_active": false,
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 147
|
||||
@@ -2934,7 +2934,7 @@
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 120
|
||||
"a": 255
|
||||
},
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@6c895",
|
||||
@@ -3129,8 +3129,8 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 280,
|
||||
"height": 280
|
||||
"width": 300,
|
||||
"height": 300
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
@@ -3251,8 +3251,8 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 140,
|
||||
"height": 140
|
||||
"width": 150,
|
||||
"height": 150
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
@@ -3279,9 +3279,9 @@
|
||||
},
|
||||
"_alignFlags": 41,
|
||||
"_target": null,
|
||||
"_left": 15,
|
||||
"_right": 15,
|
||||
"_top": 15,
|
||||
"_left": 10,
|
||||
"_right": 10,
|
||||
"_top": 10,
|
||||
"_bottom": 115,
|
||||
"_horizontalCenter": 0,
|
||||
"_verticalCenter": 0,
|
||||
@@ -3452,7 +3452,7 @@
|
||||
"__id__": 171
|
||||
}
|
||||
],
|
||||
"_active": false,
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 185
|
||||
@@ -3772,7 +3772,7 @@
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 120
|
||||
"a": 255
|
||||
},
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@6c895",
|
||||
@@ -3967,8 +3967,8 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 280,
|
||||
"height": 280
|
||||
"width": 300,
|
||||
"height": 300
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
@@ -4089,8 +4089,8 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 140,
|
||||
"height": 140
|
||||
"width": 150,
|
||||
"height": 150
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
@@ -4117,9 +4117,9 @@
|
||||
},
|
||||
"_alignFlags": 41,
|
||||
"_target": null,
|
||||
"_left": 15,
|
||||
"_right": 15,
|
||||
"_top": 15,
|
||||
"_left": 10,
|
||||
"_right": 10,
|
||||
"_top": 10,
|
||||
"_bottom": 115,
|
||||
"_horizontalCenter": 0,
|
||||
"_verticalCenter": 0,
|
||||
|
||||
@@ -2998,7 +2998,7 @@
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": -62.269,
|
||||
"y": -60.02,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
@@ -3010,8 +3010,8 @@
|
||||
},
|
||||
"_lscale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0.2,
|
||||
"y": 0.3,
|
||||
"x": 0.15,
|
||||
"y": 0.15,
|
||||
"z": 1
|
||||
},
|
||||
"_mobility": 0,
|
||||
@@ -3069,10 +3069,10 @@
|
||||
"_dstBlendFactor": 4,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
"r": 61,
|
||||
"g": 61,
|
||||
"b": 61,
|
||||
"a": 195
|
||||
},
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@34d88",
|
||||
@@ -3627,7 +3627,7 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 84,
|
||||
"width": 92,
|
||||
"height": 35.373999999999995
|
||||
},
|
||||
"_anchorPoint": {
|
||||
@@ -3666,8 +3666,8 @@
|
||||
"_string": "英雄名称",
|
||||
"_horizontalAlign": 1,
|
||||
"_verticalAlign": 1,
|
||||
"_actualFontSize": 20,
|
||||
"_fontSize": 20,
|
||||
"_actualFontSize": 22,
|
||||
"_fontSize": 22,
|
||||
"_fontFamily": "Arial",
|
||||
"_lineHeight": 24.9,
|
||||
"_overflow": 0,
|
||||
@@ -3782,7 +3782,7 @@
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": -117.839,
|
||||
"y": -113.062,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
@@ -3822,7 +3822,7 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 47.1671468533978,
|
||||
"width": 51.483861538737585,
|
||||
"height": 54.4
|
||||
},
|
||||
"_anchorPoint": {
|
||||
@@ -3861,8 +3861,8 @@
|
||||
"_string": "Lv.1",
|
||||
"_horizontalAlign": 1,
|
||||
"_verticalAlign": 1,
|
||||
"_actualFontSize": 20,
|
||||
"_fontSize": 20,
|
||||
"_actualFontSize": 22,
|
||||
"_fontSize": 22,
|
||||
"_fontFamily": "Arial",
|
||||
"_lineHeight": 40,
|
||||
"_overflow": 0,
|
||||
@@ -4416,7 +4416,7 @@
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": -22.182,
|
||||
"x": -25.305,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
@@ -4529,7 +4529,7 @@
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": -72.49951171875,
|
||||
"x": -69.669921875,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
@@ -4570,8 +4570,8 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 45.0009765625,
|
||||
"height": 27.814
|
||||
"width": 50.66015625,
|
||||
"height": 30.46
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
@@ -4601,34 +4601,34 @@
|
||||
"_dstBlendFactor": 4,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 32,
|
||||
"g": 32,
|
||||
"b": 32,
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_string": "攻击:",
|
||||
"_horizontalAlign": 1,
|
||||
"_verticalAlign": 1,
|
||||
"_actualFontSize": 18,
|
||||
"_fontSize": 18,
|
||||
"_actualFontSize": 20,
|
||||
"_fontSize": 20,
|
||||
"_fontFamily": "Arial",
|
||||
"_lineHeight": 18.9,
|
||||
"_lineHeight": 21,
|
||||
"_overflow": 0,
|
||||
"_enableWrapText": true,
|
||||
"_font": null,
|
||||
"_isSystemFontUsed": true,
|
||||
"_spacingX": 0,
|
||||
"_isItalic": false,
|
||||
"_isBold": false,
|
||||
"_isBold": true,
|
||||
"_isUnderline": false,
|
||||
"_underlineHeight": 2,
|
||||
"_cacheMode": 0,
|
||||
"_enableOutline": true,
|
||||
"_outlineColor": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"r": 0,
|
||||
"g": 0,
|
||||
"b": 0,
|
||||
"a": 255
|
||||
},
|
||||
"_outlineWidth": 2,
|
||||
@@ -4688,7 +4688,7 @@
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": -26.9775390625,
|
||||
"x": -19.09375,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
@@ -4729,8 +4729,8 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 44.04296875,
|
||||
"height": 27.94
|
||||
"width": 48.4921875,
|
||||
"height": 30.46
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
@@ -4760,18 +4760,18 @@
|
||||
"_dstBlendFactor": 4,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 0,
|
||||
"g": 0,
|
||||
"b": 0,
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_string": "9999",
|
||||
"_horizontalAlign": 1,
|
||||
"_verticalAlign": 1,
|
||||
"_actualFontSize": 18,
|
||||
"_fontSize": 18,
|
||||
"_actualFontSize": 20,
|
||||
"_fontSize": 20,
|
||||
"_fontFamily": "Arial",
|
||||
"_lineHeight": 19,
|
||||
"_lineHeight": 21,
|
||||
"_overflow": 0,
|
||||
"_enableWrapText": true,
|
||||
"_font": null,
|
||||
@@ -4785,9 +4785,9 @@
|
||||
"_enableOutline": true,
|
||||
"_outlineColor": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"r": 0,
|
||||
"g": 0,
|
||||
"b": 0,
|
||||
"a": 255
|
||||
},
|
||||
"_outlineWidth": 2,
|
||||
@@ -4847,7 +4847,7 @@
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": -3.9560546875,
|
||||
"x": 6.15234375,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
@@ -4888,8 +4888,8 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 56.5322265625,
|
||||
"height": 27.94
|
||||
"width": 62.369140625,
|
||||
"height": 30.46
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
@@ -4927,17 +4927,17 @@
|
||||
"_string": "(+999)",
|
||||
"_horizontalAlign": 0,
|
||||
"_verticalAlign": 1,
|
||||
"_actualFontSize": 18,
|
||||
"_fontSize": 18,
|
||||
"_actualFontSize": 20,
|
||||
"_fontSize": 20,
|
||||
"_fontFamily": "Arial",
|
||||
"_lineHeight": 19,
|
||||
"_lineHeight": 21,
|
||||
"_overflow": 0,
|
||||
"_enableWrapText": true,
|
||||
"_font": null,
|
||||
"_isSystemFontUsed": true,
|
||||
"_spacingX": 0,
|
||||
"_isItalic": false,
|
||||
"_isBold": false,
|
||||
"_isBold": true,
|
||||
"_isUnderline": false,
|
||||
"_underlineHeight": 2,
|
||||
"_cacheMode": 0,
|
||||
@@ -5184,7 +5184,7 @@
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": -72.49951171875,
|
||||
"x": -69.669921875,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
@@ -5225,8 +5225,8 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 45.0009765625,
|
||||
"height": 27.814
|
||||
"width": 50.66015625,
|
||||
"height": 30.46
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
@@ -5256,34 +5256,34 @@
|
||||
"_dstBlendFactor": 4,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 32,
|
||||
"g": 32,
|
||||
"b": 32,
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_string": "生命:",
|
||||
"_horizontalAlign": 1,
|
||||
"_verticalAlign": 1,
|
||||
"_actualFontSize": 18,
|
||||
"_fontSize": 18,
|
||||
"_actualFontSize": 20,
|
||||
"_fontSize": 20,
|
||||
"_fontFamily": "Arial",
|
||||
"_lineHeight": 18.9,
|
||||
"_lineHeight": 21,
|
||||
"_overflow": 0,
|
||||
"_enableWrapText": true,
|
||||
"_font": null,
|
||||
"_isSystemFontUsed": true,
|
||||
"_spacingX": 0,
|
||||
"_isItalic": false,
|
||||
"_isBold": false,
|
||||
"_isBold": true,
|
||||
"_isUnderline": false,
|
||||
"_underlineHeight": 2,
|
||||
"_cacheMode": 0,
|
||||
"_enableOutline": true,
|
||||
"_outlineColor": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"r": 0,
|
||||
"g": 0,
|
||||
"b": 0,
|
||||
"a": 255
|
||||
},
|
||||
"_outlineWidth": 2,
|
||||
@@ -5343,7 +5343,7 @@
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": -26.9775390625,
|
||||
"x": -19.09375,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
@@ -5384,8 +5384,8 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 44.04296875,
|
||||
"height": 27.94
|
||||
"width": 48.4921875,
|
||||
"height": 30.46
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
@@ -5415,18 +5415,18 @@
|
||||
"_dstBlendFactor": 4,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 0,
|
||||
"g": 0,
|
||||
"b": 0,
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_string": "9999",
|
||||
"_horizontalAlign": 1,
|
||||
"_verticalAlign": 1,
|
||||
"_actualFontSize": 18,
|
||||
"_fontSize": 18,
|
||||
"_actualFontSize": 20,
|
||||
"_fontSize": 20,
|
||||
"_fontFamily": "Arial",
|
||||
"_lineHeight": 19,
|
||||
"_lineHeight": 21,
|
||||
"_overflow": 0,
|
||||
"_enableWrapText": true,
|
||||
"_font": null,
|
||||
@@ -5440,9 +5440,9 @@
|
||||
"_enableOutline": true,
|
||||
"_outlineColor": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"r": 0,
|
||||
"g": 0,
|
||||
"b": 0,
|
||||
"a": 255
|
||||
},
|
||||
"_outlineWidth": 2,
|
||||
@@ -5502,7 +5502,7 @@
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": -3.9560546875,
|
||||
"x": 6.15234375,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
@@ -5543,8 +5543,8 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 56.5322265625,
|
||||
"height": 27.94
|
||||
"width": 62.369140625,
|
||||
"height": 30.46
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
@@ -5582,17 +5582,17 @@
|
||||
"_string": "(+999)",
|
||||
"_horizontalAlign": 0,
|
||||
"_verticalAlign": 1,
|
||||
"_actualFontSize": 18,
|
||||
"_fontSize": 18,
|
||||
"_actualFontSize": 20,
|
||||
"_fontSize": 20,
|
||||
"_fontFamily": "Arial",
|
||||
"_lineHeight": 19,
|
||||
"_lineHeight": 21,
|
||||
"_overflow": 0,
|
||||
"_enableWrapText": true,
|
||||
"_font": null,
|
||||
"_isSystemFontUsed": true,
|
||||
"_spacingX": 0,
|
||||
"_isItalic": false,
|
||||
"_isBold": false,
|
||||
"_isBold": true,
|
||||
"_isUnderline": false,
|
||||
"_underlineHeight": 2,
|
||||
"_cacheMode": 0,
|
||||
@@ -5799,7 +5799,7 @@
|
||||
"_right": 437.303,
|
||||
"_top": -2.5,
|
||||
"_bottom": -2.5,
|
||||
"_horizontalCenter": -22.182,
|
||||
"_horizontalCenter": -25.305,
|
||||
"_verticalCenter": 0,
|
||||
"_isAbsLeft": true,
|
||||
"_isAbsRight": true,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -19,7 +19,7 @@
|
||||
* - SkillSet / FieldSkillSet(SkillSet)—— 技能/光环静态配置
|
||||
* - EquipSet(findEquipByUuid)—— 装备静态配置
|
||||
*/
|
||||
import { _decorator, Label, NodeEventType, RichText } from "cc";
|
||||
import { _decorator, Node, NodeEventType, RichText, UITransform, Widget } from "cc";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||
import { SkillSet, SkillOverrides } from "../common/config/SkillSet";
|
||||
@@ -57,6 +57,15 @@ export class IBoxComp extends CCComp {
|
||||
@property(RichText)
|
||||
massage_node: RichText = null!
|
||||
|
||||
/** 背景节点(高度随 RichText 内容动态调整) */
|
||||
@property(Node)
|
||||
bg_node: Node = null!
|
||||
|
||||
/** Bg 节点高度上下留白(RichText 顶部间距 + 底部间距) */
|
||||
private static readonly BG_PADDING_V: number = 24;
|
||||
/** Bg 最小高度(防止内容过少时背景塌缩) */
|
||||
private static readonly BG_MIN_HEIGHT: number = 60;
|
||||
|
||||
/**
|
||||
* 初始化并渲染弹窗内容。
|
||||
* @param args 见 IBoxInitArgs
|
||||
@@ -92,23 +101,49 @@ export class IBoxComp extends CCComp {
|
||||
// 装备详情模式
|
||||
if (args?.equipUuid !== undefined) {
|
||||
this.renderEquip(args.equipUuid);
|
||||
return;
|
||||
}
|
||||
// 运行时技能详情模式(取第一个技能)
|
||||
if (args?.skills) {
|
||||
} else if (args?.skills) {
|
||||
// 运行时技能详情模式(取第一个技能)
|
||||
const first = Object.values(args.skills)[0];
|
||||
if (first) {
|
||||
this.renderSkill(first.uuid, first.lv);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// 技能详情模式
|
||||
if (args?.skillUuid !== undefined) {
|
||||
} else if (args?.skillUuid !== undefined) {
|
||||
// 技能详情模式
|
||||
this.renderSkill(args.skillUuid, args.skillLv ?? 1, args.overrides);
|
||||
return;
|
||||
} else {
|
||||
this.setRichText("暂无信息");
|
||||
}
|
||||
this.setHeroName("");
|
||||
this.setRichText("暂无信息");
|
||||
// RichText 排版需一帧完成,延迟同步 Bg 高度
|
||||
this.scheduleOnce(() => this.syncBgHeight(), 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据 RichText 实际内容高度,动态调整 Bg 节点高度与位置。
|
||||
* RichText 锚点已设为 (0.5, 1),从顶部向下生长;
|
||||
* Bg 锚点 (0.5, 0.5),向上居中扩展,顶部对齐 RichText 顶。
|
||||
*/
|
||||
private syncBgHeight() {
|
||||
if (!this.massage_node?.isValid) return;
|
||||
const richUT = this.massage_node.getComponent(UITransform);
|
||||
if (!richUT) return;
|
||||
|
||||
const contentH = Math.max(richUT.height, 0);
|
||||
const bgH = Math.max(contentH + IBoxComp.BG_PADDING_V, IBoxComp.BG_MIN_HEIGHT);
|
||||
|
||||
const bgNode = this.bg_node ?? this.node.getChildByName("bg");
|
||||
if (!bgNode?.isValid) return;
|
||||
const bgUT = bgNode.getComponent(UITransform);
|
||||
if (!bgUT) return;
|
||||
|
||||
// Bg 节点在 prefab 中挂了 Widget(顶底对齐),会覆盖代码设置的高度,先禁用
|
||||
const widget = bgNode.getComponent(Widget);
|
||||
if (widget) widget.enabled = false;
|
||||
|
||||
bgUT.height = bgH;
|
||||
// Bg 锚点在中心,高度为 bgH 时其中心应位于 RichText 顶部向下 bgH/2 处
|
||||
// RichText 锚点 (0.5,1),其顶部 y = pos.y;Bg 中心 y = pos.y - bgH/2
|
||||
const richPos = this.massage_node.node.position;
|
||||
bgNode.setPosition(bgNode.position.x, richPos.y - bgH / 2, bgNode.position.z);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -120,11 +155,9 @@ export class IBoxComp extends CCComp {
|
||||
private renderSkill(skillUuid: number, lv: number, overrides?: SkillOverrides) {
|
||||
const skill = SkillSet[skillUuid];
|
||||
if (!skill) {
|
||||
this.setHeroName("");
|
||||
this.setRichText("未知技能");
|
||||
return;
|
||||
}
|
||||
this.setHeroName(skill.name);
|
||||
this.setRichText(buildSingleSkillRich(skillUuid, overrides, lv));
|
||||
}
|
||||
|
||||
@@ -135,11 +168,9 @@ export class IBoxComp extends CCComp {
|
||||
private renderEquip(equipUuid: number) {
|
||||
const equip = findEquipByUuid(equipUuid);
|
||||
if (!equip) {
|
||||
this.setHeroName("");
|
||||
this.setRichText("未知装备");
|
||||
return;
|
||||
}
|
||||
this.setHeroName(equip.name);
|
||||
this.setRichText(buildEquipRich(equip.field ?? []));
|
||||
}
|
||||
|
||||
@@ -150,20 +181,6 @@ export class IBoxComp extends CCComp {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置标题名称标签
|
||||
* @param name 技能/装备名称
|
||||
*/
|
||||
private setHeroName(name: string) {
|
||||
const bgNode = this.node.getChildByName("Bg");
|
||||
const nameNode = bgNode?.getChildByName("name");
|
||||
const valNode = nameNode?.getChildByName("val");
|
||||
const label = valNode?.getComponent(Label) || valNode?.getComponentInChildren(Label);
|
||||
if (label) {
|
||||
label.string = name;
|
||||
}
|
||||
}
|
||||
|
||||
/** 点击弹窗任意区域关闭自身 */
|
||||
private onTapClose() {
|
||||
if (this.node && this.node.isValid) {
|
||||
|
||||
Reference in New Issue
Block a user