コード例 #1
0
        protected override void Run(FiveStarRoom fiveStarRoom, Actor_UserRequestReconnectionRoom message)
        {
            try
            {
                FiveStarPlayer fiveStarPlayer = fiveStarRoom.GetPlayerInfoUserIdIn(message.UserId);
                if (fiveStarPlayer == null)
                {
                    Log.Error("请求重连数据" + message.UserId + "不在房间中");
                    return;
                }
                fiveStarPlayer.User.IsOnLine = true;  //状态改为在线
                fiveStarPlayer.SetCollocation(false); //取消托管
                if (fiveStarPlayer.FiveStarRoom.CurrRoomStateType == RoomStateType.ReadyIn)
                {
                    fiveStarPlayer.Ready(); //如果未准备的状态上线 直接改变状态为准备
                }
                Actor_FiveStar_Reconnection actorFiveStarReconnection = ReconnectionRoomDataFactory.Create(fiveStarRoom, message.UserId);

                fiveStarPlayer.User.GetComponent <UserGateActorIdComponent>().ActorId = message.UserActorId;
                fiveStarPlayer.SendGateStartGame();                        //通知用户所在的网关服开始游戏 就是把 游戏服的对象id发过去
                fiveStarPlayer.SendMessageUser(actorFiveStarReconnection); //发送重连数据
                //补发最后一条可操作消息
                if (fiveStarRoom.EndCanOperateAndCanChuMessage != null)
                {
                    fiveStarPlayer.SendMessageUser(fiveStarRoom.EndCanOperateAndCanChuMessage);
                }
                ReconnectionRoomDataFactory.Dispose(actorFiveStarReconnection);
            }
            catch (Exception e)
            {
                Log.Error(e);
                throw;
            }
        }
コード例 #2
0
 //通知用户所在的网关服开始游戏 就是把 游戏服的对象id发过去
 public static void SendGateStartGame(this FiveStarPlayer fiveStarPlayer)
 {
     fiveStarPlayer.SendMessageUser(new Actor_UserStartGame()
     {
         SessionActorId = fiveStarPlayer.Id
     });                                                                                             //通知用户所在的网关服开始游戏
 }
コード例 #3
0
        //玩家摸牌
        public static void MoPai(this FiveStarPlayer fiveStarPlayer, int card)
        {
            card = fiveStarPlayer.AIMoPaiDispose(card); //AI摸牌处理
            fiveStarPlayer.MoEndHand = card;            //记录摸的最后一张手牌
            fiveStarPlayer.Hands.Add(card);
            //广播给客户端摸牌消息 但是只有摸的人 牌才是对的
            Actor_FiveStar_MoPai actorFiveStarMoPai = new Actor_FiveStar_MoPai();

            actorFiveStarMoPai.SeatIndex = fiveStarPlayer.SeatIndex;
            actorFiveStarMoPai.Card      = card;
            fiveStarPlayer.FiveStarRoom.RecordMoCard(actorFiveStarMoPai);//记录摸牌消息
            fiveStarPlayer.SendMessageUser(actorFiveStarMoPai);
            actorFiveStarMoPai.Card = -1;
            fiveStarPlayer.SendMessageOtherUser(actorFiveStarMoPai);

            fiveStarPlayer.Hands.Sort();//每次检测前要把手牌排序一下
            if (fiveStarPlayer.IsCanOperate())
            {
                fiveStarPlayer.CanOperate(FiveStarOperateType.ChuCard);
            }
            else
            {
                fiveStarPlayer.CanChuPai();
            }
        }
コード例 #4
0
 public static void SendNewestHands(this FiveStarPlayer fiveStarPlayer)
 {
     fiveStarPlayer.SendMessageUser(new Actor_FiveStar_NewestHands()
     {
         Hands = fiveStarPlayer.Hands
     });                                                                                               //发送玩家最新的手牌信息
 }
コード例 #5
0
 //设置托管的状态
 public static void SetCollocation(this FiveStarPlayer fiveStarPlayer, bool isCollocation)
 {
     if (fiveStarPlayer.IsCollocation == isCollocation)
     {
         return; //状态本来相同 就不做后续事件了
     }
     if (fiveStarPlayer.FiveStarRoom == null)
     {
         return;
     }
     //有超时才能 进入托管
     if (!fiveStarPlayer.FiveStarRoom.RoomConfig.IsHaveOverTime)
     {
         return;
     }
     if (fiveStarPlayer.FiveStarRoom.CurrRoomStateType == RoomStateType.ReadyIn)
     {
         isCollocation = false; //准备状态下 只能是 不托管状态
     }
     fiveStarPlayer.IsCollocation = isCollocation;
     if (fiveStarPlayer.IsCollocation)
     {
         fiveStarPlayer.CollocationAIOperate();
     }
     fiveStarPlayer.SendMessageUser(
         new Actor_FiveStar_CollocationChange()
     {
         IsCollocation = fiveStarPlayer.IsCollocation
     });
 }
コード例 #6
0
 //发牌
 public static void Deal(this FiveStarPlayer fiveStarPlayer, RepeatedField <int> cards)
 {
     fiveStarPlayer.Hands = cards;
     fiveStarPlayer.SendMessageUser(new Actor_FiveStar_Deal()
     {
         Cards = cards
     });                                                                         //广播发牌的消息
 }
コード例 #7
0
        //广播玩家可以操作信息
        public static void CanOperate(this FiveStarPlayer fiveStarPlayer, int qiOprateNextStep)
        {
            Actor_FiveStar_CanOperate actorFiveStarCanOperate = new Actor_FiveStar_CanOperate();

            fiveStarPlayer.SendMessageOtherUser(actorFiveStarCanOperate);
            actorFiveStarCanOperate.SeatIndex      = fiveStarPlayer.SeatIndex;
            actorFiveStarCanOperate.CanOperateLits = fiveStarPlayer.canOperateLists;
            actorFiveStarCanOperate.CanGangLits.Add(fiveStarPlayer.canGangCards.Keys.ToArray());
            fiveStarPlayer.SendMessageUser(actorFiveStarCanOperate);
            fiveStarPlayer.FiveStarRoom.QiOperateNextStep = qiOprateNextStep;
            fiveStarPlayer.FiveStarRoom.PlayerCanOperate(actorFiveStarCanOperate);//告诉房间玩家可以操作
        }
コード例 #8
0
 //开始游戏
 public static void StartGame(this FiveStarPlayer fiveStarPlayer, Actor_FiveStar_StartGame actorJoyLdsStartGame)
 {
     fiveStarPlayer.SendGateStartGame();                   //通知用户所在的网关服开始游戏
     fiveStarPlayer.SendMessageUser(actorJoyLdsStartGame); //通知客户端开始游戏
 }