Skip to content

Commit

Permalink
puzzle effect
Browse files Browse the repository at this point in the history
  • Loading branch information
Roboneet committed Feb 19, 2018
1 parent 93f579c commit e637d17
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 23 deletions.
2 changes: 1 addition & 1 deletion main/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class UserProfile(AbstractUser):
mineno=models.IntegerField(default=0)
#flag = models.ManyToManyField(flagUsed)
#flagUsed = model.IntegerField(default=0)
qslist=models.CharField(max_length=144,default='000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000')
qslist=models.CharField(max_length=144,default='a0b00000000000000000000c00000000000d000000000000e00f000g0000000h0ij00000k0l0m00000000n0000p0q000r000000000000000000000000000000000s000t000000000')

# def timeLeft(self):
# time = 7200 - (timezone.now()-self.regTime).total_seconds()
Expand Down
2 changes: 1 addition & 1 deletion main/static/assets/css/logggin.css
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ Log in form
border-radius: 5px;
display: inline-block;
height: 220px;
/*margin: 200px auto 0;*/
margin: 50px auto 0;
position: relative;
z-index: 4;
width: 500px;
Expand Down
2 changes: 1 addition & 1 deletion main/static/assets/css/loggin.css
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ Log in form
border-radius: 5px;
display: inline-block;
height: 340px;
/*margin: 50px auto 0;*/
margin: 50px auto 0;
position: relative;
z-index: 4;
width: 500px;
Expand Down
16 changes: 8 additions & 8 deletions main/static/assets/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,9 @@ li{



.snackbar{
#snackbar{
position: absolute;
bottom: 20px;
bottom: 40px;
width: 800px;
border: 1px solid #fff;
/* line-height: 50px; */
Expand All @@ -181,11 +181,11 @@ li{
z-index: 99999;
border-radius: 6px;
}
.snackbar p, .snackbar span{
#snackbar p, #snackbar span{
display: inline;
}

.snackbar span{
#snackbar span{
float: right;
margin: 0 10px;
cursor: pointer;
Expand Down Expand Up @@ -273,7 +273,7 @@ li{
}

.bombMessage{
background: #e62f2099;
background: #e62f2099 !important;
animation: flicker .5s ease-in-out alternate infinite;
}

Expand All @@ -287,15 +287,15 @@ li{
}

.correct{
background: #20e6b399;
background: #20e6b399 !important;
}

.awesome{
background: #20e64f99;
background: #20e64f99 !important;
}

.wrong{
background: #4c20e699;
background: #4c20e699 !important;
}

.gameOver{
Expand Down
13 changes: 13 additions & 0 deletions main/static/assets/css/puzzle.css
Original file line number Diff line number Diff line change
Expand Up @@ -220,4 +220,17 @@ body{
.ex-small{
line-height: 25px;

}
.glowPiece{
border: 5px solid #aa9574 !important;
animation: glowy .5s linear alternate infinite;
}

@keyframes glowy{
from{
border: 5px solid #aa9574 !important;
},
to{
border: 5px solid #276877 !important;
}
}
17 changes: 11 additions & 6 deletions main/static/assets/js/main.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
var prevGrid = (new Array(12)).fill(new Array(12).fill("9"));
var newPeice = null;


$('.tadaa').hide();
$('.snackbar').hide();
$('#snackbar').hide();
$('#puzzle').hide();
$('#game-over').hide();

setTimeout(function(){
$('.tadaa').removeClass('__hidden__');
$('.snackbar').removeClass('__hidden__')
$('#snackbar').removeClass('__hidden__')
$('#game-over').removeClass('__hidden__')
}, 1000)

Expand Down Expand Up @@ -429,6 +431,7 @@ function submitSuccess(data){
if(data.status == "CP"){
console.log(data)
setTimeout(()=>{
newPeice = data.index;
openPuzzle(data.puzzle, data.TrialsLeft)
}, 500);
}
Expand All @@ -443,9 +446,11 @@ function submitFaliure(data){

function openSnackBar(templateName, autoFade=false){
console.log(templateName);
$('.snackbar').html(templates[templateName].html);
$('.snackbar').addClass(templates[templateName].class)
$('.snackbar').fadeIn();
console.log($('#snackbar'), $('#snackbar')[0] ,$('#snackbar')[0].className)
$('#snackbar').html(templates[templateName].html);
$('#snackbar')[0].className = (templates[templateName].class);
console.log($('#snackbar'), $('#snackbar')[0] ,$('#snackbar')[0].className)
$('#snackbar').fadeIn();

if(autoFade){
setTimeout(()=>{
Expand All @@ -455,7 +460,7 @@ function openSnackBar(templateName, autoFade=false){
}

function closeSnackBar(){
$('.snackbar').fadeOut();
$('#snackbar').fadeOut();
}


Expand Down
15 changes: 14 additions & 1 deletion main/static/assets/js/puzzle.js
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,11 @@ function initPuzzle(str, tLeft){
})
board.appendChild(scene);
setupConfig();
console.log("newPeice", newPeice)
if(newPeice != null){
glowPiece(newPeice);
newPeice = null;
}
game.start();
}

Expand Down Expand Up @@ -724,4 +729,12 @@ function getString(callback){
})
}

// openPuzzle();
// openPuzzle();

function glowPiece(i){
console.log("glow",i, pieceList[i].ele)
$(pieceList[i].ele).addClass('glowPiece');
setTimeout(function(){
$(pieceList[i].ele).removeClass('glowPiece');
}, 3000)
}
2 changes: 1 addition & 1 deletion main/templates/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<div id="form">

<div id="logo">
<h3 class="tag" style="color: #5ec8c6;font-size: 20px;text-shadow:7px 7px 3px #000000;">ACMW and ACM presents</h3>
<!-- <h3 class="tag" style="color: #5ec8c6;font-size: 20px;text-shadow:7px 7px 3px #000000;">ACMW and ACM presents</h3> -->
<h1><i> CHECKMATE 2018</i></h1>
</div>
<section class="stark-login">
Expand Down
4 changes: 2 additions & 2 deletions main/templates/minesweeper.html
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ <h1>CHECKMATE 18<span class="letter6">_</span></h1>

</div>
<!-- bottom popup -->
<div class="snackbar __hidden__">
<div id="snackbar" class=" __hidden__">

</div>

Expand All @@ -142,7 +142,7 @@ <h1>CHECKMATE 18<span class="letter6">_</span></h1>
</section>
<section id="game-over" class="__hidden__">
<p>GAME OVER</p>
<button class="lo" onclick="logout()">LOG OUT</button>
<button class="lo" onclick="logout()" style="cursor:pointer;">LOG OUT</button>
</section>
</div>

Expand Down
4 changes: 2 additions & 2 deletions main/templates/register.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
</head>
<body>
<div id="wrapper">
<video src="{% static '/assets/cut_video1.mp4' %}" type="video/mp4" width="100%" height="100%" autoplay muted="true" id="vid1" paused>
<video src="{% static '/assets/cut_video1.mp4' %}" type="video/mp4" width="100%" height="100%" autoplay id="vid1" paused>
</video>
<div id="dummy">
<div id="form">

<div id="logo">
<h3 class="tag" style="color: #5ec8c6;font-size: 20px;text-shadow:7px 7px 3px #000000;">ACMW and ACM presents</h3>
<!-- <h3 class="tag" style="color: #5ec8c6;font-size: 20px;text-shadow:7px 7px 3px #000000;">ACMW and ACM presents</h3> -->
<h1><i> CHECKMATE 2018</i></h1>
</div>
<section class="stark-login">
Expand Down
2 changes: 2 additions & 0 deletions main/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,8 @@ def checkAnswer(request):
print(request.user.Puzz)
request.user.Puzz = replacindex(request.user.Puzz,request.user.puzzlePc,'n')
request.user.save()
print("-->")
print(request.user.puzzlePc)
return JsonResponse({'user':request.user.username, 'score':request.user.score,'puzzle':request.user.Puzz,'index':request.user.puzzlePc,'status':"CP",'quesDone':request.user.quesTry,'TrialLeft' : request.user.TrialLeft,'time':request.user.time})

#Pc=PuzzlePc.objects.get(id=request.user.puzzlePc)
Expand Down

0 comments on commit e637d17

Please sign in to comment.