commit
7dda4bb30a
@ -0,0 +1,12 @@
|
||||
import React from 'react'
|
||||
import App from './App'
|
||||
import store from './src/redux/store'
|
||||
import { Provider } from 'react-redux'
|
||||
|
||||
export default function Index(){
|
||||
return(
|
||||
<Provider store={store}>
|
||||
<App />
|
||||
</Provider>
|
||||
)
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,30 +0,0 @@
|
||||
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>
|
||||
)
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
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,11 @@
|
||||
|
||||
const tabNat = [
|
||||
{ label: "France", value: "Français" },
|
||||
{ label: "Allemagne", value: "Allemand" },
|
||||
{ label: "Espagne", value: "Espagnol" },
|
||||
{ label: "Royaume-Uni", value: "Anglais" },
|
||||
{ label: "États-Unis", value: "Américain" },
|
||||
{ label: "Italie", value: "Italien" },
|
||||
]
|
||||
|
||||
export default tabNat;
|
@ -0,0 +1,9 @@
|
||||
|
||||
const tabSex = [
|
||||
{ label: "Homme", value: "Homme" },
|
||||
{ label: "Femmme", value: "Femmme" },
|
||||
{ label: "Non-binaire", value: "Non-binaire" },
|
||||
{ label: "Autre", value: "Autre" },
|
||||
]
|
||||
|
||||
export default tabSex;
|
@ -0,0 +1,15 @@
|
||||
import { Message } from "./core/message"
|
||||
import { Conversation } from "./core/conversation"
|
||||
import tabSkinApp from './constSkin'
|
||||
import { User } from "./core/user";
|
||||
import tabConv from "./constCov";
|
||||
|
||||
|
||||
let UserActu:User=new User("14", "leBg", "MdpDeOuf", "ouioui", "grand", new Date(2022,12,12), 12222, 123324, 12, tabSkinApp[0], tabSkinApp, undefined);
|
||||
let UserTest:User=new User("48", "WeshWesh", "MdpDeOuf", "ouioui", "grand", new Date(2022,12,12), 12222, 123324, 12, tabSkinApp[2], tabSkinApp, undefined);
|
||||
let Alban:User=new User("17", "Alban", "oui", "ouioui", "homme", new Date(2022,12,12), 555, 667, 12, tabSkinApp[1], tabSkinApp, tabConv);
|
||||
let Fefe63:User=new User("17", "Fefe63", "jesuishm", "ouioui", "homme", new Date(2022,12,12), 12222, 123324, 12, tabSkinApp[6], tabSkinApp, undefined);
|
||||
|
||||
let tabUS:User[]=[UserActu, UserTest, Alban, Fefe63];
|
||||
|
||||
export default tabUS;
|
@ -0,0 +1,60 @@
|
||||
import { createSlice, PayloadAction } from "@reduxjs/toolkit"
|
||||
import { Skin } from "../../core/Skin";
|
||||
import { User } from "../../core/user";
|
||||
|
||||
interface currentUserState {
|
||||
value: User[]
|
||||
}
|
||||
|
||||
const initialState: currentUserState = {
|
||||
value: [],
|
||||
}
|
||||
|
||||
export const currentUserSlice = createSlice({
|
||||
name: "currentUser",
|
||||
initialState,
|
||||
reducers: {
|
||||
loginUser: (state, action: PayloadAction<User>) => {
|
||||
state.value.push(action.payload);
|
||||
},
|
||||
updateSkin: (state, action: PayloadAction<Skin>) =>{
|
||||
const newUser = state.value[0]
|
||||
newUser.setCurrentSkin(action.payload);
|
||||
state.value.pop();
|
||||
state.value.push(newUser);
|
||||
},
|
||||
updatePseudo: (state, action: PayloadAction<string>) =>{
|
||||
const newUser = state.value[0]
|
||||
newUser.setUsername(action.payload);
|
||||
state.value.pop();
|
||||
state.value.push(newUser);
|
||||
},
|
||||
updatePassword: (state, action: PayloadAction<string>) =>{
|
||||
const newUser = state.value[0]
|
||||
newUser.setPassword(action.payload);
|
||||
state.value.pop();
|
||||
state.value.push(newUser);
|
||||
},
|
||||
updateNationality: (state, action: PayloadAction<string>) =>{
|
||||
const newUser = state.value[0]
|
||||
newUser.setNationality(action.payload);
|
||||
state.value.pop();
|
||||
state.value.push(newUser);
|
||||
},
|
||||
updateSex: (state, action: PayloadAction<string>) =>{
|
||||
const newUser = state.value[0]
|
||||
newUser.setSexe(action.payload);
|
||||
state.value.pop();
|
||||
state.value.push(newUser);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
export const { loginUser } = currentUserSlice.actions
|
||||
export const { updateSkin } = currentUserSlice.actions
|
||||
export const { updatePseudo } = currentUserSlice.actions
|
||||
export const { updatePassword } = currentUserSlice.actions
|
||||
export const { updateNationality } = currentUserSlice.actions
|
||||
export const { updateSex } = currentUserSlice.actions
|
||||
|
||||
export default currentUserSlice.reducer;
|
@ -0,0 +1,18 @@
|
||||
import { configureStore } from "@reduxjs/toolkit";
|
||||
import currentUserReducer from "./features/currentUserSlice";
|
||||
import { getDefaultMiddleware } from '@reduxjs/toolkit';
|
||||
|
||||
const customizedMiddleware = getDefaultMiddleware({
|
||||
serializableCheck: false
|
||||
})
|
||||
|
||||
const store = configureStore({
|
||||
reducer: {
|
||||
currentUser: currentUserReducer,
|
||||
},
|
||||
middleware: (getDefaultMiddleware) => customizedMiddleware,
|
||||
})
|
||||
|
||||
export type RootState = ReturnType<typeof store.getState>;
|
||||
export type AppDispatch = typeof store.dispatch;
|
||||
export default store;
|
@ -1,46 +1,46 @@
|
||||
import { StatusBar } from 'expo-status-bar'
|
||||
import { StyleSheet, View, ImageSourcePropType} from 'react-native'
|
||||
import { View} from 'react-native'
|
||||
import React from 'react';
|
||||
import stylesScreen from './style/screens.style'
|
||||
import { User } from '../core/User/user';
|
||||
import { Skin } from '../core/skin';
|
||||
import { TopBar } from '../components/TopBar';
|
||||
import { BotBar } from '../components/BotBar';
|
||||
import { Conversation } from '../core/conversation';
|
||||
import { ButtonGameTypeChoice } from '../components/ButtonGameTypeChoice';
|
||||
import tabSkinApp from '../constSkin';
|
||||
import { GameSolo } from '../core/gameSolo';
|
||||
|
||||
import { useSelector } from 'react-redux';
|
||||
import { RootState } from '../redux/store';
|
||||
|
||||
|
||||
//const test= new GameSolo("test", require('bob_party/assets/ImagesJeux/BatailleNavale.jpeg'), "test", );
|
||||
let tabConv:Conversation[]=[];
|
||||
const UserActu=new User("14", "leBg", "MdpDeOuf", "ouioui", "grand", new Date(2022,12,12), 12222, 123324, 12, tabSkinApp[0], tabSkinApp, tabConv);
|
||||
|
||||
|
||||
function Home(props: { navigation: any; }) {
|
||||
const { navigation } = props
|
||||
return (
|
||||
<View style={stylesScreen.container}>
|
||||
<TopBar
|
||||
skin={UserActu.getCurrentSkin()}
|
||||
nav={navigation}
|
||||
state= 'Home'
|
||||
/>
|
||||
<View style={stylesScreen.bodyCenter}>
|
||||
<ButtonGameTypeChoice
|
||||
title='Jouer Seul'
|
||||
onPress={() => navigation.navigate('GameChoice')}
|
||||
|
||||
const currentUser = useSelector((state: RootState) => state.currentUser.value[0]);
|
||||
|
||||
return (
|
||||
<View style={stylesScreen.container}>
|
||||
<TopBar
|
||||
skin={currentUser.getCurrentSkin()}
|
||||
nav={navigation}
|
||||
state= 'Home'
|
||||
/>
|
||||
<ButtonGameTypeChoice
|
||||
title='Défier mes amis'
|
||||
onPress={() => navigation.navigate('GameChoice')}
|
||||
<View style={stylesScreen.bodyCenter}>
|
||||
<ButtonGameTypeChoice
|
||||
title='Jouer Seul'
|
||||
onPress={() => navigation.navigate('GameChoice')}
|
||||
/>
|
||||
<ButtonGameTypeChoice
|
||||
title='Défier mes amis'
|
||||
onPress={() => navigation.navigate('GameChoice')}
|
||||
/>
|
||||
</View>
|
||||
<BotBar
|
||||
nav={navigation}
|
||||
state='Home'
|
||||
/>
|
||||
</View>
|
||||
<BotBar
|
||||
nav={navigation}
|
||||
state='Home'
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1,30 +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 { 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"
|
||||
// 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>
|
||||
);
|
||||
}
|
||||
// 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
|
||||
// export default SignUp
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue