constructor()

in share/src/components/GameModder.tsx [485:522]


    constructor(props: GameModderProps) {
        super(props);

        if (IsGameModderState(gameModderState)) {
            // Loading previous modder state
            this.state = gameModderState
        } else {
            // Creating new modder state
            let imgs = Object.keys(moddableImages)
                .map((name) => {
                    let def = moddableImages[name]
                    // TODO: match the original dimensions? One difficulty with this
                    // is the sprite editor canvas can't handle this
                    // let { w, h } = GetImageTextDimensions(moddableImages[name])
                    let [w, h] = [24, 24]
                    let blank = CreateEmptyImageText(w, h);
                    return {
                        data: imageLiteralToBitmap(blank),
                        name: name,
                        callToAction: CALL_TO_ACTION[name],
                        default: textToBitmap(def)
                    };
                })

            this.state = {
                userImages: imgs,
                currentImg: 0,
                currentBackground: 12
            }
            Object.assign(gameModderState, this.state)
        }

        this.tabImages = Object.keys(moddableImages)
            .map(k => moddableImages[k])
            .map(textToBitmap)

        if (!(gameModderState as GameModderState).alertShown) this.alertTimeout = setTimeout(this.alertPlay, 5000);
    }