Exemplo n.º 1
0
        /// <summary>
        /// 随机一个庄家
        /// </summary>
        public ClientPeer SetBanker()
        {
            Random ran   = new Random();
            int    index = ran.Next(0, playerList.Count);

            bankerIndex = index;
            int userId = playerList[index].id;

            playerList[index].identity = Identity.Banker;
            // 默认庄家第一个下注,实际应该是他的下一位玩家下注,之后游戏开始后会轮换到下一位
            roundModel.Start(userId);
            ClientPeer bankerCllient = DatabaseManager.GetClientPeerByUserId(userId);

            Console.WriteLine(bankerCllient.UserName);
            return(bankerCllient);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 选择庄家
        /// </summary>
        public ClientPeer SetBanker()
        {
            Random ran      = new Random();
            int    ranIndex = ran.Next(0, playerList.Count);

            bankerIndex = ranIndex;
            //随机到的庄家用户id
            int bankerId = playerList[ranIndex].userId;

            playerList[ranIndex].identity = Identity.Banker;
            roundModel.Start(bankerId);
            ClientPeer bankerClient   = Database.DatabaseManager.GetClientPeerByUserId(bankerId);
            string     bankerUserName = bankerClient.UserName;

            Console.WriteLine("庄家为:" + bankerUserName);
            return(bankerClient);
        }