Skip to content

Commit 241ccd9

Browse files
committed
Add menu class
1 parent e281b25 commit 241ccd9

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

src/UI/Menu.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
var Element = require("./Element");
2+
3+
var Menu = function(ui, x, y){
4+
Element.call(this, ui, x, y);
5+
Phaser.GameObjects.Container.call(this, ui.scene, x , y);
6+
}
7+
8+
Menu.prototype = Object.create(Phaser.GameObjects.Container.prototype);
9+
Object.assign(Menu.prototype, Element.prototype);
10+
11+
Menu.prototype.add = function(x,y, item, callback, args, context){
12+
this[item] = this.ui.add.text(x, y, item, null, null, null, callback, args, context).setFontStyle(PathBuilder.UI.fonts["Button"]);
13+
Phaser.GameObjects.Container.prototype.add.call(this, this[item]);
14+
return this[item];
15+
}
16+
17+
Menu.prototype.update = function(){
18+
19+
}
20+
21+
Menu.prototype.hide = function(){
22+
console.log(this);
23+
this.list.forEach(function(element){ element.setVisible(false)});
24+
}
25+
26+
Menu.prototype.show = function(){
27+
this.list.forEach(function(element){ element.setVisible(true)});
28+
}
29+
30+
Menu.prototype.divide = function(){
31+
32+
}
33+
34+
35+
module.exports = Menu;

0 commit comments

Comments
 (0)