/// <summary> /// Analyzes the sprite box structure /// </summary> /// <param name="errs">The errors found within the animation clip</param> /// <param name="errKey">The label to help identify which animation clip this /// error is referring to</param> /// <param name="spriteBox">The sprite box to check</param> void Analyze(StringBuilder errs, string errKey, SpriteBox spriteBox) { // Check that the sprite box name is valid if (null == spriteBox.spriteBoxName || 0 == spriteBox.spriteBoxName.Length) { errs.AppendLine($"{errKey}: the sprite box name is missing or empty"); } // Check the size of the box if (spriteBox.width > displayWidth) { errs.AppendLine($"{errKey}: the sprite width ({spriteBox.width}) is larger than the display ({displayWidth})"); } if (spriteBox.height > displayHeight) { errs.AppendLine($"{errKey}: the sprite height ({spriteBox.height}) is larger than the display ({displayHeight})"); } // Check the sprite render method if (null == spriteBox.spriteRenderMethod) { errs.AppendLine($"{errKey}: spriteRenderMethod is missing."); } else if (!("CustomHue" == spriteBox.spriteRenderMethod || "RGBA" == spriteBox.spriteRenderMethod)) { errs.AppendLine($"{errKey}: spriteRenderMethod ({spriteBox.spriteRenderMethod}) must be 'CustomHue' or 'RGBA'."); } }
/// <summary> /// Analyzes the sprite map box structure /// </summary> /// <param name="errs">The errors found within the animation clip</param> /// <param name="errKey">The label to help identify which animation clip this /// error is referring to</param> /// <param name="spriteMapBox">The sprite map box to check</param> void Analyze(StringBuilder errs, string errKey, SpriteMapBox spriteMapBox, IReadOnlyCollection <SpriteBox> layout) { SpriteBox spriteBox = null; // Check that the sprite box name is valid if (null == spriteMapBox.spriteBoxName || 0 == spriteMapBox.spriteBoxName.Length) { errs.AppendLine($"{errKey}: the sprite box name is missing or empty"); } else { // Look up the box that it goes with foreach (var s in layout) { if (spriteMapBox.spriteBoxName == s.spriteBoxName) { spriteBox = s; break; } } // Check to see that the sprite box is in the layout if (null == spriteBox) { errs.AppendLine($"{errKey}: the sprite box ({spriteMapBox.spriteBoxName}) isn't defined in the layer"); } } // Check the reference to independent sprites and sprite sequences if (null == spriteMapBox.spriteName || 0 == spriteMapBox.spriteName.Length) { errs.AppendLine($"{errKey}: The spriteName is missing"); return; } // Get the sprite sequence var spriteSeq = SpriteSequence(spriteMapBox.spriteName); if (null == spriteSeq) { errs.AppendLine($"{errKey}: The sprite sequence {spriteMapBox.spriteName} could not be found."); return; } if (spriteMapBox.spriteName != spriteSeq.name) { errs.AppendLine($"{errKey}: The case of the sprite sequence name {spriteMapBox.spriteName} doesnt match that used in the assets folder {spriteSeq.name}"); } // Check the size of the sprites if (null != spriteBox) { Analyze(errs, spriteSeq, (uint)spriteBox.width, (uint)spriteBox.height); } }