//玩家退出房间 public static bool UserOutRoom(this MatchRoom matchRoom, long userId) { if (matchRoom.RoomType == RoomType.Match) { return(true);//随机匹配房间无法退出 只能等待游戏结束 回复成功让玩家回到大厅 } //如果正在游戏接发起投票解散房间 if (matchRoom.IsGameBeing) { matchRoom.RommEnterVoteDissolve(userId);//开始投票 return(false); } matchRoom.intData = -1; //如果是房卡 并且还没开始 就退出房间 foreach (var player in matchRoom.PlayerInfoDic) { if (player.Value.User.UserId == userId) { matchRoom.intData = player.Key; matchRoom.PlayerInfoDic.Remove(player.Key); matchRoom.BroadcastActorMessage(new Actor_OtherOutRoom() { UserId = userId }); break; } } //如果是房主退出房间 直接移除房间 if (matchRoom.intData == 0) { Game.Scene.GetComponent <MatchRoomComponent>().RemoveRoom(matchRoom.RoomId); } else if (matchRoom.intData == -1) { Log.Error("退出房间玩家不在房间中"); } return(true); }
/// <summary> /// 离开 /// </summary> /// <param name="client"></param> private void Leave(ClientPeer client) { SingleExecute.Instance.Execute ( delegate() { if (!userCache.IsOnLine(client)) { return; } int userId = userCache.GetIdByClient(client); //用户 否 匹配 if (matchCache.IsMatching(userId) == false) { return; } //正常操作 MatchRoom room = matchCache.Leave(userId); //广播给房间内 room.Brocast(OpCode.MATCH, MatchCode.LEAVE_BRO, userId, client); } ); }
/// <summary> /// 客户端聊天得请求处理 /// </summary> /// <param name="client"></param> /// <param name="msg"></param> private void Chat(ClientPeer client, string msg) { SingleExecute.Instance.Execute(() => { foreach (var matchCache in matchCaches) { if (matchCache.IsMatching(client.Id)) { MatchRoom room = matchCache.GetRoom(client.Id); chatDto.Change(client.Id, client.UserName, msg); room.Broadcast(OpCode.Chat, ChatCode.BRO, chatDto); } } if (fightCache.IsFighting(client.Id) == false) { return; } FightRoom fightRoom = fightCache.GetFightRoomByUserId(client.Id); chatDto.Change(client.Id, client.UserName, msg); fightRoom.Broadcast(OpCode.Chat, ChatCode.BRO, chatDto); }); }
/// <summary> /// 离开匹配队列 /// </summary> /// <param name="clientPeer"></param> private void leave(ClientPeer clientPeer) { SingleExecute.Instance.processSingle(() => { if (!UserCache.Instance.IsOnline(clientPeer)) { return; } int uid = UserCache.Instance.GetId(clientPeer); //用户不在匹配队列 if (!MatchCache.Instance.IsMatching(uid)) { return; } UserModel userModel = UserCache.Instance.GetModelByClientPeer(clientPeer); MatchRoom room = MatchCache.Instance.Leave(uid); Console.WriteLine("玩家:" + userModel.Name + "离开匹配房间:" + room.ID); //向房间内所有人广播有玩家离开 room.Broadcast(OpCode.MATCH, MatchCode.LEAVE_BOD, uid); }); }
private void chatRequest(ClientPeer client, int chatType) { if (userCache.IsOnline(client) == false) { return; } int userId = userCache.GetId(client); //获取发送者的id userId //发送 ChatDto dto = new ChatDto(userId, chatType); //广播给房间内的玩家 if (matchCache.IsMatching(userId)) { MatchRoom mRoom = matchCache.GetRoom(userId); mRoom.Brocast(OpCode.CHAT, ChatCode.SRES, dto); } if (fightCache.IsFighting(userId)) { FightRoom fRoom = fightCache.GetRoomByUId(userId); fRoom.Brocast(OpCode.CHAT, ChatCode.SRES, dto, client); } }
private void leave(ClientPeer client) { SingleExecute.Instance.Execute( delegate() { if (!userCache.IsOnline(client)) { return; } int userId = userCache.GetId(client); if (matchCache.IsMatching(userId) == false) { Console.WriteLine("User is not matching!"); return; } MatchRoom room = matchCache.Leave(userId); //broadcast to all player ,someone leave room.Broadcast(OpCode.MATCH, MatchCode.LEAVE_BROADCAST, userId); Console.WriteLine("Some player leave!"); }); }
/// <summary> /// 客户端发来的准备请求 /// </summary> /// <param name="client"></param> /// <param name="roomType"></param> private void Ready(ClientPeer client, int roomType) { SingleExecute.Instance.Execute(() => { if (matchCacheList[roomType].IsMatching(client.Id) == false) { return; } MatchRoom room = matchCacheList[roomType].GetRoom(client.Id); room.Ready(client.Id); room.Broadcase(OpCode.Match, MatchCode.Read_BRO, client.Id); //全部都准备了,可以开始游戏了 if (room.IsAllReady()) { startFight(room.clientList, roomType); //通知房间内的所有玩家开始游戏了 room.Broadcase(OpCode.Match, MatchCode.StartGame_BRO, null); //销毁房间 matchCacheList[roomType].DestroyRoom(room); } }); }
public int CreateRoom(AceNetFrameWork.ace.UserToken token, SocketModel mes) { string roomName = mes.getMessage <string>(); MatchRoom matchRoom = new MatchRoom(token); int playerID = cache.getId(token); string account = cache.getAccount(token); int roomID = atomic.getAndAdd(); matchRoom.HostID = playerID; matchRoom.hostAccount = account; if (matchRoomMap.TryAdd(roomID, matchRoom)) { userMatch.TryAdd(playerID, roomID); } else { //如果添加房间失败,则发送失败消息 Console.WriteLine("无法添加房间"); write(token, TypeProtocol.TYPE_GAMEHALL_CREQ, 0, GameHallProtocol.GAMEHALL_CREATEROOM_CREQ, 0); return(0); } RoomInfoDTO info = new RoomInfoDTO(); info.roomID = roomID; info.roomName = roomName; info.roomState = "正在等待"; info.roomOwner = account; roomInfoList.Add(info); write(token, TypeProtocol.TYPE_GAMEHALL_CREQ, 0, GameHallProtocol.GAMEHALL_CREATEROOM_CREQ, info); cache.removeGameHallAccMap(token);//将用户移除出大厅列表 加入到房间列表中 cache.addToRoomAccMap(token); UpdateRoomListToAll(); return(1); }
protected override void Run(Session session, C2M_GetReconnectionRoomInfo message, Action <M2C_GetReconnectionRoomInfo> reply) { M2C_GetReconnectionRoomInfo response = new M2C_GetReconnectionRoomInfo(); try { MatchRoom matchRoom = MatchRoomComponent.Ins.GetRoomUserIdIn(message.UserId); if (matchRoom == null) { response.IsGameBeing = false; response.Message = "房间已经结算"; reply(response); return; } response.IsGameBeing = true; if (matchRoom.IsGameBeing) { Actor_UserRequestReconnectionRoom m2SUserRequest = new Actor_UserRequestReconnectionRoom(); m2SUserRequest.UserId = message.UserId; m2SUserRequest.UserActorId = matchRoom.GetPlayerInfo(message.UserId).SessionActorId; ActorHelp.SendeActor(matchRoom.GameServeRoomActorId, m2SUserRequest); if (matchRoom.IsVoteDissolveIn)//如果正在投票解散中 补发一条投票结果消息 { ActorHelp.SendeActor(m2SUserRequest.UserActorId, matchRoom.VoteDissolveResult); } } else { response.RoomInfos = RoomInfoFactory.Creator(matchRoom); } reply(response); } catch (Exception e) { ReplyError(response, e, reply); } }
/// <summary> /// 用户准备 /// </summary> /// <param name="client"></param> private void Ready(ClientPeer client) { SingleExecute.Instance.Execute(() => { if (!user.IsOnLine(client)) { //不在线 return; } int userId = user.GetId(client); if (!match.IsMatching(userId)) { return;//非法操作 不能准备 } MatchRoom room = match.GetRoom(userId); room.Ready(userId); //广播消息 准备了 为什么要给自己发,确保服务器收到准备请求 回复消息后 将准备按钮隐藏 room.Brocast(OpCode.MATCHROOM, MatchRoomCode.READY_BRO, userId); Console.WriteLine(string.Format("玩家 : {0} 在房间 :{1} 准备了", user.GetModelByClient(client).name, room.id)); //是否所有玩家都准备了 if (room.IsAllUserReady()) { Console.WriteLine(String.Format("房间 :{0} 开始了战斗。。。", room.id)); //开始战斗 调用FightHandler 的开始方法 委托 if (FightDelegate != null) { FightDelegate.Invoke(room.uidList); } //通知房间内的玩家 要进行战斗了 群发消息 room.Brocast(OpCode.MATCHROOM, MatchRoomCode.START_BRO, null); match.Destroy(room); } }); }
/// <summary> /// 离开 /// </summary> /// <param name="client"></param> private void leave(ClientPeer client) { SingleExecute.Instance.Execute( delegate() { if (!userCache.IsOnline(client)) { return; } int userId = userCache.GetId(client); //用户没有匹配 不能退出 非法操作 if (matchCache.IsMatching(userId) == false) { //client.Send(OpCode.MATCH, MatchCode.LEAVE_SRES, -1); return; } //正常离开 MatchRoom room = matchCache.Leave(userId); //广播给房间内所有人 有人离开了 参数:离开的用户id room.Brocast(OpCode.MATCH, MatchCode.LEAVE_BRO, userId); Console.WriteLine("有玩家离开匹配房间"); }); }
/// <summary> /// 进入 /// </summary> /// <param name="client"></param> private void enter(ClientPeer client)//, int id) { SingleExecute.Instance.Execute( delegate() { if (!userCache.IsOnline(client)) { return; } int userId = userCache.GetId(client); //if (userId != id) // return; //如果用户已经在匹配房间等待了 那就无视 if (matchCache.IsMatching(userId)) { client.Send(OpCode.MATCH, MatchCode.ENTER_SRES, -1); //重复加入 return; } //正常进入 MatchRoom room = matchCache.Enter(userId, client); //广播给房间内除了当前客户端的其他用户,有新玩家计入了 参数:新进入的玩家的用户id #region 构造一个UserDto Dto就是针对UI定义的 UI需要什么我们就加什么字段 UserModel model = userCache.GetModelById(userId); UserDto userDto = new UserDto(model.Id, model.Name, model.Been, model.WinCount, model.LoseCount, model.RunCount, model.Lv, model.Exp); #endregion room.Brocast(OpCode.MATCH, MatchCode.ENTER_BRO, userDto, client); //返回给当前客户端 给他房间的数据模型 MatchRoomDto dto = makeRoomDto(room); client.Send(OpCode.MATCH, MatchCode.ENTER_SRES, dto); Console.WriteLine("有玩家进入匹配房间"); } ); }
protected override async void Run(Session session, S2M_RoomDissolve message) { try { MatchRoomComponent matchRoomComponent = Game.Scene.GetComponent <MatchRoomComponent>(); MatchRoom matchRoom = matchRoomComponent.GetRoom(message.RoomId); if (matchRoom != null) { if (matchRoom.RoomType == RoomType.Match) { await matchRoom.DeductBeans();//扣除豆子 } else if (message.CurrOfficNum <= 1 && message.CurrRoomStateType == RoomStateType.GameIn) { } else { Session lobbySession = Game.Scene.GetComponent <NetInnerSessionComponent>().Get(AppType.Lobby); M2S_UserFinishRoomCardGame m2SUserFinishRoom = new M2S_UserFinishRoomCardGame(); foreach (var player in matchRoom.PlayerInfoDic) { m2SUserFinishRoom.UserIds.Add(player.Value.User.UserId); } lobbySession.Send(m2SUserFinishRoom); //通知大厅服 这些玩家完成一局游戏 //通知大厅 服 玩家完成一局游戏 await matchRoom.DeductJewel(); //扣除钻石 } } matchRoomComponent.RemoveRoom(message.RoomId); } catch (Exception e) { Log.Error(e); throw; } }
//创建房卡匹房间 public static MatchRoom Create(RepeatedField <int> roomConfigLists, long toyGameId, int roomId, int friendsCircleId, long userJewelNum, IResponse iResponse) { int needJeweNumCount = 0; int number = 0; bool isAADeductJewel = false; //效验房间配置正不正确 不正确的值会修改为默认值 会赋值 需要的钻石数 和房间配置人数 if (!RoomConfigIntended.IntendedRoomConfigParameter(roomConfigLists, toyGameId, ref needJeweNumCount, ref number, ref isAADeductJewel)) { iResponse.Message = "房间配置表错误"; return(null); } //如果是亲友圈房间亲友圈的 圈主钻石数要大于100 if (friendsCircleId > 0 && userJewelNum < 100) { iResponse.Message = "亲友圈主人钻石不足100"; return(null); } if (userJewelNum < needJeweNumCount) { iResponse.Message = "钻石不足"; return(null); } MatchRoom matchRoom = ComponentFactory.Create <MatchRoom>(); MatchRoomConfig roomConfig = MatchRoomConfigFactory.Create(number, roomId, toyGameId, roomConfigLists); matchRoom.RoomId = roomId; matchRoom.FriendsCircleId = friendsCircleId; matchRoom.RoomConfig = roomConfig; matchRoom.RoomType = RoomType.RoomCard; matchRoom.NeedJeweNumCount = needJeweNumCount; matchRoom.IsAADeductJewel = isAADeductJewel; return(matchRoom); }
protected override async void Run(Session session, G2M_JoinMatchRoom message, Action <M2G_JoinMatchRoom> reply) { M2G_JoinMatchRoom response = new M2G_JoinMatchRoom(); try { MatchRoomComponent roomComponent = Game.Scene.GetComponent <MatchRoomComponent>(); MatchRoom matchroom = roomComponent.Get(message.RoomId); Unit unit = matchroom.unitComponent.Get(message.UnitId); if (unit == null) { if (message.UnitId > 0) { unit = EntityFactory.CreateWithId <Unit>(message.UnitId); } else { unit = EntityFactory.Create <Unit>(); } unit.RoomID = matchroom.Id; matchroom.unitComponent.Add(unit); } UnitGateComponent unitGateComponent = unit.GetComponent <UnitGateComponent>(); if (unitGateComponent != null) { Game.Scene.GetComponent <ActorProxyComponent>().Remove(unitGateComponent.GateSessionId); unit.RemoveComponent <UnitGateComponent>(); ActorComponent actorComponent = unit.GetComponent <ActorComponent>(); await actorComponent.RemoveLocation(); unit.RemoveComponent <ActorComponent>(); } unit.AddComponent <UnitGateComponent, long>(message.GateSessionId); await unit.AddComponent <ActorComponent, IEntityActorHandler>(new MapUnitEntityActorHandler()).AddLocation(); //Game.Scene.GetComponent<UnitComponent>().Add(unit); Unit[] units = matchroom.unitComponent.GetAll(); response.UnitIds = new long[units.Length]; for (int i = 0; i < units.Length; i++) { response.UnitIds[i] = units[i].Id; } Response_RankList retRankList = new Response_RankList(); Actor_CreateUnits actorCreateUnits = new Actor_CreateUnits(); int tmpScore = 100; foreach (Unit u in units) { actorCreateUnits.Units.Add(new UnitInfo() { UnitId = u.Id, X = (int)(u.Position.X * 1000), Z = (int)(u.Position.Z * 1000) }); retRankList.Units.Add(new RankInfo() { Id = u.Id, name = "张三", score = tmpScore }); tmpScore -= 5; } Log.Debug($"{MongoHelper.ToJson(actorCreateUnits)}"); MessageHelper.Broadcast(actorCreateUnits, units); MessageHelper.Broadcast(retRankList, units); if (matchroom.Frame > 0) { response.AgoFrameMessage = matchroom.cacheFrameMessage; response.AgoFrameMessage.Frame = matchroom.Frame; } reply(response); } catch (Exception e) { ReplyError(response, e, reply); } }
public void StartPreparingForPlay() { // Debug.Log(PlayerPrefs.GetString("GameType")); if(PlayerPrefs.GetString("GameType","Single") == "Network") { Network.Disconnect(); } this.matchRoom = GameObject.FindObjectOfType(typeof(MatchRoom)) as MatchRoom; this.playingRoomIndex = this.matchRoom.GetComponent<Room>().roomIndex; this.playingPlayerNumber = this.matchRoom.transform.GetChildCount(); this.playingMapID = this.matchRoom.matchMap; this.playingMatchType = this.matchRoom.matchType; this.playingGUPID = this.playerInfo.GUPID; this.playingPlayerID = this.playerInfo.playerID; this.playingPlayerCarID = this.playerInfo.GetComponent<CarInsanityPlayer>().selectedCar.ID; this.playingCarID = this.playerInfo.GetComponent<CarInsanityPlayer>().selectedCar.carID; this.playingPlayerName = this.playerInfo.playerName; this.playingIsAI = Convert.ToInt32(this.playerInfo.isAI); if(this.playerInfo.GUPID == this.matchRoom.GetComponent<Room>().creator.GUPID) { this.playingIsCreator = 1; }else{ this.playingIsCreator = 0; } StartCoroutine(LoadLevelWithProgress(((Definition.eSceneID)this.playingMapID).ToString())); StartCoroutine(CountingElapsedTime()); //Debug.Log("StartPreparingForPlay"); }
public void AutoMatchStart(int matchFilterMap, int matchFilterMaxPlayerNumber) { if(PlayerPrefs.GetString("GameType", "Single") == "Network") { networkView.RPC("SendToGameLobby_AutoMatch", RPCMode.Server, this.playerInfo.GUPID, matchFilterMap, matchFilterMaxPlayerNumber); } else { matchRoom = CreateMatchRoom(0, "Single", 4, matchFilterMap, "Single", this.playerInfo); lobbyController.EnteredMatchRoom(); JoinMatchRoom(0, "Single", matchFilterMap, "Single", 4, 0, "player", 0, "player", 0); // string carList = PlayerPrefs.GetString("CarList", "0:0:1:POLICE_CAR, 0:0:3:AMBULANCE, 0:0:2:LORRY_TRUCK, 0:0:4:FIRE_FIGHTING_TRUCK, 0:0:5:GARBAGE_TRUCK"); string carList = PlayerPrefs.GetString("OwnedCarList", "0:0:1:POLICE_CAR:0, 0:0:3:AMBULANCE:0, 0:0:2:LORRY_TRUCK:0, 0:0:4:FIRE_FIGHTING_TRUCK:0, 0:0:5:GARBAGE_TRUCK:0"); string[] carListArray = carList.Split(','); allCarInsanityCarInfo = new List<CarInsanityCarInfo>(); foreach(string carInfo in carListArray) { if(carInfo != ""){ string[] carInfoArray = carInfo.Split(':'); CarInsanityCarInfo c = new CarInsanityCarInfo(); c.ID = Convert.ToInt32(carInfoArray[0]); //ID c.playerID = Convert.ToInt32(carInfoArray[1]); //Player_ID c.carID = Convert.ToInt32(carInfoArray[2]); //Car_ID c.name = carInfoArray[3]; //name c.isTalentOpened = Convert.ToBoolean(Convert.ToInt32(carInfoArray[4])); //isTalentOpened allCarInsanityCarInfo.Add(c); } } for(int i = 1; i < 4; i++) { JoinMatchRoom(0, "Single", matchFilterMap, "Single", 4, i, "AI" + i.ToString(), 0, "player", 1); this.matchRoom.GetCarInsanityPlayer(i).selectedCar = allCarInsanityCarInfo[UnityEngine.Random.Range(0, allCarInsanityCarInfo.Count)]; } } }
public MatchRoom CreateMatchRoom(int roomIndex, string roomName, int maxPlayerNumber, int matchMap, string matchType, GameUserPlayer creator) { matchRoom = GameObject.Instantiate(matchRoomPrefab, Vector3.zero, Quaternion.identity) as MatchRoom; matchRoom.matchMap = matchMap; matchRoom.matchType = matchType; matchRoom.GetComponent<Room>().roomIndex = roomIndex; matchRoom.GetComponent<Room>().roomName = roomName; matchRoom.GetComponent<Room>().maxPlayerNumber = maxPlayerNumber; matchRoom.GetComponent<Room>().creator = creator; matchRoom.name = matchRoom.GetComponent<Room>().roomIndex.ToString(); matchRoom.transform.parent = gameObject.transform; return matchRoom; }
//添加亲友圈房间房间 public static void AddFriendsCircleRoom(this MatchRoomComponent matchRoomComponent, MatchRoom matchRoom) { if (matchRoom.FriendsCircleId != 0) { if (matchRoomComponent.FriendsCircleInMatchRoomDic.ContainsKey(matchRoom.FriendsCircleId)) { matchRoomComponent.FriendsCircleInMatchRoomDic[matchRoom.FriendsCircleId].Add(matchRoom); } else { matchRoomComponent.FriendsCircleInMatchRoomDic[matchRoom.FriendsCircleId] = new List <MatchRoom>() { matchRoom }; } } }
//亲友房间结束 public static void DestroyFriendsCircleRoom(this MatchRoomComponent matchRoomComponent, MatchRoom matchRoom) { if (matchRoom.FriendsCircleId != 0) { if (matchRoomComponent.FriendsCircleInMatchRoomDic.ContainsKey(matchRoom.FriendsCircleId)) { if (matchRoomComponent.FriendsCircleInMatchRoomDic[matchRoom.FriendsCircleId].Contains(matchRoom)) { matchRoomComponent.FriendsCircleInMatchRoomDic[matchRoom.FriendsCircleId].Remove(matchRoom); } } } }
public void JoinMatchRoom(int roomIndex, string roomName, int matchMap, string matchType, int maxPlayerNumber, int joinerGUPID, string joinerName, int creatorGUPID, string creatorName, int isAI) { //lobby sends data of all player that in the match GameUserPlayer joiner = GameObject.Instantiate(playerPrefab, Vector3.zero, Quaternion.identity) as GameUserPlayer; joiner.GUPID = joinerGUPID; joiner.playerName = joinerName; joiner.isAI = Convert.ToBoolean(isAI); Transform roomTransform = transform.Find(roomIndex.ToString()); if(roomTransform == null) { // Debug.Log ("matchRoom == null"); GameUserPlayer creator = GameObject.Instantiate(playerPrefab, Vector3.zero, Quaternion.identity) as GameUserPlayer; joiner.GUPID = creatorGUPID; joiner.playerName = creatorName; joiner.isAI = false; matchRoom = CreateMatchRoom(roomIndex, roomName, maxPlayerNumber, matchMap, matchType, creator); } if(!this.matchRoom.GetComponent<Room>().IsPlayerInRoom(joinerGUPID)) { this.matchRoom.PlayerJoin(joiner); joiner.transform.parent = matchRoom.transform; if(this.matchRoom.IsFull()) { StartCoroutine("StartCountDown"); if(PlayerPrefs.GetString("GameType", "Single") == "Network") { //if i m a creator, random choose a car for AI if(this.matchRoom.GetComponent<Room>().IsCreator(this.playerInfo.GUPID)) { foreach(GameUserPlayer u in this.matchRoom.GetComponent<Room>().playersInRoom) { if(u.isAI) { int randomCarForAI = UnityEngine.Random.Range(1, carAvailableKeyList.Count+1); networkView.RPC("SendToGameLobby_CarSelect", RPCMode.Server, this.matchRoom.GetComponent<Room>().roomIndex, u.GUPID, randomCarForAI, 0); } } } } } }else{ // Debug.Log("Player "+joinerName+" is in the room"); } }
public void ReceiveByClientPortal_CreateMatchRoom(int gupid, int roomIndex, string roomName, int maxPlayerNumber, int gameMap, string matchType, int p) { Definition.RPCProcessState resultState = (Definition.RPCProcessState)p; if(resultState == Definition.RPCProcessState.SUCCESS) { if(this.playerInfo.GUPID == gupid) { matchRoom = CreateMatchRoom(roomIndex, roomName, maxPlayerNumber, gameMap, matchType, this.playerInfo); lobbyController.EnteredMatchRoom(); }else{ // this.errorMsg = "FAIL. You are not the correct member."; // Debug.Log(errorMsg); lobbySceneViewer.CreateMatchErrorSceneSetting(); } }else if(resultState == Definition.RPCProcessState.UNAVAILABLE){ // this.errorMsg = "UNAVAILABLE"; // Debug.Log(errorMsg); lobbySceneViewer.CreateMatchErrorSceneSetting(); }else if(resultState == Definition.RPCProcessState.PLAYERNOTEXIST){ // this.errorMsg = "PLAYERNOTEXIST"; // Debug.Log(errorMsg); lobbySceneViewer.CreateMatchErrorSceneSetting(); }else{ // Debug.Log(p.ToString()); lobbySceneViewer.CreateMatchErrorSceneSetting(); } }
//游戏通知匹配服开始游戏了 public static void GameServeStartGame(this MatchRoom matchRoom, long serveRoomActorId) { matchRoom.IsGameBeing = true;//状态改为在游戏中 matchRoom.GameServeRoomActorId = serveRoomActorId; }
//检测可不可以开始游戏 public static bool DetetionMayStartGame(this MatchRoom matchRoom) { return(matchRoom.PlayerInfoDic.Count == matchRoom.RoomConfig.GameNumber); }
public static void GameServerStartGame(this MatchRoom matchRoom, long serverRoomAId) { matchRoom.IsInGame = true; matchRoom.GameServeRoomActorId = serverRoomAId; }