Beispiel #1
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();
        }