private void EnterMap() { MapHelper.EnterMapAsync().Coroutine(); Game.EventSystem.Run(EventIdType.EnterMainLobbyFinish); }
/// <summary> /// 准备开始游戏 /// </summary> /// <param name="self"></param> public static void ReadyStartGame(this GameControllerComponent self) { Room room = self.GetParent <Room>(); Gamer[] gamers = room.GetAll(); //房间内有3名玩家且全部准备则开始游戏 if (room.Count == 3 && gamers.Where(g => g.IsReady).Count() == 3) { //同步匹配服务器开始游戏 room.State = RoomState.Game; MapHelper.SendMessage(new MP2MH_SyncRoomState_Ntt() { RoomID = room.Id, State = room.State }); //初始玩家开始状态 foreach (var _gamer in gamers) { if (_gamer.GetComponent <HandCardsComponent>() == null) { _gamer.AddComponent <HandCardsComponent>(); } _gamer.IsReady = false; } GameControllerComponent gameController = room.GetComponent <GameControllerComponent>(); //洗牌发牌 gameController.DealCards(); List <GamerCardNum> gamersCardNum = new List <GamerCardNum>(); Array.ForEach(gamers, (g) => { HandCardsComponent handCards = g.GetComponent <HandCardsComponent>(); //重置玩家身份 handCards.AccessIdentity = Identity.None; //记录玩家手牌数 gamersCardNum.Add(new GamerCardNum() { UserID = g.UserID, Num = g.GetComponent <HandCardsComponent>().GetAll().Length }); }); //发送玩家手牌和其他玩家手牌数 foreach (var _gamer in gamers) { ActorMessageSender actorProxy = _gamer.GetComponent <UnitGateComponent>().GetActorMessageSender(); actorProxy.Send(new Actor_GameStart_Ntt() { HandCards = _gamer.GetComponent <HandCardsComponent>().GetAll(), GamersCardNum = gamersCardNum }); } //随机先手玩家 gameController.RandomFirstAuthority(); Log.Info($"房间{room.Id}开始游戏"); } }
private void EnterMap() { //异步进入Map MapHelper.EnterMapAsync().Coroutine(); }
private void EnterMapAsync() { ETModel.Game.EventSystem.Run(ETModel.EventIdType.ShowLoadingUI); MapHelper.EnterMapAsync().Coroutine(); }