Browse Source

1.出牌增加判断玩家是否有动作;2.房间信息增加字段,当前出牌玩家打出的牌

johnclot69 1 month ago
parent
commit
49600cef4a

+ 1 - 0
DotNet/Hotfix/Helper/ProtoHelper.cs

@@ -49,6 +49,7 @@ namespace ET.Server
                 info.CardNum = hgHuangHuangComponent.CardList.Count;
                 info.OpId = opPlayer?.Id ?? -1;
                 info.OpPos = opPlayer?.Pos ?? -1;
+                info.CurDisCard = hgHuangHuangComponent.DisCard;
             }
             // 本人信息
             info.MyInfo = PlayerInfoToProto(room, player, true);

+ 9 - 0
DotNet/Hotfix/Scenes/Game/Handler/HGHH/C2G_HGHHDisCardHandler.cs

@@ -78,6 +78,15 @@ namespace ET.Server
                 return;
             }
             
+            // 是否有动作,有动作无法出牌
+            if (player.ActInfo is { Count: > 0 }) 
+            {
+                response.Error = ErrorCode.ERR_OperationError;
+                response.Message = "有动作,请先操作动作,出牌错误...";
+                reply();
+                return;
+            }
+            
             // 出牌
             hgHuangHuangComponent.DisCard(room, player, request.Card, false);
             

+ 6 - 2
DotNet/Hotfix/Scenes/Game/Room/HGHuangHuangComponentSystem.cs

@@ -286,6 +286,8 @@ namespace ET.Server
             self.CardList.RemoveAt(0);
             // 当前摸的牌
             self.DrawCard = card;
+            drawCardPlayer.Act = new int[5];
+            drawCardPlayer.ActInfo.Clear();
             // 吃,碰,杠,胡,过
             bool hasAct = false;
             // 检测摸牌人动作, 校验摸牌是否胡
@@ -480,7 +482,7 @@ namespace ET.Server
                                 if (hasAct) {
                                     act[4] = 1;
                                 }
-                                if (act[2] == 1 || act[1] == 1) {
+                                if (act[2] == 1 || act[1] == 1 || act[0] == 1) {
                                     // 加入可操作玩家list
                                     if (!self.OperableList.Contains(otherPlayer.Id)) {
                                         self.OperableList.Add(otherPlayer.Id);
@@ -624,7 +626,7 @@ namespace ET.Server
         /// <param name="card"></param>
         public static void Chi(this HGHuangHuangComponent self, Room room, Player player, int card)
         {
-            if (self.IsCanChi(player))
+            if (!self.IsCanChi(player))
             {
                 return;
             }
@@ -1119,6 +1121,8 @@ namespace ET.Server
             self.CanPgIds.Remove(player.Id);
             // 从可操作玩家集合中移除
             self.OperableList.Remove(player.Id);
+            player.Act = new int[5];
+            player.ActInfo.Clear();
             // 不是摸牌人,改time
             if (self.DrawCardPlayer.Id != player.Id)
             {