diff options
author | Alex Xu <alex_y_xu@yahoo.ca> | 2013-07-02 10:46:36 -0400 |
---|---|---|
committer | Alex Xu <alex_y_xu@yahoo.ca> | 2013-07-02 10:46:36 -0400 |
commit | 1177e84b179b79ebc86a08e1fde49ed6cbd1327d (patch) | |
tree | 63a2c73002b353476c45a4213ef5fcc709b79019 /www/js/imachine.js | |
parent | 828588ccb0e7f203c53b1abad1d70f77d3185a81 (diff) | |
download | html5ks-1177e84b179b79ebc86a08e1fde49ed6cbd1327d.tar.xz html5ks-1177e84b179b79ebc86a08e1fde49ed6cbd1327d.zip |
working
Diffstat (limited to 'www/js/imachine.js')
-rw-r--r-- | www/js/imachine.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/www/js/imachine.js b/www/js/imachine.js index fd657ef..12a2f7a 100644 --- a/www/js/imachine.js +++ b/www/js/imachine.js @@ -1,12 +1,18 @@ html5ks.imachine = (function () { "use strict"; return { + seen_scene: function (scene) { + return !!html5ks.store.seen_scenes[scene]; + }, + scene_register: function (scene) { + html5ks.store.seen_scenes[scene] = true; + }, start: function () { return this.run("imachine"); }, run: function (label) { var deferred = when.defer(), - ilabel = html5ks.data.imachine[label], + ilabel = typeof label === "string" ? html5ks.data.imachine[label] : label, i = 0, runInst = function () { var inst = ilabel[i++]; @@ -20,6 +26,7 @@ html5ks.imachine = (function () { case "object": switch (inst[0]) { case "iscene": + this.scene_register(inst[1]); case "act_op": switch (inst[1]) { case "op_vid1": @@ -31,9 +38,9 @@ html5ks.imachine = (function () { break; case "seen_scene": if (this.seen_scene(inst[1])) { - runInst(inst[2]); + this.run(inst[2]); } else { - runInst(inst[3]); + this.run(inst[3]); } break; case "attraction_sc": |