//--------------------------------------------------------------------- public BaseFishLordDataJson getJson() { BaseFishLordDataJson json_data = new BaseFishLordDataJson(); json_data.mFishLordCommonDataString = BaseJsonSerializer.serialize(mFishLordCommonData); foreach (var it in mListBaseGenerator) { JsonItem json_item = new JsonItem(); json_item.mTypeName = it.GetType().ToString(); json_item.mJsonString = BaseJsonSerializer.serialize(it); json_data.mListBaseGenerator.Add(json_item); } foreach (var it in mListBaseAffector) { JsonItem json_item = new JsonItem(); json_item.mTypeName = it.GetType().ToString(); json_item.mJsonString = BaseJsonSerializer.serialize(it); json_data.mListBaseAffector.Add(json_item); } json_data.mGeneratorAffectorMapString = BaseJsonSerializer.serialize(mGeneratorAffectorMap); return(json_data); }
//--------------------------------------------------------------------- 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); } }