public List <BatchData> GetBatch() { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(HttpContext.Current.Server.MapPath("../../Data/Batchs.xml")); List <BatchData> data = new List <BatchData>(); foreach (XmlNode BatchNode in xmlDoc.SelectNodes("Batches/batch")) { string Code = BatchNode.SelectSingleNode("Code").InnerText; string Name = BatchNode.SelectSingleNode("Name").InnerText; data.Add(new BatchData(Code, Name)); } return(data); }
void UpdateGravityParticles(float dt) { if (IsActive && EmissionRate > 0) { float rate = 1.0f / EmissionRate; //issue #1201, prevent bursts of particles, due to too high emitCounter if (ParticleCount < TotalParticles) { EmitCounter += dt; } while (ParticleCount < TotalParticles && EmitCounter > rate) { InitParticle(ref GravityParticles[ParticleCount], ref GravityParticles[ParticleCount].ParticleBase); ++ParticleCount; EmitCounter -= rate; } Elapsed += dt; if (Duration != -1 && Duration < Elapsed) { StopSystem(); } } int index = 0; if (Visible) { while (index < ParticleCount) { if (UpdateParticle(ref GravityParticles[index], dt)) { // update particle counter ++index; } else { // life < 0 int currentIndex = GravityParticles[index].AtlasIndex; if (index != ParticleCount - 1) { GravityParticles[index] = GravityParticles[ParticleCount - 1]; } if (BatchNode != null) { //disable the switched particle BatchNode.DisableParticle(AtlasIndex + currentIndex); //switch indexes GravityParticles[ParticleCount - 1].AtlasIndex = currentIndex; } --ParticleCount; if (ParticleCount == 0 && AutoRemoveOnFinish) { Unschedule(); Parent.RemoveChild(this, true); return; } } } } }
public IDisposable BeginBatch() { var instance = new BatchNode(this); _nodeStack.Push(instance); return instance; }