public static async Task <FiveStarPlayer> Create(MatchPlayerInfo matchPlayerInfo, FiveStarRoom fiveStarRoom) { try { FiveStarPlayer fiveStarPlayer = ComponentFactory.Create <FiveStarPlayer>(); fiveStarPlayer.FiveStarRoom = fiveStarRoom; fiveStarPlayer.SeatIndex = matchPlayerInfo.SeatIndex; fiveStarPlayer.IsAI = matchPlayerInfo.IsAI; fiveStarPlayer.IsCollocation = fiveStarPlayer.IsAI;//如果是AI默认就是托管状态 fiveStarPlayer.User = matchPlayerInfo.User; fiveStarPlayer.User.AddComponent <UserGateActorIdComponent>().ActorId = matchPlayerInfo.SessionActorId; if (fiveStarRoom.RoomType == RoomType.Match) { fiveStarPlayer.NowScore = (int)fiveStarPlayer.User.Beans; } await fiveStarPlayer.AddComponent <MailBoxComponent>().AddLocation(); return(fiveStarPlayer); } catch (Exception e) { Log.Error(e); throw; } }