<commit_before>import { SpriteData } from '../../interfaces/spriteData';
import { Animation } from '../../interfaces/animation'

export default class SpriteGenerator {
    jsonSrc: SpriteData[];
    spriteSheetMap: any = {};

    constructor(jsonSrc: any) {
        this.jsonSrc = jsonSrc;
    }

    preload(load: Phaser.Loader.LoaderPlugin) {
        for (const spriteData of this.jsonSrc) {
            const { animations } = spriteData;

            for (const prop in animations) {
                const animation = animations[prop] as Animation;
                const { frameDimensions } = animation;
                if (this.spriteSheetMap[animation.spriteSheetKey] && this.spriteSheetMap[animation.spriteSheetKey] !== animation.spriteSheetSrc) {
                    console.error('Attempted to load a Spritesheet with an existing key but different source:', spriteData);
                }
                this.spriteSheetMap[animation.spriteSheetKey] = animation.spriteSheetSrc;
                load.spritesheet(
                    animation.spriteSheetKey, 
                    animation.spriteSheetSrc,
                    { frameWidth: frameDimensions.width, frameHeight: frameDimensions.height });
            }
        }<commit_msg>Slightly better logging<commit_after>import { SpriteData } from '../../interfaces/spriteData';
import { Animation } from '../../interfaces/animation'

export default class SpriteGenerator {
    jsonSrc: SpriteData[];
    spriteSheetMap: any = {};

    constructor(jsonSrc: any) {
        this.jsonSrc = jsonSrc;
    }

    preload(load: Phaser.Loader.LoaderPlugin) {
        for (const spriteData of this.jsonSrc) {
            const { animations } = spriteData;

            for (const prop in animations) {
                const animation = animations[prop] as Animation;
                const { frameDimensions } = animation;
                if (this.spriteSheetMap[animation.spriteSheetKey] && this.spriteSheetMap[animation.spriteSheetKey] !== animation.spriteSheetSrc) {
                    console.error('Attempted to load a Spritesheet with an existing spriteSheetKey but different spriteSheetSrc:', spriteData);
                }
                this.spriteSheetMap[animation.spriteSheetKey] = animation.spriteSheetSrc;
                load.spritesheet(
                    animation.spriteSheetKey, 
                    animation.spriteSheetSrc,
                    { frameWidth: frameDimensions.width, frameHeight: frameDimensions.height });
            }
        }
{'fraction_non_alphanumeric': 0.09440698135660452, 'fraction_numerical': 0.0, 'mean_word_length': 2.2209450830140485, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6800663', 'n_tokens_mistral': 671, 'n_tokens_neox': 626, 'n_words': 140}