diff --git a/bob_party/App.tsx b/bob_party/App.tsx
index bdd8a2f..025a7ce 100644
--- a/bob_party/App.tsx
+++ b/bob_party/App.tsx
@@ -3,7 +3,8 @@ import store from './src/redux/store'
import { Provider } from 'react-redux'
import React, { useCallback } from 'react';
import { useFonts } from 'expo-font';
-
+import TicTacToeOnline from './src/Games/Tic-Tac-Toe/tic_tac_toe_online';
+import BlackJack from './src/Games/BlackJack/blackJack';
export default function App() {
@@ -19,6 +20,7 @@ export default function App() {
return (
+
diff --git a/bob_party/server.js b/bob_party/server.js
index c677649..5e575ef 100644
--- a/bob_party/server.js
+++ b/bob_party/server.js
@@ -16,10 +16,17 @@ io.on('connection', (socket) => {
});
socket.on("messageSent", (conv) =>{
- console.log("C"+conv.id);
socket.to("C"+conv.id).emit("messageReceived");
console.log("Message envoyé");
});
+
+ socket.on('inMatch', (match) => {
+ socket.join("M" + match);
+ });
+
+ socket.on("playTicTacToe", (match, rowIndex, columnIndex, turn) =>{
+ socket.to("M"+match).emit("oppPlayTicTacToe", rowIndex, columnIndex, turn);
+ });
});
server.listen(3000, () => {
diff --git a/bob_party/src/Games/BlackJack/blackJack.js b/bob_party/src/Games/BlackJack/blackJack.js
new file mode 100644
index 0000000..2c574eb
--- /dev/null
+++ b/bob_party/src/Games/BlackJack/blackJack.js
@@ -0,0 +1,243 @@
+import React,{Component, useState} from 'react';
+import {
+ View,
+ StyleSheet,
+ ImageBackground,
+ UIManager,
+ StatusBar,
+ NativeModules,
+ AppState,
+ Platform
+} from 'react-native';
+import cardsDeck from './source/data/cards';
+import {shuffle} from './source/helpers';
+import {Overlay,ChipSelector, UserControls,FloatingText} from './source/components';
+import boardBg from './source/assets/board.png';
+import { MANAGER_USER } from '../../../appManagers';
+import { UserCoinsModifier } from '../../core/User/userCoinsModifier';
+
+
+export default function BlackJack(){
+
+ const [totalBet, setTotalBet] = useState(0);
+ const [amount, setAmount] = useState(MANAGER_USER.getCurrentUser()?.getCurrentCoins());
+ const [playerHand, setPlayerHand] = useState([]);
+ const [dealerHand, setDealerHand] = useState([]);
+ const [gameover, setGameover] = useState(false);
+ const [cardCount, setCardCount] = useState(0);
+ const [gameMessage, setGameMessage] = useState("");
+ const [gameStarted, setGameStarted] = useState(false);
+ const [startGame, setStartGame] = useState(false);
+
+
+
+ return(
+ <>
+
+
+
+
+
+
+ newGame()}
+ hit={() => hit()}
+ doubleGame={() => doubleGame()}
+ endgame={() => endgame()}
+ gameover={gameover}
+ totalBet={totalBet}
+ />
+
+
+
+
+ {
+ if(!gameover && startGame){
+ if(chipValue <= amount && !gameStarted){
+ setTotalBet(totalBet+chipValue);
+ setAmount(amount-chipValue);
+ }
+ }
+ else{
+ if (amount > 0 && amount>=chipValue){
+ newGame();
+ setTotalBet(totalBet+chipValue);
+ setAmount(amount-chipValue);
+ }
+ }
+ }}
+ />
+
+
+
+
+ {gameover && gameMessage != "" && { newGame() }} />}
+
+
+
+ >
+ )
+
+ async function modifAmount(money){
+ const modif = new UserCoinsModifier();
+ const tmp=MANAGER_USER.getCurrentUser();
+ setAmount(money);
+ if (tmp!=null){
+ await modif.changeCurrentCoins(tmp, money);
+ }
+ }
+
+ function newGame(){
+ let cardCount = 0;
+ shuffle(cardsDeck);
+
+ let playerHand = [],
+ dealerHand = [];
+
+ for(let i = 0; i < 2; i++){
+ playerHand.push(cardsDeck[cardCount]);
+ cardCount++;
+ dealerHand.push(cardsDeck[cardCount]);
+ cardCount++;
+ }
+
+ setPlayerHand(playerHand);
+ setDealerHand(dealerHand);
+ setGameover(false);
+ setCardCount(cardCount);
+ setGameMessage("");
+ setStartGame(true);
+ }
+
+ function hit(){
+ const hand=playerHand;
+
+ hand.push(cardsDeck[cardCount]);
+
+ let userPoints = checkTotalPlayerPoints(hand);
+ setGameStarted(true);
+ setPlayerHand(hand);
+ setCardCount(cardCount+1)
+
+ if(userPoints > 21){
+ endgame();
+ return;
+ }
+ }
+
+ function doubleGame(){
+ hit();
+ endgame();
+ }
+
+ async function endgame(){
+
+ let _cardCount = cardCount;
+
+ let dealerPoints = checkTotalPlayerPoints(dealerHand),
+ playerPoints = checkTotalPlayerPoints(playerHand);
+ //alert(dealerPoints)
+ while(dealerPoints < 17){
+ dealerHand.push(cardsDeck[_cardCount]);
+ _cardCount++;
+ dealerPoints = checkTotalPlayerPoints(dealerHand);
+ }
+
+ let betValue = totalBet * 1.5;
+ setGameStarted(false);
+
+ //who won
+ if(playerPoints == 21 && playerHand.length == 2){
+ //multiplicar su apuesta x 1.5
+ let newAmount = totalBet * 1.5;
+ await modifAmount(newAmount);
+ setTotalBet(0);
+ setGameover(true);
+ setGameMessage("Player BlackJack!");
+ }
+
+ if(
+ (playerPoints < 22 && dealerPoints < playerPoints) ||
+ (dealerPoints > 21 && playerPoints < 22)
+ ){
+
+ await modifAmount(amount+betValue);
+
+ setTotalBet(0);
+ setGameover(true);
+ setGameMessage("You Win $ "+ betValue);
+
+ }else if(dealerPoints > 21 && playerPoints < 22){
+ await modifAmount(amount+betValue);
+ setTotalBet(0);
+ setGameover(true);
+ setGameMessage("You Win $ "+ betValue);
+ }
+ else if(playerPoints > 21 && dealerPoints <= 21){
+ await modifAmount(amount);
+ setCardCount(_cardCount);
+ setTotalBet(0);
+ setGameover(true);
+ setGameMessage("Bust!");
+
+ }else if(playerPoints == dealerPoints){
+ await modifAmount(amount+totalBet);
+
+ setTotalBet(0);
+ setGameover(true);
+ setGameMessage("Push!");
+ }else{
+ await modifAmount(amount+totalBet);
+
+ setTotalBet(0);
+ setGameover(true);
+ setGameMessage("Dealer Wins, You Lost");
+ }
+ }
+
+ function checkTotalPlayerPoints(playerHand){
+ let aceAdjuts = false,
+ points = 0;
+ playerHand.map((card,_index) => {
+ if(card.name == 'A' && !aceAdjuts) {
+ aceAdjuts = true;
+ points = points + 10;
+ }
+ points = points + card.value;
+ });
+
+ if(aceAdjuts && points > 21){
+ points = points - 10;
+ }
+
+ return points;
+ }
+ }
+
+ const styles = StyleSheet.create({
+ container : {
+ flex : 1
+ },
+ center : {
+ alignItems : "center"
+ },
+
+ bottom : {
+ position : "absolute",
+ left : 0,
+ right : 0,
+ bottom : 0,
+ zIndex : 2
+ }
+ });
+
+
\ No newline at end of file
diff --git a/bob_party/src/Games/BlackJack/icon.png b/bob_party/src/Games/BlackJack/icon.png
new file mode 100644
index 0000000..6b7ccf2
Binary files /dev/null and b/bob_party/src/Games/BlackJack/icon.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/board.png b/bob_party/src/Games/BlackJack/source/assets/board.png
new file mode 100644
index 0000000..9ac084e
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/board.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/back.png b/bob_party/src/Games/BlackJack/source/assets/cards/back.png
new file mode 100755
index 0000000..28768c8
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/back.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/clubs/10.png b/bob_party/src/Games/BlackJack/source/assets/cards/clubs/10.png
new file mode 100755
index 0000000..e65d813
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/clubs/10.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/clubs/2.png b/bob_party/src/Games/BlackJack/source/assets/cards/clubs/2.png
new file mode 100755
index 0000000..c12a2d8
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/clubs/2.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/clubs/3.png b/bob_party/src/Games/BlackJack/source/assets/cards/clubs/3.png
new file mode 100755
index 0000000..689a87e
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/clubs/3.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/clubs/4.png b/bob_party/src/Games/BlackJack/source/assets/cards/clubs/4.png
new file mode 100755
index 0000000..d7397e1
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/clubs/4.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/clubs/5.png b/bob_party/src/Games/BlackJack/source/assets/cards/clubs/5.png
new file mode 100755
index 0000000..def72e6
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/clubs/5.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/clubs/6.png b/bob_party/src/Games/BlackJack/source/assets/cards/clubs/6.png
new file mode 100755
index 0000000..f3543de
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/clubs/6.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/clubs/7.png b/bob_party/src/Games/BlackJack/source/assets/cards/clubs/7.png
new file mode 100755
index 0000000..764fd22
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/clubs/7.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/clubs/8.png b/bob_party/src/Games/BlackJack/source/assets/cards/clubs/8.png
new file mode 100755
index 0000000..abbba85
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/clubs/8.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/clubs/9.png b/bob_party/src/Games/BlackJack/source/assets/cards/clubs/9.png
new file mode 100755
index 0000000..61c72a7
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/clubs/9.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/clubs/A.png b/bob_party/src/Games/BlackJack/source/assets/cards/clubs/A.png
new file mode 100755
index 0000000..363f58c
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/clubs/A.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/clubs/J.png b/bob_party/src/Games/BlackJack/source/assets/cards/clubs/J.png
new file mode 100755
index 0000000..8644986
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/clubs/J.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/clubs/K.png b/bob_party/src/Games/BlackJack/source/assets/cards/clubs/K.png
new file mode 100755
index 0000000..e398e91
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/clubs/K.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/clubs/Q.png b/bob_party/src/Games/BlackJack/source/assets/cards/clubs/Q.png
new file mode 100755
index 0000000..3e83d91
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/clubs/Q.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/10.png b/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/10.png
new file mode 100755
index 0000000..6363a53
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/10.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/2.png b/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/2.png
new file mode 100755
index 0000000..e77760f
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/2.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/3.png b/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/3.png
new file mode 100755
index 0000000..73c4527
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/3.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/4.png b/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/4.png
new file mode 100755
index 0000000..b74e9e1
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/4.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/5.png b/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/5.png
new file mode 100755
index 0000000..26666a6
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/5.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/6.png b/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/6.png
new file mode 100755
index 0000000..eb4118f
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/6.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/7.png b/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/7.png
new file mode 100755
index 0000000..0029db2
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/7.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/8.png b/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/8.png
new file mode 100755
index 0000000..0fd1822
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/8.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/9.png b/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/9.png
new file mode 100755
index 0000000..ea3dbb6
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/9.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/A.png b/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/A.png
new file mode 100755
index 0000000..c75eb1c
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/A.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/J.png b/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/J.png
new file mode 100755
index 0000000..ee36da3
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/J.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/K.png b/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/K.png
new file mode 100755
index 0000000..9fa63f6
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/K.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/Q.png b/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/Q.png
new file mode 100755
index 0000000..997f742
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/diamonds/Q.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/hearts/10.png b/bob_party/src/Games/BlackJack/source/assets/cards/hearts/10.png
new file mode 100755
index 0000000..a5f7c91
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/hearts/10.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/hearts/2.png b/bob_party/src/Games/BlackJack/source/assets/cards/hearts/2.png
new file mode 100755
index 0000000..3840d78
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/hearts/2.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/hearts/3.png b/bob_party/src/Games/BlackJack/source/assets/cards/hearts/3.png
new file mode 100755
index 0000000..5f64f00
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/hearts/3.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/hearts/4.png b/bob_party/src/Games/BlackJack/source/assets/cards/hearts/4.png
new file mode 100755
index 0000000..267260f
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/hearts/4.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/hearts/5.png b/bob_party/src/Games/BlackJack/source/assets/cards/hearts/5.png
new file mode 100755
index 0000000..8d2b48a
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/hearts/5.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/hearts/6.png b/bob_party/src/Games/BlackJack/source/assets/cards/hearts/6.png
new file mode 100755
index 0000000..173f5da
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/hearts/6.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/hearts/7.png b/bob_party/src/Games/BlackJack/source/assets/cards/hearts/7.png
new file mode 100755
index 0000000..c767f1e
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/hearts/7.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/hearts/8.png b/bob_party/src/Games/BlackJack/source/assets/cards/hearts/8.png
new file mode 100755
index 0000000..b7c237a
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/hearts/8.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/hearts/9.png b/bob_party/src/Games/BlackJack/source/assets/cards/hearts/9.png
new file mode 100755
index 0000000..f1d40c7
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/hearts/9.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/hearts/A.png b/bob_party/src/Games/BlackJack/source/assets/cards/hearts/A.png
new file mode 100755
index 0000000..4f805df
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/hearts/A.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/hearts/J.png b/bob_party/src/Games/BlackJack/source/assets/cards/hearts/J.png
new file mode 100755
index 0000000..d3f656c
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/hearts/J.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/hearts/K.png b/bob_party/src/Games/BlackJack/source/assets/cards/hearts/K.png
new file mode 100755
index 0000000..ea955ff
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/hearts/K.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/hearts/Q.png b/bob_party/src/Games/BlackJack/source/assets/cards/hearts/Q.png
new file mode 100755
index 0000000..5d2d6c8
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/hearts/Q.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/spades/10.png b/bob_party/src/Games/BlackJack/source/assets/cards/spades/10.png
new file mode 100755
index 0000000..fb2a4a1
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/spades/10.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/spades/2.png b/bob_party/src/Games/BlackJack/source/assets/cards/spades/2.png
new file mode 100755
index 0000000..86e8d84
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/spades/2.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/spades/3.png b/bob_party/src/Games/BlackJack/source/assets/cards/spades/3.png
new file mode 100755
index 0000000..7f5c7bb
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/spades/3.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/spades/4.png b/bob_party/src/Games/BlackJack/source/assets/cards/spades/4.png
new file mode 100755
index 0000000..67dfe9b
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/spades/4.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/spades/5.png b/bob_party/src/Games/BlackJack/source/assets/cards/spades/5.png
new file mode 100755
index 0000000..baf85c1
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/spades/5.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/spades/6.png b/bob_party/src/Games/BlackJack/source/assets/cards/spades/6.png
new file mode 100755
index 0000000..81a92c6
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/spades/6.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/spades/7.png b/bob_party/src/Games/BlackJack/source/assets/cards/spades/7.png
new file mode 100755
index 0000000..94878ac
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/spades/7.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/spades/8.png b/bob_party/src/Games/BlackJack/source/assets/cards/spades/8.png
new file mode 100755
index 0000000..2e4bbe2
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/spades/8.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/spades/9.png b/bob_party/src/Games/BlackJack/source/assets/cards/spades/9.png
new file mode 100755
index 0000000..26915e8
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/spades/9.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/spades/A.png b/bob_party/src/Games/BlackJack/source/assets/cards/spades/A.png
new file mode 100755
index 0000000..b5b321f
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/spades/A.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/spades/J.png b/bob_party/src/Games/BlackJack/source/assets/cards/spades/J.png
new file mode 100755
index 0000000..c826707
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/spades/J.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/spades/K.png b/bob_party/src/Games/BlackJack/source/assets/cards/spades/K.png
new file mode 100755
index 0000000..bc245aa
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/spades/K.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/cards/spades/Q.png b/bob_party/src/Games/BlackJack/source/assets/cards/spades/Q.png
new file mode 100755
index 0000000..20d9953
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/cards/spades/Q.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/chips/1.png b/bob_party/src/Games/BlackJack/source/assets/chips/1.png
new file mode 100644
index 0000000..3cee7af
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/chips/1.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/chips/100.png b/bob_party/src/Games/BlackJack/source/assets/chips/100.png
new file mode 100644
index 0000000..73eb3c6
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/chips/100.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/chips/10k.png b/bob_party/src/Games/BlackJack/source/assets/chips/10k.png
new file mode 100644
index 0000000..ebfa809
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/chips/10k.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/chips/1k.png b/bob_party/src/Games/BlackJack/source/assets/chips/1k.png
new file mode 100644
index 0000000..9af8afc
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/chips/1k.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/chips/25.png b/bob_party/src/Games/BlackJack/source/assets/chips/25.png
new file mode 100644
index 0000000..faba512
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/chips/25.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/chips/25k.png b/bob_party/src/Games/BlackJack/source/assets/chips/25k.png
new file mode 100644
index 0000000..35f6d6b
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/chips/25k.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/chips/2k.png b/bob_party/src/Games/BlackJack/source/assets/chips/2k.png
new file mode 100644
index 0000000..034b925
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/chips/2k.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/chips/5.png b/bob_party/src/Games/BlackJack/source/assets/chips/5.png
new file mode 100644
index 0000000..9b2d479
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/chips/5.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/chips/500.png b/bob_party/src/Games/BlackJack/source/assets/chips/500.png
new file mode 100644
index 0000000..a643226
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/chips/500.png differ
diff --git a/bob_party/src/Games/BlackJack/source/assets/chips/5k.png b/bob_party/src/Games/BlackJack/source/assets/chips/5k.png
new file mode 100644
index 0000000..2ee537e
Binary files /dev/null and b/bob_party/src/Games/BlackJack/source/assets/chips/5k.png differ
diff --git a/bob_party/src/Games/BlackJack/source/components/ActionButton.js b/bob_party/src/Games/BlackJack/source/components/ActionButton.js
new file mode 100644
index 0000000..327ac15
--- /dev/null
+++ b/bob_party/src/Games/BlackJack/source/components/ActionButton.js
@@ -0,0 +1,52 @@
+import React from 'react';
+import {
+ StyleSheet,
+ View,
+ TouchableOpacity,
+ Text
+} from 'react-native';
+
+const ActionButton = props => {
+ return(
+ {
+ if(props.onPress) props.onPress()
+ }}
+ >
+
+ {props.text.replace(" ",'\n')}
+
+
+ )
+}
+
+const styles = StyleSheet.create({
+ wrap : {
+ padding : 6,
+ backgroundColor : "rgba(255,255,255,0.7)",
+ borderColor : "rgba(255,255,255,0.9)",
+ borderWidth : 2,
+ marginBottom : 12
+ },
+ rightDirection : {
+ borderTopRightRadius : 6,
+ borderBottomRightRadius : 6
+ },
+ leftDirection : {
+ borderTopLeftRadius : 6,
+ borderBottomLeftRadius : 6
+ },
+ text : {
+ color : "white",
+ fontWeight : "bold",
+ fontSize : 14,
+ textAlign : "center"
+ }
+});
+
+export default ActionButton;
\ No newline at end of file
diff --git a/bob_party/src/Games/BlackJack/source/components/CardDeck.js b/bob_party/src/Games/BlackJack/source/components/CardDeck.js
new file mode 100644
index 0000000..ff18bf3
--- /dev/null
+++ b/bob_party/src/Games/BlackJack/source/components/CardDeck.js
@@ -0,0 +1,65 @@
+import React,{Component} from 'react';
+import {
+ View,
+ Text,
+ Image,
+ StyleSheet,
+ Dimensions
+} from 'react-native';
+import backCard from '../assets/cards/back.png';
+const {width} = Dimensions.get("window");
+const CARD_WIDTH = (width / 3) - 50;
+const CARD_HEIGHT = (width / 3) + 5;
+const CARD_SEPARATION = 50;
+
+class CardDeck extends Component{
+ render(){
+ const {cards, isDealer, gameover} = this.props
+ return(
+
+
+ {cards && cards.length > 0 && cards.map((card,i) => {
+ return (
+ 0 ? {
+ position : "absolute",
+ left : (i * CARD_SEPARATION),
+ } : {},
+ {
+ //elevation : 2,
+ borderWidth : 1,
+ borderColor : "black",
+ borderRadius : 6
+ }]}
+ >)
+ })}
+
+
+ )
+ }
+}
+
+const styles = StyleSheet.create({
+ container : {
+ justifyContent : "center"
+ },
+ row : {
+
+ }
+});
+
+export default CardDeck;
\ No newline at end of file
diff --git a/bob_party/src/Games/BlackJack/source/components/ChipSelector.js b/bob_party/src/Games/BlackJack/source/components/ChipSelector.js
new file mode 100644
index 0000000..0101fa6
--- /dev/null
+++ b/bob_party/src/Games/BlackJack/source/components/ChipSelector.js
@@ -0,0 +1,79 @@
+import React,{Component} from 'react';
+import {
+ View,
+ ScrollView,
+ StyleSheet,
+ Image,
+ Text,
+ TouchableOpacity,
+ Dimensions
+} from 'react-native';
+
+import chips from '../data/chips';
+
+const {width} = Dimensions.get('window');
+const PADDING_WRAP = 8;
+const MARGIN_SIDE = 20;
+const CHIPS_SHOWN = 7;
+const CHIP_WIDTH = (width / CHIPS_SHOWN) - ((MARGIN_SIDE / 2) * 2);
+
+class ChipSelector extends Component{
+
+ render(){
+ const {onSelect} = this.props;
+ return(
+
+
+ {chips && chips.length > 0 && chips.map((chip,_index) => (
+ onSelect(chip.value)}
+ >
+
+
+
+
+ ))}
+
+
+ )
+ }
+
+}
+
+const styles = StyleSheet.create({
+ chipsWrapper : {
+ backgroundColor : "#8A5D3C",
+ borderColor : "#AF7B56",
+ borderTopWidth : 2,
+ borderBottomWidth : 2,
+ /*elevation : 5,
+ position : "absolute",
+ bottom : 0,
+ left : 0,
+ right : 0,
+ zIndex : 3*/
+ },
+ scrollableContent:{
+ padding : PADDING_WRAP
+ },
+ chipWrap: {
+ marginRight : MARGIN_SIDE
+ },
+ chip : {
+ width : CHIP_WIDTH,
+ height: CHIP_WIDTH
+ }
+})
+
+export default ChipSelector;
\ No newline at end of file
diff --git a/bob_party/src/Games/BlackJack/source/components/FloatingText.js b/bob_party/src/Games/BlackJack/source/components/FloatingText.js
new file mode 100644
index 0000000..5b33934
--- /dev/null
+++ b/bob_party/src/Games/BlackJack/source/components/FloatingText.js
@@ -0,0 +1,32 @@
+import React from 'react';
+import {
+ View,
+ Text,
+ StyleSheet
+} from 'react-native';
+
+const FloatingText = props => {
+ return(
+
+ {props.text}
+
+ )
+}
+
+const styles = StyleSheet.create({
+ indicator : {
+ backgroundColor : "rgba(0,0,0,0.6)",
+ borderColor : "rgba(0,0,0,0.9)",
+ padding : 8,
+ alignItems : "center",
+ marginTop : 8,
+ marginBottom : 8,
+ borderRadius : 4
+ },
+ indicatorTxt : {
+ color : "white",
+ fontSize : 12
+ }
+});
+
+export default FloatingText;
\ No newline at end of file
diff --git a/bob_party/src/Games/BlackJack/source/components/Overlay.js b/bob_party/src/Games/BlackJack/source/components/Overlay.js
new file mode 100644
index 0000000..90e0f44
--- /dev/null
+++ b/bob_party/src/Games/BlackJack/source/components/Overlay.js
@@ -0,0 +1,62 @@
+import React from 'react';
+import {
+ View,
+ Text,
+ StyleSheet,
+ TouchableOpacity,
+ Dimensions
+} from 'react-native';
+
+const {width,height} = Dimensions.get("window");
+const Overlay = props =>{
+ return(
+
+ {props.text}
+ props.onClose()}>
+
+ CONTINUE
+
+
+
+ )
+}
+
+const styles = StyleSheet.create({
+ overlay : {
+ backgroundColor : "rgba(0,0,0,0.8)",
+ position : "absolute",
+ top : (height / 2) - 60,
+ left : 0,
+ right : 0,
+ zIndex : 5,
+ alignItems : "center",
+ justifyContent : "center",
+ padding : 12
+ },
+
+ text : {
+ color : "#fff",
+ fontSize : 40,
+ textAlign : "center"
+ },
+
+ center : {
+ alignItems : "center",
+ justifyContent : "center"
+ },
+
+ btn : {
+ marginTop : 10,
+ borderWidth : 1,
+ borderColor : "#fff",
+ padding : 8
+ },
+
+ continueBtn : {
+ color : "#fff",
+ fontSize : 14,
+ textAlign : "center"
+ }
+});
+
+export default Overlay;
\ No newline at end of file
diff --git a/bob_party/src/Games/BlackJack/source/components/UserControls.js b/bob_party/src/Games/BlackJack/source/components/UserControls.js
new file mode 100644
index 0000000..260cc5f
--- /dev/null
+++ b/bob_party/src/Games/BlackJack/source/components/UserControls.js
@@ -0,0 +1,132 @@
+import React,{Component} from 'react';
+import {
+ View,
+ Text,
+ TouchableOpacity,
+ StyleSheet,
+ Dimensions
+} from 'react-native';
+import {calculatePoints} from '../helpers';
+import {ActionButton, FloatingText, CardDeck} from '../components';
+const {width} = Dimensions.get('window');
+const CIRCLE_BET_SIZE = (width / 4) - 20;
+
+class UserControls extends Component{
+
+ constructor(){
+ super();
+
+ this.state = {
+ playerPoints : 0
+ }
+ }
+
+ UNSAFE_componentWillReceiveProps(nextProps){
+ if(nextProps.playerHand){
+ this.setState({
+ playerPoints : calculatePoints(nextProps.playerHand),
+ dealerPoints : calculatePoints(nextProps.dealerHand)
+ });
+ }
+ }
+
+ render(){
+
+ const {playerHand, dealerHand, newGame, hit, endgame, doubleGame, gameover, totalBet, moreMoney} = this.props;
+ const {playerPoints, dealerPoints} = this.state;
+
+ return(
+
+
+ {/*
+
+ */}
+
+
+ {gameover && }
+
+
+
+
+
+
+
+
+ {totalBet == false && (
+ newGame()}
+ />
+ )}
+
+ {!!totalBet && (
+ hit()}
+ />
+ )}
+
+ {!!totalBet && (
+ doubleGame()}
+ />
+ )}
+
+ {!!totalBet && (
+ endgame()}
+ />
+ )}
+
+
+ )
+ }
+}
+
+const styles = StyleSheet.create({
+ centerView : {
+ //flexDirection : "row",
+ alignItems : "center",
+ justifyContent : "space-around",
+ paddingTop : 10,
+ paddingBottom : 10
+ },
+ /*betCircle : {
+ width : CIRCLE_BET_SIZE,
+ height : CIRCLE_BET_SIZE,
+ borderRadius : (CIRCLE_BET_SIZE / 2),
+ borderColor : 'white',
+ borderWidth : 1,
+ padding : 2
+ },*/
+ betText : {
+ color : "white",
+ textAlign : "center"
+ },
+ center : {
+ alignItems : "center",
+ justifyContent : "center"
+ },
+ absoluteBtnRight : {
+ position : "absolute",
+ right : 0,
+ zIndex : 2
+ }
+});
+
+export default UserControls;
\ No newline at end of file
diff --git a/bob_party/src/Games/BlackJack/source/components/index.js b/bob_party/src/Games/BlackJack/source/components/index.js
new file mode 100644
index 0000000..bbfb218
--- /dev/null
+++ b/bob_party/src/Games/BlackJack/source/components/index.js
@@ -0,0 +1,15 @@
+import ChipSelector from './ChipSelector';
+import UserControls from './UserControls';
+import ActionButton from './ActionButton';
+import FloatingText from './FloatingText';
+import CardDeck from './CardDeck';
+import Overlay from './Overlay';
+
+export {
+ ChipSelector,
+ UserControls,
+ ActionButton,
+ FloatingText,
+ CardDeck,
+ Overlay
+}
\ No newline at end of file
diff --git a/bob_party/src/Games/BlackJack/source/data/cards.js b/bob_party/src/Games/BlackJack/source/data/cards.js
new file mode 100644
index 0000000..3198952
--- /dev/null
+++ b/bob_party/src/Games/BlackJack/source/data/cards.js
@@ -0,0 +1,314 @@
+export default [
+ {
+ name : 'A',
+ deck : 'spades',
+ value : 1,
+ image : require('../assets/cards/spades/A.png')
+ },
+ {
+ name : 'J',
+ deck : 'spades',
+ value : 10,
+ image : require('../assets/cards/spades/J.png')
+ },
+ {
+ name : 'Q',
+ deck : 'spades',
+ value : 10,
+ image : require('../assets/cards/spades/Q.png')
+ },
+ {
+ name : 'K',
+ deck : 'spades',
+ value : 10,
+ image : require('../assets/cards/spades/K.png')
+ },
+ {
+ name : '2',
+ deck : 'spades',
+ value : 2,
+ image : require('../assets/cards/spades/2.png')
+ },
+ {
+ name : '3',
+ deck : 'spades',
+ value : 3,
+ image : require('../assets/cards/spades/3.png')
+ },
+ {
+ name : '4',
+ deck : 'spades',
+ value : 4,
+ image : require('../assets/cards/spades/4.png')
+ },
+ {
+ name : '5',
+ deck : 'spades',
+ value : 5,
+ image : require('../assets/cards/spades/5.png')
+ },
+ {
+ name : '6',
+ deck : 'spades',
+ value : 6,
+ image : require('../assets/cards/spades/6.png')
+ },
+ {
+ name : '7',
+ deck : 'spades',
+ value : 7,
+ image : require('../assets/cards/spades/7.png')
+ },
+ {
+ name : '8',
+ deck : 'spades',
+ value : 8,
+ image : require('../assets/cards/spades/8.png')
+ },
+ {
+ name : '9',
+ deck : 'spades',
+ value : 9,
+ image : require('../assets/cards/spades/9.png')
+ },
+ {
+ name : '10',
+ deck : 'spades',
+ value : 10,
+ image : require('../assets/cards/spades/10.png')
+ },
+ {
+ name : 'A',
+ deck : 'hearts',
+ value : 1,
+ image : require('../assets/cards/hearts/A.png')
+ },
+ {
+ name : 'J',
+ deck : 'hearts',
+ value : 10,
+ image : require('../assets/cards/hearts/J.png')
+ },
+ {
+ name : 'Q',
+ deck : 'hearts',
+ value : 10,
+ image : require('../assets/cards/hearts/Q.png')
+ },
+ {
+ name : 'K',
+ deck : 'hearts',
+ value : 10,
+ image : require('../assets/cards/hearts/K.png')
+ },
+ {
+ name : '2',
+ deck : 'hearts',
+ value : 2,
+ image : require('../assets/cards/hearts/2.png')
+ },
+ {
+ name : '3',
+ deck : 'hearts',
+ value : 3,
+ image : require('../assets/cards/hearts/3.png')
+ },
+ {
+ name : '4',
+ deck : 'hearts',
+ value : 4,
+ image : require('../assets/cards/hearts/4.png')
+ },
+ {
+ name : '5',
+ deck : 'hearts',
+ value : 5,
+ image : require('../assets/cards/hearts/5.png')
+ },
+ {
+ name : '6',
+ deck : 'hearts',
+ value : 6,
+ image : require('../assets/cards/hearts/6.png')
+ },
+ {
+ name : '7',
+ deck : 'hearts',
+ value : 7,
+ image : require('../assets/cards/hearts/7.png')
+ },
+ {
+ name : '8',
+ deck : 'hearts',
+ value : 8,
+ image : require('../assets/cards/hearts/8.png')
+ },
+ {
+ name : '9',
+ deck : 'hearts',
+ value : 9,
+ image : require('../assets/cards/hearts/9.png')
+ },
+ {
+ name : '10',
+ deck : 'hearts',
+ value : 10,
+ image : require('../assets/cards/hearts/10.png')
+ },
+ {
+ name : 'A',
+ deck : 'clubs',
+ value : 1,
+ image : require('../assets/cards/clubs/A.png')
+ },
+ {
+ name : 'J',
+ deck : 'clubs',
+ value : 10,
+ image : require('../assets/cards/clubs/J.png')
+ },
+ {
+ name : 'Q',
+ deck : 'clubs',
+ value : 10,
+ image : require('../assets/cards/clubs/Q.png')
+ },
+ {
+ name : 'K',
+ deck : 'clubs',
+ value : 10,
+ image : require('../assets/cards/clubs/K.png')
+ },
+ {
+ name : '2',
+ deck : 'clubs',
+ value : 2,
+ image : require('../assets/cards/clubs/2.png')
+ },
+ {
+ name : '3',
+ deck : 'clubs',
+ value : 3,
+ image : require('../assets/cards/clubs/3.png')
+ },
+ {
+ name : '4',
+ deck : 'clubs',
+ value : 4,
+ image : require('../assets/cards/clubs/4.png')
+ },
+ {
+ name : '5',
+ deck : 'clubs',
+ value : 5,
+ image : require('../assets/cards/clubs/5.png')
+ },
+ {
+ name : '6',
+ deck : 'clubs',
+ value : 6,
+ image : require('../assets/cards/clubs/6.png')
+ },
+ {
+ name : '7',
+ deck : 'clubs',
+ value : 7,
+ image : require('../assets/cards/clubs/7.png')
+ },
+ {
+ name : '8',
+ deck : 'clubs',
+ value : 8,
+ image : require('../assets/cards/clubs/8.png')
+ },
+ {
+ name : '9',
+ deck : 'clubs',
+ value : 9,
+ image : require('../assets/cards/clubs/9.png')
+ },
+ {
+ name : '10',
+ deck : 'clubs',
+ value : 10,
+ image : require('../assets/cards/clubs/10.png')
+ },
+ {
+ name : 'A',
+ deck : 'diamonds',
+ value : 1,
+ image : require('../assets/cards/diamonds/A.png')
+ },
+ {
+ name : 'J',
+ deck : 'diamonds',
+ value : 10,
+ image : require('../assets/cards/diamonds/J.png')
+ },
+ {
+ name : 'Q',
+ deck : 'diamonds',
+ value : 10,
+ image : require('../assets/cards/diamonds/Q.png')
+ },
+ {
+ name : 'K',
+ deck : 'diamonds',
+ value : 10,
+ image : require('../assets/cards/diamonds/K.png')
+ },
+ {
+ name : '2',
+ deck : 'diamonds',
+ value : 2,
+ image : require('../assets/cards/diamonds/2.png')
+ },
+ {
+ name : '3',
+ deck : 'diamonds',
+ value : 3,
+ image : require('../assets/cards/diamonds/3.png')
+ },
+ {
+ name : '4',
+ deck : 'diamonds',
+ value : 4,
+ image : require('../assets/cards/diamonds/4.png')
+ },
+ {
+ name : '5',
+ deck : 'diamonds',
+ value : 5,
+ image : require('../assets/cards/diamonds/5.png')
+ },
+ {
+ name : '6',
+ deck : 'diamonds',
+ value : 6,
+ image : require('../assets/cards/diamonds/6.png')
+ },
+ {
+ name : '7',
+ deck : 'diamonds',
+ value : 7,
+ image : require('../assets/cards/diamonds/7.png')
+ },
+ {
+ name : '8',
+ deck : 'diamonds',
+ value : 8,
+ image : require('../assets/cards/diamonds/8.png')
+ },
+ {
+ name : '9',
+ deck : 'diamonds',
+ value : 9,
+ image : require('../assets/cards/diamonds/9.png')
+ },
+ {
+ name : '10',
+ deck : 'diamonds',
+ value : 10,
+ image : require('../assets/cards/diamonds/10.png')
+ }
+];
\ No newline at end of file
diff --git a/bob_party/src/Games/BlackJack/source/data/chips.js b/bob_party/src/Games/BlackJack/source/data/chips.js
new file mode 100644
index 0000000..f37b437
--- /dev/null
+++ b/bob_party/src/Games/BlackJack/source/data/chips.js
@@ -0,0 +1,42 @@
+export default [
+ {
+ image : require("../assets/chips/1.png"),
+ value : 1
+ },
+ {
+ image : require("../assets/chips/5.png"),
+ value : 5
+ },
+ {
+ image : require("../assets/chips/25.png"),
+ value : 25
+ },
+ {
+ image : require("../assets/chips/100.png"),
+ value : 100
+ },
+ {
+ image : require("../assets/chips/500.png"),
+ value : 500
+ },
+ {
+ image : require("../assets/chips/1k.png"),
+ value : 1000
+ },
+ {
+ image : require("../assets/chips/2k.png"),
+ value : 2000
+ },
+ {
+ image : require("../assets/chips/5k.png"),
+ value : 5000
+ },
+ {
+ image : require("../assets/chips/10k.png"),
+ value : 10000
+ },
+ {
+ image : require("../assets/chips/25k.png"),
+ value : 25000
+ }
+]
\ No newline at end of file
diff --git a/bob_party/src/Games/BlackJack/source/helpers/index.js b/bob_party/src/Games/BlackJack/source/helpers/index.js
new file mode 100644
index 0000000..11883bc
--- /dev/null
+++ b/bob_party/src/Games/BlackJack/source/helpers/index.js
@@ -0,0 +1,32 @@
+export function shuffle(a){
+ for (let i = a.length - 1; i > 0; i--) {
+ const j = Math.floor(Math.random() * (i + 1));
+ [a[i], a[j]] = [a[j], a[i]];
+ }
+ return a;
+}
+
+export function calculatePoints(playerHand){
+ /*let points = 0;
+ arr.map((card,_index) => {
+ //if(card.name == 'A' && card.name == 'J')
+ points = points + card.value
+ });
+ return points;*/
+ let aceAdjuts = false,
+ points = 0;
+
+ playerHand.map((card,_index) => {
+ if(card.name == 'A' && !aceAdjuts) {
+ aceAdjuts = true;
+ points = points + 10;
+ }
+ points = points + card.value;
+ });
+
+ if(aceAdjuts && points > 21){
+ points = points - 10;
+ }
+
+ return points;
+}
\ No newline at end of file
diff --git a/bob_party/src/Games/Tic-Tac-Toe/tic-tac-toe.tsx b/bob_party/src/Games/Tic-Tac-Toe/tic_tac_toe.tsx
similarity index 97%
rename from bob_party/src/Games/Tic-Tac-Toe/tic-tac-toe.tsx
rename to bob_party/src/Games/Tic-Tac-Toe/tic_tac_toe.tsx
index e95c907..29f34cc 100644
--- a/bob_party/src/Games/Tic-Tac-Toe/tic-tac-toe.tsx
+++ b/bob_party/src/Games/Tic-Tac-Toe/tic_tac_toe.tsx
@@ -3,11 +3,11 @@ import React, {useState} from "react";
import styles from './TicTacToeStyle.js';
import { useMatchStore } from "../../context/matchContext";
import { current } from "@reduxjs/toolkit";
-import { ScreenIndicator } from "../../components/ScreenIndicator.tsx";
-import { TopBar } from "../../components/TopBar.tsx";
+import { ScreenIndicator } from "../../components/ScreenIndicator";
+import { TopBar } from "../../components/TopBar";
-export default function tic_tac_toe(props: { navigation: any}){
+export default function TicTacToe(props: { navigation: any}){
const [map,setMap]=useState([
['','',''],
['','',''],
diff --git a/bob_party/src/Games/Tic-Tac-Toe/tic_tac_toe_online.tsx b/bob_party/src/Games/Tic-Tac-Toe/tic_tac_toe_online.tsx
new file mode 100644
index 0000000..81faefc
--- /dev/null
+++ b/bob_party/src/Games/Tic-Tac-Toe/tic_tac_toe_online.tsx
@@ -0,0 +1,202 @@
+import {Alert, Button, ImageBackground, Pressable, StyleSheet, Text, View } from "react-native";
+import React, {useState} from "react";
+import styles from './TicTacToeStyle.js';
+import { useMatchStore } from "../../context/matchContext";
+import { current } from "@reduxjs/toolkit";
+import { ScreenIndicator } from "../../components/ScreenIndicator";
+import { TopBar } from "../../components/TopBar";
+import { socket } from "../../../socketConfig";
+import { MANAGER_MATCH, MANAGER_USER } from "../../../appManagers";
+
+
+export default function TicTacToeOnline(){
+
+ const [init, setInit]=useState(0);
+
+ setUpTicTacToeOnline();
+
+ const [map,setMap]=useState([
+ ['','',''],
+ ['','',''],
+ ['','',''],
+ ]);
+
+ const [turnUser, setTurnUser]=useState("x");
+ /*
+ if (MANAGER_MATCH.getCurrentMatch()?.getTabUsers()[0].isEqual(MANAGER_USER.getCurrentUser())){
+ turn="o";
+ }
+ */
+
+ //const {navigation}=props;
+
+ const [currentTurn,setCurrentTurn] = useState("x");
+
+
+ const onPressCell = (rowIndex:number,columnIndex:number) => {
+ if (turnUser!==currentTurn){
+ Alert.alert("ce n'est pas à votre tour de jouer");
+ return;
+ }
+ if(map[rowIndex][columnIndex]==""){
+ setMap((existingMap) =>{
+ const updateMap = [...existingMap]
+ updateMap[rowIndex][columnIndex]=currentTurn;
+ return updateMap;
+ });
+ socket.emit("playTicTacToe", 1, rowIndex, columnIndex, currentTurn);
+ setCurrentTurn(currentTurn === "x"? "o" : "x");
+ const retour=checkWinning();
+ if(retour!=true){
+ checkComplete();
+ }
+
+ }else{
+ Alert.alert("Case déjà prise");
+ }
+
+ };
+
+ function setUpTicTacToeOnline() {
+ if (init===0){
+ setInit(1);
+ socket.emit("inMatch", 1);
+ socket.on("oppPlayTicTacToe", (rowIndex, columnIndex, turn) =>{
+
+ setMap((existingMap) =>{
+ const updateMap = [...existingMap]
+ updateMap[rowIndex][columnIndex]=turn;
+ return updateMap;
+ });
+ if (!checkWinning()){
+ checkComplete();
+ }
+ if (turn==="x"){
+ setCurrentTurn("o");
+ setTurnUser("o");
+ }
+ else{
+ setCurrentTurn("x");
+ setTurnUser("x");
+ }
+
+ });
+ }
+ }
+
+ const checkWinning = () =>{
+ // Checks rows
+ for (let i=0; i<3; i++){
+ const isRowXWinning = map[i].every((cell)=> cell==="x");
+ const isRowOWinning = map[i] .every((cell)=>cell==="o");
+ if(isRowXWinning==true){
+ Alert.alert("X won !");
+ //navigation.goBack();
+ return true;
+ }
+ else if(isRowOWinning==true){
+ Alert.alert("O won !");
+ //navigation.goBack();
+ return true;
+ }
+ }
+ // Checks columns
+ for (let col=0;col<3;col++){
+ let isColumnXWinning=true;
+ let isColumnOWinning=true;
+
+ for(let row=0;row<3;row++){
+ if(map[row][col] !== "x"){
+ isColumnXWinning=false;
+ }
+ if(map[row][col] !== "o"){
+ isColumnOWinning=false;
+ }
+ }
+ if (isColumnXWinning == true){
+ Alert.alert("X won !");
+ //navigation.goBack();
+ return true;
+ }
+ if(isColumnOWinning==true){
+ Alert.alert("O won !");
+ //navigation.goBack();
+ return true;
+ }
+
+ }
+ // Checks diag
+ let isDiag1XWinning=true;
+ let isDiag1OWinning=true;
+ let isDiag2XWinning=true;
+ let isDiag2OWinning=true;
+ for (let i=0;i<3;i++){
+ if(map[i][i]!=="x"){
+ isDiag1XWinning=false;
+ }
+ if(map[i][i]!=="o"){
+ isDiag1OWinning=false;
+ }
+ if(map[i][2-i]!=="x"){
+ isDiag2XWinning=false;
+ }
+ if(map[i][2-i]!=="o"){
+ isDiag2OWinning=false;
+ }
+ }
+ if(isDiag1OWinning==true || isDiag2OWinning==true){
+ Alert.alert("O won !");
+ //navigation.goBack();
+ return true;
+ }
+ if(isDiag1XWinning==true || isDiag2XWinning==true){
+ Alert.alert("X won !");
+ //navigation.goBack();
+ return true;
+ }
+ };
+
+ const checkComplete = () =>{
+ const isRow0Full = map[0].every((cell)=> cell!=="");
+ const isRow1Full = map[1] .every((cell)=>cell!=="");
+ const isRow2Full = map[2] .every((cell)=>cell!=="");
+ if(isRow0Full==true && isRow1Full==true && isRow2Full==true){
+ Alert.alert("Draw !");
+ //navigation.goBack();
+ return false;
+ }
+ };
+
+ return(
+
+
+ Current turn: {currentTurn}
+
+
+
+ {map.map((row, rowIndex)=>(
+
+ {row.map((cell, columnIndex)=> (
+ onPressCell(rowIndex,columnIndex)}
+ style={styles.cell}
+ key={`row-${rowIndex}-col-${columnIndex}`}
+ >
+ {cell === "o" && }
+ {cell === "x" &&(
+
+
+
+
+ )}
+
+ ))}
+
+ ))}
+
+
+
+ );
+}
+
+
diff --git a/bob_party/src/components/BotBar.tsx b/bob_party/src/components/BotBar.tsx
index 5541ace..d3d7cb9 100644
--- a/bob_party/src/components/BotBar.tsx
+++ b/bob_party/src/components/BotBar.tsx
@@ -6,10 +6,10 @@ import React from "react"
Importing the correct stylesheet
*/
import styles from './style/BotBar.style';
-import { useStoreStore } from "../context/storeContext";
import { useConversationStore } from "../context/conversationContext";
import { MANAGER_CONVERSATION, MANAGER_SKIN, MANAGER_USER } from "../../appManagers";
import { socket } from "../../socketConfig";
+import { useSkinStore } from "../context/storeContext";
/*
Images that are required to create a bottom bar
@@ -45,7 +45,7 @@ export const BotBar:
({ nav, state }) => {
- const setTabSkin = useStoreStore((state) => state.setTabSkin);
+ const setTabSkin = useSkinStore((state) => state.setTabSkin);
const handleStoreChange = useCallback(async () => {
diff --git a/bob_party/src/components/Skin.tsx b/bob_party/src/components/Skin.tsx
index be34a9c..1431762 100644
--- a/bob_party/src/components/Skin.tsx
+++ b/bob_party/src/components/Skin.tsx
@@ -11,7 +11,7 @@ import { useDispatch, useSelector } from "react-redux"
import { useUserStore } from "../context/userContext"
import { UserCoinsModifier } from "../core/User/userCoinsModifier"
import UserSkinModifier from "../core/User/userSkinModifier"
-import { useStoreStore } from "../context/storeContext"
+import { useSkinStore } from "../context/storeContext"
import { MANAGER_SKIN, MANAGER_USER } from "../../appManagers"
@@ -34,7 +34,7 @@ export const SkinComponent:
const setUser = useUserStore((state) => state.setUser);
- const setTabSkin = useStoreStore((state) => state.setTabSkin);
+ const setTabSkin = useSkinStore((state) => state.setTabSkin);
async function changerSkin(skin: Skin) {
diff --git a/bob_party/src/context/storeContext.tsx b/bob_party/src/context/storeContext.tsx
index 462e984..90138f8 100644
--- a/bob_party/src/context/storeContext.tsx
+++ b/bob_party/src/context/storeContext.tsx
@@ -6,14 +6,14 @@ import { User } from "../core/User/user";
// Define store types
-interface StoreState {
- tabSkin: Skin[];
+interface SkinState {
+ tabSkin: Skin[] | null;
setTabSkin: (tabSkin: Skin[]) => void;
resetTabSkin: () => void;
}
// Define store data and methods
-export const useStoreStore = create()((set, get) => ({
+export const useSkinStore = create()((set, get) => ({
tabSkin: [],
setTabSkin: (tabSkin) => set((state) => ({ tabSkin: tabSkin })),
resetTabSkin: () => set((state) => ({ tabSkin: [] })),
diff --git a/bob_party/src/core/User/user.ts b/bob_party/src/core/User/user.ts
index e49404f..3df5f3d 100644
--- a/bob_party/src/core/User/user.ts
+++ b/bob_party/src/core/User/user.ts
@@ -147,9 +147,11 @@ export class User{
this.tabSkin.push(skin);
}
- isEqual(u:User){
- if (u.getId()==this.id){
- return true;
+ isEqual(u:User | null){
+ if (u!= null){
+ if (u.getId()==this.id){
+ return true;
+ }
}
return false;
}
diff --git a/bob_party/src/navigation/AppNavigator.tsx b/bob_party/src/navigation/AppNavigator.tsx
index 460dbf6..b066ad7 100644
--- a/bob_party/src/navigation/AppNavigator.tsx
+++ b/bob_party/src/navigation/AppNavigator.tsx
@@ -14,11 +14,12 @@ import SignIn from '../screens/SignIn'
import SignUp from '../screens/SignUp'
import LobbySolo from '../screens/LobbySolo'
import CookieClicker from '../Games/CookieClicker/cookieClicker'
-import Conversation from '../screens/Conversation'
+import Conversation from '../screens/ConversationScreen'
-import Test from '../screens/Test'
-import MatchMaking from '../screens/MatchMaking'
-import TicTacToe from '../Games/Tic-Tac-Toe/tic-tac-toe'
+
+import TicTacToe from '../Games/Tic-Tac-Toe/tic_tac_toe'
+import TicTacToeOnline from '../Games/Tic-Tac-Toe/tic_tac_toe_online'
+import BlackJack from '../Games/BlackJack/blackJack'
const HomeStack = createStackNavigator();
@@ -102,6 +103,8 @@ function GameSoloStackScreen() {
+
+
);
}
diff --git a/bob_party/src/screens/Conversation.tsx b/bob_party/src/screens/ConversationScreen.tsx
similarity index 100%
rename from bob_party/src/screens/Conversation.tsx
rename to bob_party/src/screens/ConversationScreen.tsx
diff --git a/bob_party/src/screens/Home.tsx b/bob_party/src/screens/Home.tsx
index a57f8b8..b165d17 100644
--- a/bob_party/src/screens/Home.tsx
+++ b/bob_party/src/screens/Home.tsx
@@ -22,36 +22,12 @@ function Home(props: { navigation: any; }) {
const { navigation } = props
- const setTabConv = useConversationStore((state) => state.setTabConv);
- const setCurrentConv = useConversationStore((state) => state.setCurrentConv);
+
//It has to be in the home page that way the database will reload the conversations when the user receive a message een if he is in another page
- socket.on("messageReceived", async () =>{
- console.log("Message reçu");
- await handleConversationLoad();
- });
- async function handleConversationLoad(){
- const tmp = MANAGER_USER.getCurrentUser();
- if (tmp !== null) {
- await MANAGER_CONVERSATION.getLoaderConversation().loadByUser(tmp).then((res) => {
- const tmp=MANAGER_USER.getCurrentUser()
- MANAGER_CONVERSATION.setTabConv(res);
- if (tmp!==null){
- const tmpConv=MANAGER_CONVERSATION.getCurrentConv();
- if (tmpConv!==null){
- const trouveIndex = (element: Conversation) => element.getId()===tmpConv.getId();
- const index=MANAGER_CONVERSATION.getTabConv().findIndex(trouveIndex);
- MANAGER_CONVERSATION.setCurrentConv(MANAGER_CONVERSATION.getTabConv()[index]);
- setCurrentConv(MANAGER_CONVERSATION.getCurrentConv());
- }
- setTabConv(MANAGER_CONVERSATION.getTabConv());
- }
- });
- }
- }
return (
diff --git a/bob_party/src/screens/SignIn.tsx b/bob_party/src/screens/SignIn.tsx
index 7f4979f..1c47251 100644
--- a/bob_party/src/screens/SignIn.tsx
+++ b/bob_party/src/screens/SignIn.tsx
@@ -13,6 +13,8 @@ import { MANAGER_CONVERSATION, MANAGER_GAME, MANAGER_SKIN, MANAGER_USER } from '
import { socket } from "../../socketConfig";
import { useConversationStore } from '../context/conversationContext';
import { useGameStore } from '../context/gameContext';
+import { Conversation } from '../core/conversation';
+import { useSkinStore } from '../context/storeContext';
@@ -22,11 +24,15 @@ function SignIn(props: { navigation: any; }) {
const setUser = useUserStore((state) => state.setUser);
const setTabConv = useConversationStore((state) => state.setTabConv);
-
+ const setCurrentConv = useConversationStore((state) => state.setCurrentConv);
+
const setTabGame = useGameStore((state) => state.setTabGame);
const setTabGameSolo = useGameStore((state) => state.setTabGameSolo);
const setTabGameMulti = useGameStore((state) => state.setTabGameMulti);
+ const setTabSkin = useSkinStore((state) => state.setTabSkin);
+
+
const errorList = useSelector((state: RootState) => state.credentialErrors.loginErrorList);
const [pseudo, setPseudo] = useState('');
@@ -53,15 +59,14 @@ function SignIn(props: { navigation: any; }) {
await handleSkinLoad();
await handleConversationLoad();
await handleGameLoad();
- /*
- const conv=await MANAGER_CONVERSATION.getsaverConversation().saveConversation("Wesh la conv", res, [2,3], res.getUsername() + " a créé une conversation", new Date());
- if (conv!=null){
- MANAGER_CONVERSATION.getTabConv().push(conv);
- }
- */
MANAGER_CONVERSATION.getTabConv()?.forEach( conv =>{
socket.emit("inConv", conv);
});
+
+ socket.on("messageReceived", async () =>{
+ await handleConversationLoad();
+ });
+
navigation.navigate('HomeTab');
}
else{
@@ -74,18 +79,31 @@ function SignIn(props: { navigation: any; }) {
return;
}
- async function handleConversationLoad(){
+
+
+ async function handleConversationLoad(){
const tmp = MANAGER_USER.getCurrentUser();
if (tmp !== null) {
await MANAGER_CONVERSATION.getLoaderConversation().loadByUser(tmp).then((res) => {
+ const tmp=MANAGER_USER.getCurrentUser()
MANAGER_CONVERSATION.setTabConv(res);
- setTabConv(res);
+ if (tmp!==null){
+ const tmpConv=MANAGER_CONVERSATION.getCurrentConv();
+ if (tmpConv!==null){
+ const trouveIndex = (element: Conversation) => element.getId()===tmpConv.getId();
+ const index=MANAGER_CONVERSATION.getTabConv().findIndex(trouveIndex);
+ MANAGER_CONVERSATION.setCurrentConv(MANAGER_CONVERSATION.getTabConv()[index]);
+ setCurrentConv(MANAGER_CONVERSATION.getCurrentConv());
+ }
+ setTabConv(MANAGER_CONVERSATION.getTabConv());
+ }
});
}
- }
+ }
async function handleSkinLoad(){
MANAGER_SKIN.setTabSkin(await MANAGER_SKIN.getLoaderSkin().loadAllSkin());
+ setTabSkin(MANAGER_SKIN.getTabSkin());
}
async function handleGameLoad(){
diff --git a/bob_party/src/screens/Store.tsx b/bob_party/src/screens/Store.tsx
index 29ebeee..799b20b 100644
--- a/bob_party/src/screens/Store.tsx
+++ b/bob_party/src/screens/Store.tsx
@@ -7,7 +7,7 @@ import { BotBar } from '../components/BotBar';
import { FlatList } from 'react-native-gesture-handler';
import { SkinComponent } from '../components/Skin';
import { ScreenIndicator } from '../components/ScreenIndicator';
-import { useStoreStore } from '../context/storeContext';
+import { useSkinStore } from '../context/storeContext';
@@ -22,7 +22,7 @@ function Store(props: { navigation: any; }) {
item.getSkinName()}
diff --git a/bob_party/src/services/gameService/loaderGameApi.ts b/bob_party/src/services/gameService/loaderGameApi.ts
index 49d5660..791b762 100644
--- a/bob_party/src/services/gameService/loaderGameApi.ts
+++ b/bob_party/src/services/gameService/loaderGameApi.ts
@@ -1,4 +1,5 @@
import { Game } from "../../core/game";
+import { GameMulti } from "../../core/gameMulti";
import { GameSolo } from "../../core/gameSolo";
import ILoaderGame from "./ILoaderGame";
@@ -23,9 +24,11 @@ export default class LoaderGameApi implements ILoaderGame{
map.set(100,50);
map.set(300,150);
map.set(450,1000);
- const cookieClicker= new GameSolo(1, "Cookie Clicker", "https://codefirst.iut.uca.fr/git/BOB_PARTEAM/BOB_PARTY/raw/branch/typescript/bob_party/assets/ImagesJeux/Pong.png", "/Games/CookieClicker/cookieClicker.tsx", 1, 1, map);
- const ticTacToe= new GameSolo(2,"TicTacToe", "https://is3-ssl.mzstatic.com/image/thumb/Purple123/v4/f2/06/ef/f206ef53-7206-ffae-af6b-52460ba5636f/source/256x256bb.jpg", "/Games/Tic-Tac-Toe/tic-tac-toe.tsx", 1, 1, map);
- tab=[cookieClicker,ticTacToe];
+ const cookieClicker= new GameSolo(1, "Cookie Clicker", "https://codefirst.iut.uca.fr/git/BOB_PARTEAM/BOB_PARTY/raw/branch/typescript/bob_party/assets/ImagesJeux/Pong.png", "./src/Games/CookieClicker/cookieClicker.tsx", 1, 1, map);
+ const ticTacToe= new GameSolo(2,"TicTacToe", "https://is3-ssl.mzstatic.com/image/thumb/Purple123/v4/f2/06/ef/f206ef53-7206-ffae-af6b-52460ba5636f/source/256x256bb.jpg", "./src/Games/Tic-Tac-Toe/tic_tac_toe.tsx", 1, 1, map);
+ const ticTacToeOnline= new GameSolo(3,"TicTacToeOnline", "https://is3-ssl.mzstatic.com/image/thumb/Purple123/v4/f2/06/ef/f206ef53-7206-ffae-af6b-52460ba5636f/source/256x256bb.jpg", "./src/Games/Tic-Tac-Toe/tic_tac_toe_online.tsx", 2, 2, map);
+ const blackjack = new GameMulti(4, "BlackJack", "https://codefirst.iut.uca.fr/git/BOB_PARTEAM/BOB_PARTY/raw/branch/peristanceBDD/bob_party/assets/ImagesJeux/blackjack.jpg", "./src/Games/BlackJack/blackJack", 1, 1, map)
+ tab=[cookieClicker,ticTacToe, ticTacToeOnline, blackjack];
});
return tab;
diff --git a/bob_party/tsconfig.json b/bob_party/tsconfig.json
index 53124e9..7e06e77 100644
--- a/bob_party/tsconfig.json
+++ b/bob_party/tsconfig.json
@@ -22,6 +22,6 @@
"include": [
"**/*.ts",
"**/*.tsx"
-, "socketConfig.js", "server.js" ],
+, "socketConfig.js", "server.js", "src/Games/BlackJack/blackJack.js", "src/Games/BlackJack/blackJack.js" ],
"extends": "expo/tsconfig.base"
}
diff --git a/bob_party/yarn.lock b/bob_party/yarn.lock
index f8e8532..3aa548d 100644
--- a/bob_party/yarn.lock
+++ b/bob_party/yarn.lock
@@ -5135,6 +5135,11 @@ globby@^11.0.1:
merge2 "^1.4.1"
slash "^3.0.0"
+goober@^2.1.10:
+ version "2.1.11"
+ resolved "https://registry.yarnpkg.com/goober/-/goober-2.1.11.tgz#bbd71f90d2df725397340f808dbe7acc3118e610"
+ integrity sha512-5SS2lmxbhqH0u9ABEWq7WPU69a4i2pYcHeCxqaNq6Cw3mnrF0ghWNM4tEGid4dKy8XNIAUbuThuozDHHKJVh3A==
+
graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.3, graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.0, graceful-fs@^4.2.4, graceful-fs@^4.2.9:
version "4.2.10"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c"
@@ -7724,6 +7729,13 @@ react-dom@18.0.0:
loose-envify "^1.1.0"
scheduler "^0.21.0"
+react-hot-toast@^2.4.0:
+ version "2.4.0"
+ resolved "https://registry.yarnpkg.com/react-hot-toast/-/react-hot-toast-2.4.0.tgz#b91e7a4c1b6e3068fc599d3d83b4fb48668ae51d"
+ integrity sha512-qnnVbXropKuwUpriVVosgo8QrB+IaPJCpL8oBI6Ov84uvHZ5QQcTp2qg6ku2wNfgJl6rlQXJIQU5q+5lmPOutA==
+ dependencies:
+ goober "^2.1.10"
+
"react-is@^16.12.0 || ^17.0.0 || ^18.0.0", react-is@^18.0.0:
version "18.2.0"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b"
@@ -7739,6 +7751,11 @@ react-is@^17.0.1:
resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0"
integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==
+react-native-casino-roulette@^1.6.0:
+ version "1.6.0"
+ resolved "https://registry.yarnpkg.com/react-native-casino-roulette/-/react-native-casino-roulette-1.6.0.tgz#22336dc5ccb212f48c9f6b013733737df02d246b"
+ integrity sha512-6sFU5jtS595LnhpXJ74y7wT1G5ix0ZtJcBJsu7X2GWgdhMendUfi58wzsU2sSVSxUiMwQ8gvC3efHYk606acMQ==
+
react-native-codegen@^0.69.2:
version "0.69.2"
resolved "https://registry.yarnpkg.com/react-native-codegen/-/react-native-codegen-0.69.2.tgz#e33ac3b1486de59ddae687b731ddbfcef8af0e4e"