Merge branch 'typescript' of https://codefirst.iut.uca.fr/git/BOB_PARTEAM/BOB_PARTY into typescript
commit
5caa3895db
@ -0,0 +1,30 @@
|
|||||||
|
import { FC, ReactNode } from "react"
|
||||||
|
import { View, TextInput,Text } from "react-native"
|
||||||
|
import React from "react"
|
||||||
|
import { trace } from "console"
|
||||||
|
import { Game } from "../core/game"
|
||||||
|
|
||||||
|
/*
|
||||||
|
Importing the correct stylesheet
|
||||||
|
*/
|
||||||
|
import styles from "./style/TextInput.style"
|
||||||
|
|
||||||
|
export const CustomTextInput :
|
||||||
|
/*
|
||||||
|
* game : Game that must be displayed
|
||||||
|
* nav : tool needed to allow the navigation between the screens
|
||||||
|
*/
|
||||||
|
FC<{placeholder:String,text:String}> =
|
||||||
|
({placeholder, text}) =>
|
||||||
|
{
|
||||||
|
const [value, onChangeText] = React.useState(placeholder);
|
||||||
|
return (
|
||||||
|
<View>
|
||||||
|
<Text style={styles.section}>{text}</Text>
|
||||||
|
<TextInput
|
||||||
|
style={styles.input}
|
||||||
|
onChangeText= {onChangeText}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
import { StyleSheet } from 'react-native';
|
||||||
|
|
||||||
|
export default StyleSheet.create({
|
||||||
|
input: {
|
||||||
|
height: 40,
|
||||||
|
width: 250,
|
||||||
|
marginBottom:12,
|
||||||
|
borderWidth: 1,
|
||||||
|
padding: 10,
|
||||||
|
alignContent:'center',
|
||||||
|
backgroundColor:'white'
|
||||||
|
},
|
||||||
|
section:{
|
||||||
|
fontSize:15,
|
||||||
|
alignSelf:'left',
|
||||||
|
marginLeft:10,
|
||||||
|
color:'white',
|
||||||
|
},
|
||||||
|
})
|
@ -0,0 +1,67 @@
|
|||||||
|
import { ImageSourcePropType } from 'react-native';
|
||||||
|
import { Game } from './game';
|
||||||
|
import { GameCasino } from './gameCasino';
|
||||||
|
import { GameMulti } from './gameMulti';
|
||||||
|
import { GameSolo } from './gameSolo';
|
||||||
|
import { User } from "./user";
|
||||||
|
|
||||||
|
let index:number=0;
|
||||||
|
|
||||||
|
export class Match{
|
||||||
|
readonly Code:string;
|
||||||
|
private TabUsers:User[];
|
||||||
|
private TheGame:Game;
|
||||||
|
private GainingMechanism:number=0;
|
||||||
|
|
||||||
|
constructor(tabUser:User[], game:Game){
|
||||||
|
index++;
|
||||||
|
this.Code=index.toString();
|
||||||
|
this.TabUsers=[...tabUser];
|
||||||
|
this.TheGame=game;
|
||||||
|
}
|
||||||
|
|
||||||
|
getTabUsers(){
|
||||||
|
return this.TabUsers;
|
||||||
|
}
|
||||||
|
|
||||||
|
ajouterUser(us:User){
|
||||||
|
this.TabUsers.push(us);
|
||||||
|
}
|
||||||
|
|
||||||
|
setTabUser(tabUser:User[]){
|
||||||
|
this.TabUsers=[...tabUser];
|
||||||
|
}
|
||||||
|
|
||||||
|
getCode(){
|
||||||
|
return this.Code;
|
||||||
|
}
|
||||||
|
|
||||||
|
getGame(){
|
||||||
|
return this.TheGame;
|
||||||
|
}
|
||||||
|
|
||||||
|
setGame(game:Game){
|
||||||
|
this.TheGame=game;
|
||||||
|
}
|
||||||
|
|
||||||
|
getGainingMechanism(){
|
||||||
|
return this.GainingMechanism;
|
||||||
|
}
|
||||||
|
|
||||||
|
setGainingMechanism(gain:number){
|
||||||
|
this.GainingMechanism=gain;
|
||||||
|
}
|
||||||
|
|
||||||
|
convertMechanismToCoins(){
|
||||||
|
if (this.TheGame instanceof GameSolo){
|
||||||
|
return this.TheGame.CoinsWithPoints(this.GainingMechanism);
|
||||||
|
}
|
||||||
|
else if (this.TheGame instanceof GameMulti){
|
||||||
|
return this.TheGame.CoinsWithRank(this.GainingMechanism);
|
||||||
|
}
|
||||||
|
else if (this.TheGame instanceof GameCasino){
|
||||||
|
return this.TheGame.betToCoins(this.GainingMechanism);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
import { StatusBar } from 'expo-status-bar'
|
||||||
|
import { StyleSheet, View, ImageSourcePropType, Pressable, Text} from 'react-native'
|
||||||
|
import React from 'react';
|
||||||
|
import stylesScreen from './style/screens.style'
|
||||||
|
import { TextInput } from 'react-native-gesture-handler';
|
||||||
|
import { CustomTextInput } from '../components/CustomTextInput';
|
||||||
|
import { ButtonGameTypeChoice } from '../components/ButtonGameTypeChoice';
|
||||||
|
|
||||||
|
import styles from "./style/SignIn.style"
|
||||||
|
|
||||||
|
function SignIn(props: { navigation: any; }) {
|
||||||
|
const { navigation } = props
|
||||||
|
return (
|
||||||
|
<View style={stylesScreen.container}>
|
||||||
|
<View style={stylesScreen.bodyCenter}>
|
||||||
|
<CustomTextInput placeholder={""} text="ID"/>
|
||||||
|
<CustomTextInput placeholder={""} text="Password"/>
|
||||||
|
<Pressable style={styles.button} onPress={navigation.navigate('Home')}>
|
||||||
|
<Text style={styles.text}>Se connecter</Text>
|
||||||
|
</Pressable>
|
||||||
|
<Pressable>
|
||||||
|
<Text style={styles.signup}>Pas de compte? Inscrivez vous !</Text>
|
||||||
|
</Pressable>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default SignIn
|
@ -0,0 +1,30 @@
|
|||||||
|
import { StatusBar } from 'expo-status-bar'
|
||||||
|
import { StyleSheet, View, ImageSourcePropType, Pressable, Text} from 'react-native'
|
||||||
|
import React from 'react';
|
||||||
|
import stylesScreen from './style/screens.style'
|
||||||
|
import { TextInput } from 'react-native-gesture-handler';
|
||||||
|
import { CustomTextInput } from '../components/CustomTextInput';
|
||||||
|
import { ButtonGameTypeChoice } from '../components/ButtonGameTypeChoice';
|
||||||
|
|
||||||
|
import styles from "./style/SignIn.style"
|
||||||
|
|
||||||
|
function SignUp(props: { navigation: any; }) {
|
||||||
|
const { navigation } = props
|
||||||
|
return (
|
||||||
|
<View style={stylesScreen.container}>
|
||||||
|
<View style={stylesScreen.bodyCenter}>
|
||||||
|
<CustomTextInput placeholder={""} text="Pseudo"/>
|
||||||
|
<CustomTextInput placeholder={""} text="Mot de passe"/>
|
||||||
|
<CustomTextInput placeholder={""} text="Mot de passe"/>
|
||||||
|
<CustomTextInput placeholder={""} text="Nationalité"/>
|
||||||
|
<CustomTextInput placeholder={""} text="Date de naisance"/>
|
||||||
|
<CustomTextInput placeholder={""} text="Sexe"/>
|
||||||
|
<Pressable style={styles.button} onPress={navigation.navigate('Home')}>
|
||||||
|
<Text style={styles.text}>S'inscrire</Text>
|
||||||
|
</Pressable>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default SignUp
|
@ -0,0 +1,27 @@
|
|||||||
|
import { StyleSheet } from "react-native";
|
||||||
|
|
||||||
|
export default StyleSheet.create({
|
||||||
|
button: {
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
height: 50,
|
||||||
|
width: 225,
|
||||||
|
marginTop: '15%',
|
||||||
|
margin:'5%',
|
||||||
|
borderRadius: 10,
|
||||||
|
elevation: 3,
|
||||||
|
backgroundColor: '#0085FF',
|
||||||
|
},
|
||||||
|
text: {
|
||||||
|
fontSize: 16,
|
||||||
|
lineHeight: 21,
|
||||||
|
fontWeight: 'bold',
|
||||||
|
letterSpacing: 0.25,
|
||||||
|
color: 'white',
|
||||||
|
},
|
||||||
|
signup:{
|
||||||
|
fontSize:15,
|
||||||
|
color:'white',
|
||||||
|
textDecorationLine:"underline",
|
||||||
|
},
|
||||||
|
});
|
Loading…
Reference in new issue