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 new file mode 100644 index 0000000..a73cdfc --- /dev/null +++ b/bob_party/src/Games/Tic-Tac-Toe/tic-tac-toe.tsx @@ -0,0 +1,88 @@ +import {ImageBackground, StyleSheet, Text, View } from "react-native"; +import React, {useState} from "react"; + +export default function tic_tac_toe(){ + const [map,setMap]=useState([ + ['o','',''], + ['','x','x'], + ['o','',''], + ]); + + return( + + TIC TAC TOE + + + {map.map((row)=>( + + {row.map((cell)=> ( + + {cell === "o" && } + {cell === "x" &&( + + + + + )} + + ))} + + ))} + + + + + ); +} + +const styles= StyleSheet.create({ + container:{ + flex:1, + backgroundColor:"#45444E", + alignItems:"center", + justifyContent:"center", + }, + grid:{ + width:375, + height:375, + alignItems:"center", + justifyContent:"center", + }, + row:{ + flex:1, + flexDirection:"row", + }, + cell:{ + width:100, + flex:1, + }, + circle:{ + left:15, + top:15, + width:90, + height:90, + backgroundColor:"#0085FF", + borderRadius:50 + }, + cross:{ + width:"100%", + height:"100%", + }, + crossLine:{ + left:52, + top:15, + position:"absolute", + width:15, + height:100, + borderRadius:50, + backgroundColor:"#0085FF", + transform:[{rotate:"45deg"},], + }, + crossLineReversed:{ + transform:[{rotate:"-45deg"},], + }, + map:{ + aspectRatio:1, + padding:5 + } +}) \ No newline at end of file diff --git a/bob_party/src/navigation/AppNavigator.tsx b/bob_party/src/navigation/AppNavigator.tsx index 142751d..1112579 100644 --- a/bob_party/src/navigation/AppNavigator.tsx +++ b/bob_party/src/navigation/AppNavigator.tsx @@ -14,6 +14,7 @@ import SignIn from '../screens/SignIn' import SignUp from '../screens/SignUp' import LobbySolo from '../screens/LobbySolo' import CookieClicker from '../Games/CookieClicker/cookieClicker' +import TicTacToe from '../Games/Tic-Tac-Toe/tic-tac-toe' const HomeStack = createStackNavigator(); @@ -95,6 +96,7 @@ function GameSoloStackScreen() { + ); } diff --git a/bob_party/src/services/gameService/loaderGameApi.ts b/bob_party/src/services/gameService/loaderGameApi.ts index 2529784..49d5660 100644 --- a/bob_party/src/services/gameService/loaderGameApi.ts +++ b/bob_party/src/services/gameService/loaderGameApi.ts @@ -24,7 +24,9 @@ export default class LoaderGameApi implements ILoaderGame{ 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); - tab=[cookieClicker]; + 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]; + }); return tab; diff --git a/bob_party/src/testGameSolo.ts b/bob_party/src/testGameSolo.ts index 5121644..c8cfbb3 100644 --- a/bob_party/src/testGameSolo.ts +++ b/bob_party/src/testGameSolo.ts @@ -9,4 +9,5 @@ let myMap = new Map([ let game=new GameSolo(1, "bo jeu", "", "super jeu", 1, 1, myMap); + export default game; \ No newline at end of file