ADD: debut tictactoe
continuous-integration/drone/push Build is failing Details

Persistance
Lucie Bedouret 2 years ago
parent 214892ade9
commit ac883f00be

@ -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(
<View style={styles.container}>
<Text>TIC TAC TOE</Text>
<ImageBackground style={styles.grid} source={{uri:"https://upload.wikimedia.org/wikipedia/commons/6/64/Tic-tac-toe.png"}} >
<View style={styles.map}>
{map.map((row)=>(
<View style={styles.row}>
{row.map((cell)=> (
<View style={styles.cell}>
{cell === "o" && <View style={styles.circle}/>}
{cell === "x" &&(
<View style={styles.cross}>
<View style={styles.crossLine}/>
<View style={[styles.crossLine, styles.crossLineReversed]}/>
</View>
)}
</View>
))}
</View>
))}
</View>
</ImageBackground>
</View>
);
}
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
}
})

@ -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() {
<GameSoloStack.Navigator screenOptions={{headerShown: false}}>
<GameSoloStack.Screen name='LobbySolo' component={LobbySolo} options={{animationEnabled: false,}}/>
<GameSoloStack.Screen name='CookieClicker' component={CookieClicker} />
<GameSoloStack.Screen name='TicTacToe' component={TicTacToe} />
</GameSoloStack.Navigator>
);
}

@ -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;

@ -9,4 +9,5 @@ let myMap = new Map<number, number>([
let game=new GameSolo(1, "bo jeu", "", "super jeu", 1, 1, myMap);
export default game;
Loading…
Cancel
Save