protected override sealed void Process(UpdateContext updateContext, ReadOnlyBag<Entity> entities)
 {
     for (int i = 0; i < entities.Count; i++)
     {
         this.Process(updateContext, entities[i]);
     }
 }
Пример #2
0
        public override void Update(UpdateContext updateContext)
        {
            base.Update(updateContext);
#if WINDOWS
            if (_area.Contains(updateContext.InputState.MousePosition) && updateContext.InputState.WasMouseButtonPressed(MouseButton.Left) && updateContext.InputState.IsMouseButtonReleased(MouseButton.Left))
            {
                this.OnClickInner();
            }
#elif WINDOWS_PHONE
            bool isTapped = false;

            // Use Tap-gesture if it is enabled
            if (TouchPanel.EnabledGestures.ContainsFlag(GestureType.Tap))
            {
                isTapped = updateContext.InputState.HasGesture(GestureType.Tap, base.Area.ToRectangle());
            }
            else if (updateContext.InputState.IsTouchAt(base.Area.ToRectangle(), TouchLocationState.Released))
            {
                isTapped = true;
            }

            if (isTapped)
            {
                this.OnClickInner();
            }
#endif
        }
        public sealed override void Update(UpdateContext updateContext)
        {
            long currentMemory = GC.GetTotalMemory(false);
            _elapsedTime += TimeSpan.FromTicks(updateContext.GameTime.DeltaTicks);
            if (_elapsedTime > DebugInformationComponent.UpdateFrequency)
            {
                _elapsedTime -= DebugInformationComponent.UpdateFrequency;
                _frameRate = _frameCounter;
                _frameCounter = 0;

                this.FPS = (int)(_frameRate / UpdateFrequency.TotalSeconds);

                // Memory
                int newKilobytesPerSecond = (int)((currentMemory - _previousKilobytes) / DebugInformationComponent.UpdateFrequency.TotalSeconds / 1024);
                if (newKilobytesPerSecond >= 0)
                {
                    _newKilobytesPerSecond = newKilobytesPerSecond;
                }
                _previousKilobytes = currentMemory;
            }

            // GC
            if (currentMemory < _previousMemory)
            {
                _garbageCollections++;
            }
            _previousMemory = currentMemory;
        }
        public override void Process(UpdateContext updateContext, ref ParticleBuffer.Iterator iterator)
        {
            Vector3 deltaColorFirst = _medianColor - _initialColor;
            Vector3 deltaColorLast = _finalColor - _medianColor;
            Particle particle = iterator.First;

            do
            {
                if (particle.Age < _median)
                {
                    float ageMultiplier = particle.Age / _median;
                    particle.Color.X = _initialColor.X + deltaColorFirst.X * ageMultiplier;
                    particle.Color.Y = _initialColor.Y + deltaColorFirst.Y * ageMultiplier;
                    particle.Color.Z = _initialColor.Z + deltaColorFirst.Z * ageMultiplier;
                }
                else
                {
                    float ageMultiplier = (particle.Age - _median) / (1f - _median);
                    particle.Color.X = _medianColor.X + deltaColorLast.X * particle.Age;
                    particle.Color.Y = _medianColor.Y + deltaColorLast.Y * particle.Age;
                    particle.Color.Z = _medianColor.Z + deltaColorLast.Z * particle.Age;
                }

            } while (iterator.MoveNext(ref particle));
        }
Пример #5
0
 public void Update(UpdateContext updateContext)
 {
     foreach (ParticleEffect particleEffect in _particleEffectsByKey.Values)
     {
         particleEffect.Update(updateContext);
     }
 }
Пример #6
0
 public void Update(UpdateContext updateContext)
 {
     if (_enabled && this.Initialized)
     {
         this.UpdateInner(updateContext);
     }
 }
Пример #7
0
 protected override void UpdateInner(UpdateContext updateContext)
 {
     if (_adManager != null)
     {
         _adManager.Update(((IXnaGameTimeProvider)updateContext).GameTime);
     }
 }
Пример #8
0
 public override void Update(UpdateContext updateContext)
 {
     if (updateContext.InputState.IsNewKeyPress(_screenshotKey) && !string.IsNullOrEmpty(_folderPath) && Directory.Exists(_folderPath))
     {
         _takeScreenshot = true;
     }
 }
Пример #9
0
 protected override void Update(UpdateContext updateContext, bool otherScreenHasFocus, bool coveredByOtherScreen)
 {
     if (updateContext.InputState.IsNewKeyPress(_actionKey) && (_canDoActionMultipleTimes || !_hasDoneAction))
     {
         _action();
     }
 }
Пример #10
0
 public override void Update(UpdateContext updateContext)
 {
     base.Update(updateContext);
     if (_needsToUpdateArea)
     {
         this.UpdateArea();
     }
 }
 protected override void Update(UpdateContext updateContext)
 {
     int toProcess = FlaiMath.Min(_maxEntitiesToProcess, _entities.Count);
     for (int i = 0; i < toProcess; i++)
     {
         this.Process(updateContext, _entities.Dequeue());
     }
 }
 public override void Process(UpdateContext updateContext, ref ParticleBuffer.Iterator iterator)
 {
     Particle particle = iterator.First;
     do
     {
         particle.Rotation = FlaiMath.GetAngle(particle.Velocity);
     } while (iterator.MoveNext(ref particle));
 }
 internal override void ExecuteModifiers(UpdateContext updateContext, ParticleModifierCollection modifiers, ref ParticleBuffer.Iterator iterator)
 {
     foreach (ParticleModifier modifier in modifiers)
     {
         modifier.Process(updateContext, ref iterator);
         iterator.Reset();
     }
 }
Пример #14
0
 protected internal override void PostUpdate(UpdateContext updateContext)
 {
     this.TimeRemaining -= updateContext.DeltaSeconds;
     if (this.TimeRemaining <= 0)
     {
         this.Entity.Delete();
     }
 }
 internal override void ExecuteModifiers(UpdateContext updateContext, ParticleModifierCollection modifiers, ref ParticleBuffer.Iterator iterator)
 {
     ParticleBuffer.Iterator iter = iterator; // make sure that the iterator is always copied, so that all modifiers don't concurrently process the same iterator
     System.Threading.Tasks.Parallel.ForEach(modifiers, modifier =>
     {
         ParticleBuffer.Iterator iterInner = iter; // make sure that the iterator is always copied, so that all modifiers don't concurrently process the same iterator
         modifier.Process(updateContext, ref iterInner);
     });
 }
Пример #16
0
 protected sealed override void Update(UpdateContext updateContext)
 {
     if (this.ShouldProcess)
     {
         this.EntityWorld.EntityRefreshManager.BeginLock();
         this.Process(updateContext, _readOnlyEntities);
         this.EntityWorld.EntityRefreshManager.EndLock();
     }
 }
Пример #17
0
 internal void OnUpdate(UpdateContext updateContext)
 {
     if (this.IsEnabled)
     {
         this.BeginUpdate(updateContext);
         this.Update(updateContext);
         this.EndUpdate(updateContext);
     }
 }
 protected sealed override void Process(UpdateContext updateContext, ReadOnlyBag<Entity> entities)
 {
     _currentTime += TimeSpan.FromTicks(updateContext.GameTime.DeltaTicks);
     if (_currentTime >= _interval)
     {
         _currentTime -= _interval;
         this.ProcessInner(updateContext, entities);
     }
 }
        public override void Process(UpdateContext updateContext, ref ParticleBuffer.Iterator iterator)
        {
            float opacityDelta = _finalOpacity - _initialOpacity;
            Particle particle = iterator.First;

            do
            {
                particle.Opacity = _initialOpacity + opacityDelta * particle.Age;
            } while (iterator.MoveNext(ref particle));
        }
        public override void Process(UpdateContext updateContext, ref ParticleBuffer.Iterator iterator)
        {
            float scaleDelta = _finalScale - _initialScale;
            Particle particle = iterator.First;

            do
            {
                particle.Scale = _initialScale + scaleDelta * particle.Age;
            } while (iterator.MoveNext(ref particle));
        }
        protected internal override void Update(UpdateContext updateContext)
        {
            _movement += Vector2.Distance(_previousPosition, _transform.Position);
            if (_movement >= _triggerDistance)
            {
                _movement -= _triggerDistance;
                this.ParticleEffect.Trigger(_transform);
            }

            _previousPosition = _transform.Position;
        }
Пример #22
0
        public override void Process(UpdateContext updateContext, ref ParticleBuffer.Iterator iterator)
        {
            float hueChange = this.HueShiftAmount * updateContext.DeltaSeconds * FlaiMath.Pi / 180f;
            Matrix hueShiftMatrix = HueShifter.CreateHueTransformationMatrix(hueChange);

            Particle particle = iterator.First;
            do
            {
                HueShifter.Shift(ref particle.Color, ref hueShiftMatrix);
            } while (iterator.MoveNext(ref particle));
        }
        protected internal override void Update(UpdateContext updateContext)
        {
            Ensure.NotNull(_transform); // transform can't be null anymore when updating

            _timeUntilTrigger += updateContext.DeltaSeconds;
            if (_timeUntilTrigger >= _triggerPeriod)
            {
                _timeUntilTrigger -= _triggerPeriod;
                this.ParticleEffect.Trigger(_transform);
            }
        }
        public override void Process(UpdateContext updateContext, ref ParticleBuffer.Iterator iterator)
        {
            const float Multiplier = 200;
            float tempAttractionPower = this.AttractionPower * updateContext.DeltaSeconds * Multiplier;
            Particle particle = iterator.First;

            do
            {
                float distance = Vector2.Distance(this.AttractionPoint, particle.Position);
                particle.Velocity += (this.AttractionPoint - particle.Position) * tempAttractionPower / distance;
            } while (iterator.MoveNext(ref particle));
        }
Пример #25
0
        public override void Update(UpdateContext updateContext)
        {
            _elapsedTime += updateContext.GameTime.ElapsedGameTime;
            if (_elapsedTime > FpsComponent.UpdateFrequency)
            {
                _elapsedTime -= FpsComponent.UpdateFrequency;
                _frameRate = _frameCounter;
                _frameCounter = 0;

                _fps = (int)(_frameRate / FpsComponent.UpdateFrequency.TotalSeconds);
            }
        }
        public override void Process(UpdateContext updateContext, ref ParticleBuffer.Iterator iterator)
        {
            Vector3 deltaColor = _finalColor - _initialColor;
            Particle particle = iterator.First;
            do
            {
                particle.Color.X = _initialColor.X + deltaColor.X * particle.Age;
                particle.Color.Y = _initialColor.Y + deltaColor.Y * particle.Age;
                particle.Color.Z = _initialColor.Z + deltaColor.Z * particle.Age;

            } while (iterator.MoveNext(ref particle));
        }
Пример #27
0
 public void Update(UpdateContext updateContext)
 {
     // is cancelled here?
     if (!this.IsPaused)
     {
         this.TimeRemaining -= updateContext.DeltaSeconds;
         if (this.TimeRemaining < 0)
         {
             this.TimeRemaining = 0;
         }
     }
 }
Пример #28
0
        protected sealed override void Update(UpdateContext updateContext, bool otherScreenHasFocus, bool coveredByOtherScreen)
        {
            base.Update(updateContext, otherScreenHasFocus, coveredByOtherScreen);

            if (_hasDrawn && !_hasLoaded)
            {
                this.PreloadAssets();
                LoadingScreen.Load(base.ScreenManager, false, _screensToLoad);
                _hasLoaded = true;

                GC.Collect();
                base.ScreenManager.Game.ResetElapsedTime();
            }
        }
Пример #29
0
        public override void Process(UpdateContext updateContext, ref ParticleBuffer.Iterator iterator)
        {
            if (this.RotationRate <= float.Epsilon)
            {
                return;
            }

            float deltaRotation = this.RotationRate * updateContext.DeltaSeconds;
            Particle particle = iterator.First;
            do
            {
                particle.Rotation += deltaRotation;
            } while (iterator.MoveNext(ref particle));
        }
Пример #30
0
        public override void Process(UpdateContext updateContext, ref ParticleBuffer.Iterator iterator)
        {
            float deltaStrength = this.Strength * updateContext.DeltaSeconds;
            if (deltaStrength == 0f || _direction == Vector2.Zero)
            {
                return;
            }

            Vector2 deltaGravity = _direction * deltaStrength;
            Particle particle = iterator.First;
            do
            {
                particle.Velocity += deltaGravity;
            } while (iterator.MoveNext(ref particle));
        }
        private void UpdateDatabase()
        {
            var patientUpdate = new PatientUpdateColumns();
            var seriesUpdate  = new SeriesUpdateColumns();
            var studyUpdate   = new StudyUpdateColumns();

            // Update Patient level info. Different cases can occur here:
            //      A) Patient demographic info is not changed ==> update the current patient
            //      B) New patient demographics matches (another) existing patient in the datbase
            //              ==> Transfer the study to that patient. This means the study count on both patients must be updated.
            //                  The current patient should also be deleted if there's no more study attached to it after the transfer.
            //      C) New patient demographics doesn't match any patient in the database
            //              ==> A new patient should be created for this study. The study count on the current patient should be updated
            //                  and the patient should also be deleted if this is the only study attached to it.
            if (_patientInfoIsNotChanged)
            {
                _newPatient = _curPatient;
            }
            else if (_newPatient == null)
            {
                // No matching patient in the database. We should create a new patient for this study
                _newPatient = CreateNewPatient(_newPatientInfo);
            }
            else
            {
                // There's already patient in the database with the new patient demographics
                // The study should be attached to that patient.
                TransferStudy(_study.Key, _oldPatientInfo, _newPatient);
            }

            // Copy the existing valus over into the study & series objects
            // Note, this sets up an update statement that will update the key columns for
            // Study Instance UID, Series Instance UID, however, note that the columns will not
            // actually change value.  Its alittle ugly, but it will make it so if we add new
            // columns in the future, it just "works".
            _file.DataSet.LoadDicomFields(patientUpdate);
            _file.DataSet.LoadDicomFields(studyUpdate);
            _file.DataSet.LoadDicomFields(seriesUpdate);

            // Get any extensions that exist and process them
            var ep         = new ProcessorInsertExtensionPoint();
            var extensions = ep.CreateExtensions();

            foreach (IInsertExtension e in extensions)
            {
                e.UpdateExtension(_partition.Key, patientUpdate, studyUpdate, seriesUpdate, _file);
            }

            UpdatePatientEncoding(_newPatient, patientUpdate);
            SetStudyEncoding(_study, studyUpdate);

            // Update the Study table
            var patientUpdateBroker = UpdateContext.GetBroker <IPatientEntityBroker>();

            patientUpdateBroker.Update(_newPatient.Key, patientUpdate);

            // Update the Study table
            var studyUpdateBroker = UpdateContext.GetBroker <IStudyEntityBroker>();

            studyUpdateBroker.Update(_study.Key, studyUpdate);

            // Update the Series table
            var seriesUpdateBroker = UpdateContext.GetBroker <ISeriesEntityBroker>();

            seriesUpdateBroker.Update(_curSeries.Key, seriesUpdate);

            // If the Request Attributes Sequence is in the dataset, do an insert.
            // Small hole in this that if the value of this sequence has changed, both the old and
            // the new values will stay in the database, not much to do about it, except
            // reprocess the whole series, which doesn't seem worth it.
            if (_file.DataSet.Contains(DicomTags.RequestAttributesSequence))
            {
                var attribute = _file.DataSet[DicomTags.RequestAttributesSequence] as DicomAttributeSQ;
                if (attribute != null && !attribute.IsEmpty)
                {
                    foreach (DicomSequenceItem sequenceItem in (DicomSequenceItem[])attribute.Values)
                    {
                        var requestParms = new RequestAttributesInsertParameters();
                        sequenceItem.LoadDicomFields(requestParms);
                        requestParms.SeriesKey = _curSeries.Key;

                        var insertRequest = UpdateContext.GetBroker <IInsertRequestAttributes>();
                        insertRequest.Execute(requestParms);
                    }
                }
            }
        }