diff --git a/bower.json b/bower.json index 6f3d18f..ff8dc5f 100644 --- a/bower.json +++ b/bower.json @@ -6,12 +6,14 @@ "angular-mocks": "1.5.9", "content-editor-dependency": "https://s3.ap-south-1.amazonaws.com/ekstep-public-prod/content-editor/scripts/external.min.js", "content-editor": "https://s3.ap-south-1.amazonaws.com/ekstep-public-prod/content-editor/scripts/script.min.js", - "renderer-dependency-appconfig": "https://dev.ekstep.in/content/preview/scripts/renderer.script.min.js?ver=379", + "renderer-dependency-appconfig": "https://s3.ap-south-1.amazonaws.com/ekstep-public-prod/v3/preview/scripts/renderer.script.min.js", "renderer-dependency-toastr": "https://s3.ap-south-1.amazonaws.com/ekstep-public-prod/v3/preview/scripts/renderer.external.min.js", "renderer-createjs": "https://s3.ap-south-1.amazonaws.com/ekstep-public-prod/v3/preview/coreplugins/org.ekstep.ecmlrenderer-1.0/renderer/libs/createjs.min.js", "renderer-creatine": "https://s3.ap-south-1.amazonaws.com/ekstep-public-prod/v3/preview/coreplugins/org.ekstep.ecmlrenderer-1.0/renderer/libs/creatine-1.0.0.min.js", "renderer": "https://s3.ap-south-1.amazonaws.com/ekstep-public-prod/v3/preview/coreplugins/org.ekstep.ecmlrenderer-1.0/renderer/libs/renderer.min.js", "pollyfill": "https://cdn.jsdelivr.net/npm/promise-polyfill@7/dist/polyfill.min.js", - "renderer-telemetry": "https://s3.ap-south-1.amazonaws.com/ekstep-public-prod/v3/preview/scripts/renderer.telemetry.min.js" + "renderer-telemetry": "https://s3.ap-south-1.amazonaws.com/ekstep-public-prod/v3/preview/scripts/renderer.telemetry.min.js", + "renderer-cordovaplugin" : "https://s3.ap-south-1.amazonaws.com/ekstep-public-prod/v3/preview/coreplugins/org.ekstep.ecmlrenderer-1.0/renderer/libs/cordovaaudioplugin-0.6.1.min.js", + "renderer-angular-mocks": "https://cdn.jsdelivr.net/npm/angular-mocks@1.5.9/angular-mocks.min.js" } } \ No newline at end of file diff --git a/lib/renderer/dom-simulation.js b/lib/renderer/dom-simulation.js index 2cddec8..4085688 100644 --- a/lib/renderer/dom-simulation.js +++ b/lib/renderer/dom-simulation.js @@ -1,21 +1,40 @@ -var contentBody = JSON.parse('{"theme":{"stage":{"manifest":{"media":[]},"x":0,"y":0,"w":100,"h":100,"id":"stage1"},"manifest":{"media":[]},"plugin-manifest":"","compatibilityVersion":2,"id":"theme","version":1,"startStage":"stage1"}}'); - +var contentBody = JSON.parse('{"theme":{"stage":{"manifest":{"media":[]},"x":0,"y":0,"w":100,"h":100,"id":"stage1","rotate":""},"manifest":{"media":[]},"plugin-manifest":"","compatibilityVersion":2,"id":"theme","version":1,"startStage":"stage1"}}'); function setUpRenderer() { - var canvas = "
"; + window.Renderer = {}; + var canvas = "
"; var body = document.getElementsByTagName("body")[0]; var div = document.createElement('div'); div.innerHTML = canvas; body.appendChild(div.children[0]); - setGlobalConfig({config: {}, context: {}}); + setGlobalConfig({ 'context': {}, 'config': {} }); window.isMobile = window.cordova ? true : false; window.content = JSON.parse('{"baseDir":"/base/public/test/testContent", "path":"/base/public/test/testContent", "identifier": "org.ekstep.item.sample", "mimeType": "application/vnd.ekstep.ecml-archive", "name": "Content Preview ", "author": "EkStep", "localData": {"name": "Content Preview ", "loadingMessage": "Without requirements or design, programming is the art of adding bugs to an empty text file. ...", "identifier": "org.ekstep.item.sample" }, "pkgVersion": 1, "isAvailable": true}'); window.content.body = JSON.parse(JSON.stringify(contentBody)); org.ekstep.service.init(); - AppConfig.corePluginspath = '/public/coreplugins'; - org.ekstep.contentrenderer.initPlugins('', '/public/coreplugins'); + AppConfig.corePluginspath = 'base'; + org.ekstep.contentrenderer.initPlugins('', AppConfig.corePluginspath); GlobalContext.game.id = packageName; GlobalContext.game.ver = version; startTelemetry(GlobalContext.game.id, GlobalContext.game.ver); + this.contentMetaData = window.content; + this.gdata = content.body; + content.body.theme.canvasId = 'gameCanvas' + document.fonts = { 'ready': {} }; + document.fonts.ready.then = jasmine.createSpy().and.callFake(function () { + Renderer.update = true; + }); + Renderer.divIds = { 'canvas': 'ganmeCanvas', 'gameArea': 'gameArea' }; + Renderer.theme = new ThemePlugin(content.body.theme); + Renderer.theme.baseDir = globalConfig.basepath || content.path; + Renderer.theme.start(content.path.replace('file:///', '') + "/assets/"); + createjs.Ticker.addEventListener("tick", function () { + if (Renderer.update && (typeof Renderer.theme !== 'undefined')) { + Renderer.theme.update(); + Renderer.update = false; + } else if (Renderer.theme) { + Renderer.theme.tick(); + } + }); }; function startRenderer(data) { @@ -24,3 +43,4 @@ function startRenderer(data) { } setUpRenderer(); + diff --git a/lib/renderer/karma.conf.js b/lib/renderer/karma.conf.js index 63ad51c..d180738 100644 --- a/lib/renderer/karma.conf.js +++ b/lib/renderer/karma.conf.js @@ -9,10 +9,13 @@ module.exports = function(config) { // TODO: Remove this hack to get jquery, angular etc till renderer exposes bundled dependency file // https://github.com/ekstep/Contributed-Plugins/issues/136 "bower_components/pollyfill/index.js", - "bower_components/renderer-dependency-toastr/index.js", - "bower_components/renderer-dependency-appconfig/index.js", "bower_components/renderer-createjs/index.js", + "bower_components/renderer-cordovaplugin/index.js", "bower_components/renderer-creatine/index.js", + "bower_components/renderer-dependency-toastr/index.js", + "bower_components/renderer-angular-mocks/index.js", + "bower_components/renderer-telemetry/index.js", + "bower_components/renderer-dependency-appconfig/index.js", "bower_components/renderer/index.js", "bower_components/renderer-telemetry/index.js", __dirname + "/dom-simulation.js",