Exemple #1
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();
            }
        }
Exemple #3
0
        //---------------------------------------------------------------------
        public void addParticleSystem(string file_name, List <string> server_param, int fish_begin_id)
        {
            EntityParticleSystemData lord_data = mParticleSystemDataPrototype.cloneParticleSystemData(file_name);

            if (lord_data == null)
            {
                EbLog.Warning("ParticleSystem::Add::Error::" + file_name);
                return;
            }

            mParticleSystemKeeper.addParticleSystem(
                new EntityParticleSystem().create(this, mEntityFactory, lord_data, fish_begin_id, server_param, mRouteObjectMgr));
        }
        //---------------------------------------------------------------------
        public ParticleSystemDataPrototype(List <JsonPacket> json_packet_list, ParticleSystemFactory factory)
        {
            mParticleSystemFactory = factory;

            foreach (var json_packet in json_packet_list)
            {
                // 根据Json字符串来生成BaseFishLordData
                BaseFishLordDataJson     fish_lord_json = BaseJsonSerializer.deserialize <BaseFishLordDataJson>(json_packet.JsonString);
                EntityParticleSystemData fish_lord      = new EntityParticleSystemData();

                // 根据Json字符串来生成
                fish_lord.mFishLordCommonData = BaseJsonSerializer.deserialize <FishLordCommonData>
                                                    (fish_lord_json.mFishLordCommonDataString);

                // 根据Json字符串来生成BaseGeneratorData
                foreach (var it in fish_lord_json.mListBaseGenerator)
                {
                    EntityGeneratorData generator_data = mParticleSystemFactory.buildGeneratorData(it);
                    if (generator_data == null)
                    {
                        continue;
                    }
                    fish_lord.mListBaseGenerator.Add(generator_data);
                }

                // 根据Json字符串来生成BaseAffectorData
                foreach (var it in fish_lord_json.mListBaseAffector)
                {
                    EntityAffectorData affector_data = mParticleSystemFactory.buildAffectorData(it);
                    if (affector_data == null)
                    {
                        continue;
                    }
                    fish_lord.mListBaseAffector.Add(affector_data);
                }

                // 读出特效发射器和影响器的映射表。
                fish_lord.mGeneratorAffectorMap = BaseJsonSerializer.deserialize <List <GeneratorAffectorkeyValuePair> >
                                                      (fish_lord_json.mGeneratorAffectorMapString);

                mDicBaseFishLordDataPrototype.Add(json_packet.FileName.Substring(json_packet.FileName.LastIndexOf("/") + 1), fish_lord);
            }
        }
Exemple #5
0
        //---------------------------------------------------------------------
        public EntityParticleSystemData clone()
        {
            EntityParticleSystemData data = new EntityParticleSystemData();

            data.mFishLordCommonData = mFishLordCommonData.clone();

            foreach (var it in mListBaseGenerator)
            {
                data.mListBaseGenerator.Add(it.clone());
            }

            foreach (var it in mListBaseAffector)
            {
                data.mListBaseAffector.Add(it.clone());
            }

            foreach (var it in mGeneratorAffectorMap)
            {
                data.mGeneratorAffectorMap.Add(it.clone());
            }

            return(data);
        }