1
0
mirror of https://github.com/mizanxali/uno-online synced 2024-12-23 17:47:43 +00:00

Improvements and bug fixes

This commit is contained in:
Mizanali Panjwani 2021-02-17 07:04:27 +05:30
parent ff7cbe703e
commit 8b12e81206
3 changed files with 16 additions and 20 deletions

View File

@ -483,10 +483,12 @@ const Game = () => {
setDrawCardPile([...copiedDrawCardPileArray])
}
//else add the drawn card to player1's deck
//set new state
setTurn('Player 2')
setPlayer1Deck([...player1Deck.slice(0, player1Deck.length), drawCard, ...player1Deck.slice(player1Deck.length)])
setDrawCardPile([...copiedDrawCardPileArray])
else {
//set new state
setTurn('Player 2')
setPlayer1Deck([...player1Deck.slice(0, player1Deck.length), drawCard, ...player1Deck.slice(player1Deck.length)])
setDrawCardPile([...copiedDrawCardPileArray])
}
}
else {
//remove 1 new card from drawCardPile and add it to player2's deck (immutably)
@ -557,10 +559,12 @@ const Game = () => {
setDrawCardPile([...copiedDrawCardPileArray])
}
//else add the drawn card to player2's deck
//set new state
setTurn('Player 1')
setPlayer2Deck([...player2Deck.slice(0, player2Deck.length), drawCard, ...player2Deck.slice(player2Deck.length)])
setDrawCardPile([...copiedDrawCardPileArray])
else {
//set new state
setTurn('Player 1')
setPlayer2Deck([...player2Deck.slice(0, player2Deck.length), drawCard, ...player2Deck.slice(player2Deck.length)])
setDrawCardPile([...copiedDrawCardPileArray])
}
}
}

View File

@ -1,21 +1,13 @@
import React from 'react'
import { Link } from 'react-router-dom'
import { START_GAME } from '../store/actions'
import { connect } from 'react-redux'
const Homepage = (props) => {
const Homepage = () => {
return (
<div className='Homepage'>
<h1>UNO</h1>
<Link to='/play'><button onClick={props.onStartGame}>START GAME</button></Link>
<Link to='/play'><button>START GAME</button></Link>
</div>
)
}
const mapDispatchToProps = (dispatch) => {
return {
onStartGame: () => dispatch({type: START_GAME})
}
}
export default connect(null, mapDispatchToProps)(Homepage)
export default Homepage

View File

@ -1,5 +1,5 @@
//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',
'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',