Пример #1
0
        //---------------------------------------------------------------------
        public void destroy()
        {
            if (mEntityFactory != null)
            {
                mEntityFactory = null;
            }

            if (mParticleSystemDataPrototype != null)
            {
                mParticleSystemDataPrototype = null;
            }

            if (mRouteObjectMgr != null)
            {
                mRouteObjectMgr = null;
            }

            if (mParticleSystemFactory != null)
            {
                mParticleSystemFactory.destroy();
                mParticleSystemFactory = null;
            }

            if (mParticleSystemKeeper != null)
            {
                mParticleSystemKeeper.destroy();
                mParticleSystemKeeper = null;
            }

            if (mBaseEntityKeeper != null)
            {
                mBaseEntityKeeper.destroy();
                mBaseEntityKeeper = null;
            }
        }
 /// <summary>
 /// Constructs a new instance of <see cref="MemoryVariableList{T,D}"/>.
 /// </summary>
 /// <param name="dataSet">
 /// The <see cref="DataSet"/> being created.
 /// </param>
 /// <param name="reader">
 /// Reader connected to the source data structure and positioned to
 /// start reading.
 /// </param>
 /// <param name="entityFactory">
 /// Used to create new instances of the entity.
 /// </param>
 public MemoryVariableList(
     D dataSet,
     Reader reader,
     BaseEntityFactory <T, D> entityFactory)
     : base(dataSet, reader, entityFactory)
 {
 }
Пример #3
0
 /// <summary>
 /// Constructs a new instance of <see cref="BaseList{T}"/> ready to read entities from
 /// the source.
 /// </summary>
 /// <param name="dataSet">Dataset being created</param>
 /// <param name="reader">Reader used to initialise the header only</param>
 /// <param name="entityFactory">Used to create new instances of the entity</param>
 internal FixedList(
     DataSet dataSet,
     Reader reader,
     BaseEntityFactory <T> entityFactory)
     : base(dataSet, reader, entityFactory)
 {
 }
Пример #4
0
 /// <summary>
 /// Constructs a new instance of <see cref="MemoryBaseList{T}"/>.
 /// The Read method needs to be called following construction to read
 /// all the entities which form the list before the list can be used.
 /// </summary>
 /// <param name="dataSet">
 /// Dataset being created.
 /// </param>
 /// <param name="reader">
 /// Reader used to initialise the header only.
 /// </param>
 /// <param name="entityFactory">
 /// Used to create new instances of the entity.
 /// </param>
 internal MemoryBaseList(DataSet dataSet, Reader reader, BaseEntityFactory <T> entityFactory)
 {
     Header        = new Header(reader);
     _array        = new T[Header.Count];
     _dataSet      = dataSet;
     EntityFactory = entityFactory;
 }
Пример #5
0
 /// <summary>
 /// Constructs a new instance of <see cref="MemoryVariableList{T}"/>
 /// </summary>
 /// <param name="dataSet">The <see cref="DataSet"/> being created</param>
 /// <param name="reader">Reader connected to the source data structure and positioned to start reading</param>
 /// <param name="entityFactory">Used to create new instances of the entity</param>
 internal MemoryVariableList(
     DataSet dataSet,
     Reader reader,
     BaseEntityFactory <T> entityFactory)
     : base(dataSet, reader, entityFactory)
 {
 }
Пример #6
0
 public LruEntityLoader(Header header, D dataset,
                        BaseEntityFactory <V, D> entityFactory, LruCache <int, V> cache)
     : base(header, dataset, entityFactory)
 {
     _cache = cache;
     _cache.SetValueLoader(new EntityLoader <V, D>(header, dataset, entityFactory));
 }
 /// <summary>
 /// Constructs a new instance of <see cref="VariableList{T, D}"/>.
 /// </summary>
 /// <param name="dataSet">
 /// The <see cref="DataSet"/> being created.
 /// </param>
 /// <param name="reader">
 /// Reader connected to the source data structure and positioned to
 /// start reading.
 /// </param>
 /// <param name="entityFactory">
 /// Used to create new instances of the entity.
 /// </param>
 /// <param name="cacheSize">
 /// Number of items in list to have capacity to cache.
 /// </param>
 public VariableList(
     D dataSet,
     Reader reader,
     BaseEntityFactory <T, D> entityFactory,
     int cacheSize)
     : base(dataSet, reader, entityFactory, cacheSize)
 {
 }
Пример #8
0
 /// <summary>
 /// Constructs a new instance of <see cref="BaseList{T,D}"/> ready to
 /// read entities from the source.
 /// </summary>
 /// <param name="dataSet">
 /// <see cref="DataSet"/> being created.
 /// </param>
 /// <param name="reader">
 /// Reader used to initialise the header only.
 /// </param>
 /// <param name="entityFactory">
 /// Used to create new instances of the entity.
 /// </param>
 /// <param name="cacheSize">
 /// Number of items in list to have capacity to cache.
 /// </param>
 internal CacheList(
     D dataSet,
     Reader reader,
     BaseEntityFactory <T, D> entityFactory,
     int cacheSize) : base(dataSet, reader, entityFactory)
 {
     _cache = new Cache <T>(cacheSize, this);
 }
Пример #9
0
 /// <summary>
 /// Constructs a new instance of <see cref="VariableList{T}"/>
 /// </summary>
 /// <param name="dataSet">The <see cref="DataSet"/> being created</param>
 /// <param name="reader">Reader connected to the source data structure and positioned to start reading</param>
 /// <param name="entityFactory">Used to create new instances of the entity</param>
 /// <param name="cacheSize">Number of items in list to have capacity to cache</param>
 internal VariableList(
     DataSet dataSet,
     Reader reader,
     BaseEntityFactory <T> entityFactory,
     int cacheSize)
     : base(dataSet, reader, entityFactory, cacheSize)
 {
 }
Пример #10
0
 /// <summary>
 /// Constructs a new instance of <see cref="BaseList{T,D}"/> ready to
 /// read entities from the source.
 /// </summary>
 /// <param name="dataSet">
 /// Dataset being created.
 /// </param>
 /// <param name="reader">
 /// Reader used to initialise the header only.
 /// </param>
 /// <param name="entityFactory">
 /// Used to create new instances of the entity.
 /// </param>
 internal BaseList(
     D dataSet,
     Reader reader,
     BaseEntityFactory <T, D> entityFactory)
 {
     _dataSet      = dataSet;
     Header        = new Header(reader);
     EntityFactory = entityFactory;
 }
Пример #11
0
 /// <summary>
 /// Constructs a new instance of <see cref="FixedCacheList{T}"/>
 /// </summary>
 /// <param name="dataSet">The <see cref="DataSet"/> being created</param>
 /// <param name="reader">Reader connected to the source data structure and positioned to start reading</param>
 /// <param name="entityFactory">Used to create new instances of the entity</param>
 /// <param name="cacheSize">Number of items in list to have capacity to cache</param>
 internal FixedCacheList(
     DataSet dataSet,
     Reader reader,
     BaseEntityFactory <T> entityFactory,
     int cacheSize)
     : base(dataSet, reader, entityFactory)
 {
     _cache = new Cache <T>(cacheSize);
 }
Пример #12
0
        //---------------------------------------------------------------------
        public EntityParticleSystem create(BaseFishLordMgr fish_lord_mgr, BaseEntityFactory factory,
            EntityParticleSystemData fish_lord_data, int fish_begin_id, List<string> server_param, RouteObjectMgr route_object_mgr)
        {
            mFishLordMgr = fish_lord_mgr;
            mBaseEntityFactory = factory;
            mSurvivalTime = fish_lord_data.mFishLordCommonData.mDestroyTime;

            mParticleSystemEntityKeeper = new ParticleSystemEntityKeeper();
            mGeneratorAndAffectorKeeper = new GeneratorAndAffectorKeeper(fish_lord_mgr, this, factory, fish_lord_data, fish_begin_id, server_param, route_object_mgr);

            return this;
        }
Пример #13
0
        //---------------------------------------------------------------------
        public EntityParticleSystem create(BaseFishLordMgr fish_lord_mgr, BaseEntityFactory factory,
                                           EntityParticleSystemData fish_lord_data, int fish_begin_id, List <string> server_param, RouteObjectMgr route_object_mgr)
        {
            mFishLordMgr       = fish_lord_mgr;
            mBaseEntityFactory = factory;
            mSurvivalTime      = fish_lord_data.mFishLordCommonData.mDestroyTime;

            mParticleSystemEntityKeeper = new ParticleSystemEntityKeeper();
            mGeneratorAndAffectorKeeper = new GeneratorAndAffectorKeeper(fish_lord_mgr, this, factory, fish_lord_data, fish_begin_id, server_param, route_object_mgr);

            return(this);
        }
        //---------------------------------------------------------------------
        public GeneratorAndAffectorKeeper(
            BaseFishLordMgr fish_lord_mgr, EntityParticleSystem fish_lord, BaseEntityFactory factory,
            EntityParticleSystemData fish_lord_data, int fish_begin_id, List <string> server_param, RouteObjectMgr route_object_mgr)
        {
            mFishLordMgr = fish_lord_mgr;

            int fish_id = fish_begin_id;

            int generator_id = 0;

            foreach (var it in fish_lord_data.mListBaseGenerator)
            {
                EntityGenerator generator = mFishLordMgr.buildGenerator(it, server_param, route_object_mgr);
                generator.setBaseFishLord(fish_lord);
                generator.setBaseGeneratorId(generator_id);

                generator.setBeginFishId(fish_id);
                fish_id += it.getBaseEntityCount();

                if (generator == null)
                {
                    continue;
                }
                mListBaseGenerator.Add(generator);

                generator_id++;
            }

            foreach (var it in fish_lord_data.mListBaseAffector)
            {
                EntityAffector affector = mFishLordMgr.buildAffector(it);
                if (affector == null)
                {
                    continue;
                }
                affector.setBaseFishLord(fish_lord);
                mListBaseAffector.Add(affector);
            }

            foreach (var it in fish_lord_data.mGeneratorAffectorMap)
            {
                if (mListBaseAffector.Count > it.mAffectorIndex && mListBaseGenerator.Count > it.mGeneratorIndex)
                {
                    mListBaseAffector[it.mAffectorIndex].setGeneratorId(it.mGeneratorIndex);
                }
            }

            foreach (var it in mListBaseGenerator)
            {
                it.create();
            }
        }
Пример #15
0
 /// <summary>
 /// Create the EntityLoader
 /// </summary>
 /// <param name="header">
 /// The header for this group of entities
 /// </param>
 /// <param name="dataset">
 /// The dataset the entities belong to
 /// </param>
 /// <param name="entityFactory">
 /// The entity factory used to create the entities
 /// </param>
 public EntityLoader(Header header, D dataset,
                     BaseEntityFactory <V, D> entityFactory)
 {
     _dataset       = dataset;
     _entityFactory = entityFactory;
     _header        = header;
     try
     {
         GetEntityFactory().GetLength();
         _fixedLength = true;
     }
     catch (NotImplementedException)
     {
         // expected for variable length entities
     }
 }
Пример #16
0
        //---------------------------------------------------------------------
        public GeneratorAndAffectorKeeper(
            BaseFishLordMgr fish_lord_mgr, EntityParticleSystem fish_lord, BaseEntityFactory factory,
            EntityParticleSystemData fish_lord_data, int fish_begin_id, List<string> server_param, RouteObjectMgr route_object_mgr)
        {
            mFishLordMgr = fish_lord_mgr;

            int fish_id = fish_begin_id;

            int generator_id = 0;
            foreach (var it in fish_lord_data.mListBaseGenerator)
            {
                EntityGenerator generator = mFishLordMgr.buildGenerator(it, server_param, route_object_mgr);
                generator.setBaseFishLord(fish_lord);
                generator.setBaseGeneratorId(generator_id);

                generator.setBeginFishId(fish_id);
                fish_id += it.getBaseEntityCount();

                if (generator == null) continue;
                mListBaseGenerator.Add(generator);

                generator_id++;
            }

            foreach (var it in fish_lord_data.mListBaseAffector)
            {
                EntityAffector affector = mFishLordMgr.buildAffector(it);
                if (affector == null) continue;
                affector.setBaseFishLord(fish_lord);
                mListBaseAffector.Add(affector);
            }

            foreach (var it in fish_lord_data.mGeneratorAffectorMap)
            {
                if (mListBaseAffector.Count > it.mAffectorIndex && mListBaseGenerator.Count > it.mGeneratorIndex)
                {
                    mListBaseAffector[it.mAffectorIndex].setGeneratorId(it.mGeneratorIndex);
                }
            }

            foreach (var it in mListBaseGenerator)
            {
                it.create();
            }
        }
Пример #17
0
        //---------------------------------------------------------------------
        public void destroy()
        {
            if (mEntityFactory != null)
            {
                mEntityFactory = null;
            }

            if (mParticleSystemDataPrototype != null)
            {
                mParticleSystemDataPrototype = null;
            }

            if (mRouteObjectMgr != null)
            {
                mRouteObjectMgr = null;
            }

            if (mParticleSystemFactory != null)
            {
                mParticleSystemFactory.destroy();
                mParticleSystemFactory = null;
            }

            if (mParticleSystemKeeper != null)
            {
                mParticleSystemKeeper.destroy();
                mParticleSystemKeeper = null;
            }

            if (mBaseEntityKeeper != null)
            {
                mBaseEntityKeeper.destroy();
                mBaseEntityKeeper = null;
            }
        }
Пример #18
0
 //---------------------------------------------------------------------
 public BaseFishLordMgr(BaseEntityFactory factory, ParticleSystemFactory fish_lord_factory)
 {
     mEntityFactory         = factory;
     mParticleSystemFactory = fish_lord_factory;
 }
 /// <summary>
 /// Constructs a new instance of <see cref="PropertiesList"/>
 /// </summary>
 /// <param name="dataSet">
 /// The <see cref="DataSet"/> being created.
 /// </param>
 /// <param name="reader">
 /// Reader connected to the source data structure and positioned to
 /// start reading.
 /// </param>
 /// <param name="entityFactory">
 /// Used to create new instances of the entity.
 /// </param>
 internal PropertiesList(DataSet dataSet, Reader reader, BaseEntityFactory <Property, DataSet> entityFactory)
     : base(dataSet, reader, entityFactory)
 {
 }
Пример #20
0
 //---------------------------------------------------------------------
 public BaseFishLordMgr(BaseEntityFactory factory, ParticleSystemFactory fish_lord_factory)
 {
     mEntityFactory = factory;
     mParticleSystemFactory = fish_lord_factory;
 }
Пример #21
0
 public CachedEntityLoader(Header header, D dataset,
                           BaseEntityFactory <V, D> entityFactory, IPutCache <int, V> cache)
     : base(header, dataset, entityFactory)
 {
     _cache = cache;
 }