コード例 #1
0
        public void LoadParticlesLibrary(string file)
        {
            if (file.Contains(".mwl"))
            {
                MyParticlesLibrary.Deserialize(file);
            }
            else
            {
                ProfilerShort.Begin("Verify Integrity");
                MyDataIntegrityChecker.HashInFile(file);
                MyObjectBuilder_Definitions builder = null;

                ProfilerShort.BeginNextBlock("Parse");
                MyObjectBuilderSerializer.DeserializeXML <MyObjectBuilder_Definitions>(file, out builder);

                if (builder == null || builder.ParticleEffects == null)
                {
                    return;
                }
                else
                {
                    MyParticlesLibrary.Close();
                    foreach (var classDef in builder.ParticleEffects)
                    {
                        MyParticleEffect effect = MyParticlesManager.EffectsPool.Allocate();
                        effect.DeserializeFromObjectBuilder(classDef);
                        MyParticlesLibrary.AddParticleEffect(effect);
                    }
                }

                //definitionBuilders.Add(new Tuple<MyObjectBuilder_Definitions, string>(builder, file));
                ProfilerShort.End();
            }
        }
コード例 #2
0
 public void LoadParticlesLibrary(string file)
 {
     if (file.Contains(".mwl"))
     {
         MyParticlesLibrary.Deserialize(file);
     }
     else
     {
         MyDataIntegrityChecker.HashInFile(file);
         MyObjectBuilder_Definitions objectBuilder = null;
         MyObjectBuilderSerializer.DeserializeXML <MyObjectBuilder_Definitions>(file, out objectBuilder);
         if ((objectBuilder != null) && (objectBuilder.ParticleEffects != null))
         {
             MyParticlesLibrary.Close();
             foreach (MyObjectBuilder_ParticleEffect effect in objectBuilder.ParticleEffects)
             {
                 MyParticleEffect local1 = MyParticlesManager.EffectsPool.Allocate(false);
                 local1.DeserializeFromObjectBuilder(effect);
                 MyParticlesLibrary.AddParticleEffect(local1);
             }
         }
     }
 }