Beispiel #1
0
 /// <summary>
 /// Проверка является ли сущность игровым персонажем
 /// </summary>
 /// <param name="playerId"></param>
 /// <returns></returns>
 public static bool IsPlayer(long playerId)
 {
     return(PlayerUtils.GetPlayerIdentity(playerId) != null);
 }
Beispiel #2
0
 /// <summary>
 /// Получение обьекта сущности игрока в мире игры (через апи торча (лучше чем через апи игры так как можно расщирить))
 /// </summary>
 /// <param name="identityId"></param>
 /// <returns></returns>
 public static MyIdentity GetPlayerIdentity(long identityId)
 {
     return(((IEnumerable <MyIdentity>)PlayerUtils.GetAllPlayerIdentities()).Where <MyIdentity>((Func <MyIdentity, bool>)(c => c.IdentityId == identityId)).FirstOrDefault <MyIdentity>());
 }
Beispiel #3
0
        /// <summary>
        /// Получение имени игрока по его ID
        /// </summary>
        /// <param name="playerId"></param>
        /// <returns></returns>
        public static string GetPlayerNameById(long playerId)
        {
            MyIdentity identityById = PlayerUtils.GetIdentityById(playerId);

            return(identityById != null ? identityById.DisplayName : "Nobody");
        }