UNPKG

@robotical/scratch-to-python-transpiler

Version:
38 lines (37 loc) 1.3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var Target_1 = require("./Target"); var fromSb3_1 = require("./io/sb3/fromSb3"); var toSb3_1 = require("./io/sb3/toSb3"); var toPython_1 = require("./io/python/toPython"); var Project = /** @class */ (function () { function Project(options) { this.toSb3 = toSb3_1.default.bind(this); this.toPython = toPython_1.default.bind(this); this.stage = new Target_1.Stage(); this.sprites = []; this.tempo = 60; this.videoOn = false; this.videoAlpha = 0.5; this.textToSpeechLanguage = null; Object.assign(this, options); for (var _i = 0, _a = this.sprites; _i < _a.length; _i++) { var sprite = _a[_i]; sprite.project = this; } } Project.prototype.sprite = function (id) { switch (typeof id) { case "string": return this.sprites.find(function (sprite) { return sprite.name === id; }) || null; case "number": return this.sprites[id] || null; default: return null; } }; Project.fromSb3 = fromSb3_1.default; Project.fromSb3JSON = fromSb3_1.fromSb3JSON; return Project; }()); exports.default = Project;