Ejemplo n.º 1
0
        internal static bool IsClient(Edict edict, IEntityDictionary entityDictionary, IGlobalVars globalVars)
        {
            if (edict == null)
            {
                return(false);
            }

            var index = entityDictionary.EntityIndex(edict);

            return(0 < index && index <= globalVars.MaxClients);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes the utility code
        /// </summary>
        /// <param name="entityDictionary"></param>
        public static void Initialize(IEntityDictionary entityDictionary)
        {
            EntityDictionary = entityDictionary ?? throw new ArgumentNullException(nameof(entityDictionary));

            //Cache properties for lookup
            //Case insensitive
            EntityProperties = new Dictionary <string, PropertyInfo>(StringComparer.OrdinalIgnoreCase);

            foreach (var prop in typeof(BaseEntity).GetProperties(BindingFlags.Public | BindingFlags.Instance))
            {
                if (prop.PropertyType == typeof(string))
                {
                    EntityProperties.Add(prop.Name, prop);
                }
            }
        }
Ejemplo n.º 3
0
 public Networking(IEngineServer engineServer, IGlobalVars globals, IEngineModel engineModel, IEntityDictionary entityDictionary, ITrace trace)
 {
     EngineServer     = engineServer ?? throw new ArgumentNullException(nameof(engineServer));
     Globals          = globals ?? throw new ArgumentNullException(nameof(globals));
     EngineModel      = engineModel ?? throw new ArgumentNullException(nameof(engineModel));
     EntityDictionary = entityDictionary ?? throw new ArgumentNullException(nameof(entityDictionary));
     Trace            = trace ?? throw new ArgumentNullException(nameof(trace));
 }
Ejemplo n.º 4
0
 internal EntityDictionaryDynamicActor(IEntityDictionary <TKey, TEntity> dictionary, SyntaxOptions syntaxOptions) : base(dictionary, syntaxOptions)
 {
     _dictionary = dictionary;
     //TODO iterate over T properties and fill Expando property and Directory
 }
Ejemplo n.º 5
0
 public EntityRegistry(IEntityDictionary entityDictionary)
 {
     EntityDictionary = entityDictionary ?? throw new ArgumentNullException(nameof(entityDictionary));
 }
Ejemplo n.º 6
0
 public ServerInterface(IGlobalVars globals, IEntityDictionary entityDictionary)
 {
     Globals          = globals ?? throw new ArgumentNullException(nameof(globals));
     EntityDictionary = entityDictionary ?? throw new ArgumentNullException(nameof(entityDictionary));
 }
Ejemplo n.º 7
0
 internal EntitySubjectDictionaryActor(IEntityDictionary <TKey, IEntitySubject <TValue> > dictionary) => _dictionary = dictionary;
Ejemplo n.º 8
0
 public static IDictionary <TKey, TValue> AsValueDictionary <TKey, TValue>(this IEntityDictionary <TKey, IEntitySubject <TValue> > dictionary) => new EntitySubjectDictionaryActor <TKey, TValue>(dictionary);