2022-11-04 12:18:45 +00:00
|
|
|
class TimeMenu {
|
|
|
|
constructor() {
|
2022-11-18 14:51:05 +00:00
|
|
|
this.buttons = [
|
|
|
|
new Button(660,0,100,30,0,true,"#fff",false,"#000","#000","15s"),
|
|
|
|
new Button(660,30,100,30,0,true,"#fff",false,"#000","#000","30s"),
|
|
|
|
new Button(660,60,100,30,0,true,"#fff",false,"#000","#000","45s"),
|
|
|
|
new Button(660,90,100,30,0,true,"#fff",false,"#000","#000","60s"),
|
|
|
|
];
|
|
|
|
this.dropdown = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
draw() {
|
|
|
|
this.buttons[0].draw();
|
|
|
|
|
|
|
|
if (this.dropdown) {
|
|
|
|
for (let i = 0; i < this.buttons.length; i++) {
|
|
|
|
this.buttons[i].draw()
|
|
|
|
if (this.buttons[0].isPressed() && user.time != 15) {
|
|
|
|
user.time = 15;
|
|
|
|
this.dropdown = false;
|
|
|
|
} else if (this.buttons[1].isPressed()) {
|
|
|
|
user.time = 30;
|
|
|
|
this.dropdown = false;
|
|
|
|
} else if (this.buttons[2].isPressed()) {
|
|
|
|
user.time = 45;
|
|
|
|
this.dropdown = false;
|
|
|
|
} else if (this.buttons[3].isPressed()) {
|
|
|
|
user.time = 60;
|
|
|
|
this.dropdown = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-04 12:18:45 +00:00
|
|
|
|
2022-11-18 14:51:05 +00:00
|
|
|
if (this.buttons[0].isPressed()) {
|
|
|
|
this.dropdown = true;
|
|
|
|
} else if (mouseIsPressed) {
|
|
|
|
this.dropdown = false;
|
|
|
|
}
|
2022-11-04 12:18:45 +00:00
|
|
|
}
|
|
|
|
}
|