forked from Github/uno-online
Improvements and bug fixes
This commit is contained in:
parent
ff7cbe703e
commit
8b12e81206
@ -483,10 +483,12 @@ const Game = () => {
|
|||||||
setDrawCardPile([...copiedDrawCardPileArray])
|
setDrawCardPile([...copiedDrawCardPileArray])
|
||||||
}
|
}
|
||||||
//else add the drawn card to player1's deck
|
//else add the drawn card to player1's deck
|
||||||
//set new state
|
else {
|
||||||
setTurn('Player 2')
|
//set new state
|
||||||
setPlayer1Deck([...player1Deck.slice(0, player1Deck.length), drawCard, ...player1Deck.slice(player1Deck.length)])
|
setTurn('Player 2')
|
||||||
setDrawCardPile([...copiedDrawCardPileArray])
|
setPlayer1Deck([...player1Deck.slice(0, player1Deck.length), drawCard, ...player1Deck.slice(player1Deck.length)])
|
||||||
|
setDrawCardPile([...copiedDrawCardPileArray])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//remove 1 new card from drawCardPile and add it to player2's deck (immutably)
|
//remove 1 new card from drawCardPile and add it to player2's deck (immutably)
|
||||||
@ -557,10 +559,12 @@ const Game = () => {
|
|||||||
setDrawCardPile([...copiedDrawCardPileArray])
|
setDrawCardPile([...copiedDrawCardPileArray])
|
||||||
}
|
}
|
||||||
//else add the drawn card to player2's deck
|
//else add the drawn card to player2's deck
|
||||||
//set new state
|
else {
|
||||||
setTurn('Player 1')
|
//set new state
|
||||||
setPlayer2Deck([...player2Deck.slice(0, player2Deck.length), drawCard, ...player2Deck.slice(player2Deck.length)])
|
setTurn('Player 1')
|
||||||
setDrawCardPile([...copiedDrawCardPileArray])
|
setPlayer2Deck([...player2Deck.slice(0, player2Deck.length), drawCard, ...player2Deck.slice(player2Deck.length)])
|
||||||
|
setDrawCardPile([...copiedDrawCardPileArray])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,21 +1,13 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { Link } from 'react-router-dom'
|
import { Link } from 'react-router-dom'
|
||||||
import { START_GAME } from '../store/actions'
|
|
||||||
import { connect } from 'react-redux'
|
|
||||||
|
|
||||||
const Homepage = (props) => {
|
const Homepage = () => {
|
||||||
return (
|
return (
|
||||||
<div className='Homepage'>
|
<div className='Homepage'>
|
||||||
<h1>UNO</h1>
|
<h1>UNO</h1>
|
||||||
<Link to='/play'><button onClick={props.onStartGame}>START GAME</button></Link>
|
<Link to='/play'><button>START GAME</button></Link>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => {
|
export default Homepage
|
||||||
return {
|
|
||||||
onStartGame: () => dispatch({type: START_GAME})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default connect(null, mapDispatchToProps)(Homepage)
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//pack of 108 cards (# = reverse)
|
//pack of 108 cards (# = reverse)
|
||||||
export default CARDS = [
|
export default [
|
||||||
'0R', '1R', '1R', '2R', '2R', '3R', '3R', '4R', '4R', '5R', '5R', '6R', '6R', '7R', '7R', '8R', '8R', '9R', '9R', 'skipR', 'skipR', '#R', '#R', 'D2R', 'D2R',
|
'0R', '1R', '1R', '2R', '2R', '3R', '3R', '4R', '4R', '5R', '5R', '6R', '6R', '7R', '7R', '8R', '8R', '9R', '9R', 'skipR', 'skipR', '#R', '#R', 'D2R', 'D2R',
|
||||||
'0G', '1G', '1G', '2G', '2G', '3G', '3G', '4G', '4G', '5G', '5G', '6G', '6G', '7G', '7G', '8G', '8G', '9G', '9G', 'skipG', 'skipG', '#G', '#G', 'D2G', 'D2G',
|
'0G', '1G', '1G', '2G', '2G', '3G', '3G', '4G', '4G', '5G', '5G', '6G', '6G', '7G', '7G', '8G', '8G', '9G', '9G', 'skipG', 'skipG', '#G', '#G', 'D2G', 'D2G',
|
||||||
'0B', '1B', '1B', '2B', '2B', '3B', '3B', '4B', '4B', '5B', '5B', '6B', '6B', '7B', '7B', '8B', '8B', '9B', '9B', 'skipB', 'skipB', '#B', '#B', 'D2B', 'D2B',
|
'0B', '1B', '1B', '2B', '2B', '3B', '3B', '4B', '4B', '5B', '5B', '6B', '6B', '7B', '7B', '8B', '8B', '9B', '9B', 'skipB', 'skipB', '#B', '#B', 'D2B', 'D2B',
|
||||||
|
Loading…
Reference in New Issue
Block a user