void ShowPreview() { if (pnlAttackerAnim.Visible) { moveAnim = new Graphics.Renderers.Moves.NormalMoveAnimation(2, 2); moveAnim.AnimationIndex = nudAttackerAnimIndex.Value; moveAnim.MoveTime = nudAttackerAnimTime.Value; moveAnim.RenderLoops = nudAttackerAnimCycle.Value; tmrPreview.Interval = nudAttackerAnimTime.Value; } else if (pnlDefenderAnim.Visible) { moveAnim = new Graphics.Renderers.Moves.NormalMoveAnimation(2, 2); moveAnim.AnimationIndex = nudDefenderAnimIndex.Value; moveAnim.MoveTime = nudDefenderAnimTime.Value; moveAnim.RenderLoops = nudDefenderAnimCycle.Value; tmrPreview.Interval = nudDefenderAnimTime.Value; } else { switch ((Enums.MoveAnimationType)cbTravelingAnimType.SelectedIndex) { case Enums.MoveAnimationType.Normal: { moveAnim = new Graphics.Renderers.Moves.NormalMoveAnimation(2, 2); } break; case Enums.MoveAnimationType.Overlay: { moveAnim = new Logic.Graphics.Renderers.Moves.OverlayMoveAnimation(); } break; case Enums.MoveAnimationType.Tile: { moveAnim = new Logic.Graphics.Renderers.Moves.TileMoveAnimation(2, 2, (Enums.MoveRange)cbRangeType.SelectedIndex, Enums.Direction.Right, 3); } break; case Enums.MoveAnimationType.Arrow: { moveAnim = new Logic.Graphics.Renderers.Moves.ArrowMoveAnimation(1, 2, Enums.Direction.Right, 4); } break; case Enums.MoveAnimationType.Throw: { moveAnim = new Logic.Graphics.Renderers.Moves.ThrowMoveAnimation(1, 4, 3, -1); } break; case Enums.MoveAnimationType.Beam: { moveAnim = new Logic.Graphics.Renderers.Moves.BeamMoveAnimation(1, 2, Enums.Direction.Right, 4); } break; case Enums.MoveAnimationType.ItemArrow: { moveAnim = new Logic.Graphics.Renderers.Moves.ItemArrowMoveAnimation(1, 2, Enums.Direction.Right, 4); } break; case Enums.MoveAnimationType.ItemThrow: { moveAnim = new Logic.Graphics.Renderers.Moves.ItemThrowMoveAnimation(1, 4, 3, -1); } break; } moveAnim.AnimationIndex = nudTravelingAnimIndex.Value; moveAnim.MoveTime = nudTravelingAnimTime.Value; moveAnim.RenderLoops = nudTravelingAnimCycle.Value; tmrPreview.Interval = nudTravelingAnimTime.Value; } Music.Music.AudioPlayer.PlaySoundEffect("magic" + nudSound.Value + ".wav"); moveAnim.Active = true; moveAnim.Frame = 0; moveAnim.CompletedLoops = 0; RenderAnimationToPictureBox(picPreview, moveAnim); tmrPreview.Start(); }
public static void RenderAnimationToPictureBox(SdlDotNet.Widgets.PictureBox pic, Graphics.Renderers.Moves.IMoveAnimation animation) { if (animation.Active) { Graphics.Renderers.RendererDestinationData destData = new Graphics.Renderers.RendererDestinationData(pic.Image, new Point(0, 0), pic.Size); Graphics.Renderers.Moves.MoveRenderer.RenderMoveAnimation(destData, animation, new Point(32 * animation.StartX, 32 * animation.StartY)); pic.RequestRedraw(); } }
void ShowPreview() { if (pnlAttackerAnim.Visible) { moveAnim = new Graphics.Renderers.Moves.NormalMoveAnimation(2, 2); moveAnim.AnimationIndex = nudAttackerAnimIndex.Value; moveAnim.MoveTime = nudAttackerAnimTime.Value; moveAnim.RenderLoops = nudAttackerAnimCycle.Value; tmrPreview.Interval = nudAttackerAnimTime.Value; } else if (pnlDefenderAnim.Visible) { moveAnim = new Graphics.Renderers.Moves.NormalMoveAnimation(2, 2); moveAnim.AnimationIndex = nudDefenderAnimIndex.Value; moveAnim.MoveTime = nudDefenderAnimTime.Value; moveAnim.RenderLoops = nudDefenderAnimCycle.Value; tmrPreview.Interval = nudDefenderAnimTime.Value; } else { switch ((Enums.MoveAnimationType)cbTravelingAnimType.SelectedIndex) { case Enums.MoveAnimationType.Normal: { moveAnim = new Graphics.Renderers.Moves.NormalMoveAnimation(2, 2); } break; case Enums.MoveAnimationType.Overlay: { moveAnim = new Logic.Graphics.Renderers.Moves.OverlayMoveAnimation(); } break; case Enums.MoveAnimationType.Tile: { moveAnim = new Logic.Graphics.Renderers.Moves.TileMoveAnimation(2, 2, (Enums.MoveRange)cbRangeType.SelectedIndex, Enums.Direction.Right, 3); } break; case Enums.MoveAnimationType.Arrow: { moveAnim = new Logic.Graphics.Renderers.Moves.ArrowMoveAnimation(1, 2, Enums.Direction.Right, 4); } break; case Enums.MoveAnimationType.Throw: { moveAnim = new Logic.Graphics.Renderers.Moves.ThrowMoveAnimation(1, 4, 3, -1); } break; case Enums.MoveAnimationType.Beam: { moveAnim = new Logic.Graphics.Renderers.Moves.BeamMoveAnimation(1, 2, Enums.Direction.Right, 4); } break; case Enums.MoveAnimationType.ItemArrow: { moveAnim = new Logic.Graphics.Renderers.Moves.ItemArrowMoveAnimation(1, 2, Enums.Direction.Right, 4); } break; case Enums.MoveAnimationType.ItemThrow: { moveAnim = new Logic.Graphics.Renderers.Moves.ItemThrowMoveAnimation(1, 4, 3, -1); } break; } moveAnim.AnimationIndex = nudTravelingAnimIndex.Value; moveAnim.MoveTime = nudTravelingAnimTime.Value; moveAnim.RenderLoops = nudTravelingAnimCycle.Value; tmrPreview.Interval = nudTravelingAnimTime.Value; } Music.Music.AudioPlayer.PlaySoundEffect("magic" + nudSound.Value + ".wav"); moveAnim.Active = true; moveAnim.Frame = 0; moveAnim.CompletedLoops = 0; RenderAnimationToPictureBox(picPreview, moveAnim); tmrPreview.Start(); }