//计算下局谁坐庄先摸牌 和如果是四人房谁 休息

        //发送小结算消息
        public static void SendSamllResults(this FiveStarRoom fiveStarRoom)
        {
            Actor_FiveStar_SmallResult actorFiveStarSmall = new Actor_FiveStar_SmallResult();

            actorFiveStarSmall.SmallPlayerResults = fiveStarRoom.SmallPlayerResults;
            actorFiveStarSmall.MaiMaCard          = fiveStarRoom.MaiMaCard; //买马的牌 赋值
            fiveStarRoom.RecordSmallResult(actorFiveStarSmall);             //记录小结算信息
            fiveStarRoom.BroadcastMssagePlayers(actorFiveStarSmall);
        }
Exemple #2
0
 //玩家轮休
 public static void PlayerRest(this FiveStarRoom fiveStarRoom)
 {
     if (fiveStarRoom.RoomNumber != 4)
     {
         return;//不是4人房直接 返回
     }
     fiveStarRoom.FiveStarPlayerDic[fiveStarRoom.NextRestSeatIndex].IsRestIn = true;
     fiveStarRoom.BroadcastMssagePlayers(new Actor_FiveStar_PlayerRest()
     {
         RestSeatIndex = fiveStarRoom.NextRestSeatIndex
     });
     fiveStarRoom.CurrRestSeatIndex = fiveStarRoom.NextRestSeatIndex;
 }
Exemple #3
0
        //玩家杠牌分数变化 和记录杠牌次数
        public static void PlayerGangPaiGetScore(this FiveStarRoom fiveStarRoom, int oprateSeateIndex, int oprateType)
        {
            if (oprateType != FiveStarOperateType.AnGang &&
                oprateType != FiveStarOperateType.CaGang &&
                oprateType != FiveStarOperateType.MingGang)
            {
                return;
            }

            fiveStarRoom.FiveStarPlayerDic[oprateSeateIndex].GangPaiCount++;//杠牌次数加1
            Actor_FiveStar_ScoreChange actorFiveStarScoreChange = new Actor_FiveStar_ScoreChange();

            for (int i = 0; i < fiveStarRoom.RoomNumber; i++)
            {
                actorFiveStarScoreChange.GetScore.Add(0);
            }
            fiveStarRoom.intData = 1;         //默认 不是杠上杠就是1
            if (fiveStarRoom.IsGangShangCard) //如果是杠上杠
            {
                fiveStarRoom.intData = 2;     //分数在乘以2
            }
            switch (oprateType)
            {
            case FiveStarOperateType.AnGang:
                fiveStarRoom.CaGangAnGangScoreChang(actorFiveStarScoreChange, oprateSeateIndex,
                                                    fiveStarRoom.RoomConfig.BottomScore * 2 * fiveStarRoom.intData);//分数变化
                break;

            case FiveStarOperateType.CaGang:
                fiveStarRoom.CaGangAnGangScoreChang(actorFiveStarScoreChange, oprateSeateIndex,
                                                    fiveStarRoom.RoomConfig.BottomScore * fiveStarRoom.intData);//分数变化
                break;

            case FiveStarOperateType.MingGang:
                actorFiveStarScoreChange.GetScore[oprateSeateIndex]             += fiveStarRoom.RoomConfig.BottomScore * 2 * fiveStarRoom.intData;
                actorFiveStarScoreChange.GetScore[fiveStarRoom.CurrChuPaiIndex] -= fiveStarRoom.RoomConfig.BottomScore * 2 * fiveStarRoom.intData;
                break;

            default:
                return;
            }
            fiveStarRoom.GangHuNum = 2;//标记为 刚杠过
            for (int i = 0; i < fiveStarRoom.RoomNumber; i++)
            {
                fiveStarRoom.FiveStarPlayerDic[i].SmallGangScore += actorFiveStarScoreChange.GetScore[i]; //记录杠牌得分
                fiveStarRoom.FiveStarPlayerDic[i].NowScoreChange(actorFiveStarScoreChange.GetScore[i]);   //现在的分数变化
                actorFiveStarScoreChange.NowScore.Add(fiveStarRoom.FiveStarPlayerDic[i].NowScore);
            }
            //广播分数变化消息
            fiveStarRoom.BroadcastMssagePlayers(actorFiveStarScoreChange);
        }
        //房间总结算 解散投票也会走这
        public static async void RoomTotalResult(this FiveStarRoom fiveStarRoom)
        {
            Actor_FiveStar_TotalResult actorFiveStarTotalResult = new Actor_FiveStar_TotalResult();

            for (int i = 0; i < fiveStarRoom.FiveStarPlayerDic.Count; i++)
            {
                actorFiveStarTotalResult.TotalPlayerResults.Add(FiveStarTotalPlayerResultFactory.Create(fiveStarRoom.FiveStarPlayerDic[i]));
            }
            fiveStarRoom.BroadcastMssagePlayers(actorFiveStarTotalResult);
            await fiveStarRoom.SaveTotalMiltary();   //房间总结算 存储大局对战记录

            fiveStarRoom.SendMiltaryFriendsCircle(); //发送战绩给亲友圈服
            fiveStarRoom.Dispose();                  //直接销毁房间
        }
Exemple #5
0
 //广播玩家买码
 public static int BoradcastPlayerMaiMa(this FiveStarRoom fiveStarRoom)
 {
     if (fiveStarRoom.ResidueCards.Count > 0)
     {
         Actor_FiveStar_MaiMa actorFiveStarMaiMa = new Actor_FiveStar_MaiMa();
         actorFiveStarMaiMa.Card = fiveStarRoom.ResidueCards[fiveStarRoom.ResidueCards.Count - 1];
         fiveStarRoom.MaiMaCard  = actorFiveStarMaiMa.Card;//记录买马的牌
         int maiMaMulttiple = CardFiveStarHuPaiLogic.GetMaiMaMultiple(actorFiveStarMaiMa.Card);
         actorFiveStarMaiMa.Score = maiMaMulttiple * fiveStarRoom.RoomConfig.BottomScore;
         fiveStarRoom.RecordMaiMa(actorFiveStarMaiMa);//记录买马信息
         fiveStarRoom.BroadcastMssagePlayers(actorFiveStarMaiMa);
         return(maiMaMulttiple);
     }
     return(0);
 }
Exemple #6
0
        //小局开始游戏
        public static void SmallStartGame(this FiveStarRoom fiveStarRoom)
        {
            fiveStarRoom.CurrRoomStateType = RoomStateType.GameIn;//更改房间游戏状态
            Actor_FiveStar_SmallStartGame actorFiveStarStart = new Actor_FiveStar_SmallStartGame();

            actorFiveStarStart.CurrOfficNum = ++fiveStarRoom.CurrOfficNum; //当前局数
            fiveStarRoom.BroadcastMssagePlayers(actorFiveStarStart);       //广播小局游戏开始
            fiveStarRoom.PlayerRest();                                     //玩家轮休
            if (fiveStarRoom.RoomConfig.MaxPiaoNum > 0)
            {
                fiveStarRoom.BroadcastCanDaPiao();//广播可以打漂
            }
            else
            {
                fiveStarRoom.Deal();//发牌
            }
        }
Exemple #7
0
 //通知所有玩家打漂
 public static void BroadcastCanDaPiao(this FiveStarRoom fiveStarRoom)
 {
     fiveStarRoom.IsDaPiaoBeing = true;
     fiveStarRoom.OverTime      = fiveStarRoom.GetOverTime(0, FiveStarOverTimeType.DaPiaoType);//获取超时时间
     for (int i = 0; i < fiveStarRoom.FiveStarPlayerDic.Count; i++)
     {
         fiveStarRoom.FiveStarPlayerDic[i].AIDelayDaPiao();//AI延迟打漂
     }
     fiveStarRoom.EntiretyOprationAleadyNum = 0;
     if (fiveStarRoom.RoomNumber == 4)
     {
         fiveStarRoom.EntiretyOprationAleadyNum++;//如果是4人 默认一个人已经做了操作
     }
     fiveStarRoom.BroadcastMssagePlayers(new Actor_FiveStar_CanDaPiao()
     {
         MaxPiaoNum = fiveStarRoom.RoomConfig.MaxPiaoNum
     });
 }
Exemple #8
0
        //广播操作消息
        public static void BroadcastOperateResults(this FiveStarRoom fiveStarRoom)
        {
            //如果还有正在操作的玩家 就暂时不广播消息
            if (fiveStarRoom.CanOperatePlayerIndex.Count > 0)
            {
                return;
            }
            //先清空可胡牌人数
            fiveStarRoom.HuPaiPlayerSeatIndexs.Clear();

            fiveStarRoom.intData = fiveStarRoom.BeforeOperateResults.Count;
            //广播消息 并 执行具体操作
            foreach (var beforeOperate in fiveStarRoom.BeforeOperateResults)
            {
                fiveStarRoom.FiveStarPlayerDic[beforeOperate.SeatIndex].ExecuteOperate(beforeOperate.OperateInfo); //如果执行 错误 就视为执行放弃操作
                fiveStarRoom.RecordOperateInfo(beforeOperate);                                                     //记录操作消息
                //广播此次操作消息
                fiveStarRoom.BroadcastMssagePlayers(beforeOperate);
                if (--fiveStarRoom.intData <= 0)
                {
                    //操作完成 后续操作
                    fiveStarRoom.FiveStarPlayerDic[beforeOperate.SeatIndex].OperateFinishFollow(beforeOperate.OperateInfo); //两个玩家同时操作 同时放弃 只用执行一次后续操作
                }
                //杠牌的话还有分数扣除
                fiveStarRoom.PlayerGangPaiGetScore(beforeOperate.SeatIndex, beforeOperate.OperateInfo.OperateType);
                //记录已经胡牌的人数
                if (beforeOperate.OperateInfo.OperateType == FiveStarOperateType.FangChongHu ||
                    beforeOperate.OperateInfo.OperateType == FiveStarOperateType.ZiMo)
                {
                    fiveStarRoom.HuPaiPlayerSeatIndexs.Add(beforeOperate.SeatIndex);
                }
            }
            //如果胡牌人数大于0 就直接结算
            if (fiveStarRoom.HuPaiPlayerSeatIndexs.Count > 0)
            {
                fiveStarRoom.PlayerHuPaiResult(fiveStarRoom.BeforeOperateResults[0].OperateInfo.OperateType, fiveStarRoom.HuPaiPlayerSeatIndexs.ToArray());
            }
            //处理完消息后清除列表
            fiveStarRoom.BeforeOperateResults.Clear();
        }