Exemplo n.º 1
0
        /// <summary>
        /// 随机先手玩家
        /// </summary>
        public static void RandomFirstAuthority(this GameControllerComponent self)
        {
            Room room = self.GetEntity <Room>();
            OrderControllerComponent orderController = room.GetComponent <OrderControllerComponent>();

            Gamer[] gamers = room.GetAll();

            int  index          = RandomHelper.RandomNumber(0, gamers.Length);
            long firstAuthority = gamers[index].Id;

            orderController.Init(firstAuthority);

            //广播先手玩家
            room.Broadcast(new SelectAuthority()
            {
                PlayerId = firstAuthority
            });
        }
        /// <summary>
        /// 随机先手玩家
        /// </summary>
        public static void RandomFirstAuthority(this GameControllerComponent self)
        {
            Room room = self.GetParent <Room>();
            OrderControllerComponent orderController = room.GetComponent <OrderControllerComponent>();

            Gamer[] gamers = room.gamers;

            int  index          = RandomHelper.RandomNumber(0, gamers.Length);
            long firstAuthority = gamers[index].UserID;

            orderController.Init(firstAuthority);

            //广播先手抢地主玩家
            room.Broadcast(new Actor_AuthorityGrabLandlord_Ntt()
            {
                UserID = firstAuthority
            });
        }