Browse Source

提交一版协议和逻辑

johnclot69 1 year ago
parent
commit
6b30ce6dec

+ 5 - 0
Config/Proto/OuterMessage_C_30001.proto

@@ -198,6 +198,11 @@ message G2C_Ready // IResponse
 	bool IsReady = 4;
 }
 
+message G2C_ReadyPush  // IActorMessage
+{
+	RoomInfo info = 1;	// 房间信息
+}
+
 //ResponseType G2C_Kick
 message C2G_Kick // IRequest
 {

+ 35 - 5
DotNet/Hotfix/Helper/ProtoHelper.cs

@@ -33,17 +33,47 @@ namespace ET.Server
         /// <returns></returns>
         public static RoomInfo RoomToProto(Room room)
         {
-            RoomInfo info = new RoomInfo();
+            RoomInfo info = new ();
             info.RoomId = room.RoomId;
             info.Type = room.Type;
             info.OwnerId = room.OwnerId;
-            info.PlayerList = new List<PlayerInfo>();
-            foreach (Player p in room.GetAllPlayers().Values.Where(p => p != null))
+            // info.State = room.State;
+            // todo 玩家信息
+            // info.PlayerList = new List<PlayerInfo>();
+            // foreach (Player p in room.GetAllPlayers().Values.Where(p => p != null))
+            // {
+            //     info.PlayerList.Add(ProtoHelper.PlayerToProto(p));
+            // }
+            return info;
+        }
+
+        /// <summary>
+        /// 房间玩家信息转proto
+        /// </summary>
+        /// <param name="player">玩家</param>
+        /// <param name="flag">是否本人</param>
+        /// <returns></returns>
+        public static PlayerInfo PlayerInfoToProto(Player player, bool flag)
+        {
+            PlayerInfo info = new ();
+            info.id = player.Id;
+            info.name = player.Name;
+            info.sex = player.Sex;
+            info.exp = player.Exp;
+            info.level = player.Level;
+            info.vip = 0;
+            info.pos = player.Pos;
+            info.state = player.State;
+            info.isAuto = player.IsAuto;
+            info.cardInfo = new CardInfo();
+            if (flag)
             {
-                info.PlayerList.Add(ProtoHelper.PlayerToProto(p));
+                info.cardInfo.RemainCards = player.RemainCards;
             }
+            info.cardInfo.RemainCardsNum = player.RemainCards.Count;
+            info.cardInfo.DisCards = player.DisCards;
+            
             return info;
         }
-
     }
 }

+ 4 - 3
DotNet/Hotfix/Scenes/Game/Handler/C2G_JoinRoomHandler.cs

@@ -68,8 +68,9 @@ namespace ET.Server
                 return;
             }
             
-            // 房间状态是否可进入
-            if (room.State != 0)
+            // todo 房间状态是否可进入, 后面这个判断要调整
+            HGHHMainCheckerComponent hghhMainCheckerComponent = room.GetComponent<HGHHMainCheckerComponent>();
+            if (hghhMainCheckerComponent != null && hghhMainCheckerComponent.State != 0)
             {
                 response.Error = ErrorCode.ERR_OperationError;
                 response.Message = "房间已开始,不可进入...";
@@ -81,7 +82,7 @@ namespace ET.Server
             room.Add(player);
             
             // 返回房间数据
-            response.Info = ProtoHelper.RoomToProto(room);
+            response.Info = hghhMainCheckerComponent.RoomToProto(room);
             reply();
             await ETTask.CompletedTask;
         }

+ 3 - 2
DotNet/Hotfix/Scenes/Game/Handler/C2G_KickHandler.cs

@@ -67,8 +67,9 @@ namespace ET.Server
 				return;
 			}
 			
-			// 是否踢人状态
-			if (room.State != 0)
+			// todo 是否踢人状态, 后面这个判断要调整
+			HGHHMainCheckerComponent hghhMainCheckerComponent = room.GetComponent<HGHHMainCheckerComponent>();
+			if (hghhMainCheckerComponent != null && hghhMainCheckerComponent.State != 0)
 			{
 				response.Error = ErrorCode.ERR_ParameterError;
 				response.Message = "游戏进行中,不可踢人...";

+ 37 - 4
DotNet/Hotfix/Scenes/Game/Handler/C2G_ReadyHandler.cs

@@ -1,4 +1,5 @@
 using System;
+using System.Collections.Generic;
 
 namespace ET.Server
 {
@@ -40,17 +41,49 @@ namespace ET.Server
                 return;
             }
             
-            // 玩家房间是否已开始
-            if (room.State != 0)
+            // todo 玩家房间是否已开始, 后面这个判断要调整
+            HGHHMainCheckerComponent hghhMainCheckerComponent = room.GetComponent<HGHHMainCheckerComponent>();
+            if (hghhMainCheckerComponent != null && hghhMainCheckerComponent.State != 0)
             {
                 response.Error = ErrorCode.ERR_OperationError;
                 response.Message = "房间已开始,不可准备...";
                 reply();
                 return;
             }
+
+            player.State = 1;
+            
+            Log.Info($"id:{player.Id}, 玩家:{player.Name}, 状态:已准备,通知所有玩家");
             
-            // 设置数据
-            player.IsReady = true;
+            // 广播
+            for (int index = 0; index < room.GetAllPlayers().Count; index++)
+            {
+                Player p = room.GetAllPlayers()[index];
+                if (p != null)
+                {
+                    RoomInfo roomInfo = new RoomInfo();
+                    roomInfo.Type = 1;
+                    roomInfo.State = hghhMainCheckerComponent.State;
+                    roomInfo.Time = hghhMainCheckerComponent.Time;
+                    roomInfo.Rand1 = hghhMainCheckerComponent.Rand[0];
+                    roomInfo.Rand2 = hghhMainCheckerComponent.Rand[1];
+                    roomInfo.CardNum = hghhMainCheckerComponent.CardList.Count;
+                    // 本人
+                    roomInfo.MyInfo = hghhMainCheckerComponent.PlayerInfoToProto(p, true);
+                    // 其他三家
+                    roomInfo.OtherInfo = new List<PlayerInfo>();
+                    int[] nextPos = room.GetSorcPos(index);
+                    foreach (int pos in nextPos)
+                    {
+                        Player other = room.GetAllPlayers()[pos];
+                        if (other != null)
+                        {
+                            roomInfo.OtherInfo.Add(hghhMainCheckerComponent.PlayerInfoToProto(other, false));
+                        }
+                    }
+                    MessageHelper.SendToClient(p, new G2C_ReadyPush(){info = roomInfo});
+                }
+            }
             
             // 返回
             response.IsReady = true;

+ 4 - 1
DotNet/Hotfix/Scenes/Game/Player/PlayerSystem.cs

@@ -1,4 +1,6 @@
-namespace ET.Server
+using System.Collections.Generic;
+
+namespace ET.Server
 {
     [FriendOf(typeof(Player))]
     public static class PlayerSystem
@@ -12,6 +14,7 @@
                 self.Account = a;
                 self.IsOnline = true;
                 self.LoginTime = TimeHelper.ServerNow();
+                self.RemainCards = new List<int>();
                 // 添加本地玩家数据
                 self.DomainScene().GetComponent<GamePlayerComponent>().Add(self);
             }

+ 140 - 9
DotNet/Hotfix/Scenes/Game/Room/HGHHMainCheckerComponentSystem.cs

@@ -15,7 +15,7 @@ namespace ET.Server
                 Log.Error($"黄冈晃晃主逻辑组件获取不到主实体...");
                 return;
             }
-            Log.Debug($"检测: 黄冈晃晃-房间号:{room.RoomId}, 状态:{room.State}...");
+            Log.Debug($"检测: 黄冈晃晃-房间号:{room.RoomId}, 状态:{self.State}...");
             
             try
             {
@@ -35,6 +35,19 @@ namespace ET.Server
         {
             Log.Info($"创建黄冈晃晃主逻辑组件...");
             self.Flag = false;
+            self.Time = 0;
+            self.Players = new Player[4];
+            self.CurrentRound = 0;
+            self.CardList = new List<int>();
+            // 初始化牌库
+            for (int i = 0; i < 4; i++)
+            {
+                foreach (int value in HghhConstValue.Values)
+                {
+                    self.CardList.Add(value);
+                }
+                RandomGenerator.Shuffle(self.CardList);
+            }
             self.RepeatedTimer = TimerComponent.Instance.NewRepeatedTimer(1000, TimerInvokeType.HGHHMainChecker, self);
         }
     }
@@ -53,14 +66,15 @@ namespace ET.Server
     {
         public static void Check(this HGHHMainCheckerComponent self, Room room)
         {
-            switch (room.State)
+            Log.Debug($"检测: 黄冈晃晃-房间号:{room.RoomId}...");
+            switch (self.State)
             {
                 case 0:
                     // 等待状态
                     Log.Debug($"检测: 黄冈晃晃-房间号:{room.RoomId}, 状态:检测是否可开局...");
                     if (self.CheckReadySatrt(room))
                     {
-                        room.State = 1;
+                        self.State = 1;
                         self.Flag = false;
                         self.Time = 0;
                     }
@@ -81,7 +95,7 @@ namespace ET.Server
                     {
                         if (self.Time > 0)
                         {
-                            room.State = 2;
+                            self.State = 2;
                             self.Flag = false;
                             self.Time = 0;
                         }
@@ -122,7 +136,7 @@ namespace ET.Server
         /// <returns></returns>
         private static bool CheckReadySatrt(this HGHHMainCheckerComponent self, Room room)
         {
-            if (!room.IsStart() || room.State != 0)
+            if (!room.IsStart() || self.State != 0)
             {
                 return false;
             }
@@ -130,7 +144,7 @@ namespace ET.Server
             // 通知客户端3秒倒计时
             foreach (Player player in room.GetAllPlayers().Values.Where(player => player != null))
             {
-                MessageHelper.SendToClient(player, new G2C_ReadySatrt(){ReadySatrtTime = 3});
+                MessageHelper.SendToClient(player, new G2C_ReadySatrtPush(){ReadySatrtTime = 3});
             }
 
             return true;
@@ -143,9 +157,74 @@ namespace ET.Server
         /// <param name="room"></param>
         private static void Start(this HGHHMainCheckerComponent self, Room room)
         {
-            // 定庄|摇骰子|发牌
-            
-            
+            self.CurrentRound += 1;
+            // 摇骰子
+            int rand1 = RandomGenerator.RandomNumber(1, 7);
+            int rand2 = RandomGenerator.RandomNumber(1, 7);
+            self.Rand = new[] { rand1, rand2 };
+            // 定庄
+            self.ZhuangPos = (rand1 + rand2) % 4;
+            // 当前操作玩家
+            self.CurrentPlayer = room.GetAllPlayers()[self.ZhuangPos];
+            // 当前摸牌玩家
+            self.DrawCardPlayer = room.GetAllPlayers()[self.ZhuangPos];
+            // 发牌
+            self.SendCard(room);
+            // 通知客户端
+            for (int index = 0; index < room.GetAllPlayers().Count; index++)
+            {
+                Player player = room.GetAllPlayers()[index];
+                if (player != null)
+                {
+                    player.State = 2;
+                    RoomInfo roomInfo = new RoomInfo();
+                    roomInfo.Type = 1;
+                    roomInfo.State = self.State;
+                    roomInfo.Time = self.Time;
+                    roomInfo.Rand1 = self.Rand[0];
+                    roomInfo.Rand2 = self.Rand[1];
+                    roomInfo.CardNum = self.CardList.Count;
+                    // 本人
+                    roomInfo.MyInfo = self.PlayerInfoToProto(player, true);
+                    // 其他三家
+                    roomInfo.OtherInfo = new List<PlayerInfo>();
+                    int[] nextPos = room.GetSorcPos(index);
+                    foreach (int pos in nextPos)
+                    {
+                        Player other = room.GetAllPlayers()[pos];
+                        if (other != null)
+                        {
+                            roomInfo.OtherInfo.Add(self.PlayerInfoToProto(other, false));
+                        }
+                    }
+                    MessageHelper.SendToClient(player, new G2C_SatrtPush(){info = roomInfo});
+                    
+                    Log.Info($"房间id={room.RoomId}, 玩家id={player.Id}, 玩家={player.Name}, 手牌信息={player.RemainCards}");
+                }
+            }
+        }
+        
+        /// <summary>
+        /// 发牌
+        /// </summary>
+        /// <param name="self"></param>
+        /// <param name="room"></param>
+        private static void SendCard(this HGHHMainCheckerComponent self, Room room)
+        {
+            foreach (Player player in room.GetAllPlayers().Values)
+            {
+                if (player == null)
+                {
+                    continue;
+                }
+
+                for (int i = 0; i < 13; i++)
+                {
+                    int card = self.CardList[0];
+                    player.RemainCards.Add(card);
+                    self.CardList.RemoveAt(0);
+                }
+            }
         }
 
         /// <summary>
@@ -157,5 +236,57 @@ namespace ET.Server
         {
             
         }
+        
+        /// <summary>
+        /// 房间信息转proto
+        /// </summary>
+        /// <param name="self"></param>
+        /// <param name="room"></param>
+        /// <returns></returns>
+        public static RoomInfo RoomToProto(this HGHHMainCheckerComponent self, Room room)
+        {
+            RoomInfo info = new ();
+            info.RoomId = room.RoomId;
+            info.Type = room.Type;
+            info.OwnerId = room.OwnerId;
+            info.State = self.State;
+            // todo 玩家信息
+            // info.PlayerList = new List<PlayerInfo>();
+            // foreach (Player p in room.GetAllPlayers().Values.Where(p => p != null))
+            // {
+            //     info.PlayerList.Add(ProtoHelper.PlayerToProto(p));
+            // }
+            return info;
+        }
+
+        /// <summary>
+        /// 房间内玩家信息转proto
+        /// </summary>
+        /// <param name="self">玩家</param>
+        /// <param name="player">玩家</param>
+        /// <param name="flag">是否本人</param>
+        /// <returns></returns>
+        public static PlayerInfo PlayerInfoToProto(this HGHHMainCheckerComponent self, Player player, bool flag)
+        {
+            PlayerInfo info = new ();
+            info.id = player.Id;
+            info.name = player.Name;
+            info.sex = player.Sex;
+            info.exp = player.Exp;
+            info.level = player.Level;
+            info.vip = 0;
+            info.pos = player.Pos;
+            info.state = player.State;
+            info.isAuto = player.IsAuto;
+            info.cardInfo = new CardInfo();
+            if (flag)
+            {
+                info.cardInfo.RemainCards = player.RemainCards;
+            }
+            info.cardInfo.RemainCardsNum = player.RemainCards.Count;
+            info.cardInfo.DisCards = player.DisCards;
+            
+            return info;
+        }
     }
 }

+ 22 - 5
DotNet/Hotfix/Scenes/Game/Room/RoomSystem.cs

@@ -63,7 +63,7 @@ namespace ET.Server
         /// </summary>
         /// <param name="self"></param>
         /// <returns></returns>
-        public static Dictionary<long, Player> GetAllPlayers(this Room self)
+        public static SortedList<long, Player> GetAllPlayers(this Room self)
         {
             return self.Players;
         }
@@ -99,12 +99,10 @@ namespace ET.Server
             
             foreach (Player player in self.Players.Values)
             {
-                if (player is not { IsReady: true })
+                if (player is { State: 1 })
                 {
-                    continue;
+                    cnt += 1;
                 }
-                
-                cnt += 1;
             }
 
             if (cnt >= self.MaxNum)
@@ -114,5 +112,24 @@ namespace ET.Server
             
             return false;
         }
+
+        /// <summary>
+        /// 根据当前玩家位置,获取另外三家位置顺序
+        /// </summary>
+        /// <param name="self"></param>
+        /// <param name="pos"></param>
+        /// <returns></returns>
+        public static int[] GetSorcPos(this Room self, int pos)
+        {
+            int[] nextPos = pos switch
+            {
+                3 => new int[] { 0, 1, 2 },
+                2 => new int[] { 3, 0, 1 },
+                1 => new int[] { 2, 3, 0 },
+                0 => new int[] { 1, 2, 3 },
+                _ => null
+            };
+            return nextPos;
+        }
     }
 }

+ 80 - 3
DotNet/Model/Generate/Message/CommonProto_CS_10001.cs

@@ -45,6 +45,45 @@ namespace ET
 
 	}
 
+	[Message(CommonProto.ActInfo)]
+	[ProtoContract]
+	public partial class ActInfo: ProtoObject
+	{
+		[ProtoMember(1)]
+		public int Card { get; set; }
+
+		[ProtoMember(2)]
+		public int Type { get; set; }
+
+		[ProtoMember(3)]
+		public long PlayerId { get; set; }
+
+	}
+
+	[Message(CommonProto.CardInfo)]
+	[ProtoContract]
+	public partial class CardInfo: ProtoObject
+	{
+		[ProtoMember(1)]
+		public List<int> RemainCards { get; set; }
+
+		[ProtoMember(2)]
+		public int RemainCardsNum { get; set; }
+
+		[ProtoMember(3)]
+		public List<int> DisCards { get; set; }
+
+		[ProtoMember(4)]
+		public List<ActInfo> UsedInfo { get; set; }
+
+		[ProtoMember(5)]
+		public List<int> Acts { get; set; }
+
+		[ProtoMember(6)]
+		public List<ActInfo> ActInfo { get; set; }
+
+	}
+
 	[Message(CommonProto.PlayerInfo)]
 	[ProtoContract]
 	public partial class PlayerInfo: ProtoObject
@@ -67,6 +106,18 @@ namespace ET
 		[ProtoMember(6)]
 		public int vip { get; set; }
 
+		[ProtoMember(7)]
+		public int pos { get; set; }
+
+		[ProtoMember(8)]
+		public int state { get; set; }
+
+		[ProtoMember(9)]
+		public bool isAuto { get; set; }
+
+		[ProtoMember(10)]
+		public CardInfo cardInfo { get; set; }
+
 	}
 
 	[Message(CommonProto.RoomInfo)]
@@ -83,7 +134,31 @@ namespace ET
 		public long OwnerId { get; set; }
 
 		[ProtoMember(4)]
-		public List<PlayerInfo> PlayerList { get; set; }
+		public int State { get; set; }
+
+		[ProtoMember(5)]
+		public int Time { get; set; }
+
+		[ProtoMember(6)]
+		public int Rand1 { get; set; }
+
+		[ProtoMember(7)]
+		public int Rand2 { get; set; }
+
+		[ProtoMember(8)]
+		public int CardNum { get; set; }
+
+		[ProtoMember(9)]
+		public PlayerInfo MyInfo { get; set; }
+
+		[ProtoMember(10)]
+		public List<PlayerInfo> OtherInfo { get; set; }
+
+		[ProtoMember(11)]
+		public long OpId { get; set; }
+
+		[ProtoMember(12)]
+		public int OpPos { get; set; }
 
 	}
 
@@ -91,7 +166,9 @@ namespace ET
 	{
 		 public const ushort MoveInfo = 10002;
 		 public const ushort UnitInfo = 10003;
-		 public const ushort PlayerInfo = 10004;
-		 public const ushort RoomInfo = 10005;
+		 public const ushort ActInfo = 10004;
+		 public const ushort CardInfo = 10005;
+		 public const ushort PlayerInfo = 10006;
+		 public const ushort RoomInfo = 10007;
 	}
 }

+ 195 - 10
DotNet/Model/Generate/Message/OuterMessage_C_30001.cs

@@ -401,6 +401,15 @@ namespace ET
 
 	}
 
+	[Message(OuterMessage.G2C_ReadyPush)]
+	[ProtoContract]
+	public partial class G2C_ReadyPush: ProtoObject, IActorMessage
+	{
+		[ProtoMember(1)]
+		public RoomInfo info { get; set; }
+
+	}
+
 	[ResponseType(nameof(G2C_Kick))]
 	[Message(OuterMessage.C2G_Kick)]
 	[ProtoContract]
@@ -432,15 +441,182 @@ namespace ET
 
 	}
 
-	[Message(OuterMessage.G2C_ReadySatrt)]
+	[Message(OuterMessage.G2C_ReadySatrtPush)]
 	[ProtoContract]
-	public partial class G2C_ReadySatrt: ProtoObject, IActorMessage
+	public partial class G2C_ReadySatrtPush: ProtoObject, IActorMessage
 	{
 		[ProtoMember(1)]
 		public long ReadySatrtTime { get; set; }
 
 	}
 
+	[Message(OuterMessage.G2C_SatrtPush)]
+	[ProtoContract]
+	public partial class G2C_SatrtPush: ProtoObject, IActorMessage
+	{
+		[ProtoMember(1)]
+		public RoomInfo info { get; set; }
+
+	}
+
+	[Message(OuterMessage.G2C_DrawCardPush)]
+	[ProtoContract]
+	public partial class G2C_DrawCardPush: ProtoObject, IActorMessage
+	{
+		[ProtoMember(1)]
+		public long PlayerId { get; set; }
+
+		[ProtoMember(2)]
+		public int DrawCardPos { get; set; }
+
+		[ProtoMember(3)]
+		public List<int> Acts { get; set; }
+
+		[ProtoMember(4)]
+		public List<ActInfo> ActInfo { get; set; }
+
+		[ProtoMember(5)]
+		public int DrawCardsNum { get; set; }
+
+		[ProtoMember(6)]
+		public int CardNum { get; set; }
+
+		[ProtoMember(7)]
+		public int DrawCard { get; set; }
+
+		[ProtoMember(8)]
+		public int Time { get; set; }
+
+	}
+
+	[ResponseType(nameof(G2C_DisCard))]
+	[Message(OuterMessage.C2G_DisCard)]
+	[ProtoContract]
+	public partial class C2G_DisCard: ProtoObject, IRequest
+	{
+		[ProtoMember(1)]
+		public int RpcId { get; set; }
+
+	}
+
+	[Message(OuterMessage.G2C_DisCard)]
+	[ProtoContract]
+	public partial class G2C_DisCard: ProtoObject, IResponse
+	{
+		[ProtoMember(1)]
+		public int RpcId { get; set; }
+
+		[ProtoMember(2)]
+		public int Error { get; set; }
+
+		[ProtoMember(3)]
+		public string Message { get; set; }
+
+	}
+
+	[Message(OuterMessage.G2C_DisCardPush)]
+	[ProtoContract]
+	public partial class G2C_DisCardPush: ProtoObject, IActorMessage
+	{
+		[ProtoMember(1)]
+		public long PlayerId { get; set; }
+
+		[ProtoMember(2)]
+		public int DisCardPos { get; set; }
+
+		[ProtoMember(3)]
+		public List<int> Acts { get; set; }
+
+		[ProtoMember(4)]
+		public List<ActInfo> ActInfo { get; set; }
+
+		[ProtoMember(5)]
+		public int DisCardsNum { get; set; }
+
+		[ProtoMember(6)]
+		public int DisCard { get; set; }
+
+		[ProtoMember(7)]
+		public int Time { get; set; }
+
+	}
+
+	[ResponseType(nameof(G2C_Operation))]
+	[Message(OuterMessage.C2G_Operation)]
+	[ProtoContract]
+	public partial class C2G_Operation: ProtoObject, IRequest
+	{
+		[ProtoMember(1)]
+		public int RpcId { get; set; }
+
+		[ProtoMember(2)]
+		public int OpType { get; set; }
+
+	}
+
+	[Message(OuterMessage.G2C_Operation)]
+	[ProtoContract]
+	public partial class G2C_Operation: ProtoObject, IResponse
+	{
+		[ProtoMember(1)]
+		public int RpcId { get; set; }
+
+		[ProtoMember(2)]
+		public int Error { get; set; }
+
+		[ProtoMember(3)]
+		public string Message { get; set; }
+
+	}
+
+	[Message(OuterMessage.G2C_OperationPush)]
+	[ProtoContract]
+	public partial class G2C_OperationPush: ProtoObject, IActorMessage
+	{
+		[ProtoMember(1)]
+		public int OpType { get; set; }
+
+		[ProtoMember(2)]
+		public long DisPlayerId { get; set; }
+
+		[ProtoMember(3)]
+		public int Card { get; set; }
+
+		[ProtoMember(4)]
+		public int GangType { get; set; }
+
+		[ProtoMember(5)]
+		public long OpPlayerId { get; set; }
+
+		[ProtoMember(6)]
+		public int OpPos { get; set; }
+
+		[ProtoMember(7)]
+		public int DisCardPos { get; set; }
+
+		[ProtoMember(8)]
+		public List<int> OpRemainCards { get; set; }
+
+		[ProtoMember(9)]
+		public int OpRemainCardsNum { get; set; }
+
+		[ProtoMember(10)]
+		public List<long> ClickHuId { get; set; }
+
+		[ProtoMember(11)]
+		public List<int> Acts { get; set; }
+
+		[ProtoMember(12)]
+		public List<ActInfo> ActInfo { get; set; }
+
+		[ProtoMember(13)]
+		public int HuType { get; set; }
+
+		[ProtoMember(14)]
+		public int Time { get; set; }
+
+	}
+
 	[Message(OuterMessage.G2C_TestHotfixMessage)]
 	[ProtoContract]
 	public partial class G2C_TestHotfixMessage: ProtoObject, IMessage
@@ -530,13 +706,22 @@ namespace ET
 		 public const ushort G2C_JoinRoom = 30027;
 		 public const ushort C2G_Ready = 30028;
 		 public const ushort G2C_Ready = 30029;
-		 public const ushort C2G_Kick = 30030;
-		 public const ushort G2C_Kick = 30031;
-		 public const ushort G2C_ReadySatrt = 30032;
-		 public const ushort G2C_TestHotfixMessage = 30033;
-		 public const ushort C2M_TransferMap = 30034;
-		 public const ushort M2C_TransferMap = 30035;
-		 public const ushort C2G_Benchmark = 30036;
-		 public const ushort G2C_Benchmark = 30037;
+		 public const ushort G2C_ReadyPush = 30030;
+		 public const ushort C2G_Kick = 30031;
+		 public const ushort G2C_Kick = 30032;
+		 public const ushort G2C_ReadySatrtPush = 30033;
+		 public const ushort G2C_SatrtPush = 30034;
+		 public const ushort G2C_DrawCardPush = 30035;
+		 public const ushort C2G_DisCard = 30036;
+		 public const ushort G2C_DisCard = 30037;
+		 public const ushort G2C_DisCardPush = 30038;
+		 public const ushort C2G_Operation = 30039;
+		 public const ushort G2C_Operation = 30040;
+		 public const ushort G2C_OperationPush = 30041;
+		 public const ushort G2C_TestHotfixMessage = 30042;
+		 public const ushort C2M_TransferMap = 30043;
+		 public const ushort M2C_TransferMap = 30044;
+		 public const ushort C2G_Benchmark = 30045;
+		 public const ushort G2C_Benchmark = 30046;
 	}
 }

+ 13 - 3
DotNet/Model/Scenes/Game/Player/Player.cs

@@ -1,4 +1,6 @@
-namespace ET.Server
+using System.Collections.Generic;
+
+namespace ET.Server
 {
     [ChildOf(typeof(GamePlayerComponent))]
     public sealed class Player : Entity, IAwake<string>, IDestroy
@@ -29,7 +31,15 @@
         
         /** 房间号 **/
         public string RoomId { get; set; }
-        /** 玩家是否准备 **/
-        public bool IsReady { get; set; }
+        /** 玩家位置 0东 1南 2西 3北 **/
+        public int Pos { get; set; }
+        /** 玩家状态 0未准备 1已准备 2游戏中 3结束 **/
+        public int State { get; set; }
+        /** 是否托管 **/
+        public bool IsAuto { get; set; }
+        /** 玩家手牌 **/
+        public List<int> RemainCards { get; set; }
+        /** 玩家打出的牌 **/
+        public List<int> DisCards { get; set; }
     }
 }

+ 22 - 17
DotNet/Model/Scenes/Game/Room/HGHHMainCheckerComponent.cs

@@ -5,28 +5,33 @@ namespace ET.Server
     [ComponentOf(typeof(Room))]
     public class HGHHMainCheckerComponent: Entity, IAwake, IDestroy
     {
-        /// <summary>
-        /// 麻将对应数值
-        /// 0x01-0x09 万
-        /// 0x11-0x19 筒
-        /// 0x21-0x29 条
-        /// 0x31-0x37 东南西北中发白
-        /// </summary>
-        public static readonly int[] values =
-        {
-            0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,
-            0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
-            0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29,
-            0x35, 0x36, 0x37
-        };
-
         /** 检测标记 **/
         public bool Flag { get; set; }
-
+        /** 时间秒数 **/
         public int Time { get; set; }
+        /** 房间状态 [0等待 1开局 2进行中 3已结束] **/
+        public int State { get; set; }
+        /** 座位上的玩家 **/
+        public Player[] Players { get; set; }
+        /** 当前局数 **/
+        public int CurrentRound { get; set; }
+        /** 庄家位置 0东 1南 2西 3北 **/
+        public int ZhuangPos { get; set; }
+        /** 骰子 **/
+        public int[] Rand { get; set; }
+        /** 当前操作玩家 **/
+        public Player CurrentPlayer { get; set; }
+        /** 当前打出的牌 **/
+        public int DisCard { get; set; }
+        /** 当前出牌玩家 **/
+        public Player DisCardPlayer { get; set; }
+        /** 当前摸的牌 **/
+        public int DrawCard { get; set; }
+        /** 当前摸牌玩家 **/
+        public Player DrawCardPlayer { get; set; }
 
         /** 牌库 **/
-        public List<int> CardList = new List<int>();
+        public List<int> CardList { get; set; }
 
         public long RepeatedTimer;
     }

+ 1 - 3
DotNet/Model/Scenes/Game/Room/Room.cs

@@ -13,13 +13,11 @@ namespace ET.Server
         /** 房间最大人数 **/
         public int MaxNum { get; set; }
         /** 房间玩家集合 **/
-        public Dictionary<long, Player> Players = new Dictionary<long, Player>();
+        public SortedList<long, Player> Players = new SortedList<long, Player>();
         /** 房间玩法类型 1:黄冈晃晃 **/
         public int Type { get; set; }
         /** 房主playerId **/
         public long OwnerId { get; set; }
-        /** 房间状态 [0等待 1开局 2进行中 3已结束] **/
-        public int State { get; set; }
         /** 创建时间 **/
         public long CreateTime { get; set; }
     }

+ 80 - 3
Unity/Assets/Scripts/Codes/Model/Client/Generate/Message/CommonProto_CS_10001.cs

@@ -45,6 +45,45 @@ namespace ET
 
 	}
 
+	[Message(CommonProto.ActInfo)]
+	[ProtoContract]
+	public partial class ActInfo: ProtoObject
+	{
+		[ProtoMember(1)]
+		public int Card { get; set; }
+
+		[ProtoMember(2)]
+		public int Type { get; set; }
+
+		[ProtoMember(3)]
+		public long PlayerId { get; set; }
+
+	}
+
+	[Message(CommonProto.CardInfo)]
+	[ProtoContract]
+	public partial class CardInfo: ProtoObject
+	{
+		[ProtoMember(1)]
+		public List<int> RemainCards { get; set; }
+
+		[ProtoMember(2)]
+		public int RemainCardsNum { get; set; }
+
+		[ProtoMember(3)]
+		public List<int> DisCards { get; set; }
+
+		[ProtoMember(4)]
+		public List<ActInfo> UsedInfo { get; set; }
+
+		[ProtoMember(5)]
+		public List<int> Acts { get; set; }
+
+		[ProtoMember(6)]
+		public List<ActInfo> ActInfo { get; set; }
+
+	}
+
 	[Message(CommonProto.PlayerInfo)]
 	[ProtoContract]
 	public partial class PlayerInfo: ProtoObject
@@ -67,6 +106,18 @@ namespace ET
 		[ProtoMember(6)]
 		public int vip { get; set; }
 
+		[ProtoMember(7)]
+		public int pos { get; set; }
+
+		[ProtoMember(8)]
+		public int state { get; set; }
+
+		[ProtoMember(9)]
+		public bool isAuto { get; set; }
+
+		[ProtoMember(10)]
+		public CardInfo cardInfo { get; set; }
+
 	}
 
 	[Message(CommonProto.RoomInfo)]
@@ -83,7 +134,31 @@ namespace ET
 		public long OwnerId { get; set; }
 
 		[ProtoMember(4)]
-		public List<PlayerInfo> PlayerList { get; set; }
+		public int State { get; set; }
+
+		[ProtoMember(5)]
+		public int Time { get; set; }
+
+		[ProtoMember(6)]
+		public int Rand1 { get; set; }
+
+		[ProtoMember(7)]
+		public int Rand2 { get; set; }
+
+		[ProtoMember(8)]
+		public int CardNum { get; set; }
+
+		[ProtoMember(9)]
+		public PlayerInfo MyInfo { get; set; }
+
+		[ProtoMember(10)]
+		public List<PlayerInfo> OtherInfo { get; set; }
+
+		[ProtoMember(11)]
+		public long OpId { get; set; }
+
+		[ProtoMember(12)]
+		public int OpPos { get; set; }
 
 	}
 
@@ -91,7 +166,9 @@ namespace ET
 	{
 		 public const ushort MoveInfo = 10002;
 		 public const ushort UnitInfo = 10003;
-		 public const ushort PlayerInfo = 10004;
-		 public const ushort RoomInfo = 10005;
+		 public const ushort ActInfo = 10004;
+		 public const ushort CardInfo = 10005;
+		 public const ushort PlayerInfo = 10006;
+		 public const ushort RoomInfo = 10007;
 	}
 }

+ 0 - 11
Unity/Assets/Scripts/Codes/Model/Client/Generate/Message/CommonProto_CS_10001.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: f98098da3541a834d8e4dd2ca59effa5
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 195 - 10
Unity/Assets/Scripts/Codes/Model/Client/Generate/Message/OuterMessage_C_30001.cs

@@ -401,6 +401,15 @@ namespace ET
 
 	}
 
+	[Message(OuterMessage.G2C_ReadyPush)]
+	[ProtoContract]
+	public partial class G2C_ReadyPush: ProtoObject, IActorMessage
+	{
+		[ProtoMember(1)]
+		public RoomInfo info { get; set; }
+
+	}
+
 	[ResponseType(nameof(G2C_Kick))]
 	[Message(OuterMessage.C2G_Kick)]
 	[ProtoContract]
@@ -432,15 +441,182 @@ namespace ET
 
 	}
 
-	[Message(OuterMessage.G2C_ReadySatrt)]
+	[Message(OuterMessage.G2C_ReadySatrtPush)]
 	[ProtoContract]
-	public partial class G2C_ReadySatrt: ProtoObject, IActorMessage
+	public partial class G2C_ReadySatrtPush: ProtoObject, IActorMessage
 	{
 		[ProtoMember(1)]
 		public long ReadySatrtTime { get; set; }
 
 	}
 
+	[Message(OuterMessage.G2C_SatrtPush)]
+	[ProtoContract]
+	public partial class G2C_SatrtPush: ProtoObject, IActorMessage
+	{
+		[ProtoMember(1)]
+		public RoomInfo info { get; set; }
+
+	}
+
+	[Message(OuterMessage.G2C_DrawCardPush)]
+	[ProtoContract]
+	public partial class G2C_DrawCardPush: ProtoObject, IActorMessage
+	{
+		[ProtoMember(1)]
+		public long PlayerId { get; set; }
+
+		[ProtoMember(2)]
+		public int DrawCardPos { get; set; }
+
+		[ProtoMember(3)]
+		public List<int> Acts { get; set; }
+
+		[ProtoMember(4)]
+		public List<ActInfo> ActInfo { get; set; }
+
+		[ProtoMember(5)]
+		public int DrawCardsNum { get; set; }
+
+		[ProtoMember(6)]
+		public int CardNum { get; set; }
+
+		[ProtoMember(7)]
+		public int DrawCard { get; set; }
+
+		[ProtoMember(8)]
+		public int Time { get; set; }
+
+	}
+
+	[ResponseType(nameof(G2C_DisCard))]
+	[Message(OuterMessage.C2G_DisCard)]
+	[ProtoContract]
+	public partial class C2G_DisCard: ProtoObject, IRequest
+	{
+		[ProtoMember(1)]
+		public int RpcId { get; set; }
+
+	}
+
+	[Message(OuterMessage.G2C_DisCard)]
+	[ProtoContract]
+	public partial class G2C_DisCard: ProtoObject, IResponse
+	{
+		[ProtoMember(1)]
+		public int RpcId { get; set; }
+
+		[ProtoMember(2)]
+		public int Error { get; set; }
+
+		[ProtoMember(3)]
+		public string Message { get; set; }
+
+	}
+
+	[Message(OuterMessage.G2C_DisCardPush)]
+	[ProtoContract]
+	public partial class G2C_DisCardPush: ProtoObject, IActorMessage
+	{
+		[ProtoMember(1)]
+		public long PlayerId { get; set; }
+
+		[ProtoMember(2)]
+		public int DisCardPos { get; set; }
+
+		[ProtoMember(3)]
+		public List<int> Acts { get; set; }
+
+		[ProtoMember(4)]
+		public List<ActInfo> ActInfo { get; set; }
+
+		[ProtoMember(5)]
+		public int DisCardsNum { get; set; }
+
+		[ProtoMember(6)]
+		public int DisCard { get; set; }
+
+		[ProtoMember(7)]
+		public int Time { get; set; }
+
+	}
+
+	[ResponseType(nameof(G2C_Operation))]
+	[Message(OuterMessage.C2G_Operation)]
+	[ProtoContract]
+	public partial class C2G_Operation: ProtoObject, IRequest
+	{
+		[ProtoMember(1)]
+		public int RpcId { get; set; }
+
+		[ProtoMember(2)]
+		public int OpType { get; set; }
+
+	}
+
+	[Message(OuterMessage.G2C_Operation)]
+	[ProtoContract]
+	public partial class G2C_Operation: ProtoObject, IResponse
+	{
+		[ProtoMember(1)]
+		public int RpcId { get; set; }
+
+		[ProtoMember(2)]
+		public int Error { get; set; }
+
+		[ProtoMember(3)]
+		public string Message { get; set; }
+
+	}
+
+	[Message(OuterMessage.G2C_OperationPush)]
+	[ProtoContract]
+	public partial class G2C_OperationPush: ProtoObject, IActorMessage
+	{
+		[ProtoMember(1)]
+		public int OpType { get; set; }
+
+		[ProtoMember(2)]
+		public long DisPlayerId { get; set; }
+
+		[ProtoMember(3)]
+		public int Card { get; set; }
+
+		[ProtoMember(4)]
+		public int GangType { get; set; }
+
+		[ProtoMember(5)]
+		public long OpPlayerId { get; set; }
+
+		[ProtoMember(6)]
+		public int OpPos { get; set; }
+
+		[ProtoMember(7)]
+		public int DisCardPos { get; set; }
+
+		[ProtoMember(8)]
+		public List<int> OpRemainCards { get; set; }
+
+		[ProtoMember(9)]
+		public int OpRemainCardsNum { get; set; }
+
+		[ProtoMember(10)]
+		public List<long> ClickHuId { get; set; }
+
+		[ProtoMember(11)]
+		public List<int> Acts { get; set; }
+
+		[ProtoMember(12)]
+		public List<ActInfo> ActInfo { get; set; }
+
+		[ProtoMember(13)]
+		public int HuType { get; set; }
+
+		[ProtoMember(14)]
+		public int Time { get; set; }
+
+	}
+
 	[Message(OuterMessage.G2C_TestHotfixMessage)]
 	[ProtoContract]
 	public partial class G2C_TestHotfixMessage: ProtoObject, IMessage
@@ -530,13 +706,22 @@ namespace ET
 		 public const ushort G2C_JoinRoom = 30027;
 		 public const ushort C2G_Ready = 30028;
 		 public const ushort G2C_Ready = 30029;
-		 public const ushort C2G_Kick = 30030;
-		 public const ushort G2C_Kick = 30031;
-		 public const ushort G2C_ReadySatrt = 30032;
-		 public const ushort G2C_TestHotfixMessage = 30033;
-		 public const ushort C2M_TransferMap = 30034;
-		 public const ushort M2C_TransferMap = 30035;
-		 public const ushort C2G_Benchmark = 30036;
-		 public const ushort G2C_Benchmark = 30037;
+		 public const ushort G2C_ReadyPush = 30030;
+		 public const ushort C2G_Kick = 30031;
+		 public const ushort G2C_Kick = 30032;
+		 public const ushort G2C_ReadySatrtPush = 30033;
+		 public const ushort G2C_SatrtPush = 30034;
+		 public const ushort G2C_DrawCardPush = 30035;
+		 public const ushort C2G_DisCard = 30036;
+		 public const ushort G2C_DisCard = 30037;
+		 public const ushort G2C_DisCardPush = 30038;
+		 public const ushort C2G_Operation = 30039;
+		 public const ushort G2C_Operation = 30040;
+		 public const ushort G2C_OperationPush = 30041;
+		 public const ushort G2C_TestHotfixMessage = 30042;
+		 public const ushort C2M_TransferMap = 30043;
+		 public const ushort M2C_TransferMap = 30044;
+		 public const ushort C2G_Benchmark = 30045;
+		 public const ushort G2C_Benchmark = 30046;
 	}
 }

+ 0 - 11
Unity/Assets/Scripts/Codes/Model/Client/Generate/Message/OuterMessage_C_30001.cs.meta

@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 5a37c7a9cdefe1d49a631de5b2a1da54
-MonoImporter:
-  externalObjects: {}
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 19 - 0
Unity/Assets/Scripts/Core/Helper/RandomGenerator.cs

@@ -108,5 +108,24 @@ namespace ET
                 return value.ToString();
             }
         }
+        
+        /// <summary>
+        /// 乱序一个list
+        /// </summary>
+        /// <param name="list"></param>
+        /// <typeparam name="T"></typeparam>
+        public static void Shuffle<T>(List<T> list)
+        {
+            Random rng = new Random();
+            int n = list.Count;
+            while (n > 1)
+            {
+                n--;
+                int k = rng.Next(n + 1);
+                T value = list[k];
+                list[k] = list[n];
+                list[n] = value;
+            }
+        }
     }
 }