1 var BreadItemWidgetClass = function(manager, args)
3 BreadItemWidgetClass.base.apply(this, arguments);
4 this.manager = manager;
6 this.size = new Point2D(320, 32);
7 this.origin = new Point2D(5, 37);
9 this.updateInterval = 10;
10 this.updateCount = 999;
13 this.numberKeyPressed = [false, false, false, false, false, false, false, false, false, false];
15 }.extend(WidgetClass, {
16 generateBreadImage(score){
19 return "burntbread.png";
35 attach : function(){},
39 this.manager.mainArea.removeChild(this.wBox);
41 var element = document.createElement('div');
44 style.top = this.origin.y + "px";
45 style.left = this.origin.x + "px";
46 style.width = this.size.x + "px";
47 style.height = this.size.y + "px";
48 //style.overflow = "hidden";
49 style.position = "absolute";
54 var items = this.manager.userManager.breadList;
57 for(var i = 0; i < maxItems && i < items.length; i++)
59 var img = document.createElement('img');
62 style.position = "absolute";
64 style.left = xloc + "px";
65 style.width = this.size.y + "px";
66 style.height = this.size.y + "px";
67 src = "images/" + BreadItemWidgetClass.prototype.generateBreadImage(items[i]);
68 //src = "images/012.png";
70 element.appendChild(img);
71 var div = document.createElement('div');
74 style.position = "absolute";
75 style.top = this.size.y + "px";
76 style.left = xloc + "px";
77 style.width = this.size.y + "px";
78 style.height = this.size.y + "px";
79 style.textAlign = "center";
82 element.appendChild(div);
86 this.manager.mainArea.appendChild(element);
93 this.manager.mainArea.removeChild(this.wBox);
99 if(this.updateCount > this.updateInterval)
102 this.updateCount = 0;
105 for(var i = 0; i < 10; i++)
107 if(this.manager.UIManager.keyState.numbers[i])
109 if(this.numberKeyPressed[i])
111 this.keyPressed(this.manager.userManager.breadList[i]);
115 this.numberKeyPressed[i] = false;
121 keyPressed : function(breadId)