Skip to content

Commit f1b8ab0

Browse files
committed
end game when lost pokerface
1 parent f31556e commit f1b8ab0

File tree

2 files changed

+29
-15
lines changed

2 files changed

+29
-15
lines changed

examples/examples-game/public/styles.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,14 @@
145145

146146
.valueMeter {
147147
position: relative;
148-
width: 500px;
148+
width: 100%;
149149
height: 20px;
150150
margin: 0;
151151
padding: 0;
152152
background-color: white;
153153
display:block;
154154
vertical-align: top;
155-
margin-left: 100px;
155+
/* margin-left: 100px; */
156156
margin-bottom: 20px;
157157
}
158158

@@ -162,7 +162,7 @@
162162
font-size: 1rem;
163163
line-height: 20px;
164164
text-align: right;
165-
width: 90px;
165+
width: 100%;
166166
margin: 0;
167167
padding: 0;
168168
margin-bottom: 20px;

examples/examples-game/views/webcamFaceExpressionRecognition.html

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,16 @@
4444

4545
<div class="pokerface">
4646
<p class="title">Poker Face</p>
47-
<p class="valueMeter-label">Neutral</p>
47+
<!-- <p class="valueMeter-label">Neutral</p> -->
4848
<div class="valueMeter" id="neutralThreshold">
4949
<i class="bar"></i>
5050
<i class="draggable-cursor"></i>
5151
</div>
52-
<p class="valueMeter-label">Exception</p>
52+
<!-- <p class="valueMeter-label">Exception</p>
5353
<div class="valueMeter" id="exceptionThreshold">
5454
<i class="bar"></i>
5555
<i class="draggable-cursor"></i>
56-
</div>
56+
</div> -->
5757
</div>
5858

5959
<div class="video">
@@ -395,7 +395,7 @@ <h4>Detections:</h4>
395395
winning = true;
396396
$('.pokerface').removeClass('nop');
397397
if(last_play != "good" && isPlaying) {
398-
$('audio#audio-good')[0].play();
398+
//$('audio#audio-good')[0].play();
399399
last_play = "good";
400400
}
401401
}
@@ -404,10 +404,19 @@ <h4>Detections:</h4>
404404
winning = false;
405405
$('.pokerface').addClass('nop');
406406
if(last_play != "bad" && isPlaying) {
407-
$('audio#audio-bad')[0].play();
407+
//$('audio#audio-bad')[0].play();
408+
stop();
408409
last_play = "bad";
409410
}
410411
}
412+
413+
}
414+
415+
function playWin() {
416+
$('audio#audio-good')[0].play();
417+
}
418+
function playLost() {
419+
$('audio#audio-bad')[0].play();
411420
}
412421

413422
var isStarted = false;
@@ -442,10 +451,15 @@ <h4>Detections:</h4>
442451

443452
$('#countdown .values').removeAttr('disabled');
444453
$('#detections-list').html('');
445-
updateSlider('neutralThreshold', 0);
446-
updateSlider('exceptionThreshold', 0);
447-
winning = true;
448-
$('.pokerface').removeClass('nop');
454+
//updateSlider('neutralThreshold', 0);
455+
//updateSlider('exceptionThreshold', 0);
456+
457+
if(winning) {
458+
playWin();
459+
}
460+
else {
461+
playLost();
462+
}
449463
}
450464

451465
function pad(number, length) {
@@ -460,9 +474,9 @@ <h4>Detections:</h4>
460474
var timeValues = timer.getTimeValues();
461475
$('#countdown .values').val(pad(timeValues.minutes, 2)+':'+pad(timeValues.seconds, 2));
462476

463-
if (timeValues.seconds <= 2 && $('audio#audio-end')[0].paused) {
464-
$('audio#audio-end')[0].play();
465-
}
477+
// if (timeValues.seconds <= 2 && $('audio#audio-end')[0].paused) {
478+
// $('audio#audio-end')[0].play();
479+
// }
466480
});
467481

468482
timer.addEventListener('targetAchieved', function (e) {

0 commit comments

Comments
 (0)