disable button while 'cpu' playing
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<title>openzilch.js</title>
|
<title>openzilch.js</title>
|
||||||
<link href="style/main.css" rel="stylesheet" type="text/css" />
|
<link href="style/main.css" rel="stylesheet" type="text/css" />
|
||||||
|
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=0.5, maximum-scale=1, user-scalable=no, minimal-ui">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -28,20 +28,26 @@ function Interface() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
self.pointsButton.addEventListener("click", function() {
|
self.pointsButton.addEventListener("click", function() {
|
||||||
|
if (self.playing) {
|
||||||
self.fireEvent("takePoints");
|
self.fireEvent("takePoints");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
self.dicesButton.addEventListener("click", function() {
|
self.dicesButton.addEventListener("click", function() {
|
||||||
|
if (self.playing) {
|
||||||
self.fireEvent("addPoints");
|
self.fireEvent("addPoints");
|
||||||
self.fireEvent("roleDices");
|
self.fireEvent("roleDices");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
for (var diceIndex = 0; diceIndex < 6; diceIndex++) {
|
for (var diceIndex = 0; diceIndex < 6; diceIndex++) {
|
||||||
var diceContainer = self.dices[diceIndex];
|
var diceContainer = self.dices[diceIndex];
|
||||||
diceContainer.diceIndex = diceIndex;
|
diceContainer.diceIndex = diceIndex;
|
||||||
diceContainer.addEventListener("click", function() {
|
diceContainer.addEventListener("click", function() {
|
||||||
|
if (self.playing) {
|
||||||
self.fireEvent("toggleDice", this.diceIndex);
|
self.fireEvent("toggleDice", this.diceIndex);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,9 +144,11 @@ Interface.prototype.setPoints = function(points) {
|
|||||||
|
|
||||||
Interface.prototype.setPlaying = function(playing) {
|
Interface.prototype.setPlaying = function(playing) {
|
||||||
if (playing) {
|
if (playing) {
|
||||||
|
this.playing = true;
|
||||||
this.playerScoreContainer.classList.add('active');
|
this.playerScoreContainer.classList.add('active');
|
||||||
this.cpuScoreContainer.classList.remove('active');
|
this.cpuScoreContainer.classList.remove('active');
|
||||||
} else {
|
} else {
|
||||||
|
this.playing = false;
|
||||||
this.playerScoreContainer.classList.remove('active');
|
this.playerScoreContainer.classList.remove('active');
|
||||||
this.cpuScoreContainer.classList.add('active');
|
this.cpuScoreContainer.classList.add('active');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user