mirror of
https://github.com/derron1/mpsfun.git
synced 2026-01-21 22:15:08 +00:00
Front page update
This commit is contained in:
@@ -13,8 +13,12 @@
|
|||||||
<div class="slogan"><p class="text-center">Replace The Negatives In Your Life With Positives And Move Your Life Ahead</p></div>
|
<div class="slogan"><p class="text-center">Replace The Negatives In Your Life With Positives And Move Your Life Ahead</p></div>
|
||||||
<br>
|
<br>
|
||||||
<div class="row column text-center">
|
<div class="row column text-center">
|
||||||
|
<<<<<<< HEAD
|
||||||
<button class="hollow button">PLAY NOW</button>
|
<button class="hollow button">PLAY NOW</button>
|
||||||
<p>Skip game, Maybe next time</p>
|
<p>Skip game, Maybe next time</p>
|
||||||
|
=======
|
||||||
|
<button class="hollow button" @click="play">PLAY NOW</button>
|
||||||
|
>>>>>>> 9900326fe2ab7bef4076d5909998bc66fffabbae
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -112,6 +116,7 @@
|
|||||||
<p>Replace The Negatives In Your Life With Positives And Move Your Life Ahead</p>
|
<p>Replace The Negatives In Your Life With Positives And Move Your Life Ahead</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<<<<<<< HEAD
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -144,6 +149,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
-->
|
-->
|
||||||
|
=======
|
||||||
|
<mps-game v-if="playing"></mps-game>
|
||||||
|
>>>>>>> 9900326fe2ab7bef4076d5909998bc66fffabbae
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -281,12 +289,14 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import MpsGame from './MpsGame';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'hello',
|
name: 'hello',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
msg: 'Vue + Foundation',
|
msg: 'Vue + Foundation',
|
||||||
|
playing: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@@ -294,6 +304,14 @@ export default {
|
|||||||
// document.getElementById('first_window').style.height = height;
|
// document.getElementById('first_window').style.height = height;
|
||||||
// console.log(height);
|
// console.log(height);
|
||||||
},
|
},
|
||||||
|
methods: {
|
||||||
|
play() {
|
||||||
|
this.playing = true;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
MpsGame,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="game">
|
<div id="game">
|
||||||
<div class="modal-overlay">
|
<div class="" style="height: 500px;">
|
||||||
<div class="modal">
|
<div class="modal">
|
||||||
<h2 class="winner">Well Done!</h2>
|
<h2 class="winner">Well Done!</h2>
|
||||||
<button @click="restart" class="restart">Play Again?</button>
|
<button @click="restart" class="restart">Play Again?</button>
|
||||||
@@ -9,17 +9,27 @@
|
|||||||
<li></li>
|
<li></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-for="(card, index) in shuffledCards" :id="index" class="card" :data-id="card.id" @click="flip(index)">
|
||||||
|
<div class="inside">
|
||||||
|
<div class="front">
|
||||||
|
<img :src="card.img" :alt="card.name" />
|
||||||
|
</div>
|
||||||
|
<div class="back">
|
||||||
|
<img src="http://i.imgur.com/diex0Zl.png" alt="Codepen" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
|
/* eslint-disable */
|
||||||
name: 'game',
|
name: 'game',
|
||||||
mounted() {
|
mounted() {
|
||||||
|
this.shuffleCards();
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -29,40 +39,99 @@
|
|||||||
overlay: '',
|
overlay: '',
|
||||||
// restartButton:'',
|
// restartButton:'',
|
||||||
cardsArray: '',
|
cardsArray: '',
|
||||||
shuffleCards: '',
|
shuffledCards: [],
|
||||||
card: [
|
paused: false,
|
||||||
|
guess: null,
|
||||||
|
cards: [
|
||||||
{
|
{
|
||||||
name: 'mpsOne',
|
name: 'mpsOne',
|
||||||
img: 'https://cdn.dribbble.com/users/139604/screenshots/3505913/a-behind-the-scenes-project-walkthrough_1x.jpg',
|
img: 'http://lorempixel.com/400/200/sports',
|
||||||
id: 1,
|
id: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'mpsTwo',
|
name: 'mpsTwo',
|
||||||
img: 'https://cdn.dribbble.com/users/139604/screenshots/3505913/a-behind-the-scenes-project-walkthrough_1x.jpg',
|
img: 'http://lorempixel.com/400/200/city',
|
||||||
id: 2,
|
id: 2,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'mpsThree',
|
name: 'mpsThree',
|
||||||
img: 'https://cdn.dribbble.com/users/139604/screenshots/3505913/a-behind-the-scenes-project-walkthrough_1x.jpg',
|
img: 'http://lorempixel.com/400/200/people',
|
||||||
id: 3,
|
id: 3,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'mpsFour',
|
name: 'mpsFour',
|
||||||
img: 'https://cdn.dribbble.com/users/139604/screenshots/3505913/a-behind-the-scenes-project-walkthrough_1x.jpg',
|
img: 'http://lorempixel.com/400/200/transport',
|
||||||
id: 4,
|
id: 4,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
methods: {
|
||||||
|
restart() {
|
||||||
|
this.shuffleCards();
|
||||||
|
},
|
||||||
|
shuffleCards() {
|
||||||
|
this.shuffledCards = this.shuffle(this.cards.concat(this.cards));
|
||||||
|
},
|
||||||
|
shuffle(array) {
|
||||||
|
let counter = array.length;
|
||||||
|
let temp;
|
||||||
|
let index;
|
||||||
|
const localArray = array;
|
||||||
|
// While there are elements in the array
|
||||||
|
while (counter > 0) {
|
||||||
|
// Pick a random index
|
||||||
|
index = Math.floor(Math.random() * counter);
|
||||||
|
// Decrease counter by 1
|
||||||
|
counter -= 1;
|
||||||
|
// And swap the last element with it
|
||||||
|
temp = localArray[counter];
|
||||||
|
localArray[counter] = array[index];
|
||||||
|
localArray[index] = temp;
|
||||||
|
}
|
||||||
|
return localArray;
|
||||||
|
},
|
||||||
|
flip(cardId) {
|
||||||
|
const $card = $('#'+ cardId); // eslint-disable-line
|
||||||
|
if (!this.paused && !$card.find('.inside').hasClass('matched') && !$card.find('.inside').hasClass('picked')) {
|
||||||
|
$card.find('.inside').addClass('picked');
|
||||||
|
if (!this.guess) {
|
||||||
|
this.guess = $($card).attr('data-id');
|
||||||
|
} else if (this.guess === $($card).attr('data-id') && !$($card).hasClass('picked')) {
|
||||||
|
$('.picked').addClass('matched');
|
||||||
|
this.guess = null;
|
||||||
|
} else {
|
||||||
|
this.guess = null;
|
||||||
|
this.paused = true;
|
||||||
|
setTimeout(() => {
|
||||||
|
$('.picked').removeClass('picked');
|
||||||
|
this.paused = false;
|
||||||
|
}, 600);
|
||||||
|
}
|
||||||
|
if ($('.matched').length === $('.card').length) {
|
||||||
|
this.win();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
win() {
|
||||||
|
this.paused = true;
|
||||||
|
setTimeout(function(){
|
||||||
|
alert('SSSSSS');
|
||||||
|
}, 1000);
|
||||||
|
},
|
||||||
|
},
|
||||||
destroyed() {
|
destroyed() {
|
||||||
this.accordion.destroy();
|
// this.accordion.destroy();
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang='scss' scoped>
|
<style lang='scss' scoped>
|
||||||
@import url(http://weloveiconfonts.com/api/?family=brandico);
|
@import url(http://weloveiconfonts.com/api/?family=brandico);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* brandico */
|
/* brandico */
|
||||||
|
|
||||||
[class*="brandico-"]:before {
|
[class*="brandico-"]:before {
|
||||||
font-family: 'brandico', sans-serif;
|
font-family: 'brandico', sans-serif;
|
||||||
}
|
}
|
||||||
@@ -71,7 +140,8 @@
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
html, body {
|
html,
|
||||||
|
body {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,7 +182,7 @@ body {
|
|||||||
|
|
||||||
.card {
|
.card {
|
||||||
float: left;
|
float: left;
|
||||||
width: 16.66666%;
|
width: 25%;
|
||||||
height: 25%;
|
height: 25%;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@@ -135,7 +205,8 @@ body {
|
|||||||
transition: .4s ease-in-out;
|
transition: .4s ease-in-out;
|
||||||
background: white;
|
background: white;
|
||||||
|
|
||||||
&.picked, &.matched {
|
&.picked,
|
||||||
|
&.matched {
|
||||||
transform: rotateY(180deg);
|
transform: rotateY(180deg);
|
||||||
}
|
}
|
||||||
&.matched {
|
&.matched {
|
||||||
@@ -144,7 +215,8 @@ body {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.front, .back {
|
.front,
|
||||||
|
.back {
|
||||||
border: 1px solid black;
|
border: 1px solid black;
|
||||||
backface-visibility: hidden;
|
backface-visibility: hidden;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|||||||
Reference in New Issue
Block a user