|
@@ -31,10 +31,7 @@ namespace ET.Server
|
|
|
self.AdmitDefeatList = new List<long>();
|
|
|
self.CanHuIds = new List<Player>();
|
|
|
self.CanPgIds = new List<Player>();
|
|
|
- self.OperableList = new List<Player>();
|
|
|
- self.ClickHuIds = new List<Player>();
|
|
|
- self.CanPgIds = new List<Player>();
|
|
|
- self.OperableList = new List<Player>();
|
|
|
+ self.OperableList = new List<long>();
|
|
|
self.ClickHuIds = new List<Player>();
|
|
|
self.CardList = new List<int>();
|
|
|
self.UpdateTime = 0;
|
|
@@ -267,9 +264,9 @@ namespace ET.Server
|
|
|
hasAct = true;
|
|
|
drawCardPlayer.Act[3] = 1;
|
|
|
self.CanHuIds.Add(drawCardPlayer);
|
|
|
- if (!self.OperableList.Contains(drawCardPlayer))
|
|
|
+ if (!self.OperableList.Contains(drawCardPlayer.Id))
|
|
|
{
|
|
|
- self.OperableList.Add(drawCardPlayer);
|
|
|
+ self.OperableList.Add(drawCardPlayer.Id);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -279,9 +276,9 @@ namespace ET.Server
|
|
|
{
|
|
|
hasAct = true;
|
|
|
drawCardPlayer.Act[2] = 1;
|
|
|
- if (!self.OperableList.Contains(drawCardPlayer))
|
|
|
+ if (!self.OperableList.Contains(drawCardPlayer.Id))
|
|
|
{
|
|
|
- self.OperableList.Add(drawCardPlayer);
|
|
|
+ self.OperableList.Add(drawCardPlayer.Id);
|
|
|
}
|
|
|
if (!self.CanPgIds.Contains(drawCardPlayer))
|
|
|
{
|
|
@@ -318,7 +315,7 @@ namespace ET.Server
|
|
|
Log.Error($"出牌错误,player is null.");
|
|
|
return;
|
|
|
}
|
|
|
- using (await CoroutineLockComponent.Instance.Wait(CoroutineLockType.DisCard, player.Id))
|
|
|
+ using (await CoroutineLockComponent.Instance.Wait(CoroutineLockType.PlayerOperation, player.Id))
|
|
|
{
|
|
|
if (self.CurrentPlayer.Id == player.Id && self.DrawCardPlayer.Id == player.Id)
|
|
|
{
|
|
@@ -409,9 +406,9 @@ namespace ET.Server
|
|
|
self.CanHuIds.Add(otherPlayer);
|
|
|
}
|
|
|
|
|
|
- if (!self.OperableList.Contains(otherPlayer))
|
|
|
+ if (!self.OperableList.Contains(otherPlayer.Id))
|
|
|
{
|
|
|
- self.OperableList.Add(otherPlayer);
|
|
|
+ self.OperableList.Add(otherPlayer.Id);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -438,8 +435,8 @@ namespace ET.Server
|
|
|
}
|
|
|
if (act[2] == 1 || act[1] == 1) {
|
|
|
|
|
|
- if (!self.OperableList.Contains(otherPlayer)) {
|
|
|
- self.OperableList.Add(otherPlayer);
|
|
|
+ if (!self.OperableList.Contains(otherPlayer.Id)) {
|
|
|
+ self.OperableList.Add(otherPlayer.Id);
|
|
|
}
|
|
|
|
|
|
if (!self.CanPgIds.Contains(otherPlayer)) {
|
|
@@ -498,13 +495,158 @@ namespace ET.Server
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- self.CurrentPlayer = self.Players[self.OperableList.First().Pos];
|
|
|
+ long id = self.OperableList.First();
|
|
|
+ Player tmpPlayer = room.GetPlayer(id);
|
|
|
+ if (tmpPlayer != null)
|
|
|
+ {
|
|
|
+ self.CurrentPlayer = self.Players[tmpPlayer.Pos];
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ private static bool IsCanChi(this HGHuangHuangComponent self, Player player)
|
|
|
+ {
|
|
|
+ if (self.ClickHuIds.Count > 0)
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (self.CanHuIds.Count > 1)
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (self.CanHuIds.Count == 1)
|
|
|
+ {
|
|
|
+ if (self.CanPgIds.Count > 0)
|
|
|
+ {
|
|
|
+ if (self.CanPgIds.Any(p => p != null && p.Id != player.Id))
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return self.CanHuIds.Contains(player);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (self.CanPgIds.Count > 0)
|
|
|
+ {
|
|
|
+ return self.CanPgIds.Contains(player);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public static void Chi(this HGHuangHuangComponent self, Room room, Player player, int card)
|
|
|
+ {
|
|
|
+ if (self.IsCanChi(player))
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (self.DisCard >= HGHuangHuangConst.DONG_FENG)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ self.DisCardPlayer.DisCards = CardHelper.Remove(self.DisCardPlayer.DisCards, self.DisCard);
|
|
|
+
|
|
|
+ int[] temp = CardHelper.Add(player.RemainCards, self.DisCard);
|
|
|
+ for (int i = 0; i < 3; i++)
|
|
|
+ {
|
|
|
+ temp = CardHelper.Remove(temp, card + i);
|
|
|
+ }
|
|
|
+
|
|
|
+ player.RemainCards = temp;
|
|
|
+
|
|
|
+ player.KeZi.Add(new Struct.Kezi((int)HGHuangHuangConst.KeziType.CHI, card, self.DisCardPlayer.Id));
|
|
|
+
|
|
|
+ self.OperableList.Clear();
|
|
|
+
|
|
|
+ self.DrawCardPlayer = player;
|
|
|
+ self.PengPlayer = player;
|
|
|
+
|
|
|
+
|
|
|
+ self.Time = 15;
|
|
|
+ self.Flag = false;
|
|
|
+
|
|
|
+ Log.Info($"玩家吃牌... 玩家ID:{player.Id}, 位置:{player.Pos}, 手牌大小:{player.RemainCards.Length}, 手牌信息:{string.Join(", ", player.RemainCards)}, 吃的牌:{card}");
|
|
|
+
|
|
|
+
|
|
|
+ foreach (Player p in room.GetAllPlayers().Values.Where(p => p != null))
|
|
|
+ {
|
|
|
+ MessageHelper.SendToClient(p, new G2C_DrawCardPush(){info = ProtoHelper.RoomToProto(room, p, p)});
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public static void Peng(this HGHuangHuangComponent self, Room room, Player player)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public static void Gang(this HGHuangHuangComponent self, Room room, Player player, int card)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public static void Hu(this HGHuangHuangComponent self, Room room, Player player)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public static void Guo(this HGHuangHuangComponent self, Room room, Player player)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
|