Compare commits

...

4 Commits

Author SHA1 Message Date
Mathilde JEAN 510931ef0f Merge branch 'Persistance' of https://codefirst.iut.uca.fr/git/BOB_PARTEAM/BOB_PARTY into Persistance
continuous-integration/drone/push Build is passing Details
2 years ago
Mathilde JEAN 8f0726912a vue matchmaking pas finie
2 years ago
Alban GUILHOT be990ab73d corrections
continuous-integration/drone/push Build is passing Details
2 years ago
Alban GUILHOT 01290170d2 Corrections
continuous-integration/drone/push Build is passing Details
2 years ago

@ -0,0 +1,54 @@
import { FC, ReactNode, useCallback } from "react"
import { Pressable, Image, ImageStyle, Text, View, Alert, ImageSourcePropType, TextStyle, TextInput } from "react-native"
import React from "react"
import { trace } from "console"
import { Game } from "../core/game"
/*
Importing the correct stylesheet
*/
import stylesGame from './style/Game.style';
import styles from "./style/ButtonGameTypeChoice.style"
import LobbySolo from "../screens/LobbySolo"
import ManagerMatch from "../services/matchServices/managerMatch"
import MatchCreator from "../core/Match/matchCreator"
import { useMatchStore } from "../context/matchContext"
import { MANAGER_MATCH, MANAGER_USER } from "../../appManagers"
export const JoinButtonComponent :
/*
* game : Game that must be displayed
* nav : tool needed to allow the navigation between the screens
*/
FC<{game: Game | undefined, nav: any}> =
({game, nav}) =>
{
const setMatch = useMatchStore((state) => state.setMatch);
const createNewMatchSolo = useCallback(async (game : Game | undefined, nav: any) => {
const m=new MatchCreator();
const tmp=MANAGER_USER.getCurrentUser();
if (tmp!==null){
let match=await m.createMatch(tmp, game);
MANAGER_MATCH.setCurrentMatch(match);
setMatch(match);
nav.navigate("GameSolo");
}
}, []);
return (
<View style={styles.button}>
<TextInput/>
<Pressable onPress={() => createNewMatchSolo(game, nav)}>
<Text style={styles.text}>Launch</Text>
</Pressable>
</View>
);
}

@ -7,7 +7,7 @@ import { Game } from "../core/game"
/*
Importing the correct stylesheet
*/
import styles from './style/Game.style';
import styles from './style/PlayerBox.style';
import LobbySolo from "../screens/LobbySolo"
import ManagerMatch from "../services/matchServices/managerMatch"
import MatchCreator from "../core/Match/matchCreator"
@ -26,12 +26,12 @@ FC<{user: User}> =
({user}) =>
{
return (
<View>
<View style={styles.container}>
<Image
style={styles.image}
style={styles.icon}
source={{uri: user.getCurrentSkin().getSkinSource()}}
/>
<Text style={styles.name}>{user.getUsername()}</Text>
<Text style={styles.nomJoueur}>{user.getUsername()}</Text>
</View>
)

@ -0,0 +1,27 @@
import { StyleSheet } from "react-native";
/*
Stylesheet for the Skin component
*/
export default StyleSheet.create({
container: {
flex:1,
backgroundColor: '#45445E',
flexDirection: "row",
justifyContent: "flex-start",
margin: 10,
},
icon: {
width: 70,
height: 70,
borderRadius: 70,
marginRight: 10,
},
nomJoueur :{
fontSize: 25,
fontFamily: 'Helvetica',
fontWeight: 'bold',
color: 'white',
},
});

@ -5,7 +5,7 @@ import { Match } from "./match";
export default class MatchCreator{
async createMatch(u:User, g:Game): Promise<Match>{
async createMatch(u:User, g:Game | undefined): Promise<Match>{
return await MANAGER_MATCH.getsaverMatch().saveMatch(u, g);
}
}

@ -18,7 +18,7 @@ import Conversation from '../screens/Conversation'
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'
const HomeStack = createStackNavigator();

@ -39,117 +39,4 @@ function GameChoice(props: { navigation: any}) {
}
function Button(props: { onPress: any; title?: any | undefined; }) {
const { onPress, title = 'Save' } = props;
return (
<Pressable style={styles.button} onPress={onPress}>
<Text style={styles.text}>{title}</Text>
</Pressable>
);
}
const styles = StyleSheet.create({
body: {
flex: 1,
flexDirection: 'column',
alignItems: 'flex-start',
width: '70%',
},
container: {
flex: 1,
backgroundColor: "#45444E",
flexDirection: "column",
justifyContent: "flex-start",
alignItems: "center",
},
button: {
alignItems: 'center',
justifyContent: 'center',
height: '30%',
width: '100%',
marginTop: '10%',
paddingVertical: 12,
paddingHorizontal: 32,
borderRadius: 10,
elevation: 3,
backgroundColor: '#0085FF',
},
text: {
fontSize: 16,
lineHeight: 21,
fontWeight: 'bold',
letterSpacing: 0.25,
color: 'white',
},
header: {
flex : 0.15,
width: '100%',
flexDirection: 'row',
backgroundColor: '#2D2C33',
alignItems: 'center',
justifyContent: 'space-around',
},
titre: {
flex: 0.7,
flexDirection: 'column',
textAlign: 'center',
fontSize: 30,
fontFamily: 'Helvetica',
fontWeight: 'bold',
letterSpacing: 0.25,
color: 'white',
},
engrenage: {
borderRadius: 50,
width: 50,
height: 50,
},
avatar: {
borderRadius: 50,
width: 50,
height: 50,
},
footer: {
flex: 0.15,
flexDirection: 'row',
backgroundColor: '#2D2C33',
flexWrap: 'wrap',
width: '100%',
justifyContent: 'space-evenly',
},
iconFooter: {
marginBottom: 25,
marginTop: 10,
width: 65,
height: 50,
},
iconStore: {
marginBottom: 25,
marginTop: 10,
marginLeft: 7,
marginRight: 8,
width: 50,
height: 50,
},
imageSkin : {
borderRadius: 15,
marginTop: 15,
marginRight: 15,
width: 100,
height: 100,
},
nomSkin :{
textAlign: 'center',
fontSize: 15,
fontFamily: 'Helvetica',
fontWeight: 'bold',
letterSpacing: 0.25,
color: 'white',
},
});
export default GameChoice

@ -3,6 +3,7 @@ import { View, Image, Text, Button} from 'react-native'
import React from 'react';
import stylesScreen from './style/screens.style';
import styles from './style/Settings.style';
import stylesList from './style/MatchMaking.style';
import { TopBar } from '../components/TopBar';
import { BotBar } from '../components/BotBar';
import { Conversation } from '../core/conversation';
@ -28,6 +29,7 @@ function MatchMaking(props: { navigation: any; }) {
data={match?.getTabUsers()}
keyExtractor={usr =>usr.getUsername()}
renderItem={({item}) => <PlayerBox user={item}/>}
style={stylesList.list}
/>
<View style={stylesScreen.bodyCenter}>
<Button
@ -37,9 +39,9 @@ function MatchMaking(props: { navigation: any; }) {
</View>
<Image
style={{width:100, height:100}}
source={{uri: match?.getGame().getImageSource()}}
/>
style={{width:100, height:100}}
source={{uri: match?.getGame().getImageSource()}}
/>
</View>
);
}

@ -0,0 +1,45 @@
import { StatusBar } from 'expo-status-bar'
import { View, Image} from 'react-native'
import React from 'react';
import stylesScreen from './style/screens.style'
import { TopBar } from '../components/TopBar';
import { BotBar } from '../components/BotBar';
import { Conversation } from '../core/conversation';
import { ButtonGameTypeChoice } from '../components/ButtonGameTypeChoice';
import { JoinButtonComponent } from '../components/JoinButtonComponent';
import { useMatchStore } from '../context/matchContext';
function RejoindreOuLancer(props: { navigation: any; }) {
const { navigation } = props
const match = useMatchStore().match;
return (
<View style={stylesScreen.container}>
<TopBar
nav={navigation}
state='matchmacking'
/>
<View style={stylesScreen.bodyCenter}>
<ButtonGameTypeChoice
title='Créer une partie'
onPress={() => navigation.navigate(match?.getGame().getName().replace(/\s/g, ''))}
/>
<ButtonGameTypeChoice
title='Rejoindre une partie'
onPress={() => navigation.navigate(match?.getGame().getName().replace(/\s/g, ''))}
/>
<JoinButtonComponent game={match?.getGame()} nav={navigation}/>
</View>
<Image
style={{width:100, height:100}}
source={{uri: match?.getGame().getImageSource()}}
/>
</View>
);
}
export default RejoindreOuLancer

@ -11,7 +11,6 @@ import { checkNewUserValidity } from '../core/Auth/newUser';
import DateTimePicker, { DateTimePickerEvent } from '@react-native-community/datetimepicker';
import RNPickerSelect from "react-native-picker-select";
import { PickerGreySmall } from '../components/PickerGreySmall';
import { loginUser } from '../redux/features/currentUserSlice';
import { RootState } from '../redux/store';
import { updateImpossibleBirthDate, updateInvalidPassword, updateInvalidPseudo, updateTooLongPseudo, updateTooShortPassword, updateUndefinedBirthDate, updateUndefinedNationality, updateUndefinedPassword, updateUndefinedPseudo, updateUndefinedSex } from '../redux/features/credentialErrorsSlice';
import { getSystemErrorMap } from 'util';
@ -83,7 +82,7 @@ function SignUp(props: { navigation: any; }) {
break;
case (errorList.invalidPassword):
Alert.alert("Votre pseudo doit contenir au moins une majuscule, une majuscule, un chiffre et un caractère spécial (#?!@$%^&*-)");
Alert.alert("Votre password doit contenir au moins une majuscule, une majuscule, un chiffre et un caractère spécial (#?!@$%^&*-)");
dispatch(updateInvalidPassword(false));
break;
@ -99,7 +98,7 @@ function SignUp(props: { navigation: any; }) {
<View style={{width: '60%', alignItems: 'center'}}>
<Text style={styles.text}>Login</Text>
<TextInput style={styles.textInput} placeholder='Login' onChangeText={(val) => setPseudo(val)} autoCapitalize='none' />
<TextInput style={styles.textInput} placeholder='Login' onChangeText={(val) => setPseudo(val)} autoCapitalize='none'/>
</View>
<View style={{width: '60%', alignItems: 'center'}}>

@ -0,0 +1,12 @@
import { StyleSheet } from "react-native";
const coinSkinGap = 10;
const infoGap = 20;
export default StyleSheet.create({
list: {
flex: 1,
flexDirection: 'column',
},
});

@ -6,7 +6,8 @@ export default StyleSheet.create({
width: '100%',
height: '5%',
backgroundColor: 'white',
padding: 10,
color:'black',
padding: 20,
marginTop: 10,
},
button: {

@ -9,7 +9,7 @@ export default interface ISaverMatch{
* m the Match we want to save
*/
saveMatch(u:User, g:Game): Promise<Match>;
saveMatch(u:User, g:Game | undefined): Promise<Match>;
/**
* deleteMatch methode that delete a Match in the data management system

Loading…
Cancel
Save