Compare commits
5 Commits
9ac63859f1
...
051342a9c4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
051342a9c4 | ||
|
|
5dfc790412 | ||
|
|
a039324fbc | ||
|
|
cfd0faa38c | ||
|
|
c20be9f17b |
File diff suppressed because it is too large
Load Diff
@@ -1,505 +0,0 @@
|
||||
[
|
||||
{
|
||||
"__type__": "cc.Prefab",
|
||||
"_name": "tip",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"_native": "",
|
||||
"data": {
|
||||
"__id__": 1
|
||||
},
|
||||
"optimizationPolicy": 0,
|
||||
"persistent": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "tip",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"_parent": null,
|
||||
"_children": [
|
||||
{
|
||||
"__id__": 2
|
||||
},
|
||||
{
|
||||
"__id__": 10
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 20
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 22
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 640,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
"__type__": "cc.Quat",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0,
|
||||
"w": 1
|
||||
},
|
||||
"_lscale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
"_mobility": 0,
|
||||
"_layer": 1073741824,
|
||||
"_euler": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "bg",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 3
|
||||
},
|
||||
{
|
||||
"__id__": 5
|
||||
},
|
||||
{
|
||||
"__id__": 7
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 9
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": -4.773,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
"__type__": "cc.Quat",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0,
|
||||
"w": 1
|
||||
},
|
||||
"_lscale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
"_mobility": 0,
|
||||
"_layer": 33554432,
|
||||
"_euler": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.UITransform",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 4
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 780,
|
||||
"height": 130
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "1003GdjfpKXJE/TG1yWDuH"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Sprite",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 6
|
||||
},
|
||||
"_customMaterial": null,
|
||||
"_srcBlendFactor": 2,
|
||||
"_dstBlendFactor": 4,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73@eb418",
|
||||
"__expectedType__": "cc.SpriteFrame"
|
||||
},
|
||||
"_type": 1,
|
||||
"_fillType": 0,
|
||||
"_sizeMode": 0,
|
||||
"_fillCenter": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"_fillStart": 0,
|
||||
"_fillRange": 0,
|
||||
"_isTrimmedMode": true,
|
||||
"_useGrayscale": false,
|
||||
"_atlas": {
|
||||
"__uuid__": "cb93c900-b440-4571-91d1-7da1636e3d73",
|
||||
"__expectedType__": "cc.SpriteAtlas"
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "60UFmTMHJPWp2w+0Gho1h8"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Widget",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 8
|
||||
},
|
||||
"_alignFlags": 40,
|
||||
"_target": null,
|
||||
"_left": -30,
|
||||
"_right": -30,
|
||||
"_top": 0,
|
||||
"_bottom": 0,
|
||||
"_horizontalCenter": 0,
|
||||
"_verticalCenter": 0,
|
||||
"_isAbsLeft": true,
|
||||
"_isAbsRight": true,
|
||||
"_isAbsTop": true,
|
||||
"_isAbsBottom": true,
|
||||
"_isAbsHorizontalCenter": true,
|
||||
"_isAbsVerticalCenter": true,
|
||||
"_originalWidth": 428,
|
||||
"_originalHeight": 0,
|
||||
"_alignMode": 2,
|
||||
"_lockFlags": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "63ZPc/lvZEMp22HeC+sVFO"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "4ebCuCwKhIYKWQP8OrCFBS",
|
||||
"instance": null,
|
||||
"targetOverrides": null,
|
||||
"nestedPrefabInstanceRoots": null
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "lab",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 11
|
||||
},
|
||||
{
|
||||
"__id__": 13
|
||||
},
|
||||
{
|
||||
"__id__": 15
|
||||
},
|
||||
{
|
||||
"__id__": 17
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 19
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
"__type__": "cc.Quat",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0,
|
||||
"w": 1
|
||||
},
|
||||
"_lscale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
"_mobility": 0,
|
||||
"_layer": 33554432,
|
||||
"_euler": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.UITransform",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 10
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 12
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 670,
|
||||
"height": 100
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "14Q/gAI7JJuIWi5WFPFHjn"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Label",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 10
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 14
|
||||
},
|
||||
"_customMaterial": null,
|
||||
"_srcBlendFactor": 2,
|
||||
"_dstBlendFactor": 4,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_string": "这里是信息",
|
||||
"_horizontalAlign": 1,
|
||||
"_verticalAlign": 1,
|
||||
"_actualFontSize": 41,
|
||||
"_fontSize": 40,
|
||||
"_fontFamily": "Arial",
|
||||
"_lineHeight": 40,
|
||||
"_overflow": 2,
|
||||
"_enableWrapText": true,
|
||||
"_font": null,
|
||||
"_isSystemFontUsed": true,
|
||||
"_spacingX": 0,
|
||||
"_isItalic": false,
|
||||
"_isBold": true,
|
||||
"_isUnderline": false,
|
||||
"_underlineHeight": 2,
|
||||
"_cacheMode": 1,
|
||||
"_enableOutline": true,
|
||||
"_outlineColor": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 0,
|
||||
"g": 0,
|
||||
"b": 0,
|
||||
"a": 255
|
||||
},
|
||||
"_outlineWidth": 4,
|
||||
"_enableShadow": false,
|
||||
"_shadowColor": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 0,
|
||||
"g": 0,
|
||||
"b": 0,
|
||||
"a": 255
|
||||
},
|
||||
"_shadowOffset": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 2,
|
||||
"y": 2
|
||||
},
|
||||
"_shadowBlur": 2,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "f4PtuT0TNHiaf1kHgltRjN"
|
||||
},
|
||||
{
|
||||
"__type__": "110c8vEd5NEPL/N9meGQnaX",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 10
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 16
|
||||
},
|
||||
"_params": [],
|
||||
"_dataID": "",
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "0bsDdkC31Dx6EJbtMWR83S"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Widget",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 10
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 18
|
||||
},
|
||||
"_alignFlags": 45,
|
||||
"_target": null,
|
||||
"_left": 25,
|
||||
"_right": 25,
|
||||
"_top": 10,
|
||||
"_bottom": 10,
|
||||
"_horizontalCenter": 0,
|
||||
"_verticalCenter": 0,
|
||||
"_isAbsLeft": true,
|
||||
"_isAbsRight": true,
|
||||
"_isAbsTop": true,
|
||||
"_isAbsBottom": true,
|
||||
"_isAbsHorizontalCenter": true,
|
||||
"_isAbsVerticalCenter": true,
|
||||
"_originalWidth": 600,
|
||||
"_originalHeight": 54.4,
|
||||
"_alignMode": 2,
|
||||
"_lockFlags": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "57At9q+gBFlZN9Nieh/UVp"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "a1CYFX8AxIUpCik88M7h8G",
|
||||
"instance": null,
|
||||
"targetOverrides": null,
|
||||
"nestedPrefabInstanceRoots": null
|
||||
},
|
||||
{
|
||||
"__type__": "cc.UITransform",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 21
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 720,
|
||||
"height": 120
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "ef3+UDPdVJGoz5oexdMgv2"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "18X8QQ53xKDbV/EH/Cm3i4",
|
||||
"instance": null,
|
||||
"targetOverrides": null
|
||||
}
|
||||
]
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"ver": "1.1.50",
|
||||
"importer": "prefab",
|
||||
"imported": true,
|
||||
"uuid": "c09817a2-70d1-4e67-8f4c-60d9ff67bd1f",
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"syncNodeName": "tip"
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -416,7 +416,7 @@ export class CardComp extends CCComp {
|
||||
// x轴偏移逻辑
|
||||
if (this.restPosition.x < -200) { // -260
|
||||
targetX = this.restPosition.x + 30;
|
||||
} else if (this.restPosition.x > 200) { // 260
|
||||
} else if (this.restPosition.x > 80) { // 260 -> 86也算
|
||||
targetX = this.restPosition.x - 30;
|
||||
}
|
||||
// y轴变大时 +35
|
||||
@@ -549,7 +549,7 @@ export class CardComp extends CCComp {
|
||||
if (this.isEnlarged) {
|
||||
if (this.restPosition.x <= -200) {
|
||||
baseX = this.restPosition.x + 30;
|
||||
} else if (this.restPosition.x >= 200) {
|
||||
} else if (this.restPosition.x >= 80) {
|
||||
baseX = this.restPosition.x - 30;
|
||||
}
|
||||
baseY = this.restPosition.y + 35;
|
||||
@@ -657,7 +657,7 @@ export class CardComp extends CCComp {
|
||||
this.node.setSiblingIndex(99); // 变大时提到最前
|
||||
if (this.restPosition.x <= -200) { // -260
|
||||
targetX = this.restPosition.x + 30;
|
||||
} else if (this.restPosition.x >= 200) { // 260
|
||||
} else if (this.restPosition.x >= 80) { // 260 -> 86也算
|
||||
targetX = this.restPosition.x - 30;
|
||||
}
|
||||
targetY = this.restPosition.y + 35; // y轴增加
|
||||
@@ -705,7 +705,7 @@ export class CardComp extends CCComp {
|
||||
// ---- 按卡牌类型渲染具体内容 ----
|
||||
const uiTrans = this.node.getComponent(UITransform);
|
||||
if (uiTrans) {
|
||||
uiTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 300 : 230);
|
||||
uiTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 340 : 230);
|
||||
const widget = this.node.getComponent(Widget);
|
||||
if (widget) widget.updateAlignment();
|
||||
}
|
||||
@@ -714,14 +714,14 @@ export class CardComp extends CCComp {
|
||||
if (this.BG_node) {
|
||||
const bgTrans = this.BG_node.getComponent(UITransform);
|
||||
if (bgTrans) {
|
||||
bgTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 300 : 230);
|
||||
bgTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 340 : 230);
|
||||
const widget = this.BG_node.getComponent(Widget);
|
||||
if (widget) widget.updateAlignment();
|
||||
}
|
||||
this.BG_node.children.forEach(child => {
|
||||
const childTrans = child.getComponent(UITransform);
|
||||
if (childTrans) {
|
||||
childTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 300 : 230);
|
||||
childTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 340 : 230);
|
||||
const widget = child.getComponent(Widget);
|
||||
if (widget) widget.updateAlignment();
|
||||
}
|
||||
@@ -741,14 +741,14 @@ export class CardComp extends CCComp {
|
||||
if (this.HF_node) {
|
||||
const hfTrans = this.HF_node.getComponent(UITransform);
|
||||
if (hfTrans) {
|
||||
hfTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 300 : 230);
|
||||
hfTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 340 : 230);
|
||||
const widget = this.HF_node.getComponent(Widget);
|
||||
if (widget) widget.updateAlignment();
|
||||
}
|
||||
this.HF_node.children.forEach(child => {
|
||||
const childTrans = child.getComponent(UITransform);
|
||||
if (childTrans) {
|
||||
childTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 300 : 230);
|
||||
childTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 340 : 230);
|
||||
const widget = child.getComponent(Widget);
|
||||
if (widget) widget.updateAlignment();
|
||||
}
|
||||
@@ -758,14 +758,14 @@ export class CardComp extends CCComp {
|
||||
if (this.NF_node) {
|
||||
const nfTrans = this.NF_node.getComponent(UITransform);
|
||||
if (nfTrans) {
|
||||
nfTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 300 : 230);
|
||||
nfTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 340 : 230);
|
||||
const widget = this.NF_node.getComponent(Widget);
|
||||
if (widget) widget.updateAlignment();
|
||||
}
|
||||
this.NF_node.children.forEach(child => {
|
||||
const childTrans = child.getComponent(UITransform);
|
||||
if (childTrans) {
|
||||
childTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 300 : 230);
|
||||
childTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 340 : 230);
|
||||
const widget = child.getComponent(Widget);
|
||||
if (widget) widget.updateAlignment();
|
||||
}
|
||||
@@ -776,7 +776,7 @@ export class CardComp extends CCComp {
|
||||
if (hbNode) {
|
||||
const hbTrans = hbNode.getComponent(UITransform);
|
||||
if (hbTrans) {
|
||||
hbTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 300 : 230);
|
||||
hbTrans.setContentSize(this.isEnlarged ? 230 : 170, this.isEnlarged ? 340 : 230);
|
||||
const widget = hbNode.getComponent(Widget);
|
||||
if (widget) widget.updateAlignment();
|
||||
}
|
||||
@@ -905,7 +905,7 @@ export class CardComp extends CCComp {
|
||||
if (this.isEnlarged) {
|
||||
if (this.restPosition.x <= -200) {
|
||||
targetX = this.restPosition.x + 30;
|
||||
} else if (this.restPosition.x >= 200) {
|
||||
} else if (this.restPosition.x >= 80) {
|
||||
targetX = this.restPosition.x - 30;
|
||||
}
|
||||
targetY = this.restPosition.y + 35;
|
||||
|
||||
@@ -520,7 +520,10 @@ export class MissionCardComp extends CCComp {
|
||||
|
||||
/** 将四个卡槽节点映射为 CardComp,形成固定顺序控制数组 */
|
||||
private cacheCardComps() {
|
||||
const nodes = [this.card1, this.card2, this.card3, this.card4];
|
||||
if (this.card4) {
|
||||
this.card4.active = false;
|
||||
}
|
||||
const nodes = [this.card1, this.card2, this.card3];
|
||||
this.cardComps = nodes
|
||||
.map(node => node?.getComponent(CardComp))
|
||||
.filter((comp): comp is CardComp => !!comp);
|
||||
@@ -641,7 +644,7 @@ export class MissionCardComp extends CCComp {
|
||||
});
|
||||
}
|
||||
|
||||
/** 构建本次抽卡结果,保证最终可分发4条数据 */
|
||||
/** 构建本次抽卡结果,保证最终可分发3条数据 */
|
||||
private buildDrawCards(): CardConfig[] {
|
||||
let targetType: CardType | CardType[] | undefined = undefined;
|
||||
if (this.isBattlePhase) {
|
||||
@@ -651,11 +654,11 @@ export class MissionCardComp extends CCComp {
|
||||
}
|
||||
const cards = getCardsByLv(this.poolLv, targetType);
|
||||
|
||||
/** 正常情况下直接取前4 */
|
||||
if (cards.length >= 4) return cards.slice(0, 4);
|
||||
/** 兜底:当返回不足4张时循环补齐,保证分发不缺位 */
|
||||
/** 正常情况下直接取前3 */
|
||||
if (cards.length >= 3) return cards.slice(0, 3);
|
||||
/** 兜底:当返回不足3张时循环补齐,保证分发不缺位 */
|
||||
const filled = [...cards];
|
||||
while (filled.length < 4) {
|
||||
while (filled.length < 3) {
|
||||
const fallback = getCardsByLv(this.poolLv, targetType);
|
||||
if (fallback.length === 0) break;
|
||||
filled.push(fallback[filled.length % fallback.length]);
|
||||
@@ -665,14 +668,14 @@ export class MissionCardComp extends CCComp {
|
||||
|
||||
private tryRefreshHeroCards(heroType?: HType, targetPoolLv?: number): boolean {
|
||||
const cards = drawCardsByRule(this.poolLv, {
|
||||
count: 4,
|
||||
count: 3,
|
||||
type: CardType.Hero,
|
||||
heroType,
|
||||
targetPoolLv
|
||||
});
|
||||
if (cards.length <= 0) return false;
|
||||
this.layoutCardSlots();
|
||||
this.dispatchCardsToSlots(cards.slice(0, 4));
|
||||
this.dispatchCardsToSlots(cards.slice(0, 3));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -708,15 +711,12 @@ export class MissionCardComp extends CCComp {
|
||||
private layoutCardSlots() {
|
||||
const count = this.cardComps.length;
|
||||
if (count === 0) return;
|
||||
const startX = -((count - 1) * this.cardWidth) / 2;
|
||||
for (let i = 0; i < count; i++) {
|
||||
const x = startX + i * this.cardWidth;
|
||||
this.cardComps[i].setSlotPosition(x);
|
||||
this.cardComps[i].setSlotPosition(this.cardsPos[i]);
|
||||
}
|
||||
mLogger.log(this.debugMode, "MissionCardComp", "layout card slots", {
|
||||
count,
|
||||
cardWidth: this.cardWidth,
|
||||
startX
|
||||
cardWidth: this.cardWidth
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -160,6 +160,8 @@ export class MissionComp extends CCComp {
|
||||
private monsterCountSyncTimer: number = 0;
|
||||
/** 当前波数 */
|
||||
private currentWave: number = 0;
|
||||
/** 是否为Boss波次 */
|
||||
private isBossWave: boolean = false;
|
||||
/** 上一次发放金币奖励的波数(防止重复发放) */
|
||||
private lastPrepareCoinWave: number = 0;
|
||||
/** 当前任务阶段 */
|
||||
@@ -216,13 +218,15 @@ export class MissionComp extends CCComp {
|
||||
this.syncMonsterSpawnState(dt)
|
||||
if(smc.mission.stop_mon_action) return
|
||||
smc.vmdata.mission_data.fight_time+=dt
|
||||
this.FightTime-=dt
|
||||
this.update_time();
|
||||
if (this.FightTime <= 0) {
|
||||
// 时间到了,自动结束战斗进入准备阶段
|
||||
this.FightTime = FightSet.FiIGHT_TIME;
|
||||
oops.message.dispatchEvent("TimeUpAdvanceWave");
|
||||
if (!this.isBossWave) {
|
||||
this.FightTime-=dt
|
||||
if (this.FightTime <= 0) {
|
||||
// 时间到了,自动结束战斗进入准备阶段
|
||||
this.FightTime = FightSet.FiIGHT_TIME;
|
||||
oops.message.dispatchEvent("TimeUpAdvanceWave");
|
||||
}
|
||||
}
|
||||
this.update_time();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,6 +234,16 @@ export class MissionComp extends CCComp {
|
||||
|
||||
/** 更新时间/波数显示(仅在秒数变化时更新以减少 Label 操作) */
|
||||
update_time(){
|
||||
if (this.isBossWave) {
|
||||
const str = "∞";
|
||||
if (str != this.lastTimeStr) {
|
||||
this.time_node.getChildByName("time").getComponent(Label).string = str;
|
||||
this.lastTimeStr = str;
|
||||
this.lastTimeSecond = -1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const time = Math.max(0, this.FightTime);
|
||||
const remainSecond = Math.floor(time);
|
||||
if (remainSecond === this.lastTimeSecond) return;
|
||||
@@ -237,7 +251,7 @@ export class MissionComp extends CCComp {
|
||||
let m = Math.floor(remainSecond / 60);
|
||||
let s = remainSecond % 60;
|
||||
const wave = Math.max(1, this.currentWave || smc.vmdata.mission_data.level || 1);
|
||||
let str = `W${wave.toString().padStart(2, '0')} ${m.toString().padStart(2, '0')}:${s.toString().padStart(2, '0')}`;
|
||||
let str = `${m.toString().padStart(2, '0')}:${s.toString().padStart(2, '0')}`;
|
||||
if(str != this.lastTimeStr){
|
||||
this.time_node.getChildByName("time").getComponent(Label).string = str;
|
||||
this.lastTimeStr = str;
|
||||
@@ -310,9 +324,13 @@ export class MissionComp extends CCComp {
|
||||
return;
|
||||
}
|
||||
|
||||
// 先激活节点,确保后续的组件刷新和渲染数据更新能正常生效
|
||||
this.tooltip.active = true;
|
||||
|
||||
// 禁用 Widget 组件,防止其在 LateUpdate 中覆盖 tween 的位置修改
|
||||
const widget = this.tooltip.getComponent(Widget);
|
||||
if (widget) {
|
||||
widget.updateAlignment(); // 强制刷新一次布局,防止第一次激活时尺寸未初始化
|
||||
widget.enabled = false;
|
||||
}
|
||||
|
||||
@@ -321,10 +339,10 @@ export class MissionComp extends CCComp {
|
||||
const label = labNode.getComponent(Label);
|
||||
if (label) {
|
||||
label.string = phaseName;
|
||||
label.updateRenderData(true); // 强制更新渲染数据,避免首次无文本
|
||||
}
|
||||
}
|
||||
|
||||
this.tooltip.active = true;
|
||||
Tween.stopAllByTarget(this.tooltip);
|
||||
|
||||
// 动感动画设计:右侧进入 -> 屏幕中央(带有轻微的弹跳和滑动) -> 左侧飞出
|
||||
@@ -374,18 +392,16 @@ export class MissionComp extends CCComp {
|
||||
if (phaseNode) {
|
||||
const label = phaseNode.getComponent(Label);
|
||||
if (label) {
|
||||
label.string = MissionComp.PhaseNameMap[targetPhase] || "未知";
|
||||
const wave = Math.max(1, this.currentWave || (smc.vmdata && smc.vmdata.mission_data ? smc.vmdata.mission_data.level : 1) || 1);
|
||||
label.string = `第 ${wave}/20 波`;
|
||||
}
|
||||
|
||||
// 阶段切换动感表现:针对阶段变化加入缩放与回弹动画,让流程充满心流体验
|
||||
if (targetPhase === MissionPhase.PrepareStart ||
|
||||
targetPhase === MissionPhase.PrepareEnd ||
|
||||
targetPhase === MissionPhase.BattleStart ||
|
||||
targetPhase === MissionPhase.BattleEnd) {
|
||||
Tween.stopAllByTarget(phaseNode);
|
||||
phaseNode.scale = v3(0.5, 0.5, 1);
|
||||
tween(phaseNode)
|
||||
.to(0.3, { scale: v3(1.5, 1.5, 1) }, { easing: "backOut" })
|
||||
// 阶段切换动感表现:只在进入战斗阶段跳动一下,让流程充满心流体验
|
||||
if (targetPhase === MissionPhase.BattleStart) {
|
||||
Tween.stopAllByTarget(this.time_node);
|
||||
this.time_node.scale = v3(1, 1, 1);
|
||||
tween(this.time_node)
|
||||
.to(0.3, { scale: v3(1.2, 1.2, 1) }, { easing: "backOut" })
|
||||
.to(0.2, { scale: v3(1, 1, 1) }, { easing: "sineInOut" })
|
||||
.start();
|
||||
}
|
||||
@@ -649,6 +665,7 @@ export class MissionComp extends CCComp {
|
||||
smc.vmdata.mission_data.mon_max = Math.max(1, Math.floor(this.maxMonsterCount))
|
||||
this.currentPhase = MissionPhase.None;
|
||||
this.currentWave = 1;
|
||||
this.isBossWave = false;
|
||||
this.FightTime=FightSet.FiIGHT_TIME
|
||||
this.rewards=[]
|
||||
this.revive_times = 1;
|
||||
@@ -684,8 +701,19 @@ export class MissionComp extends CCComp {
|
||||
const wave = Number(data?.wave ?? 0);
|
||||
if (wave <= 0) return;
|
||||
|
||||
// 在新一波到来时,先进入 BattleEnd,触发上一波的战斗结束技能 (fend),2秒后自动进入下一波的准备阶段
|
||||
this.changePhase(MissionPhase.BattleEnd);
|
||||
this.isBossWave = !!data?.bossWave;
|
||||
|
||||
if (wave > 1) {
|
||||
// 在新一波到来时,先进入 BattleEnd,触发上一波的战斗结束技能 (fend),2秒后自动进入下一波的准备阶段
|
||||
this.changePhase(MissionPhase.BattleEnd);
|
||||
} else {
|
||||
// 第1波不需要结束上一波,延迟一点播放提示,避免被开始游戏的loading遮挡
|
||||
this.scheduleOnce(() => {
|
||||
if (this.currentPhase === MissionPhase.Prepare) {
|
||||
this.playTooltipAnim(`第 ${wave} 波`);
|
||||
}
|
||||
}, 0.5);
|
||||
}
|
||||
|
||||
this.currentWave = wave;
|
||||
smc.vmdata.mission_data.level = wave;
|
||||
|
||||
Reference in New Issue
Block a user