diff --git a/assets/iterated/iterated_payoffs.json b/assets/iterated/iterated_payoffs.json index 2a1f589..5454a96 100644 --- a/assets/iterated/iterated_payoffs.json +++ b/assets/iterated/iterated_payoffs.json @@ -63,13 +63,29 @@ "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":502,"h":502}, "sourceSize": {"w":502,"h":502} +}, +"iterated_payoffs0008": +{ + "frame": {"x":1034,"y":1034,"w":502,"h":502}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":502,"h":502}, + "sourceSize": {"w":502,"h":502} +}, +"iterated_payoffs0009": +{ + "frame": {"x":10,"y":1546,"w":502,"h":502}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":502,"h":502}, + "sourceSize": {"w":502,"h":502} }}, "meta": { "app": "Adobe Animate", "version": "15.2.0.66", "image": "iterated_payoffs.png", "format": "RGBA8888", - "size": {"w":2048,"h":2048}, + "size": {"w":2048,"h":4096}, "scale": "1" } } diff --git a/assets/iterated/iterated_payoffs.png b/assets/iterated/iterated_payoffs.png index 9dc49bb..418eb84 100644 Binary files a/assets/iterated/iterated_payoffs.png and b/assets/iterated/iterated_payoffs.png differ diff --git a/assets/iterated/iterated_scoreboard.json b/assets/iterated/iterated_scoreboard.json deleted file mode 100644 index 27446e1..0000000 --- a/assets/iterated/iterated_scoreboard.json +++ /dev/null @@ -1,19 +0,0 @@ -{"frames": { - -"iterated_scoreboard0000": -{ - "frame": {"x":10,"y":10,"w":402,"h":202}, - "rotated": false, - "trimmed": false, - "spriteSourceSize": {"x":0,"y":0,"w":402,"h":202}, - "sourceSize": {"w":402,"h":202} -}}, -"meta": { - "app": "Adobe Animate", - "version": "15.2.0.66", - "image": "iterated_scoreboard.png", - "format": "RGBA8888", - "size": {"w":512,"h":512}, - "scale": "1" -} -} diff --git a/assets/iterated/iterated_scoreboard.png b/assets/iterated/iterated_scoreboard.png index 8f8fbc3..5f01357 100644 Binary files a/assets/iterated/iterated_scoreboard.png and b/assets/iterated/iterated_scoreboard.png differ diff --git a/css/slides.css b/css/slides.css index b5f0676..819495c 100644 --- a/css/slides.css +++ b/css/slides.css @@ -59,17 +59,15 @@ body{ top:-270px; } -#slideshow .object{ +.object{ position: absolute; + transition: left 0.5s ease-in-out, top 0.5s ease-in-out; } /********* Fader *********/ .fader{ - -webkit-transition: opacity 0.3s ease-in-out; - -mos-transition: opacity 0.3s ease-in-out; - -ms-transition: opacity 0.3s ease-in-out; - transition: opacity 0.3s ease-in-out; + transition: opacity 0.5s ease-in-out; } /******** Text Box ********/ @@ -293,6 +291,31 @@ body{ z-index: 200; } +/*************************/ +/******* SCOREBOARD *******/ +/*************************/ + +#scoreboard{ + position: absolute; + width:200px; height:100px; + background: url(../assets/iterated/iterated_scoreboard.png); + background-size: 100% 100%; +} +#scoreboard > div{ + position: absolute; + width: 60px; height: 60px; + text-align: center; + font-size: 50px; + color: #666666; +} +#scoreboard > div:nth-child(1){ + left: 20px; + top: 21px; +} +#scoreboard > div:nth-child(2){ + right: 15px; + top: 21px; +} /*************************/ /***** SLIDE SELECT ******/ diff --git a/js/core/Background.js b/js/core/Background.js index 10ac25f..b221c69 100644 --- a/js/core/Background.js +++ b/js/core/Background.js @@ -18,14 +18,8 @@ function Background(config){ self.dom.style.height = height+"px"; self.dom.style.background = config.color; - // Add... - self.add = function(INSTANT){ - return _addFade(self, INSTANT); - }; - - // Remove... - self.remove = function(INSTANT){ - return _removeFade(self, INSTANT); - }; + // Add & Remove + self.add = function(){ _add(self); }; + self.remove = function(){ _remove(self); }; } \ No newline at end of file diff --git a/js/core/Button.js b/js/core/Button.js index 697daf4..522ec0c 100644 --- a/js/core/Button.js +++ b/js/core/Button.js @@ -72,15 +72,8 @@ function Button(config){ listen(self, self.id+"/deactivate", self.deactivate); } - // Add... - self.add = function(INSTANT){ - return _addFade(self, INSTANT); - }; - - // Remove... - self.remove = function(INSTANT){ - unlisten(self); - return _removeFade(self, INSTANT); - }; + // Add & Remove + self.add = function(){ _add(self); }; + self.remove = function(){ _remove(self); }; } \ No newline at end of file diff --git a/js/core/Slideshow.js b/js/core/Slideshow.js index 597f37e..d14b8ad 100644 --- a/js/core/Slideshow.js +++ b/js/core/Slideshow.js @@ -14,14 +14,14 @@ function Slideshow(config){ // Reset: INITIAL VARIABLES self.reset = function(){ - // CLEAR - if(self.clear) self.clear(); - // On End? if(self.currentSlide && self.currentSlide.onend){ self.currentSlide.onend(self); } + // CLEAR + if(self.clear) self.clear(); + // Reset self.dom.innerHTML = ""; self.slideIndex = -1; @@ -36,7 +36,7 @@ function Slideshow(config){ ////////////////////////////////////////////////// // Go to next slide - self.nextSlide = function(INSTANT){ + self.nextSlide = function(){ // On End? if(self.currentSlide && self.currentSlide.onend){ @@ -73,9 +73,7 @@ function Slideshow(config){ self.objects = {}; // Add Object - self.add = function(objectConfig, INSTANT){ - - INSTANT = true; // hack, sure. + self.add = function(objectConfig){ // Create object var Classname = window[objectConfig.type]; @@ -87,29 +85,25 @@ function Slideshow(config){ self.objects[objectConfig.id] = obj; // Add it for real! - return obj.add(INSTANT); // return a possible promise + return obj.add(); }; // Remove Object - self.remove = function(objectID, INSTANT){ - - INSTANT = true; // hack, sure. + self.remove = function(objectID){ // Find it... var obj = self.objects[objectID]; // Remove from memory & DOM delete self.objects[objectID]; - return obj.remove(INSTANT); // return a possible promise + return obj.remove(); }; // Clear: Remove ALL objects - self.clear = function(INSTANT){ - for(var id in self.objects){ - self.remove(id, INSTANT); - } + self.clear = function(){ + for(var id in self.objects) self.remove(id); }; diff --git a/js/core/TextBox.js b/js/core/TextBox.js index 537d84b..ae3a7e5 100644 --- a/js/core/TextBox.js +++ b/js/core/TextBox.js @@ -30,16 +30,10 @@ function TextBox(config){ self.text_id = id; self.setText(Words.get(self.text_id)); }; - self.setTextID(config.text_id); + if(config.text_id) self.setTextID(config.text_id); - // Add... - self.add = function(INSTANT){ - return _addFade(self, INSTANT); - }; - - // Remove... - self.remove = function(INSTANT){ - return _removeFade(self, INSTANT); - }; + // Add & Remove + self.add = function(){ _add(self); }; + self.remove = function(){ _remove(self); }; } \ No newline at end of file diff --git a/js/sims/Iterated.js b/js/sims/Iterated.js index 2713632..b88c525 100644 --- a/js/sims/Iterated.js +++ b/js/sims/Iterated.js @@ -135,7 +135,7 @@ function Iterated(config){ self.dehighlightPayoff(); // End Round - publish("iterated/round/end"); + publish("iterated/round/end", payoffs); }); @@ -166,19 +166,62 @@ function Iterated(config){ /////////////////////////////////////////////// // Add... - self.add = function(INSTANT){ - return _add(self); + self.add = function(){ + _add(self); }; // Remove... - self.remove = function(INSTANT){ + self.remove = function(){ app.destroy(); unlisten(self); - return _remove(self); + _remove(self); }; } +function IteratedScoreboard(config){ + + var self = this; + self.config = config; + + // DOM + self.dom = document.createElement("div"); + self.dom.id = "scoreboard"; + self.dom.className = "object"; + self.dom.style.left = config.x+"px"; + self.dom.style.top = config.y+"px"; + + // Left score + var left = document.createElement("div"); + self.dom.appendChild(left); + + // Right score + var right = document.createElement("div"); + self.dom.appendChild(right); + + // Reset + self.score = [0,0]; + self.reset = function(){ + self.score = [0,0]; + self.showScore(); + }; + self.addScore = function(a,b){ + self.score[0] += a; + self.score[1] += b; + self.showScore(); + }; + self.showScore = function(){ + left.innerHTML = self.score[0]; + right.innerHTML = self.score[1]; + }; + self.reset(); + + // Add & Remove + self.add = function(){ _add(self); }; + self.remove = function(){ _remove(self); }; + +} + function IteratedPeep(config){ var self = this; diff --git a/js/sims/SandboxUI.js b/js/sims/SandboxUI.js index f04c41c..7ef3f05 100644 --- a/js/sims/SandboxUI.js +++ b/js/sims/SandboxUI.js @@ -410,16 +410,16 @@ function SandboxUI(config){ ///////////////////////////////////////// // Add... - self.add = function(INSTANT){ - return _add(self); + self.add = function(){ + _add(self); }; // Remove... - self.remove = function(INSTANT){ + self.remove = function(){ for(var i=0;i= ROUNDS[ROUND_INDEX].num){ @@ -55,12 +79,16 @@ SLIDES.push({ publish("slideshow/scratch"); // NEXT SLIDE, WHATEVER }else{ publish("iterated/newOpponent",[ROUNDS[ROUND_INDEX].id]); + self.objects.scoreboard.reset(); + _showInfo(); } } }); + _showInfo(); + }, onend: function(self){ diff --git a/lang/en.html b/lang/en.html index 3574a43..ba0d1ae 100644 --- a/lang/en.html +++ b/lang/en.html @@ -83,6 +83,12 @@ blah blah blah blah. But what if... +

+opponent: +

+

+your total score: +