private void HandleAnimExport(object sender, AnimationSet animSet) { this.createPropertyGridTab(animSet, "AnimSet"); }
public SpriteSheetPreviewer(AnimationSet animationSet) : this() { m_pictureBox.AnimationSet = animationSet; }
/// <summary> /// Loads an AnimationSet into the AnimationController. /// </summary> /// <param name="animSetPath">Asset path to the AnimationSet.</param> /// <param name="texturePath">Asset path to the image file to use.</param> public AnimationController(string animSetPath, string texturePath, string initialAnim) { this.Color = Color.White; this.Scale = 1.0f; this.Rotation = 0.0f; this.DrawBottomCenter = true; m_animSet = GlobalHelper.loadContent<AnimationSet>(animSetPath); // Build up a mapping of animation & sprite indices to image dimension idxs List<Rectangle> imageDimensionsList = new List<Rectangle>(); int counter = 0; m_sourceRectangleIdxs = new int[m_animSet.anims.Length][]; for (int i = 0; i < m_animSet.anims.Length; ++i) { m_sourceRectangleIdxs[i] = new int[m_animSet.anims[i].sprites.Length]; for (int j = 0; j < m_animSet.anims[i].sprites.Length; ++j) { imageDimensionsList.Add(m_animSet.anims[i].sprites[j].box); m_sourceRectangleIdxs[i][j] = counter; counter++; } } Texture = new GameTexture(texturePath, imageDimensionsList.ToArray()); if (!String.IsNullOrEmpty(initialAnim)) { requestAnimation(initialAnim); } }
public AnimationSet makeAnimationSet() { AnimationSet animSet = new AnimationSet(); List<Animation> animations = new List<Animation>(); List<SpriteBox> sbs = new List<SpriteBox>(SpriteBoxes.ToArray()); while (sbs.Count > 0) { Animation a = new Animation(); List<Sprite> sprites = new List<Sprite>(); animations.Add(a); Color c = sbs[0].Color; List<SpriteBox> matches = sbs.FindAll(i => i.Color == c); sbs.RemoveAll(i => i.Color == c); foreach (SpriteBox box in matches) { sprites.Add(box.Sprite); } a.sprites = sprites.ToArray(); } animSet.anims = animations.ToArray(); return animSet; }