summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
Diffstat (limited to 'public')
-rw-r--r--public/js/game.js18
1 files changed, 10 insertions, 8 deletions
diff --git a/public/js/game.js b/public/js/game.js
index f095c4b..a4cf74b 100644
--- a/public/js/game.js
+++ b/public/js/game.js
@@ -101,13 +101,15 @@ var Events = {
// Explicit changes to the UI when moving from one state to another.
// This is for things like moving divs off the screen, changing bindings, etc.
// Anything a load method does should be undone by the unload method.. for now.
+// These are all functions so they can have their own weirdo scope..
+// I should have started doing it like this a long time ago!
var UI = {};
-UI[ State.WAITING ] = {
- load: function(data){
+UI[ State.WAITING ] = new function() {
+ this.load = function(data){
$("#current-state").html("Waiting");
$("#drawing").show();
- },
- unload: function(){
+ }
+ this.unload = function(){
$("#drawing").hide();
}
}
@@ -161,11 +163,11 @@ UI[ State.WINNING ] = new function(){
}
}
-UI[ State.RESET ] = {
- load: function(data){
+UI[ State.RESET ] = new function() {
+ this.load = function(data){
$("#current-state").html("whoahao RESET!");
- },
- unload: function(){
+ }
+ this.unload = function(){
}
}