added roll icon
This commit is contained in:
parent
8a172e2ad2
commit
eea532ec47
@ -40,6 +40,9 @@ function App() {
|
|||||||
<Gameboard />
|
<Gameboard />
|
||||||
</PlayerDataContext.Provider>
|
</PlayerDataContext.Provider>
|
||||||
) : null}
|
) : null}
|
||||||
|
<a href='https://www.flaticon.com/free-icons/hand' title='hand icons'>
|
||||||
|
Hand icons created by berkahicon - Flaticon
|
||||||
|
</a>
|
||||||
</Route>
|
</Route>
|
||||||
</Switch>
|
</Switch>
|
||||||
</Router>
|
</Router>
|
||||||
|
|||||||
@ -27,3 +27,6 @@
|
|||||||
width: 50px;
|
width: 50px;
|
||||||
height: 50px;
|
height: 50px;
|
||||||
}
|
}
|
||||||
|
.roll {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|||||||
@ -6,10 +6,11 @@ import three from '../../images/dice/3.png';
|
|||||||
import four from '../../images/dice/4.png';
|
import four from '../../images/dice/4.png';
|
||||||
import five from '../../images/dice/5.png';
|
import five from '../../images/dice/5.png';
|
||||||
import six from '../../images/dice/6.png';
|
import six from '../../images/dice/6.png';
|
||||||
|
import roll from '../../images/dice/roll.png';
|
||||||
|
|
||||||
const Dice = ({ rolledNumberCallback, rolledNumber, nowMoving, color, movingPlayer }) => {
|
const Dice = ({ rolledNumberCallback, rolledNumber, nowMoving, color, movingPlayer }) => {
|
||||||
const socket = useContext(SocketContext);
|
const socket = useContext(SocketContext);
|
||||||
const [images] = useState([one, two, three, four, five, six]);
|
const [images] = useState([one, two, three, four, five, six, roll]);
|
||||||
const handleRoll = () => {
|
const handleRoll = () => {
|
||||||
socket.emit('game:roll');
|
socket.emit('game:roll');
|
||||||
};
|
};
|
||||||
@ -24,7 +25,7 @@ const Dice = ({ rolledNumberCallback, rolledNumber, nowMoving, color, movingPlay
|
|||||||
rolledNumber ? (
|
rolledNumber ? (
|
||||||
<img src={images[rolledNumber - 1]} alt={rolledNumber} width='100' height='100' />
|
<img src={images[rolledNumber - 1]} alt={rolledNumber} width='100' height='100' />
|
||||||
) : nowMoving ? (
|
) : nowMoving ? (
|
||||||
<button onClick={handleRoll}> Roll </button>
|
<img src={images[6]} className='roll' alt='roll' width='100' height='100' onClick={handleRoll} />
|
||||||
) : null
|
) : null
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
BIN
src/images/dice/roll.png
Normal file
BIN
src/images/dice/roll.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 66 KiB |
Loading…
Reference in New Issue
Block a user