/// <summary> /// 开始战斗 /// </summary> public void StartFight(List <int> uidList) { SingleExecute.Instance.Execute( delegate() { //创建战斗房间 FightRoom room = fightCache.Create(uidList); room.InitPlayerCards(); room.Sort(); //发送给每个客户端 他自身有什么牌 foreach (int uid in uidList) { ClientPeer client = userCache.GetClientPeer(uid); List <CardDto> cardList = room.GetUserCards(uid); //int[] cardIds = new int[17]; //54 每一张牌 都是一个 id //红桃A 是 0 //红桃2 是 1 //红桃3 是 2 //红桃4 是 3 //红桃5 是 4 //发送的int数组 是 234 client.Send(OpCode.FIGHT, FightCode.GET_CARD_SRES, cardList); } //发送开始抢地主的响应 int firstUserId = room.GetFirstUId(); brocast(room, OpCode.FIGHT, FightCode.TURN_GRAB_BRO, firstUserId, null); }); }
/// <summary> /// 开始发牌、抢地主 /// </summary> /// <param name="uidList"></param> public void StartFight(List <int> uidList) { SingleExecute.Instance.Execute(() => { FightRoom room = FightCache.Create(uidList); room.InitPlayerCards(); room.Sort(); //返回给客户端 foreach (var uid in uidList) { ClientPeer client = UserCache.GetClient(uid); List <CardDto> cardDtos = room.GetUserCard(uid); client.Send(new SocketMsg { OpCode = MsgType.Fight, SubCode = FightCode.Get_Card_Result, value = cardDtos }); } //开始抢地主 int firstUserId = room.GetFirstUId(); var socketMsg = new SocketMsg { OpCode = MsgType.Fight, SubCode = FightCode.Turn_Grab_Bro, value = firstUserId }; BroCast(room, socketMsg); }); }
/// <summary> /// 开始战斗 /// </summary> public void startFight(List <int> uidList) { SingleExecute.Instance.Execute(() => { //创建战斗房间 FightRoom room = fightCache.Create(uidList); room.InitPlayerCards(); room.Sort(); //发送给每个客户端 他自身有什么牌 foreach (int uid in uidList) { ClientPeer client = userCache.GetClientPeer(uid); List <CardDto> cardList = room.getUserCards(uid); client.Send(OpCode.FIGHT, FightCode.GET_CARD_SRES, cardList); } //开始抢地主 int firstUserId = room.GetFirstUId(); Brocast(room, OpCode.FIGHT, FightCode.TURN_GRAB_BRO, firstUserId, null); }); }
/// <summary> /// start play cards /// </summary> /// <param name="userIdList"></param> public void startFight(List <int> userIdList) { SingleExecute.Instance.Execute(() => { //create fight room FightRoom room = fightCache.Create(userIdList); room.InitPlayerCards(); room.Sort(); //send all client ,what cards he have; foreach (int uid in userIdList) { ClientPeer client = userCache.GetClientPeer(uid); List <CardDto> cardList = room.getUserCards(uid); client.Send(OpCode.FIGHT, FightCode.GET_CARD_SRES, cardList); } //start grab landlord int firstUserId = room.GetFirstUserId(); //tell all client firstUserId user to grab landlord Broadcast(room, OpCode.FIGHT, FightCode.TURN_GRAB_BROADCAST, firstUserId, null); }); }
/// <summary> /// 开始战斗 /// </summary> public void startFight(List <int> uIdList) { SingleExecute.Instance.Execute( delegate() { //创建战斗房间 FightRoom room = fightCache.Create(uIdList); room.InitPlayerCards(); room.Sort(); //发送设置按钮响应 brocast(room, OpCode.FIGHT, FightCode.BUTTON_BRO, null); //发送给每个客户端 它自身有什么用 foreach (int uid in uIdList) { ClientPeer client = userCache.GetClientPeer(uid); List <CardDto> cardList = room.GetUserCards(uid); client.Send(OpCode.FIGHT, FightCode.GET_CARD_SRES, cardList); } //发送开始抢地主的响应 int firstUserId = room.GetFirstUId(); brocast(room, OpCode.FIGHT, FightCode.TURN_GRAB_BRO, firstUserId, null); }); }