public override List <VisibleTimeline> CreateNewEditorItem(AnimationClass ActiveAnimation, AnimationClass.AnimationLayer ActiveLayer, int KeyFrame, System.Drawing.Point MousePosition) { List <VisibleTimeline> ReturnValue = new List <VisibleTimeline>(); AnimatedBitmapSpawnerHelper NewSpawner = new AnimatedBitmapSpawnerHelper(); if (NewSpawner.ShowDialog() == DialogResult.OK) { string SpriteName = "Animations/Sprites/" + NewSpawner.SpawnViewer.BitmapName; Matrix view = Matrix.Identity; Matrix Projection = Matrix.CreateOrthographicOffCenter(0, ActiveLayer.renderTarget.Width, ActiveLayer.renderTarget.Height, 0, 0, 1); Matrix HalfPixelOffset = Matrix.CreateTranslation(-0.5f, -0.5f, 0); Projection = view * (HalfPixelOffset * Projection); Particle3DSample.ParticleSettings ParticleSettings = new Particle3DSample.ParticleSettings(); ParticleSettings.TextureName = SpriteName; ParticleSettings.MaxParticles = 20000; ParticleSettings.MinScale = new Vector2(1, 1); ParticleSettings.DurationInSeconds = 1d; ParticleSettings.Gravity = new Vector2(0, 0); ParticleSettings.NumberOfImages = 1; ParticleSettings.BlendState = BlendState.AlphaBlend; ParticleSettings.StartingAlpha = 0.7f; ParticleSettings.EndAlpha = 0.1f; int StripIndex = SpriteName.IndexOf("_strip"); if (StripIndex > 0) { StripIndex += 6; string ImageInformation = SpriteName.Substring(StripIndex); ParticleSettings.NumberOfImages = Convert.ToInt32(ImageInformation); } ParticleSystem = new Particle3DSample.ParticleSystem(ParticleSettings); ParticleSystem.LoadContent(NewSpawner.SpawnViewer.content, GameScreen.GraphicsDevice, Projection); ParticleEmitterTimeline NewParticleEmitorTimeline = new ParticleEmitterTimeline(ParticleSystem); NewParticleEmitorTimeline.Position = new Vector2(535, 170); NewParticleEmitorTimeline.SpawnFrame = KeyFrame; NewParticleEmitorTimeline.DeathFrame = KeyFrame + 10; NewParticleEmitorTimeline.IsUsed = true;//Disable the spawner as we spawn the AnimatedBitmap manually. NewParticleEmitorTimeline.Add( KeyFrame, new VisibleAnimationObjectKeyFrame(new Vector2(NewParticleEmitorTimeline.Position.X, NewParticleEmitorTimeline.Position.Y), true, -1)); ReturnValue.Add(NewParticleEmitorTimeline); } return(ReturnValue); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { IWindowsFormsEditorService svc = (IWindowsFormsEditorService) provider.GetService(typeof(IWindowsFormsEditorService)); if (svc != null) { AnimatedBitmapSpawnerHelper NewSpawner = new AnimatedBitmapSpawnerHelper((string)value); if (NewSpawner.ShowDialog() == DialogResult.OK) { value = NewSpawner.SpawnViewer.Bitmap; } } return(value); }
public override List <VisibleTimeline> CreateNewEditorItem(AnimationClass ActiveAnimation, AnimationClass.AnimationLayer ActiveLayer, int KeyFrame, System.Drawing.Point MousePosition) { List <VisibleTimeline> ReturnValue = new List <VisibleTimeline>(); AnimatedBitmapSpawnerHelper NewSpawner = new AnimatedBitmapSpawnerHelper(); if (NewSpawner.ShowDialog() == System.Windows.Forms.DialogResult.OK) { AnimatedTileTimeline NewAnimatedBitmapSpawner = new AnimatedTileTimeline(NewSpawner.SpawnViewer.BitmapName, NewSpawner.SpawnViewer.Bitmap); NewAnimatedBitmapSpawner.Position = new Vector2(535, 170); NewAnimatedBitmapSpawner.SpawnFrame = KeyFrame; NewAnimatedBitmapSpawner.DeathFrame = KeyFrame + 10; NewAnimatedBitmapSpawner.IsUsed = true;//Disable the spawner as we spawn the AnimatedBitmap manually. NewAnimatedBitmapSpawner.Add(KeyFrame, new AnimatedTileKeyFrame(NewAnimatedBitmapSpawner.Position, true, -1, NewAnimatedBitmapSpawner.PixelPerSecond, 312)); ReturnValue.Add(NewAnimatedBitmapSpawner); } return(ReturnValue); }