Example #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();
            }
        }
Example #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);
             }
         }
     }
 }
Example #3
0
 public void LoadParticlesLibrary(string file)
 {
     MyParticlesLibrary.Deserialize(file);
 }
Example #4
0
 public void LoadParticlesLibrary(string file)
 {
     // Before Loading Particles Library the definitions need to initialized first!
     MyDefinitionManager.Static.LoadData(new List <Sandbox.Common.ObjectBuilders.MyObjectBuilder_Checkpoint.ModItem>());
     MyParticlesLibrary.Deserialize(file);
 }