var JD;
(function (JD) {
    function loadScript(gameType) {
        var scr = document.createElement("script");
        scr.src = "Games/Elements/" + GameTypes[gameType] + "/" + GameTypes[gameType] + ".js";
        document.getElementsByTagName('head')[0].appendChild(scr);
    }
    JD.loadScript = loadScript;
    function initGame(alias, attrs, game, x, y) {
        return new GameGroups.StartingGroup(game, attrs[0], x, y, attrs[1]);
    }
    function decode(arr, json, game) {
        var ret = [];
        var len = json.length;
        for (var i = 0; i < len; i++) {
            ret.push(initGame(json[i].GameType, json[i].attrs, game, (i + 1) * Global.Main.dims.x, 0));
        }
        ret = arr.concat(ret);
        return ret;
    }
    JD.decode = decode;
})(JD || (JD = {}));
//# sourceMappingURL=JsonDecoder.js.map