예제 #1
0
        /// <inheritdoc />
        public bool TryGetOnlinePlayerById(string id, out IPlayer output)
        {
            IEnumerable <EcoPlayer> players = OnlinePlayers.Cast <EcoPlayer>();

            EcoPlayer player = players.FirstOrDefault(x => x.Id.Equals(id));

            output = player;

            return(player != null);
        }
예제 #2
0
        /// <inheritdoc />
        public bool TryGetOnlinePlayerByName(string name, out IPlayer output)
        {
            IEnumerable <EcoPlayer> players = OnlinePlayers.Cast <EcoPlayer>();

            EcoPlayer player = players.FirstOrDefault(x => x.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase))
                               ?? players.FirstOrDefault(x => x.Name.ComparerContains(name));

            output = player;

            return(player != null);
        }
예제 #3
0
        /// <inheritdoc />
        public IUserInfo GetUser(string id)
        {
            if (TryGetOnlinePlayerById(id, out IPlayer p))
            {
                return(p.GetUser());
            }

            p = new EcoPlayer(id, this, container);
            InternalPlayersList.Add((EcoPlayer)p);

            return(p.GetUser());
        }