From cbaf4afd95803f0424858c99a232d54f18a9a702 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A3=AE2003?= <2384017988@qq.com> Date: Sat, 26 Sep 2026 15:35:40 +0800 Subject: [PATCH] 1 --- Assets/Art/FengLei/Fish/1.prefab | 5 + Assets/Art/FengLei/Fish/10.prefab | 6 + Assets/Art/FengLei/Fish/12.prefab | 6 + Assets/Art/FengLei/Fish/14.prefab | 6 + Assets/Art/FengLei/Fish/19.prefab | 6 + Assets/Art/FengLei/Fish/20.prefab | 6 + Assets/Art/FengLei/Fish/21.prefab | 5 + Assets/Art/FengLei/Fish/22.prefab | 6 + Assets/Art/FengLei/Fish/24.prefab | 6 +- Assets/Art/FengLei/Fish/26.prefab | 6 + Assets/Art/FengLei/Fish/42.prefab | 6 + Assets/Art/FengLei/Fish/45.prefab | 6 + Assets/Art/FengLei/Fish/48.prefab | 6 + Assets/Art/FengLei/Fish/53.prefab | 8 +- Assets/Art/FengLei/Fish/61.prefab | 6 + Assets/Art/FengLei/Fish/63.prefab | 6 + Assets/Art/FengLei/Fish/68.prefab | 6 + Assets/Art/FengLei/Fish/69.prefab | 6 + Assets/Art/FengLei/Fish/71.prefab | 6 + Assets/Art/FengLei/Fish/72.prefab | 6 + Assets/Art/FengLei/Fish/8.prefab | 6 + Assets/Art/FengLei/Fish/Z_1.prefab | 9 +- .../Scripts/Manager/CreateFishManager.cs | 52 +++-- .../Scripts/Net/WebSocketManager_Message.cs | 37 ++- .../ZDX/eff_dead_1595_timeline Variant.prefab | 4 +- .../Game/HHWK/Fish/Fish_2008 Variant.prefab | 2 +- .../Game/HHWK/Fish/Fish_2011 Variant.prefab | 2 +- .../Game/HHWK/Fish/Fish_2012 Variant.prefab | 2 +- .../Game/HHWK/Fish/Fish_2013 Variant.prefab | 2 +- .../Game/HHWK/Fish/Fish_2014 Variant.prefab | 2 +- .../Game/HHWK/Fish/Fish_3002 Variant.prefab | 2 +- .../Game/HHWK/Fish/fish_1017 Variant.prefab | 2 +- .../Game/HHWK/Fish/fish_1019 Variant.prefab | 2 +- .../Game/HHWK/Fish/fish_1020 Variant.prefab | 2 +- .../Game/HHWK/Fish/fish_1021 Variant.prefab | 2 +- .../Game/HHWK/Fish/fish_1022 Variant.prefab | 12 +- .../Game/HHWK/Fish/fish_1024 Variant.prefab | 2 +- .../Game/HHWK/Fish/fish_1025 Variant.prefab | 2 +- .../Game/HHWK/Fish/fish_1026 Variant.prefab | 2 +- .../Game/HHWK/Fish/fish_1027 Variant.prefab | 2 +- .../Game/HHWK/Fish/fish_1028 Variant.prefab | 2 +- .../Game/HHWK/Fish/fish_2010 Variant.prefab | 2 +- .../Game/HHWK/Fish/fish_3001 Variant.prefab | 2 +- .../Game/HHWK/Fish/fish_3003 Variant.prefab | 2 +- .../ChessGame/ChessGameManager.cs | 12 + .../ChineseChess/ChineseChessMainPanel.cs | 214 +++++++++++++++++- .../ChineseChess/UIChineseChessRoomExplain.cs | 12 +- 47 files changed, 454 insertions(+), 60 deletions(-) diff --git a/Assets/Art/FengLei/Fish/1.prefab b/Assets/Art/FengLei/Fish/1.prefab index 8585b3b6f..0fd943c10 100644 --- a/Assets/Art/FengLei/Fish/1.prefab +++ b/Assets/Art/FengLei/Fish/1.prefab @@ -887,6 +887,8 @@ MonoBehaviour: createVideoClip: {fileID: 0} rotationPY: 60 useMirrorCompensate: 1 + useRollSignFlip: 0 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 0 @@ -894,6 +896,9 @@ MonoBehaviour: depthOffset: 560 is2DFish: 0 sortOrder2D: 0 + drawMoveLine: 0 + drawLineSegments: 60 + drawLineColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1} --- !u!1 &1470420886364660 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Art/FengLei/Fish/10.prefab b/Assets/Art/FengLei/Fish/10.prefab index e97161433..b3fafde58 100644 --- a/Assets/Art/FengLei/Fish/10.prefab +++ b/Assets/Art/FengLei/Fish/10.prefab @@ -193,6 +193,9 @@ MonoBehaviour: needLockEvent: 0 createVideoClip: {fileID: 0} rotationPY: 60 + useMirrorCompensate: 1 + useRollSignFlip: 0 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 0 @@ -200,6 +203,9 @@ MonoBehaviour: depthOffset: 570 is2DFish: 0 sortOrder2D: 0 + drawMoveLine: 0 + drawLineSegments: 60 + drawLineColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1} --- !u!1 &233454476363136655 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Art/FengLei/Fish/12.prefab b/Assets/Art/FengLei/Fish/12.prefab index eb72b732d..9e3db67bc 100644 --- a/Assets/Art/FengLei/Fish/12.prefab +++ b/Assets/Art/FengLei/Fish/12.prefab @@ -94,6 +94,9 @@ MonoBehaviour: needLockEvent: 0 createVideoClip: {fileID: 0} rotationPY: 60 + useMirrorCompensate: 1 + useRollSignFlip: 0 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 0 @@ -101,6 +104,9 @@ MonoBehaviour: depthOffset: 510 is2DFish: 0 sortOrder2D: 0 + drawMoveLine: 0 + drawLineSegments: 60 + drawLineColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1} --- !u!1 &23241636797705634 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Art/FengLei/Fish/14.prefab b/Assets/Art/FengLei/Fish/14.prefab index 5da320df7..beea00ff4 100644 --- a/Assets/Art/FengLei/Fish/14.prefab +++ b/Assets/Art/FengLei/Fish/14.prefab @@ -3247,6 +3247,9 @@ MonoBehaviour: needLockEvent: 0 createVideoClip: {fileID: 0} rotationPY: 60 + useMirrorCompensate: 1 + useRollSignFlip: 0 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 0 @@ -3254,6 +3257,9 @@ MonoBehaviour: depthOffset: 460 is2DFish: 0 sortOrder2D: 0 + drawMoveLine: 0 + drawLineSegments: 60 + drawLineColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1} --- !u!1 &1529740580748378 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Art/FengLei/Fish/19.prefab b/Assets/Art/FengLei/Fish/19.prefab index c78703e1c..d4809237c 100644 --- a/Assets/Art/FengLei/Fish/19.prefab +++ b/Assets/Art/FengLei/Fish/19.prefab @@ -133,6 +133,9 @@ MonoBehaviour: needLockEvent: 0 createVideoClip: {fileID: 0} rotationPY: 60 + useMirrorCompensate: 1 + useRollSignFlip: 0 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 0 @@ -140,6 +143,9 @@ MonoBehaviour: depthOffset: 450 is2DFish: 0 sortOrder2D: 0 + drawMoveLine: 0 + drawLineSegments: 60 + drawLineColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1} --- !u!1 &1064317485118747 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Art/FengLei/Fish/20.prefab b/Assets/Art/FengLei/Fish/20.prefab index 2834e0c47..c35a0d963 100644 --- a/Assets/Art/FengLei/Fish/20.prefab +++ b/Assets/Art/FengLei/Fish/20.prefab @@ -94,6 +94,9 @@ MonoBehaviour: needLockEvent: 0 createVideoClip: {fileID: 0} rotationPY: 60 + useMirrorCompensate: 1 + useRollSignFlip: 0 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 0 @@ -101,6 +104,9 @@ MonoBehaviour: depthOffset: 440 is2DFish: 0 sortOrder2D: 0 + drawMoveLine: 0 + drawLineSegments: 60 + drawLineColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1} --- !u!1 &91986277059817027 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Art/FengLei/Fish/21.prefab b/Assets/Art/FengLei/Fish/21.prefab index ddc715d83..7f43fb0a1 100644 --- a/Assets/Art/FengLei/Fish/21.prefab +++ b/Assets/Art/FengLei/Fish/21.prefab @@ -95,6 +95,8 @@ MonoBehaviour: createVideoClip: {fileID: 0} rotationPY: 60 useMirrorCompensate: 1 + useRollSignFlip: 0 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 0 @@ -102,6 +104,9 @@ MonoBehaviour: depthOffset: 600 is2DFish: 0 sortOrder2D: 0 + drawMoveLine: 0 + drawLineSegments: 60 + drawLineColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1} --- !u!1 &126286391056136836 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Art/FengLei/Fish/22.prefab b/Assets/Art/FengLei/Fish/22.prefab index 1223b99f1..ba6fa5d09 100644 --- a/Assets/Art/FengLei/Fish/22.prefab +++ b/Assets/Art/FengLei/Fish/22.prefab @@ -94,6 +94,9 @@ MonoBehaviour: needLockEvent: 0 createVideoClip: {fileID: 0} rotationPY: 60 + useMirrorCompensate: 1 + useRollSignFlip: 0 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 0 @@ -101,6 +104,9 @@ MonoBehaviour: depthOffset: 520 is2DFish: 0 sortOrder2D: 0 + drawMoveLine: 0 + drawLineSegments: 60 + drawLineColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1} --- !u!1 &260146002311135624 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Art/FengLei/Fish/24.prefab b/Assets/Art/FengLei/Fish/24.prefab index 480e99b11..f761c1337 100644 --- a/Assets/Art/FengLei/Fish/24.prefab +++ b/Assets/Art/FengLei/Fish/24.prefab @@ -93,10 +93,10 @@ MonoBehaviour: - {fileID: 5085328304069200089} needLockEvent: 0 createVideoClip: {fileID: 0} - rotationPY: -120 + rotationPY: 60 useMirrorCompensate: 1 - useRollSignFlip: 1 - useRouteFlipX: 1 + useRollSignFlip: 0 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 0 diff --git a/Assets/Art/FengLei/Fish/26.prefab b/Assets/Art/FengLei/Fish/26.prefab index f1f561191..04703f03b 100644 --- a/Assets/Art/FengLei/Fish/26.prefab +++ b/Assets/Art/FengLei/Fish/26.prefab @@ -3732,6 +3732,9 @@ MonoBehaviour: needLockEvent: 0 createVideoClip: {fileID: 0} rotationPY: 60 + useMirrorCompensate: 1 + useRollSignFlip: 0 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 0 @@ -3739,6 +3742,9 @@ MonoBehaviour: depthOffset: 430 is2DFish: 0 sortOrder2D: 0 + drawMoveLine: 0 + drawLineSegments: 60 + drawLineColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1} --- !u!1 &1785410037514682 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Art/FengLei/Fish/42.prefab b/Assets/Art/FengLei/Fish/42.prefab index 7de7fc5f4..78f150b84 100644 --- a/Assets/Art/FengLei/Fish/42.prefab +++ b/Assets/Art/FengLei/Fish/42.prefab @@ -5519,6 +5519,9 @@ MonoBehaviour: needLockEvent: 0 createVideoClip: {fileID: 0} rotationPY: 60 + useMirrorCompensate: 1 + useRollSignFlip: 0 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 0 @@ -5526,6 +5529,9 @@ MonoBehaviour: depthOffset: 470 is2DFish: 0 sortOrder2D: 0 + drawMoveLine: 0 + drawLineSegments: 60 + drawLineColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1} --- !u!1 &1918114390380129 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Art/FengLei/Fish/45.prefab b/Assets/Art/FengLei/Fish/45.prefab index d5efcf2f8..a4a198325 100644 --- a/Assets/Art/FengLei/Fish/45.prefab +++ b/Assets/Art/FengLei/Fish/45.prefab @@ -95,6 +95,9 @@ MonoBehaviour: needLockEvent: 0 createVideoClip: {fileID: 0} rotationPY: 60 + useMirrorCompensate: 1 + useRollSignFlip: 0 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 0 @@ -102,6 +105,9 @@ MonoBehaviour: depthOffset: 490 is2DFish: 0 sortOrder2D: 0 + drawMoveLine: 0 + drawLineSegments: 60 + drawLineColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1} --- !u!58 &-6866065024429339140 CircleCollider2D: m_ObjectHideFlags: 0 diff --git a/Assets/Art/FengLei/Fish/48.prefab b/Assets/Art/FengLei/Fish/48.prefab index 8b283ffc7..67f7d6a9a 100644 --- a/Assets/Art/FengLei/Fish/48.prefab +++ b/Assets/Art/FengLei/Fish/48.prefab @@ -95,6 +95,9 @@ MonoBehaviour: needLockEvent: 0 createVideoClip: {fileID: 0} rotationPY: 60 + useMirrorCompensate: 1 + useRollSignFlip: 0 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 0 @@ -102,6 +105,9 @@ MonoBehaviour: depthOffset: 540 is2DFish: 0 sortOrder2D: 0 + drawMoveLine: 0 + drawLineSegments: 60 + drawLineColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1} --- !u!58 &-1529010931143686574 CircleCollider2D: m_ObjectHideFlags: 0 diff --git a/Assets/Art/FengLei/Fish/53.prefab b/Assets/Art/FengLei/Fish/53.prefab index b4c89f66d..95bf7d7f9 100644 --- a/Assets/Art/FengLei/Fish/53.prefab +++ b/Assets/Art/FengLei/Fish/53.prefab @@ -15753,13 +15753,19 @@ MonoBehaviour: needLockEvent: 0 createVideoClip: {fileID: 0} rotationPY: 30 + useMirrorCompensate: 1 + useRollSignFlip: 0 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 0 ischild0: 1 - depthOffset: 0 + depthOffset: 370 is2DFish: 0 sortOrder2D: 0 + drawMoveLine: 0 + drawLineSegments: 60 + drawLineColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1} --- !u!1 &1594108707966477 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Art/FengLei/Fish/61.prefab b/Assets/Art/FengLei/Fish/61.prefab index 9e3b4597f..a2f10cb0c 100644 --- a/Assets/Art/FengLei/Fish/61.prefab +++ b/Assets/Art/FengLei/Fish/61.prefab @@ -5106,6 +5106,9 @@ MonoBehaviour: needLockEvent: 0 createVideoClip: {fileID: 0} rotationPY: 60 + useMirrorCompensate: 1 + useRollSignFlip: 0 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 0 @@ -5113,6 +5116,9 @@ MonoBehaviour: depthOffset: 410 is2DFish: 0 sortOrder2D: 0 + drawMoveLine: 0 + drawLineSegments: 60 + drawLineColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1} --- !u!1 &1500587202456742 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Art/FengLei/Fish/63.prefab b/Assets/Art/FengLei/Fish/63.prefab index dc7730e28..cb1538650 100644 --- a/Assets/Art/FengLei/Fish/63.prefab +++ b/Assets/Art/FengLei/Fish/63.prefab @@ -94,6 +94,9 @@ MonoBehaviour: needLockEvent: 0 createVideoClip: {fileID: 0} rotationPY: 30 + useMirrorCompensate: 1 + useRollSignFlip: 0 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 0 @@ -101,6 +104,9 @@ MonoBehaviour: depthOffset: 480 is2DFish: 0 sortOrder2D: 0 + drawMoveLine: 0 + drawLineSegments: 60 + drawLineColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1} --- !u!1 &41597890750949400 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Art/FengLei/Fish/68.prefab b/Assets/Art/FengLei/Fish/68.prefab index 02004cfc6..dc115380e 100644 --- a/Assets/Art/FengLei/Fish/68.prefab +++ b/Assets/Art/FengLei/Fish/68.prefab @@ -332,6 +332,9 @@ MonoBehaviour: needLockEvent: 0 createVideoClip: {fileID: 0} rotationPY: 60 + useMirrorCompensate: 1 + useRollSignFlip: 0 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 0 @@ -339,6 +342,9 @@ MonoBehaviour: depthOffset: 530 is2DFish: 0 sortOrder2D: 0 + drawMoveLine: 0 + drawLineSegments: 60 + drawLineColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1} --- !u!1 &1361146795606657 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Art/FengLei/Fish/69.prefab b/Assets/Art/FengLei/Fish/69.prefab index ba188ab1f..ac7d5a39c 100644 --- a/Assets/Art/FengLei/Fish/69.prefab +++ b/Assets/Art/FengLei/Fish/69.prefab @@ -9011,6 +9011,9 @@ MonoBehaviour: needLockEvent: 0 createVideoClip: {fileID: 0} rotationPY: 60 + useMirrorCompensate: 1 + useRollSignFlip: 0 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 0 @@ -9018,6 +9021,9 @@ MonoBehaviour: depthOffset: 360 is2DFish: 0 sortOrder2D: 0 + drawMoveLine: 0 + drawLineSegments: 60 + drawLineColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1} --- !u!1 &1819357568620622 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Art/FengLei/Fish/71.prefab b/Assets/Art/FengLei/Fish/71.prefab index dabe61823..846b5bf1f 100644 --- a/Assets/Art/FengLei/Fish/71.prefab +++ b/Assets/Art/FengLei/Fish/71.prefab @@ -5436,6 +5436,9 @@ MonoBehaviour: needLockEvent: 0 createVideoClip: {fileID: 0} rotationPY: 60 + useMirrorCompensate: 1 + useRollSignFlip: 0 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 0 @@ -5443,6 +5446,9 @@ MonoBehaviour: depthOffset: 390 is2DFish: 0 sortOrder2D: 0 + drawMoveLine: 0 + drawLineSegments: 60 + drawLineColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1} --- !u!1 &1491235563968188 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Art/FengLei/Fish/72.prefab b/Assets/Art/FengLei/Fish/72.prefab index 5a217028c..5e762a579 100644 --- a/Assets/Art/FengLei/Fish/72.prefab +++ b/Assets/Art/FengLei/Fish/72.prefab @@ -162,6 +162,9 @@ MonoBehaviour: needLockEvent: 0 createVideoClip: {fileID: 0} rotationPY: 60 + useMirrorCompensate: 1 + useRollSignFlip: 0 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 0 @@ -169,6 +172,9 @@ MonoBehaviour: depthOffset: 420 is2DFish: 0 sortOrder2D: 0 + drawMoveLine: 0 + drawLineSegments: 60 + drawLineColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1} --- !u!1 &1088853801920561 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Art/FengLei/Fish/8.prefab b/Assets/Art/FengLei/Fish/8.prefab index 7895c235f..ce08687d7 100644 --- a/Assets/Art/FengLei/Fish/8.prefab +++ b/Assets/Art/FengLei/Fish/8.prefab @@ -93,6 +93,9 @@ MonoBehaviour: needLockEvent: 0 createVideoClip: {fileID: 0} rotationPY: 60 + useMirrorCompensate: 1 + useRollSignFlip: 0 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 0 @@ -100,6 +103,9 @@ MonoBehaviour: depthOffset: 580 is2DFish: 0 sortOrder2D: 0 + drawMoveLine: 0 + drawLineSegments: 60 + drawLineColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1} --- !u!1 &65381062315250812 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Art/FengLei/Fish/Z_1.prefab b/Assets/Art/FengLei/Fish/Z_1.prefab index 8cf8c57ee..19daebc89 100644 --- a/Assets/Art/FengLei/Fish/Z_1.prefab +++ b/Assets/Art/FengLei/Fish/Z_1.prefab @@ -172,10 +172,14 @@ MonoBehaviour: yzID: colliderList: [] lockPoint: {fileID: 7919990334340192164} - bingDongEffect: {fileID: 4067042857930265640} + bingDongEffect: + - {fileID: 0} needLockEvent: 0 createVideoClip: {fileID: 0} rotationPY: 60 + useMirrorCompensate: 1 + useRollSignFlip: 0 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 0 @@ -183,6 +187,9 @@ MonoBehaviour: depthOffset: 560 is2DFish: 0 sortOrder2D: 0 + drawMoveLine: 0 + drawLineSegments: 60 + drawLineColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1} --- !u!1 &173797174121316484 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/MyGame/Scripts/Manager/CreateFishManager.cs b/Assets/MyGame/Scripts/Manager/CreateFishManager.cs index 0ac001577..b98453da0 100644 --- a/Assets/MyGame/Scripts/Manager/CreateFishManager.cs +++ b/Assets/MyGame/Scripts/Manager/CreateFishManager.cs @@ -130,6 +130,8 @@ public class CreateFishManager : MonoSingleton [Tooltip("按 M 键生成的鱼编号(配置 fishNumber)")] public string debugSpawnFishNumber = "11043"; public bool isleft = true; + [Tooltip("按M键批量模式:激活=本地在所有普通鱼路线上各生成一条(不走服务端);不激活=走服务端出一条")] + public bool debugSpawnAllLines = false; private Dictionary frozenFishStates = new Dictionary(); private Dictionary frozenFishIsMoves = new Dictionary(); @@ -333,7 +335,23 @@ public class CreateFishManager : MonoSingleton Debug.LogWarning("[CreateFishManager] 当前未在房间中(roomId 为空),无法出鱼"); return; } - APIManager.TempSpawnFish(roomId, debugSpawnFishNumber,1,30, isleft?1:2); + // ⭐ debugSpawnAllLines 激活:本地在所有普通鱼路线("曲线"+id)上各生成一条(不走服务端); + // 不激活:走服务端 AdminApi 出一条(现状) + if (debugSpawnAllLines) + { + int spawned = 0; + foreach (var key in MonsterMoveLine.dic_BezierCurveDatas.Keys) + { + if (key == null || !key.StartsWith("曲线")) continue; + if (!int.TryParse(key.Substring(2), out int rid)) continue; + if (ManualSpawn(debugSpawnFishNumber, rid, 30)) spawned++; + } + Debug.Log($"[CreateFishManager] 调试批量出鱼(所有路线): fishNumber={debugSpawnFishNumber}, 共生成{spawned}条"); + } + else + { + APIManager.TempSpawnFish(roomId, debugSpawnFishNumber,1,30, isleft?1:2); + } } } @@ -2078,28 +2096,30 @@ public class CreateFishManager : MonoSingleton } // 特殊鱼:金币飞向炮台(池化,动画事件播完手动回池) + // ⭐ Get 不设置位置:DieEffect_TSY(ZDX 炸弹蟹等)爆奖完全用预制体里配置好的位置(含 y 轴); + // 只有 BJBase 金币特效按鱼死亡位置摆放(startPoint 依赖) var award = EffectPool.Instance.Get( monster.effect_DieAward != null ? monster.effect_DieAward : dieFXPrefabAward, - monster.transform.position, Quaternion.identity, currGameType.subPanelParent.parent, + currGameType.subPanelParent.parent, autoReturn: false); - try - { - award.GetComponent().anchoredPosition = - CoordinateTransformation.WorldPos_ToCanvas( - monster.transform.position, - GetUiCanvas()); - } - catch - { - award.transform.position = monster.transform.position; - - } - var coinScript = award.GetComponent(); if (coinScript != null) { - // 普通爆奖(BJBase 体系) + // 普通爆奖(BJBase 体系):摆到鱼死亡位置(画布坐标),startPoint 依赖 + try + { + award.GetComponent().anchoredPosition = + CoordinateTransformation.WorldPos_ToCanvas( + monster.transform.position, + GetUiCanvas()); + } + catch + { + award.transform.position = monster.transform.position; + + } + coinScript.startPoint = award.transform.position; coinScript.Init(killFish.gold, sitData.transform.position, killFish.userId, sitData.posID, killFish.param); coinScript.isLocalCoin = sitData.user == GameManager.Instance.user.id; diff --git a/Assets/MyGame/Scripts/Net/WebSocketManager_Message.cs b/Assets/MyGame/Scripts/Net/WebSocketManager_Message.cs index 95908ac36..d8c9e86b1 100644 --- a/Assets/MyGame/Scripts/Net/WebSocketManager_Message.cs +++ b/Assets/MyGame/Scripts/Net/WebSocketManager_Message.cs @@ -90,9 +90,17 @@ namespace Assets.MyGame.Scripts.Net case "BeginGame": { var va = JsonConvert.DeserializeObject>(msg.ToString()).arguments[0]; - roomMainPanel.subUIManager.CloseAll(); - roomMainPanel.StartGame(msg); - roomMainPanel.UpdateUserData(va); + if (roomMainPanel != null && roomMainPanel.IsChessGameActive && va.state == 2) + { + // 对局中收到 BeginGame = 断线重连/取消挂起的房间同步:只刷新玩家数据,不重置对局 + roomMainPanel.UpdateUserData(va); + } + else + { + roomMainPanel.subUIManager.CloseAll(); + roomMainPanel.StartGame(msg); + roomMainPanel.UpdateUserData(va); + } } break; @@ -174,6 +182,12 @@ namespace Assets.MyGame.Scripts.Net { roomMainPanel.subUIManager.ShowAsync(UIPanel.ZGXQDefeated); } + // 服务端已结算:本地对局同步置结束 + 停表(防后台方回前台后对局还在跑) + if (roomMainPanel != null) + { + roomMainPanel.StopWaitCountdown(); + roomMainPanel.MarkChessGameOverByServer(); + } // 结算后按结果实时更新房间双方金币显示 roomMainPanel.ApplySettlementGold(va); } @@ -222,7 +236,16 @@ namespace Assets.MyGame.Scripts.Net } break; case "Disconnect": - roomMainPanel.subUIManager.ShowAsync(UIPanel.ZGXQWin); + { + // 对方断线 { userId, disconnectTime, timeoutSeconds }:只提示等待重连, + // 服务端超时未重连会自动判负推 GameEnd(心跳里的 CheckTimeout 也会触发检查) + var va = JsonConvert.DeserializeObject>>(msg).arguments[0]; + string disUserId = va["userId"]?.ToString(); + int disTimeout = 60; + if (va.ContainsKey("timeoutSeconds") && va["timeoutSeconds"] != null) + int.TryParse(va["timeoutSeconds"].ToString(), out disTimeout); + if (roomMainPanel != null) roomMainPanel.OnOpponentDisconnected(disUserId, disTimeout); + } break; case "GameError": { @@ -251,6 +274,7 @@ namespace Assets.MyGame.Scripts.Net { var va = JsonConvert.DeserializeObject>>(msg).arguments[0]; Debug.Log($"[Chess] 重连: userId={va["userId"]}, userName={va["userName"]}"); + if (roomMainPanel != null) roomMainPanel.OnOpponentReconnected(va["userId"]?.ToString()); } break; @@ -272,6 +296,8 @@ namespace Assets.MyGame.Scripts.Net roomMainPanel.subUIManager.ShowAsync(UIPanel.ZGXQWin); else roomMainPanel.subUIManager.ShowAsync(UIPanel.ZGXQDefeated); + // 服务端已结算:本地对局同步置结束(防后台方回前台后对局还在跑) + if (roomMainPanel != null) roomMainPanel.MarkChessGameOverByServer(); // 结算后按结果实时更新房间双方金币显示 roomMainPanel.ApplySettlementGold(winUserId); } @@ -316,9 +342,9 @@ namespace Assets.MyGame.Scripts.Net case "PlayerAfkNotice": { // 玩家挂起通知 { userId }(房间组推送;挂起仅表现提示,不影响服务端操作校验) - // 表现层(座位挂起标记)由 UI 对话接入 var va = JsonConvert.DeserializeObject>(msg).arguments[0]; Debug.Log($"[Chess] 玩家挂起: userId={va?.userId}"); + if (roomMainPanel != null) roomMainPanel.OnPlayerAfkNotice(va?.userId); } break; @@ -327,6 +353,7 @@ namespace Assets.MyGame.Scripts.Net // 玩家取消挂起通知 { userId }(房间组推送;发起者本人另收 BeginGame 恢复房间同步) var va = JsonConvert.DeserializeObject>(msg).arguments[0]; Debug.Log($"[Chess] 玩家取消挂起: userId={va?.userId}"); + if (roomMainPanel != null) roomMainPanel.OnPlayerCancelAfkNotice(va?.userId); } break; diff --git a/Assets/MyGame/aa/Game/FLZY/TSY/ZDX/eff_dead_1595_timeline Variant.prefab b/Assets/MyGame/aa/Game/FLZY/TSY/ZDX/eff_dead_1595_timeline Variant.prefab index 848b8354d..4ff588065 100644 --- a/Assets/MyGame/aa/Game/FLZY/TSY/ZDX/eff_dead_1595_timeline Variant.prefab +++ b/Assets/MyGame/aa/Game/FLZY/TSY/ZDX/eff_dead_1595_timeline Variant.prefab @@ -26,7 +26,7 @@ Transform: m_GameObject: {fileID: 7036353727337932811} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 4000, z: 0} + m_LocalPosition: {x: 5000, y: 4000, z: 0} m_LocalScale: {x: 5, y: 5, z: 5} m_ConstrainProportionsScale: 1 m_Children: @@ -52,7 +52,6 @@ MonoBehaviour: fishScore: 0 bJbeishu: 0 maxScore: 0 - startOffset: {x: 0, y: 0, z: -100} isSelf: 0 isScoreEnd: 0 useScorePanel: 1 @@ -229,3 +228,4 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: subCamera: {fileID: 0} + isFishCamera: 0 diff --git a/Assets/MyGame/aa/Game/HHWK/Fish/Fish_2008 Variant.prefab b/Assets/MyGame/aa/Game/HHWK/Fish/Fish_2008 Variant.prefab index de32aa241..02956197d 100644 --- a/Assets/MyGame/aa/Game/HHWK/Fish/Fish_2008 Variant.prefab +++ b/Assets/MyGame/aa/Game/HHWK/Fish/Fish_2008 Variant.prefab @@ -648,7 +648,7 @@ MonoBehaviour: rotationPY: 70 useMirrorCompensate: 1 useRollSignFlip: 0 - useRouteFlipX: 1 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 0 diff --git a/Assets/MyGame/aa/Game/HHWK/Fish/Fish_2011 Variant.prefab b/Assets/MyGame/aa/Game/HHWK/Fish/Fish_2011 Variant.prefab index 044da7934..9781f5223 100644 --- a/Assets/MyGame/aa/Game/HHWK/Fish/Fish_2011 Variant.prefab +++ b/Assets/MyGame/aa/Game/HHWK/Fish/Fish_2011 Variant.prefab @@ -689,7 +689,7 @@ MonoBehaviour: rotationPY: 90 useMirrorCompensate: 1 useRollSignFlip: 0 - useRouteFlipX: 1 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 0 diff --git a/Assets/MyGame/aa/Game/HHWK/Fish/Fish_2012 Variant.prefab b/Assets/MyGame/aa/Game/HHWK/Fish/Fish_2012 Variant.prefab index 9c7d58693..63e890332 100644 --- a/Assets/MyGame/aa/Game/HHWK/Fish/Fish_2012 Variant.prefab +++ b/Assets/MyGame/aa/Game/HHWK/Fish/Fish_2012 Variant.prefab @@ -693,7 +693,7 @@ MonoBehaviour: rotationPY: 90 useMirrorCompensate: 1 useRollSignFlip: 0 - useRouteFlipX: 1 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 0 diff --git a/Assets/MyGame/aa/Game/HHWK/Fish/Fish_2013 Variant.prefab b/Assets/MyGame/aa/Game/HHWK/Fish/Fish_2013 Variant.prefab index a2e23a856..f5d3d8de0 100644 --- a/Assets/MyGame/aa/Game/HHWK/Fish/Fish_2013 Variant.prefab +++ b/Assets/MyGame/aa/Game/HHWK/Fish/Fish_2013 Variant.prefab @@ -389,7 +389,7 @@ MonoBehaviour: rotationPY: 90 useMirrorCompensate: 1 useRollSignFlip: 0 - useRouteFlipX: 1 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 0 diff --git a/Assets/MyGame/aa/Game/HHWK/Fish/Fish_2014 Variant.prefab b/Assets/MyGame/aa/Game/HHWK/Fish/Fish_2014 Variant.prefab index 49c906415..845a6bb5d 100644 --- a/Assets/MyGame/aa/Game/HHWK/Fish/Fish_2014 Variant.prefab +++ b/Assets/MyGame/aa/Game/HHWK/Fish/Fish_2014 Variant.prefab @@ -421,7 +421,7 @@ MonoBehaviour: rotationPY: 90 useMirrorCompensate: 1 useRollSignFlip: 0 - useRouteFlipX: 1 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 0 diff --git a/Assets/MyGame/aa/Game/HHWK/Fish/Fish_3002 Variant.prefab b/Assets/MyGame/aa/Game/HHWK/Fish/Fish_3002 Variant.prefab index a1ac1806a..5652ccba3 100644 --- a/Assets/MyGame/aa/Game/HHWK/Fish/Fish_3002 Variant.prefab +++ b/Assets/MyGame/aa/Game/HHWK/Fish/Fish_3002 Variant.prefab @@ -903,7 +903,7 @@ MonoBehaviour: rotationPY: 90 useMirrorCompensate: 1 useRollSignFlip: 0 - useRouteFlipX: 1 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 0 diff --git a/Assets/MyGame/aa/Game/HHWK/Fish/fish_1017 Variant.prefab b/Assets/MyGame/aa/Game/HHWK/Fish/fish_1017 Variant.prefab index 220441190..9859be358 100644 --- a/Assets/MyGame/aa/Game/HHWK/Fish/fish_1017 Variant.prefab +++ b/Assets/MyGame/aa/Game/HHWK/Fish/fish_1017 Variant.prefab @@ -206,7 +206,7 @@ MonoBehaviour: rotationPY: 90 useMirrorCompensate: 1 useRollSignFlip: 0 - useRouteFlipX: 1 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 1 diff --git a/Assets/MyGame/aa/Game/HHWK/Fish/fish_1019 Variant.prefab b/Assets/MyGame/aa/Game/HHWK/Fish/fish_1019 Variant.prefab index 997e8c143..35a05cb59 100644 --- a/Assets/MyGame/aa/Game/HHWK/Fish/fish_1019 Variant.prefab +++ b/Assets/MyGame/aa/Game/HHWK/Fish/fish_1019 Variant.prefab @@ -212,7 +212,7 @@ MonoBehaviour: rotationPY: 90 useMirrorCompensate: 1 useRollSignFlip: 0 - useRouteFlipX: 1 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 1 diff --git a/Assets/MyGame/aa/Game/HHWK/Fish/fish_1020 Variant.prefab b/Assets/MyGame/aa/Game/HHWK/Fish/fish_1020 Variant.prefab index 44783e77b..974f0cba2 100644 --- a/Assets/MyGame/aa/Game/HHWK/Fish/fish_1020 Variant.prefab +++ b/Assets/MyGame/aa/Game/HHWK/Fish/fish_1020 Variant.prefab @@ -366,7 +366,7 @@ MonoBehaviour: rotationPY: 90 useMirrorCompensate: 1 useRollSignFlip: 0 - useRouteFlipX: 1 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 1 diff --git a/Assets/MyGame/aa/Game/HHWK/Fish/fish_1021 Variant.prefab b/Assets/MyGame/aa/Game/HHWK/Fish/fish_1021 Variant.prefab index 02c69a3b1..bb781a6b0 100644 --- a/Assets/MyGame/aa/Game/HHWK/Fish/fish_1021 Variant.prefab +++ b/Assets/MyGame/aa/Game/HHWK/Fish/fish_1021 Variant.prefab @@ -206,7 +206,7 @@ MonoBehaviour: rotationPY: 90 useMirrorCompensate: 1 useRollSignFlip: 1 - useRouteFlipX: 1 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 1 diff --git a/Assets/MyGame/aa/Game/HHWK/Fish/fish_1022 Variant.prefab b/Assets/MyGame/aa/Game/HHWK/Fish/fish_1022 Variant.prefab index ff930dfde..caf25b7f8 100644 --- a/Assets/MyGame/aa/Game/HHWK/Fish/fish_1022 Variant.prefab +++ b/Assets/MyGame/aa/Game/HHWK/Fish/fish_1022 Variant.prefab @@ -212,7 +212,7 @@ MonoBehaviour: rotationPY: 90 useMirrorCompensate: 1 useRollSignFlip: 1 - useRouteFlipX: 1 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 1 @@ -285,19 +285,19 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4703437598541787, guid: ee1e72c133ca6124485715190eaa1e3a, type: 3} propertyPath: m_LocalRotation.w - value: 0.7071068 + value: 0.5 objectReference: {fileID: 0} - target: {fileID: 4703437598541787, guid: ee1e72c133ca6124485715190eaa1e3a, type: 3} propertyPath: m_LocalRotation.x - value: -0.7071068 + value: -0.5 objectReference: {fileID: 0} - target: {fileID: 4703437598541787, guid: ee1e72c133ca6124485715190eaa1e3a, type: 3} propertyPath: m_LocalRotation.y - value: 0 + value: 0.5 objectReference: {fileID: 0} - target: {fileID: 4703437598541787, guid: ee1e72c133ca6124485715190eaa1e3a, type: 3} propertyPath: m_LocalRotation.z - value: 0 + value: 0.5 objectReference: {fileID: 0} - target: {fileID: 4703437598541787, guid: ee1e72c133ca6124485715190eaa1e3a, type: 3} propertyPath: m_LocalEulerAnglesHint.x @@ -305,7 +305,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4703437598541787, guid: ee1e72c133ca6124485715190eaa1e3a, type: 3} propertyPath: m_LocalEulerAnglesHint.y - value: -0 + value: 90 objectReference: {fileID: 0} - target: {fileID: 4703437598541787, guid: ee1e72c133ca6124485715190eaa1e3a, type: 3} propertyPath: m_LocalEulerAnglesHint.z diff --git a/Assets/MyGame/aa/Game/HHWK/Fish/fish_1024 Variant.prefab b/Assets/MyGame/aa/Game/HHWK/Fish/fish_1024 Variant.prefab index bc1759edd..e8b8bc04a 100644 --- a/Assets/MyGame/aa/Game/HHWK/Fish/fish_1024 Variant.prefab +++ b/Assets/MyGame/aa/Game/HHWK/Fish/fish_1024 Variant.prefab @@ -206,7 +206,7 @@ MonoBehaviour: rotationPY: 90 useMirrorCompensate: 1 useRollSignFlip: 1 - useRouteFlipX: 1 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 1 diff --git a/Assets/MyGame/aa/Game/HHWK/Fish/fish_1025 Variant.prefab b/Assets/MyGame/aa/Game/HHWK/Fish/fish_1025 Variant.prefab index 4081a0e4d..00bb22af5 100644 --- a/Assets/MyGame/aa/Game/HHWK/Fish/fish_1025 Variant.prefab +++ b/Assets/MyGame/aa/Game/HHWK/Fish/fish_1025 Variant.prefab @@ -212,7 +212,7 @@ MonoBehaviour: rotationPY: 90 useMirrorCompensate: 1 useRollSignFlip: 1 - useRouteFlipX: 1 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 1 diff --git a/Assets/MyGame/aa/Game/HHWK/Fish/fish_1026 Variant.prefab b/Assets/MyGame/aa/Game/HHWK/Fish/fish_1026 Variant.prefab index beb97aa7d..2f712eabd 100644 --- a/Assets/MyGame/aa/Game/HHWK/Fish/fish_1026 Variant.prefab +++ b/Assets/MyGame/aa/Game/HHWK/Fish/fish_1026 Variant.prefab @@ -284,7 +284,7 @@ MonoBehaviour: rotationPY: 90 useMirrorCompensate: 1 useRollSignFlip: 0 - useRouteFlipX: 1 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 0 diff --git a/Assets/MyGame/aa/Game/HHWK/Fish/fish_1027 Variant.prefab b/Assets/MyGame/aa/Game/HHWK/Fish/fish_1027 Variant.prefab index da5dccc63..fe99813ed 100644 --- a/Assets/MyGame/aa/Game/HHWK/Fish/fish_1027 Variant.prefab +++ b/Assets/MyGame/aa/Game/HHWK/Fish/fish_1027 Variant.prefab @@ -206,7 +206,7 @@ MonoBehaviour: rotationPY: 90 useMirrorCompensate: 1 useRollSignFlip: 0 - useRouteFlipX: 1 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 1 diff --git a/Assets/MyGame/aa/Game/HHWK/Fish/fish_1028 Variant.prefab b/Assets/MyGame/aa/Game/HHWK/Fish/fish_1028 Variant.prefab index c92cbf1f5..49688168b 100644 --- a/Assets/MyGame/aa/Game/HHWK/Fish/fish_1028 Variant.prefab +++ b/Assets/MyGame/aa/Game/HHWK/Fish/fish_1028 Variant.prefab @@ -206,7 +206,7 @@ MonoBehaviour: rotationPY: 90 useMirrorCompensate: 1 useRollSignFlip: 0 - useRouteFlipX: 1 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 1 diff --git a/Assets/MyGame/aa/Game/HHWK/Fish/fish_2010 Variant.prefab b/Assets/MyGame/aa/Game/HHWK/Fish/fish_2010 Variant.prefab index 65ca90976..2a1726b48 100644 --- a/Assets/MyGame/aa/Game/HHWK/Fish/fish_2010 Variant.prefab +++ b/Assets/MyGame/aa/Game/HHWK/Fish/fish_2010 Variant.prefab @@ -345,7 +345,7 @@ MonoBehaviour: rotationPY: 90 useMirrorCompensate: 1 useRollSignFlip: 0 - useRouteFlipX: 1 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 0 diff --git a/Assets/MyGame/aa/Game/HHWK/Fish/fish_3001 Variant.prefab b/Assets/MyGame/aa/Game/HHWK/Fish/fish_3001 Variant.prefab index 5e10d9ed2..ba2386e8e 100644 --- a/Assets/MyGame/aa/Game/HHWK/Fish/fish_3001 Variant.prefab +++ b/Assets/MyGame/aa/Game/HHWK/Fish/fish_3001 Variant.prefab @@ -501,7 +501,7 @@ MonoBehaviour: rotationPY: 90 useMirrorCompensate: 1 useRollSignFlip: 0 - useRouteFlipX: 1 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 0 diff --git a/Assets/MyGame/aa/Game/HHWK/Fish/fish_3003 Variant.prefab b/Assets/MyGame/aa/Game/HHWK/Fish/fish_3003 Variant.prefab index bda18227c..5fa095aa3 100644 --- a/Assets/MyGame/aa/Game/HHWK/Fish/fish_3003 Variant.prefab +++ b/Assets/MyGame/aa/Game/HHWK/Fish/fish_3003 Variant.prefab @@ -727,7 +727,7 @@ MonoBehaviour: rotationPY: 90 useMirrorCompensate: 1 useRollSignFlip: 0 - useRouteFlipX: 1 + useRouteFlipX: 0 baseMmove: 0 isRotate: 1 isNot1: 0 diff --git a/Assets/MyGame/aa/UI/Game/ChineseChess/ChessGame/ChessGameManager.cs b/Assets/MyGame/aa/UI/Game/ChineseChess/ChessGame/ChessGameManager.cs index db0c9ca36..97673d26e 100644 --- a/Assets/MyGame/aa/UI/Game/ChineseChess/ChessGame/ChessGameManager.cs +++ b/Assets/MyGame/aa/UI/Game/ChineseChess/ChessGame/ChessGameManager.cs @@ -241,4 +241,16 @@ public class ChessGameManager winnerCamp = winner; OnGameOver?.Invoke(winner); } + + /// + /// 外部强制结束对局(挂起判负 / 服务端结算同步)。 + /// silent=true 只置结束状态、不触发 OnGameOver(调用方自行上报和弹面板,避免重复) + /// + public void ForceGameOver(ChessCamp winner, bool silent = false) + { + if (isGameOver) return; + isGameOver = true; + winnerCamp = winner; + if (!silent) OnGameOver?.Invoke(winner); + } } diff --git a/Assets/MyGame/aa/UI/Game/ChineseChess/ChineseChessMainPanel.cs b/Assets/MyGame/aa/UI/Game/ChineseChess/ChineseChessMainPanel.cs index 08d647e7e..7405499e7 100644 --- a/Assets/MyGame/aa/UI/Game/ChineseChess/ChineseChessMainPanel.cs +++ b/Assets/MyGame/aa/UI/Game/ChineseChess/ChineseChessMainPanel.cs @@ -225,6 +225,7 @@ public class ChineseChessMainPanel : GameMainPanel_Base var va = JsonConvert.DeserializeObject>(msg.ToString()); ChessGameRoom chessGameRoom = va.arguments[0]; roomData = chessGameRoom; // 记录房间数据(开象棋对局时要取阵营) + StartHeartbeat(); // 房间心跳(更新活跃时间 + 断线超时检查) UpdateUserData(chessGameRoom); switch (chessGameRoom.users.Count) @@ -252,7 +253,7 @@ public class ChineseChessMainPanel : GameMainPanel_Base if (isRoomOwner) { - btn_StartGame.gameObject.SetActive(true); + //btn_StartGame.gameObject.SetActive(true); btn_StartGame.onClick.RemoveAllListeners(); btn_StartGame.onClick.AddListener(() => { @@ -474,6 +475,11 @@ public class ChineseChessMainPanel : GameMainPanel_Base { if (roomData == null || roomData.users == null) return; + // 新一局开始:清挂起状态 + isMyAfk = false; + isOpponentAfk = false; + StopAfkMonitor(); + // 我的阵营:RedisGameUser.type 1 黑方 2 红方 var me = roomData.users.Find(u => u.userId == GameManager.Instance.user.BaseInfo.number); ChessCamp myCamp = me != null ? (ChessCamp)me.type : ChessCamp.Red; @@ -624,7 +630,207 @@ public class ChineseChessMainPanel : GameMainPanel_Base #endregion - /// 发送象棋帧同步数据(SyncGameData 通道) + #region 玩家挂起(退到后台)/ 断线 / 房间心跳 + + /// 挂起判负秒数:挂起最多 120s 超时判输;双方都挂起时,先挂起的判输 + private const float AfkTimeoutSeconds = 120f; + /// 挂起判负毫秒数(北京时间戳比较用) + private const long AfkTimeoutMs = (long)(AfkTimeoutSeconds * 1000f); + + /// 当前北京时间(毫秒,服务端同步) + private static long NowMs => BeijingTimeManager.Instance.CurrentTimestampMs; + + private bool isMyAfk; // 我是否挂起中(退到后台) + private long myAfkStartTimeMs; // 我挂起开始时间(北京时间毫秒) + private bool isOpponentAfk; // 对方是否挂起中 + private long opponentAfkStartTimeMs; // 对方挂起开始时间(北京时间毫秒) + private Coroutine afkMonitorCoroutine; + private Coroutine heartbeatCoroutine; + + /// 是否处于对局中(挂起/断线/重连处理只对进行中的对局生效) + public bool IsChessGameActive => chessGameManager != null && !chessGameManager.isGameOver; + + private string MyChessUserId => GameManager.Instance.user.BaseInfo.number; + + private string OpponentChessUserId + { + get + { + if (roomData?.users == null) return null; + var op = roomData.users.Find(u => u.userId != MyChessUserId); + return op?.userId; + } + } + + /// + /// 应用切后台/回前台(iOS/Android 都会触发 OnApplicationPause): + /// 退到后台 = 挂起(发 SetPlayerAfk);回前台 = 取消挂起(发 CancelPlayerAfk,本人会收到 BeginGame 恢复同步) + /// + private void OnApplicationPause(bool pause) + { + if (roomData == null || !IsChessGameActive) return; // 只对进行中的对局处理 + + if (pause) + { + isMyAfk = true; + myAfkStartTimeMs = NowMs; + StopWaitCountdown(); // 后台期间停走棋倒计时,回前台重新计 + WebSocketSendList.SetPlayerAfkChineseChess(roomData.roomId, MyChessUserId); + } + else if (isMyAfk) + { + isMyAfk = false; + WebSocketSendList.CancelPlayerAfkChineseChess(roomData.roomId, MyChessUserId); + + // ===== 挂起判定(北京时间,回前台必判,弹对应结果面板): + // 谁挂起满 120s 谁输;双方都超时 → 先挂起的输 ===== + long now = NowMs; + bool iTimedOut = now - myAfkStartTimeMs >= AfkTimeoutMs; + bool oppTimedOut = isOpponentAfk && now - opponentAfkStartTimeMs >= AfkTimeoutMs; + ChessCamp oppCamp = chessGameManager.myCamp == ChessCamp.Red ? ChessCamp.Black : ChessCamp.Red; + + if (oppTimedOut && (!iTimedOut || opponentAfkStartTimeMs <= myAfkStartTimeMs)) + { + JudgeAfkLose(chessGameManager.myCamp); // 对方超时(或双方都超时但对方先挂起)→ 对方输 + return; + } + if (iTimedOut) + { + JudgeAfkLose(oppCamp); // 我挂起超时 → 我输(本地立即弹失败面板) + return; + } + // 都没超时 → 继续对局(对方挂起监控继续跑) + + // 恢复走棋倒计时 + OnChessTurnChanged(chessGameManager.currentTurn); + } + } + + /// PlayerAfkNotice:对方退到后台 → 提示 + 开始 120s 判负监控 + public void OnPlayerAfkNotice(string userId) + { + if (!IsChessGameActive || userId != OpponentChessUserId) return; + isOpponentAfk = true; + opponentAfkStartTimeMs = NowMs; + if (chessBoard != null) chessBoard.ShowToast($"对方已挂起,{AfkTimeoutSeconds:0}秒内未恢复将判负"); + StartAfkMonitor(); + } + + /// PlayerCancelAfkNotice:对方回前台 → 清除挂起,继续对局 + public void OnPlayerCancelAfkNotice(string userId) + { + if (userId != OpponentChessUserId) return; + isOpponentAfk = false; + StopAfkMonitor(); + if (chessBoard != null) chessBoard.ShowToast("对方已恢复"); + } + + /// 对方挂起监控:挂起满 120s → 对方判输(我在前台时运行;我挂起时冻结,回前台再判) + private IEnumerator AfkMonitorRoutine() + { + while (IsChessGameActive && isOpponentAfk) + { + if (NowMs - opponentAfkStartTimeMs >= AfkTimeoutMs) + { + JudgeAfkLose(chessGameManager.myCamp); // 对方挂起超时 → 对方输 + yield break; + } + yield return new WaitForSeconds(1f); + } + } + + private void StartAfkMonitor() + { + StopAfkMonitor(); + if (IsChessGameActive && isActiveAndEnabled) + afkMonitorCoroutine = StartCoroutine(AfkMonitorRoutine()); + } + + private void StopAfkMonitor() + { + if (afkMonitorCoroutine != null) + { + StopCoroutine(afkMonitorCoroutine); + afkMonitorCoroutine = null; + } + } + + /// + /// 挂起判负结算:由判定方直接上报 EndGame(对方可能还在后台收不到,不能只靠赢家上报) + /// + private void JudgeAfkLose(ChessCamp winnerCamp) + { + if (!IsChessGameActive) return; + StopAfkMonitor(); + isOpponentAfk = false; + isMyAfk = false; + StopWaitCountdown(); + + bool iWin = winnerCamp == chessGameManager.myCamp; + string winnerId = iWin ? MyChessUserId : OpponentChessUserId; + if (roomData != null && !string.IsNullOrEmpty(winnerId)) + WebSocketSendList.EndGameChineseChess(roomData.roomId, winnerId); // EndGame 第二参 = 胜者 userId + + // 本地对局置结束(静默:不走 OnChessGameOver 的重复上报,上面已上报) + chessGameManager.ForceGameOver(winnerCamp, silent: true); + subUIManager.ShowAsync(iWin ? UIPanel.ZGXQWin : UIPanel.ZGXQDefeated); + } + + /// Disconnect:对方断线 → 停倒计时 + 提示(服务端超时未重连自动判负推 GameEnd) + public void OnOpponentDisconnected(string userId, int timeoutSeconds) + { + if (!IsChessGameActive || userId != OpponentChessUserId) return; + StopWaitCountdown(); + if (chessBoard != null) + chessBoard.ShowToast($"对方断线,{Mathf.Max(1, timeoutSeconds)}秒内未重连将判负"); + } + + /// Reconnect:对方重连 → 恢复走棋倒计时 + public void OnOpponentReconnected(string userId) + { + if (!IsChessGameActive || userId != OpponentChessUserId) return; + if (chessBoard != null) chessBoard.ShowToast("对方已重连"); + OnChessTurnChanged(chessGameManager.currentTurn); + } + + /// 服务端结算通知(EndGameSuccess/GameEnd)→ 本地对局同步置结束,防止后台方回前台后对局还在跑 + public void MarkChessGameOverByServer() + { + if (chessGameManager != null && !chessGameManager.isGameOver) + chessGameManager.ForceGameOver(chessGameManager.myCamp, silent: true); + } + + /// 房间心跳:更新房间活跃时间 + 触发断线超时检查(协议 2.11 / 2.12,每 30s) + private IEnumerator HeartbeatRoutine() + { + var wait = new WaitForSeconds(30f); + while (true) + { + yield return wait; + if (roomData != null && !string.IsNullOrEmpty(roomData.roomId)) + { + WebSocketSendList.HeartbeatChineseChess(roomData.roomId); + WebSocketSendList.CheckTimeoutChineseChess(roomData.roomId); + } + } + } + + private void StartHeartbeat() + { + StopHeartbeat(); + if (isActiveAndEnabled) heartbeatCoroutine = StartCoroutine(HeartbeatRoutine()); + } + + private void StopHeartbeat() + { + if (heartbeatCoroutine != null) + { + StopCoroutine(heartbeatCoroutine); + heartbeatCoroutine = null; + } + } + + #endregion private void SendChessNetData(ChessNetData data) { if (roomData == null || chessGameManager == null || data == null) return; @@ -692,6 +898,10 @@ public class ChineseChessMainPanel : GameMainPanel_Base chessGameManager = null; } StopWaitCountdown(); // 停走棋倒计时 + StopAfkMonitor(); // 停挂起监控 + StopHeartbeat(); // 停房间心跳 + isMyAfk = false; + isOpponentAfk = false; if (chessBoard != null) chessBoard.Clear(); if (autoChessBoardRect != null) { diff --git a/Assets/MyGame/aa/UI/Game/ChineseChess/UIChineseChessRoomExplain.cs b/Assets/MyGame/aa/UI/Game/ChineseChess/UIChineseChessRoomExplain.cs index 2d32febfc..02d7ee0d9 100644 --- a/Assets/MyGame/aa/UI/Game/ChineseChess/UIChineseChessRoomExplain.cs +++ b/Assets/MyGame/aa/UI/Game/ChineseChess/UIChineseChessRoomExplain.cs @@ -35,14 +35,14 @@ public class UIChineseChessRoomExplain : SubUIBase WebSocketSendList.GameReadyChineseChess(v.roomId,GameManager.Instance.user.BaseInfo.number); uIManager.Close(UIPanel.ZGXQGameExplain); }); - btn_Close.onClick.RemoveAllListeners(); - btn_Close.onClick.AddListener(() => - { - uIManager.CloseAll(); + //btn_Close.onClick.RemoveAllListeners(); + //btn_Close.onClick.AddListener(() => + //{ + // uIManager.CloseAll(); - WebSocketSendList.ExitRoomChineseChess(v.roomId, GameManager.Instance.user.BaseInfo.number); + // WebSocketSendList.ExitRoomChineseChess(v.roomId, GameManager.Instance.user.BaseInfo.number); - }); + //}); } }