2017-07-10 18:06:22 +00:00
|
|
|
// THE TRUST GAME - COOPERATE, YA NO?
|
|
|
|
SLIDES.push({
|
|
|
|
|
|
|
|
id: "oneoff",
|
|
|
|
|
|
|
|
onstart: function(self){
|
|
|
|
|
|
|
|
// Iterated Simulation
|
|
|
|
self.add({id:"iterated", type:"Iterated", x:130, y:133});
|
|
|
|
|
|
|
|
// Words on top & bottom
|
|
|
|
self.add({
|
|
|
|
id:"topWords", type:"TextBox", text_id:"oneoff_0_top",
|
2017-07-15 02:29:31 +00:00
|
|
|
x:130, y:10, width:700, height:100, align:"center"
|
2017-07-10 18:06:22 +00:00
|
|
|
});
|
|
|
|
self.add({
|
|
|
|
id:"btmWords", type:"TextBox", text_id:"oneoff_0_btm",
|
2017-07-15 02:29:31 +00:00
|
|
|
x:130, y:397, width:700, height:100, align:"center"
|
|
|
|
});
|
|
|
|
|
|
|
|
// Labels
|
|
|
|
self.add({
|
|
|
|
id:"labelYou", type:"TextBox",
|
|
|
|
x:211, y:201, width:50, height:50,
|
|
|
|
align:"center", color:"#aaa", size:17,
|
|
|
|
text_id:"label_you"
|
|
|
|
});
|
|
|
|
self.add({
|
|
|
|
id:"labelThem", type:"TextBox",
|
|
|
|
x:702, y:189, width:50, height:50,
|
|
|
|
align:"center", color:"#aaa", size:17,
|
|
|
|
text_id:"label_them"
|
2017-07-10 18:06:22 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
// Buttons
|
|
|
|
self.add({
|
2017-07-13 15:07:33 +00:00
|
|
|
id:"btnCheat", type:"Button", x:275, y:463, text_id:"label_cheat", uppercase:true,
|
2017-07-10 18:06:22 +00:00
|
|
|
onclick:function(){
|
|
|
|
_.answer = "CHEAT";
|
|
|
|
publish("slideshow/next");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
self.add({
|
2017-07-13 15:07:33 +00:00
|
|
|
id:"btnCooperate", type:"Button", x:495, y:460, text_id:"label_cooperate", uppercase:true,
|
2017-07-10 18:06:22 +00:00
|
|
|
onclick:function(){
|
|
|
|
_.answer = "COOPERATE";
|
|
|
|
publish("slideshow/next");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2017-07-15 02:29:31 +00:00
|
|
|
},
|
|
|
|
onend: function(self){
|
|
|
|
self.remove("labelYou");
|
|
|
|
self.remove("labelThem");
|
2017-07-10 18:06:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
},{
|
|
|
|
|
|
|
|
onstart: function(self){
|
|
|
|
|
2017-07-15 02:29:31 +00:00
|
|
|
var o = self.objects;
|
|
|
|
|
2017-07-10 18:06:22 +00:00
|
|
|
// Payoff
|
2017-07-15 02:29:31 +00:00
|
|
|
o.iterated.oneoffHighlight1(_.answer);
|
2017-07-10 18:06:22 +00:00
|
|
|
|
|
|
|
// Text
|
2017-07-15 02:29:31 +00:00
|
|
|
var t = o.topWords;
|
|
|
|
var b = o.btmWords;
|
2017-07-10 18:06:22 +00:00
|
|
|
if(_.answer=="COOPERATE"){
|
2017-07-15 02:29:31 +00:00
|
|
|
t.setText(Words.get("oneoff_1_cooperated")+"<br>"+Words.get("oneoff_1_top"));
|
2017-07-10 18:06:22 +00:00
|
|
|
}else{
|
2017-07-15 02:29:31 +00:00
|
|
|
t.setText(Words.get("oneoff_1_cheated")+"<br>"+Words.get("oneoff_1_top"));
|
2017-07-10 18:06:22 +00:00
|
|
|
}
|
|
|
|
b.setTextID("oneoff_1_btm");
|
2017-07-15 02:29:31 +00:00
|
|
|
|
|
|
|
// Hide & fade
|
|
|
|
_hide(o.topWords); _fadeIn(o.topWords, 150+10);
|
|
|
|
_hide(o.btmWords); _fadeIn(o.btmWords, 150+600);
|
|
|
|
_hide(o.btnCheat); _fadeIn(o.btnCheat, 150+1200);
|
|
|
|
_hide(o.btnCooperate); _fadeIn(o.btnCooperate, 150+1200);
|
|
|
|
|
2017-07-10 18:06:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
},{
|
|
|
|
|
|
|
|
onstart: function(self){
|
|
|
|
|
2017-07-15 02:29:31 +00:00
|
|
|
var o = self.objects;
|
|
|
|
|
2017-07-10 18:06:22 +00:00
|
|
|
// Payoff
|
2017-07-15 02:29:31 +00:00
|
|
|
o.iterated.oneoffHighlight2(_.answer);
|
2017-07-10 18:06:22 +00:00
|
|
|
|
|
|
|
// Text
|
2017-07-15 02:29:31 +00:00
|
|
|
var t = o.topWords;
|
|
|
|
var b = o.btmWords;
|
2017-07-10 18:06:22 +00:00
|
|
|
if(_.answer=="COOPERATE"){
|
2017-07-15 02:29:31 +00:00
|
|
|
t.setText(Words.get("oneoff_2_cooperated")+"<br>"+Words.get("oneoff_2_top"));
|
2017-07-10 18:06:22 +00:00
|
|
|
}else{
|
2017-07-15 02:29:31 +00:00
|
|
|
t.setText(Words.get("oneoff_2_cheated")+"<br>"+Words.get("oneoff_2_top"));
|
2017-07-10 18:06:22 +00:00
|
|
|
}
|
|
|
|
b.setTextID("oneoff_2_btm");
|
|
|
|
|
|
|
|
// Replace button
|
|
|
|
self.remove("btnCheat");
|
|
|
|
self.remove("btnCooperate");
|
|
|
|
self.add({
|
2017-07-15 02:29:31 +00:00
|
|
|
id:"btnNext", type:"Button", x:304, y:466, size:"long",
|
|
|
|
text_id:"oneoff_button_next",
|
2017-07-10 18:06:22 +00:00
|
|
|
message:"slideshow/next"
|
|
|
|
});
|
|
|
|
|
2017-07-15 02:29:31 +00:00
|
|
|
// Hide & fade
|
|
|
|
_hide(o.topWords); _fadeIn(o.topWords, 150+10);
|
|
|
|
_hide(o.btmWords); _fadeIn(o.btmWords, 150+600);
|
|
|
|
_hide(o.btnNext); _fadeIn(o.btnNext, 150+1200);
|
|
|
|
|
2017-07-12 13:42:17 +00:00
|
|
|
},
|
2017-07-10 18:06:22 +00:00
|
|
|
|
2017-07-12 13:42:17 +00:00
|
|
|
onend: function(self){
|
|
|
|
self.objects.iterated.dehighlightPayoff();
|
|
|
|
self.remove("topWords");
|
|
|
|
self.remove("btmWords");
|
|
|
|
self.remove("btnNext");
|
2017-07-15 02:29:31 +00:00
|
|
|
_.clear();
|
2017-07-10 18:06:22 +00:00
|
|
|
}
|
2017-07-12 13:42:17 +00:00
|
|
|
|
|
|
|
});
|
|
|
|
|