avancées tests

stub-api
Mathilde Jean 3 years ago
commit 3422518fd8

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1013 B

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

@ -14,13 +14,13 @@
"@react-navigation/stack": "^6.3.2", "@react-navigation/stack": "^6.3.2",
"expo": "^46.0.15", "expo": "^46.0.15",
"expo-status-bar": "~1.4.0", "expo-status-bar": "~1.4.0",
"jest": "^29.1.2", "jest": "^26.6.3",
"node": "^18.10.0", "node": "^18.10.0",
"react": "18.0.0", "react": "18.0.0",
"react-dom": "18.0.0", "react-dom": "18.0.0",
"react-native": "^0.69.6", "react-native": "^0.69.6",
"react-native-gesture-handler": "^2.7.1", "react-native-gesture-handler": "~2.5.0",
"react-native-safe-area-context": "^4.4.1", "react-native-safe-area-context": "4.3.1",
"react-native-web": "~0.18.7" "react-native-web": "~0.18.7"
}, },
"devDependencies": { "devDependencies": {

@ -1,30 +1,87 @@
import { FC, ReactNode } from "react" import { FC, ReactNode } from "react"
import { Pressable, Image, ImageStyle, Text, View, Alert, ImageSourcePropType, TextStyle } from "react-native" import { Pressable, Image, View} from "react-native"
import React from "react" import React from "react"
/*
Importing the correct stylesheet
*/
import styles from './style/BotBar.style';
/*
Images that are required to create a bottom bar
*/
/*
Icons when the corresponding screen is not displayed (white ones)
*/
const gamepad = require('../../assets/Icons/UnSelected/Gamepad.png');
const message = require('../../assets/Icons/UnSelected/Chat.png');
const store = require('../../assets/Icons/UnSelected/Store.png');
/*
Icons when the corresponding screen is displayed (blue ones)
*/
const sgamepad = require('../../assets/Icons/Selected/SGamepad.png');
const smessage = require('../../assets/Icons/Selected/SChat.png');
const sstore = require('../../assets/Icons/Selected/SStore.png');
export const BotBar : export const BotBar :
FC<{messages:ImageSourcePropType, games: ImageSourcePropType, shop: ImageSourcePropType, style: ImageStyle, styleStore: ImageStyle, nav: any, styleBar : any}> = /* Parameters :
({messages, games, shop,style, styleStore, nav,styleBar}) => * nav : tool needed to allow the navigation between the screens
* state : optional parameter that indicates from which screen the component has been called
(the string must be the name of the screen)
*/
FC<{nav: any, state?: String}> =
({nav, state}) =>
{ {
/*
By default, all the images are the white ones
*/
var imgLeft=message, imgMid=gamepad, imgRight=store
/*
For each screen corresponding to a screen of the bottom bar,
we need to change one of the icons to the corresponding blue one
(for example, when the chat screen is displayed,
the icon of the messages must switch to the blue one)
*/
switch (state) {
case 'Home':
imgMid = sgamepad
break;
case 'Chat':
imgLeft = smessage
break;
case 'Store':
imgRight = sstore
break;
default:
break;
}
/*
Once the icons are correctly attributed,
the function can display the component
*/
return ( return (
<View style={styleBar}> <View style={styles.footer}>
<Pressable onPress={() => nav.navigate('ChatTab')}> <Pressable onPress={() => nav.navigate('ChatTab')}>
<Image <Image
style={style} style={styles.icon}
source={messages} source={imgLeft}
/> />
</Pressable> </Pressable>
<Pressable onPress={()=> nav.navigate('HomeTab')}> <Pressable onPress={()=> {nav.navigate('HomeTab', {screen: 'Home'})}}>
<Image <Image
style={style} style={styles.icon}
source={games} source={imgMid}
/> />
</Pressable> </Pressable>
<Pressable onPress={() => nav.navigate('StoreTab')}> <Pressable onPress={() => nav.navigate('StoreTab')}>
<Image <Image
style={styleStore} style={styles.icon}
source={shop} source={imgRight}
/> />
</Pressable> </Pressable>
</View> </View>

@ -0,0 +1,16 @@
import { FC} from "react"
import { Pressable, Text} from "react-native"
import React from "react"
import styles from "./style/ButtonChangeSkin.style"
export const ButtonChangeSkin:
FC<{ onPress: any;}>
=
({onPress}) =>
{
return (
<Pressable style={styles.button} onPress={onPress}>
<Text style={styles.text}>Changer de skin</Text>
</Pressable>
);
}

@ -0,0 +1,23 @@
import { FC} from "react"
import { Pressable, Text} from "react-native"
import React from "react"
/*
Importing the corresponding stylesheet
*/
import styles from "./style/ButtonGameTypeChoice.style"
export const ButtonGameTypeChoice:
/* Parameters:
* onPress : function that must be called when the button has been clicked
* title : optional text that would be in the button
*/
FC<{ onPress: any; title?: any | undefined; }>
=
({onPress,title}) =>
{
return (
<Pressable style={styles.button} onPress={onPress}>
<Text style={styles.text}>{title}</Text>
</Pressable>
);
}

@ -0,0 +1,42 @@
import { FC, ReactNode } from "react"
import { Pressable, Image, ImageStyle, Text, View, Alert, ImageSourcePropType, TextStyle } from "react-native"
import React from "react"
import { Skin } from "../core/skin"
import { Conversation } from "../core/conversation"
/*
Importing the correct stylesheet
*/
import styles from "./style/ConverstationComponent.style"
import { SkinComponent } from "./Skin"
export const ConversationComponent :
/* Parameters :
* skin : Skin to be displayed
* state : Indicates from wich screen the component has been called
*/
FC<{conv: Conversation, state: String}> =
({conv, state}) =>
{
/* The display of this component depends of the screen from where it has been called:
* From the TopBar (icon) : Small image in a circle
* From the shop (shop) : Image + Name + Price, Pressable => Buy the skin
* From the profile (profile) : Name + Image, Pressable => Change the skin
*/
switch (state) {
case 'Preview':
return(
<View style={{flexDirection: 'row', height: 70, borderBottomWidth: 2,borderBottomColor: '#2D2C33', paddingLeft: '5%',}}>
<View style={{alignSelf: 'center'}}>
<SkinComponent skin={conv.getTabUser()[1].getCurrentSkin()} state='icon'/>
</View>
<View style={{marginLeft: '5%', justifyContent: 'space-evenly'}}>
<Text style={styles.textNom}>{conv.getTabUser()[1].getUsername()}</Text>
<Text style={styles.textMess}>{conv.getLastMessage()}</Text>
</View>
</View>
)
default:
break;
}
}

@ -0,0 +1,31 @@
import { FC, ReactNode } from "react"
import { Pressable, Image, ImageStyle, Text, View, Alert, ImageSourcePropType, TextStyle } from "react-native"
import React from "react"
import { trace } from "console"
import { Game } from "../core/Game"
/*
Importing the correct stylesheet
*/
import styles from './style/Game.style';
export const GameComponent :
/*
* game : Game that must be displayed
* nav : tool needed to allow the navigation between the screens
*/
FC<{game: Game, nav: any}> =
({game, nav}) =>
{
return (
<View>
<Pressable onPress={() => Alert.alert("Lancement du jeu")}>
<Image
style={styles.image}
source={game.getImageSource()}
/>
<Text style={styles.name}>{game.getName()}</Text>
</Pressable>
</View>
)
}

@ -0,0 +1,13 @@
import { FC, ReactNode } from "react"
import { Pressable, Image, ImageStyle, Text, View, Alert, ImageSourcePropType, TextStyle } from "react-native"
import React from "react"
import styles from './style/ScreenIndicator.style'
export const ScreenIndicator: FC<{title: String}> = ({title}) =>
{
return(
<View style={styles.textTopView}>
<Text style={styles.textTop}>{title}</Text>
</View>
)
}

@ -0,0 +1,66 @@
import { FC, ReactNode } from "react"
import { Pressable, Image, ImageStyle, Text, View, Alert, ImageSourcePropType, TextStyle } from "react-native"
import React from "react"
import { Skin } from "../core/skin"
/*
Importing the correct stylesheet
*/
import styles from "./style/Skin.style"
export const SkinComponent :
/* Parameters :
* skin : Skin to be displayed
* state : Indicates from wich screen the component has been called
*/
FC<{skin: Skin, state: String}> =
({skin, state}) =>
{
/* The display of this component depends of the screen from where it has been called:
* From the TopBar (icon) : Small image in a circle
* From the shop (shop) : Image + Name + Price, Pressable => Buy the skin
* From the profile (profile) : Name + Image, Pressable => Change the skin
*/
switch (state) {
case 'icon':
return (
<View>
<Image source={ skin.getSkinSource()} style={styles.icon}/>
</View>
)
case 'shop':
return(
<Pressable onPress={() => Alert.alert("Achat du skin")} style={styles.imageWrapper}>
<Text style={styles.nomSkin}>{skin.getSkinName()}</Text>
<Image
style={styles.imageSkin}
source={skin.getSkinSource()}
/>
<Text style={styles.nomSkin}>100</Text>
</Pressable>
)
case 'liste':
return(
<Pressable onPress={() => Alert.alert("Changement du skin")} style={styles.imageWrapper}>
<Text style={styles.nomSkin}>{skin.getSkinName()}</Text>
<Image
style={styles.imageSkin}
source={skin.getSkinSource()}
/>
</Pressable>
)
case 'profile':
return(
<Pressable onPress={() => Alert.alert("Achat du skin")} style={styles.imageWrapperProfil}>
<Text style={styles.nomSkin}>{skin.getSkinName()}</Text>
<Image
style={styles.imageSkin}
source={skin.getSkinSource()}
/>
</Pressable>
)
default:
break;
}
}

@ -1,23 +1,59 @@
import { FC, ReactNode } from "react" import { FC, ReactNode } from "react"
import { Pressable, Image, ImageStyle, Text, View, Alert, ImageSourcePropType, TextStyle } from "react-native" import { Pressable, Image, Text, View} from "react-native"
import { Skin } from "../core/Skin" import { Skin } from "../core/Skin"
import React from "react" import React from "react"
import { SkinComponent } from "./skinAvatar" import { SkinComponent } from "./Skin"
import MainTabNavigator from "../navigation/AppNavigator"
import { BottomTabNavigationProp } from "@react-navigation/bottom-tabs"
/*
Import the correct stylesheet
*/
import styles from './style/TopBar.style';
export const TopBar : FC<{skin: Skin, styleAvatar: ImageStyle, title: String, rightIcon: ImageSourcePropType, styleIcon: ImageStyle,nav: any, styleTitle: TextStyle, styleHeader : any}> = ({skin, styleAvatar, title, rightIcon,styleIcon, nav, styleTitle, styleHeader}) => /*
Images required
*/
const engrenage = require('../../assets/Icons/UnSelected/Cogs.png');
const cross = require('../../assets/Icons/UnSelected/Cross.png');
const msc = require('../../assets/Icons/FondGris.png');
export const TopBar :
/* Parameters:
* skin : optional skin to display
* nav : tool needed to allow the navigation between the screens
* state : optional parameter that indicates from which screen the component has been called
(the string must be the name of the screen)
*/
FC<{skin?: Skin, nav: any, state?: string}> =
({skin, nav, state}) =>
{ {
/* The display of this component depends of the screen from where it has been called:
* From the Settings (icon) : Name of the page + cross button
* From other : skin + Title + parameters icon
*/
switch (state) {
case 'settings':
return (
<View style={styles.header}>
<Pressable>
<Image source={msc} style={styles.icon}/>
</Pressable>
<Text style={styles.titre}>BOB PARTY</Text>
<Pressable onPress={() => nav.goBack()}>
<Image source={cross} style={styles.icon}/>
</Pressable>
</View>
)
default:
return ( return (
<View style={styleHeader}> <View style={styles.header}>
<Pressable onPress={() => nav.navigate('ProfileTab')}> <Pressable onPress={() => nav.navigate('ProfileTab', {screen: 'Profile'})}>
<SkinComponent skin={skin} children={styleAvatar} /> <SkinComponent skin={skin} state='icon' />
</Pressable> </Pressable>
<Text style={styleTitle}>{title}</Text> <Text style={styles.titre}>BOB PARTY</Text>
<Pressable onPress={() => nav.navigate('Settings')}> <Pressable onPress={() => nav.navigate('Settings')}>
<Image source={rightIcon} style={styleIcon}/> <Image source={engrenage} style={styles.icon}/>
</Pressable> </Pressable>
</View> </View>
) )
}
} }

@ -1,12 +0,0 @@
import { FC, ReactNode } from "react"
import { Button, Image, ImageStyle, Text, View } from "react-native"
import { Skin } from "../core/Skin"
import React from "react"
export const SkinComponent : FC<{skin: Skin, children: ImageStyle}> = ({skin, children}) => {
return (
<View>
<Image source={ skin.getSkinSource()} style={children}/>
</View>
)
}

@ -0,0 +1,20 @@
import { StyleSheet } from 'react-native';
/*
Stylesheet for the BotBar component
*/
export default StyleSheet.create({
footer: {
flex: 0.15,
flexDirection: 'row',
backgroundColor: '#2D2C33',
width: '100%',
justifyContent: 'space-evenly',
alignItems: 'center',
},
icon: {
width: 65,
height: 65,
},
});

@ -0,0 +1,20 @@
import { StyleSheet } from 'react-native';
export default StyleSheet.create({
button: {
alignItems: 'center',
justifyContent: 'center',
padding: 3,
marginTop: 5,
marginHorizontal: 10,
borderRadius: 10,
backgroundColor: '#2D2C33',
},
text: {
fontSize: 16,
lineHeight: 21,
fontWeight: 'bold',
letterSpacing: 0.25,
color: 'white',
},
});

@ -0,0 +1,25 @@
import { StyleSheet } from 'react-native';
/*
Stylesheet for the ButtonGameTypeChoice component
*/
export default StyleSheet.create({
button: {
alignItems: 'center',
justifyContent: 'center',
height: '30%',
width: '70%',
margin: '5%',
borderRadius: 10,
elevation: 3,
backgroundColor: '#0085FF',
},
text: {
fontSize: 16,
lineHeight: 21,
fontWeight: 'bold',
letterSpacing: 0.25,
color: 'white',
},
});

@ -0,0 +1,15 @@
import { StyleSheet } from "react-native";
export default StyleSheet.create({
textNom: {
fontSize: 20,
fontWeight: 'bold',
letterSpacing: 0.25,
color: 'white',
},
textMess: {
fontSize: 15,
letterSpacing: 0.25,
color: '#D9D9D9',
}
});

@ -0,0 +1,24 @@
import { StyleSheet } from "react-native";
/*
Stylesheet for the GameComponent component
*/
export default StyleSheet.create(
{
image : {
borderRadius: 15,
marginTop: 15,
marginRight: 15,
width: 100,
height: 100,
},
name :{
textAlign: 'center',
fontSize: 15,
fontFamily: 'Helvetica',
fontWeight: 'bold',
letterSpacing: 0.25,
color: 'white',
},
})

@ -0,0 +1,21 @@
import { StyleSheet } from 'react-native';
export default StyleSheet.create({
textTop: {
textAlign: "center",
fontSize: 16,
lineHeight: 21,
fontWeight: 'bold',
letterSpacing: 0.25,
color: 'white',
},
textTopView: {
backgroundColor: '#0085FF',
width: '30%',
padding: 5,
paddingBottom: 10,
alignSelf: 'center',
borderBottomRightRadius: 50,
borderBottomLeftRadius: 50,
}
});

@ -0,0 +1,36 @@
import { StyleSheet } from "react-native";
/*
Stylesheet for the Skin component
*/
export default StyleSheet.create({
icon: {
width: 50,
height: 50,
borderRadius: 50,
},
imageWrapper: {
height: 135,
width: '40%',
flexDirection: "column",
margin: 10,
},
imageWrapperProfil: {
height: 135,
flexDirection: "column",
margin: 10,
},
imageSkin : {
borderRadius: 15,
width: '100%',
flex:1
},
nomSkin :{
textAlign: 'center',
fontSize: 25,
fontFamily: 'Helvetica',
fontWeight: 'bold',
color: 'white',
},
});

@ -0,0 +1,35 @@
import { StyleSheet } from 'react-native';
/*
Stylesheet for the TopBar component
*/
export default StyleSheet.create({
header: {
flex: 0.15,
flexDirection: 'row',
backgroundColor: '#2D2C33',
width: '100%',
justifyContent: 'space-evenly',
alignItems: 'center',
},
avatar: {
borderRadius: 50,
width: 50,
height: 50,
},
icon: {
width: 50,
height: 50,
},
titre: {
flex: 0.7,
flexDirection: 'column',
textAlign: 'center',
fontSize: 30,
fontFamily: 'Helvetica',
fontWeight: 'bold',
letterSpacing: 0.25,
color: 'white',
},
});

@ -0,0 +1,25 @@
import { Message } from "./core/message"
import { Conversation } from "./core/conversation"
import tabSkinApp from './constSkin'
import { User } from "./core/user";
let UserActu:User=new User("14", "leBg", "ouioui", "grand", new Date(2022,12,12), 12222, 123324, 12, tabSkinApp[0], tabSkinApp, undefined);
let UserTest:User=new User("48", "Wesh Wesh", "ouioui", "grand", new Date(2022,12,12), 12222, 123324, 12, tabSkinApp[1], tabSkinApp, undefined);
let tabMessageTest:Message[]=[
new Message("Salut", UserActu, new Date(2022,12,12)),
new Message("Wesh", UserTest, new Date(2022,12,13)),
new Message("Ca va", UserActu, new Date(2022,12,14)),
new Message("Ouais et toi?", UserTest, new Date(2022,12,15)),
]
let tabUS:User[]=[UserActu, UserTest];
let conv = new Conversation(tabUS, tabMessageTest, "le super nom");
let tabConv:Conversation[]=[conv];
export default tabConv;

@ -0,0 +1,14 @@
import { Skin } from "./core/skin";
let tabSkinApp:Skin[]=[
new Skin("S0001", "Bob",require('bob_party/assets/BobsSkins/BobClassic.png'), 0),
new Skin("S0002", "Bob Blue",require('bob_party/assets/BobsSkins/BobBlue.png'), 100),
new Skin("S0003", "Bob BW",require('bob_party/assets/BobsSkins/BobBW.png'), 100),
new Skin("S0004", "Bob Green",require('bob_party/assets/BobsSkins/BobGreen.png'), 100),
new Skin("S0005", "Bob P&T",require('bob_party/assets/BobsSkins/BobPinkTurquoise.png'), 100),
new Skin("S0006", "Bob Red",require('bob_party/assets/BobsSkins/BobRed.png'), 100),
new Skin("S0007", "Bob Cute",require('bob_party/assets/BobsSkins/BobYellowGreenBlueHeart.png'), 100),
]
export default tabSkinApp;

@ -1,35 +1,45 @@
export interface Game{ import { randomBytes } from "crypto";
private Name:String; import { ImageSourcePropType } from "react-native";
private ImageSource:String;
private GameSource:String;
constructor(name:String, imageSource:String, gameSource:String){ export class Game{
private Name:string;
private ImageSource:ImageSourcePropType;
private GameSource:string ;
/* Constructor of the class */
constructor (name:string, imageSource:ImageSourcePropType, gameSource:string){
this.Name=name; this.Name=name;
this.ImageSource=imageSource this.ImageSource=imageSource;
this.GameSource=gameSource; this.GameSource=gameSource;
} }
/* Brief : Function getting the name of a game */
getName(){ getName(){
return this.Name; return this.Name;
} }
setName(name:String){ /* Brief : Function setting the name of a game */
setName(name:string){
this.Name=name; this.Name=name;
} }
getImageSource(imageSource:String){ /* Brief : Function getting the image of a game */
getImageSource(){
return this.ImageSource; return this.ImageSource;
} }
setImageSource(imageSource:String){ /* Brief : Function setting the image of a game */
setImageSource(imageSource:ImageSourcePropType){
this.ImageSource=imageSource; this.ImageSource=imageSource;
} }
/* Brief : Function getting the source of a game */
getGameSource(){ getGameSource(){
return this.GameSource; return this.GameSource;
} }
setGameSource(gameSource:String){ /* Brief : Function getting the source of a game */
setGameSource(gameSource:string){
this.GameSource=gameSource; this.GameSource=gameSource;
} }
} }

@ -3,29 +3,62 @@ import { User } from "./user";
export class Conversation{ export class Conversation{
private TabUser?: User[]; private TabUser: User[];
private TabMessage?: Message[]; private TabMessage: Message[];
private Name?: string;
constructor(tabUser: User[], tabMessage:Message[]){ /* Constructor of the class */
constructor(tabUser: User[], tabMessage:Message[], name?:string){
this.TabUser=[...tabUser]; this.TabUser=[...tabUser];
this.TabMessage=[...tabMessage]; this.TabMessage=[...tabMessage];
this.Name=name;
} }
/* Brief : function returning the messages of a conversation */
getTabMessage(){ getTabMessage(){
this.sortMessageDesc();
return this.TabMessage; return this.TabMessage;
} }
/* Brief : function returning the users of a conversation */
getTabUser(){ getTabUser(){
return this.TabUser; return this.TabUser;
} }
/* Brief : function adding an user to a conversation */
ajouterUser(us:User){ ajouterUser(us:User){
this.TabUser?.push(us); this.TabUser?.push(us);
} }
/* Brief : function adding a message to a conversation */
ajouterMessage(mess:Message){ ajouterMessage(mess:Message){
this.TabMessage?.push(mess); this.TabMessage?.push(mess);
this.sortMessageDesc();
}
/* Brief : function returning the name to a conversation */
getName(){
return this.Name;
}
/* Brief : function setting the name to a conversation */
setName(name:string){
this.Name=name;
}
/* Brief : function returning the last message of a conversation */
getLastMessage(){
this.sortMessageDesc();
return this.TabMessage[0].getMessageContent();
}
/* Brief : function sorting the messages of a conversation to be in the discussion order */
sortMessageDesc(){
this.TabMessage.sort(
(objA, objB) => objB.getMessageDate().getTime() - objA.getMessageDate().getTime(),
);
} }
} }

@ -0,0 +1,27 @@
import { ImageSourcePropType } from 'react-native';
import { Game } from './game'
export class GameSolo extends Game{
readonly PtsToCoins:Map<number,number>
constructor(name:string, imageSource:ImageSourcePropType, gameSource:string, ptsToCoins:Map<number,number>){
super(name, imageSource, gameSource);
this.PtsToCoins=ptsToCoins;
}
getSoloMap(){
return this.PtsToCoins;
}
CoinsWithPoints(nbPoints:number){
let coins;
for (let key of this.PtsToCoins.keys()){
coins = this.PtsToCoins.get(key);
if (nbPoints<key ){
return coins;
}
}
return coins;
}
}

@ -6,32 +6,39 @@ export class Message{
private Sender: User; private Sender: User;
private DateEnvoie: Date; private DateEnvoie: Date;
/* Constructor of the class */
constructor(content: string, sender:User, dateEnvoie:Date){ constructor(content: string, sender:User, dateEnvoie:Date){
this.Content=content; this.Content=content;
this.Sender=sender; this.Sender=sender;
this.DateEnvoie=dateEnvoie; this.DateEnvoie=dateEnvoie;
} }
/* Brief : Function setting the content of a message */
setMessageContent(content: string){ setMessageContent(content: string){
this.Content=content; this.Content=content;
} }
setSMessageSender(sender: User){ /* Brief : Function setting the sender of a message */
setMessageSender(sender: User){
this.Sender=sender; this.Sender=sender;
} }
setSMessageDate(dateEnvoie: Date){ /* Brief : Function setting the date of a message */
setMessageDate(dateEnvoie: Date){
this.DateEnvoie=dateEnvoie; this.DateEnvoie=dateEnvoie;
} }
/* Brief : Function getting the content of a message */
getMessageContent(){ getMessageContent(){
return this.Content; return this.Content;
} }
/* Brief : Function getting the sender of a message */
getMessageSender(){ getMessageSender(){
return this.Sender; return this.Sender;
} }
/* Brief : Function getting the date of a message */
getMessageDate(){ getMessageDate(){
return this.DateEnvoie; return this.DateEnvoie;
} }

@ -1,6 +1,9 @@
import { Skin } from './Skin'; import { Skin } from './Skin';
/*
// Instance // Instance
let classique = new Skin('Classique', 'wouhou'); let classique = new Skin('Classique', 'wouhou');
@ -28,4 +31,4 @@ describe('Skin set tests', () => {
it('should return The wouhou', () => { it('should return The wouhou', () => {
expect(classique.getSkinSource()).toBe('The wouhou'); expect(classique.getSkinSource()).toBe('The wouhou');
}) })
}) })*/

@ -1,25 +1,51 @@
import { ImageSourcePropType } from "react-native";
export class Skin{ export class Skin{
readonly Id: string;
private Name: string; private Name: string;
private Source: any; private Source: ImageSourcePropType;
private Cost:number;
constructor(name: string, source:any){ /* Constructor of the class */
constructor(id:string, name: string, source:ImageSourcePropType, Cost:number){
this.Id=id;
this.Name=name; this.Name=name;
this.Source=source; this.Source=source;
this.Cost=Cost;
} }
/* Brief : Fuction setting the name of a skin */
setSkinName(name: string){ setSkinName(name: string){
this.Name=name; this.Name=name;
} }
setSkinSource(source: any){ /* Brief : Fuction setting the source of the image of a skin */
setSkinSource(source: ImageSourcePropType){
this.Source=source; this.Source=source;
} }
/* Brief : Fuction getting the source of the image of a skin */
getSkinSource(){ getSkinSource(){
return this.Source; return this.Source;
} }
/* Brief : Fuction getting the name of a skin */
getSkinName(){ getSkinName(){
return this.Name; return this.Name;
} }
/* Brief : Fuction getting the id of a skin */
getSkinId(){
return this.Id;
}
/* Brief : Fuction getting the cost of a skin */
getSkinCost(){
return this.Cost;
}
/* Brief : Fuction getting the cost of a skin */
setSkinCost(cost:number){
this.Cost=cost;
}
} }

@ -1,109 +1,161 @@
import { Skin } from './Skin' import { Skin } from './Skin'
import { Conversation } from './conversation'; import { Conversation } from './conversation';
import { sign } from 'crypto';
export class User{ export class User{
private Id: string; readonly Id: string;
private Username: string; private Username: string;
private Nationality: string; private Nationality: string;
private Sexe: string; private Sexe: string;
private DateOfBirth: Date; private DateOfBirth: Date;
private CurrentCoins: number; private CurrentCoins: number;
private TotalCoins: number; private TotalCoins: number;
private NbGamePlayed: number;
private CurrentSkin: Skin; private CurrentSkin: Skin;
private TabSkin: Skin[]; private TabSkin: Skin[];
private TabConv: Conversation[]; private TabConv?: Conversation[];
/* Consturctor of the class */
constructor(id: string, username: string, nationality: string, sexe: string, dateOfBirth: Date, currentCoins: number, totalCoins: number, constructor(id: string, username: string, nationality: string, sexe: string, dateOfBirth: Date, currentCoins: number, totalCoins: number,
currentSkin: Skin, tabSkin: Skin[], tabConv: Conversation[] ){ nbGamePlayed:number, currentSkin: Skin, tabSkin: Skin[], tabConv?: Conversation[] ){
this.Id=id; this.Id=id;
this.Username=username; this.Username=username;
this.Nationality=nationality; this.Nationality=nationality;
this.Sexe=sexe; this.Sexe=sexe;
this.DateOfBirth=dateOfBirth; this.DateOfBirth=dateOfBirth;
this.NbGamePlayed=nbGamePlayed;
this.CurrentCoins=currentCoins; this.CurrentCoins=currentCoins;
this.TotalCoins=totalCoins; this.TotalCoins=totalCoins;
this.CurrentSkin=currentSkin; this.CurrentSkin=currentSkin;
this.TabSkin=[...tabSkin]; this.TabSkin=[...tabSkin];
this.TabConv=[...tabConv]; tabConv?.forEach(conv => {
this.TabConv?.push(conv);
});
} }
/* Brief : Function getting the name of an user */
getUsername(){ getUsername(){
return this.Username; return this.Username;
} }
/* Brief : Function setting the name of an user */
setUsername(username: string){ setUsername(username: string){
this.Username=username; this.Username=username;
} }
/* Brief : Function getting the id of an user */
getId(){ getId(){
return this.Id; return this.Id;
} }
setId(id: string){ /* Brief : Function getting the current number of coins of an user */
this.Id=id;
}
getCurrentCoins(){ getCurrentCoins(){
return this.CurrentCoins; return this.CurrentCoins;
} }
/* Brief : Function setting the current number of coins of an user */
setCurrentCoins(currentCoins: number){ setCurrentCoins(currentCoins: number){
this.CurrentCoins=currentCoins; this.CurrentCoins=currentCoins;
} }
/* Brief : Function getting the sex of an user */
getSexe(){ getSexe(){
return this.Sexe; return this.Sexe;
} }
/* Brief : Function getting the sex of an user */
setSexe(sexe: string){ setSexe(sexe: string){
this.Sexe=sexe; this.Sexe=sexe;
} }
/* Brief : Function getting the date of birth of an user */
getDateOfBirth(){ getDateOfBirth(){
return this.DateOfBirth; return this.DateOfBirth;
} }
/* Brief : Function setting the date of birth of an user */
setDateOfBirth(dateOfBirth: Date){ setDateOfBirth(dateOfBirth: Date){
this.DateOfBirth=dateOfBirth; this.DateOfBirth=dateOfBirth;
} }
/* Brief : Function getting the nationality of an user */
getNationality(){ getNationality(){
return this.Nationality; return this.Nationality;
} }
/* Brief : Function setting the nationality of an user */
setNationality(nationality: string){ setNationality(nationality: string){
this.Nationality=nationality; this.Nationality=nationality;
} }
/* Brief : Function getting the total number of coins of an user */
getTotalCoins(){ getTotalCoins(){
return this.TotalCoins; return this.TotalCoins;
} }
/* Brief : Function setting the total number of coins of an user */
setTotalCoins(totalCoins: number){ setTotalCoins(totalCoins: number){
this.TotalCoins=totalCoins; this.TotalCoins=totalCoins;
} }
/* Brief : Function getting the current number of game played by an user */
getGamePlayed(){
return this.NbGamePlayed;
}
/* Brief : Function setting the current number of game played by an user */
setGamePlayed(nb: number){
this.NbGamePlayed=nb;
}
/* Brief : Function getting the current skin of an user */
getCurrentSkin(){ getCurrentSkin(){
return this.CurrentSkin; return this.CurrentSkin;
} }
/* Brief : Function setting the current skin of an user */
setCurrentSkin(newSkin: Skin){ setCurrentSkin(newSkin: Skin){
this.CurrentSkin=newSkin; this.CurrentSkin=newSkin;
} }
/* Brief : Function getting the skins of an user */
getTabSkin(){ getTabSkin(){
return this.TabSkin; return this.TabSkin;
} }
/* Brief : Function setting the skins of an user */
setTabSkin(tabSkin: Skin[]){ setTabSkin(tabSkin: Skin[]){
this.TabSkin=[...tabSkin]; this.TabSkin=[...tabSkin];
} }
/* Brief : Function getting the conversations of an user */
getTabConv(){ getTabConv(){
return this.TabConv; return this.TabConv;
} }
setTabConv(tabConv: Conversation[]){ /* Brief : Function setting the conversations of an user */
this.TabConv=[...tabConv]; setTabConv(tabConv?: Conversation[]){
tabConv?.forEach(conv => {
this.TabConv?.push(conv);
});
}
changeUserCoins(coin:number){
this.CurrentCoins+=coin;
if (coin>0){
this.TotalCoins+=coin;
}
}
changerCurrentSkin(skin:Skin){
this.CurrentSkin=skin;
}
ajouterSkin(skin:Skin){
this.TabSkin.push(skin);
} }
} }

@ -8,6 +8,8 @@ import Store from '../screens/Store'
import Chat from '../screens/Chat' import Chat from '../screens/Chat'
import Settings from '../screens/Settings' import Settings from '../screens/Settings'
import Profile from '../screens/Profile' import Profile from '../screens/Profile'
import SkinList from '../screens/SkinList'
import GameChoice from '../screens/GameChoice'
import Test from '../screens/Test' import Test from '../screens/Test'
@ -15,17 +17,23 @@ import Test from '../screens/Test'
const HomeStack = createStackNavigator(); const HomeStack = createStackNavigator();
/*
Stack of screens for home and game choice
*/
function HomeStackScreen() { function HomeStackScreen() {
return ( return (
<HomeStack.Navigator screenOptions={{headerShown: false}}> <HomeStack.Navigator screenOptions={{ headerShown: false}}>
<HomeStack.Screen name="Home" component={Home} /> <HomeStack.Screen name="Home" component={Home} options={{animationEnabled: false,}}/>
<HomeStack.Screen name="Settings" component={Settings} /> <HomeStack.Screen name="Settings" component={Settings} />
<HomeStack.Screen name='GameChoice' component={GameChoice} options={{animationEnabled: false,}}/>
</HomeStack.Navigator> </HomeStack.Navigator>
); );
} }
const StoreStack = createStackNavigator(); const StoreStack = createStackNavigator();
/*
Stack of screens for the store and the purshase of new skins
*/
function StoreStackScreen() { function StoreStackScreen() {
return ( return (
<StoreStack.Navigator screenOptions={{headerShown: false}}> <StoreStack.Navigator screenOptions={{headerShown: false}}>
@ -36,7 +44,9 @@ function StoreStackScreen() {
} }
const ChatStack = createStackNavigator(); const ChatStack = createStackNavigator();
/*
Stack of screens for conversations
*/
function ChatStackScreen() { function ChatStackScreen() {
return ( return (
<ChatStack.Navigator screenOptions={{headerShown: false}}> <ChatStack.Navigator screenOptions={{headerShown: false}}>
@ -47,23 +57,27 @@ function ChatStackScreen() {
} }
const ProfileStack = createStackNavigator(); const ProfileStack = createStackNavigator();
/*
Stack of screens for the profile and the changement of informations
*/
function ProfileStackScreen() { function ProfileStackScreen() {
return ( return (
<ProfileStack.Navigator screenOptions={{headerShown: false}}> <ProfileStack.Navigator screenOptions={{headerShown: false}}>
<ProfileStack.Screen name="Profile" component={Profile} /> <ProfileStack.Screen name="Profile" component={Profile} options={{animationEnabled: false,}}/>
<ProfileStack.Screen name="Settings" component={Settings} /> <ProfileStack.Screen name="Settings" component={Settings} />
<ProfileStack.Screen name="SkinList" component={SkinList} options={{animationEnabled: false,}}/>
</ProfileStack.Navigator> </ProfileStack.Navigator>
); );
} }
const Tab = createBottomTabNavigator() const Tab = createBottomTabNavigator()
/*
Tab navigator to navigate between the stacks
*/
function MainTabNavigator() { function MainTabNavigator() {
return ( return (
<NavigationContainer> <NavigationContainer>
<Tab.Navigator <Tab.Navigator
initialRouteName='Home'
backBehavior='none' backBehavior='none'
screenOptions={{headerShown: false, tabBarStyle: { display: 'none' },}} screenOptions={{headerShown: false, tabBarStyle: { display: 'none' },}}
> >

@ -1,142 +1,41 @@
import { StatusBar } from 'expo-status-bar' import { StatusBar } from 'expo-status-bar'
import { StyleSheet, View, Text, Alert, Pressable, Image} from 'react-native' import { StyleSheet, View, Text} from 'react-native'
import React from 'react'; import React from 'react';
import stylesScreen from './style/screens.style'
import { Skin } from '../core/skin'; import { Skin } from '../core/skin';
import { TopBar } from '../components/TopBar'; import { TopBar } from '../components/TopBar';
import { BotBar } from '../components/BotBar'; import { BotBar } from '../components/BotBar';
import { ScreenIndicator } from '../components/ScreenIndicator';
import { User } from '../core/user';
import { FlatList } from 'react-native-gesture-handler';
import { ConversationComponent } from '../components/ConversationComponent';
const avatar = require('../../assets/Icons/BobClassic.png'); import tabSkinApp from '../constSkin';
const skinTest= new Skin("Bob",require('../../assets/Icons/BobClassic.png')); import tabConv from '../constCov';
const engrenage = require('../../assets/Icons/UnSelected/Cogs.png');
const gamepad = require('../../assets/Icons/UnSelected/Gamepad.png');
const message = require('../../assets/Icons/Selected/SChat.png'); const UserActu=new User("14", "leBg", "ouioui", "grand", new Date(2022,12,12), 12222, 123324, 12, tabSkinApp[0], tabSkinApp, tabConv);
const store = require('../../assets/Icons/UnSelected/Store.png');
function Chat(props: { navigation: any; }) { function Chat(props: { navigation: any; }) {
const { navigation } = props const { navigation } = props
return ( return (
<View style={styles.container}> <View style={stylesScreen.container}>
<TopBar <TopBar
skin={skinTest} skin={UserActu.getCurrentSkin()}
styleAvatar={styles.avatar} nav={navigation}
title="BOB PARTY" />
rightIcon={engrenage} <View style={stylesScreen.bodyStart}>
styleIcon={styles.engrenage} <FlatList
nav={navigation} styleTitle={styles.titre} styleHeader={styles.header} data={tabConv}
renderItem={({item}) => <ConversationComponent conv={item} state='Preview'/>}
/> />
<View style={styles.body}>
<Text style={styles.text}>couille</Text>
</View> </View>
<BotBar <BotBar
messages={message}
games={gamepad}
shop={store}
style={styles.iconFooter}
styleStore={styles.iconStore}
nav={navigation} nav={navigation}
styleBar={styles.footer} state='Chat'
/> />
</View> </View>
); );
} }
function Button(props: { onPress: any; title?: "Save" | 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: {
marginBot: 25,
marginTop: 10,
width: 65,
height: 50,
},
iconStore: {
marginBot: 25,
marginTop: 10,
marginLeft: 7,
marginRight: 8,
width: 50,
height: 50,
},
});
export default Chat export default Chat

@ -0,0 +1,155 @@
import { StatusBar } from 'expo-status-bar'
import { StyleSheet, View, Text, Alert, Pressable, Image} from 'react-native'
import React from 'react';
import { Game } from '../core/Game';
import { Skin } from '../core/skin';
import { TopBar } from '../components/TopBar';
import { BotBar } from '../components/BotBar';
import { GameComponent } from '../components/GameComponent';
import { User } from '../core/user';
import tabSkinApp from '../constSkin';
import { Conversation } from '../core/conversation';
let tabConv:Conversation[]=[];
const msc = require('../../assets/Icons/FondGris.png');
const UserActu=new User("14", "leBg", "ouioui", "grand", new Date(2022,12,12), 12222, 123324, 12, tabSkinApp[0], tabSkinApp, tabConv);
const jeuTest= new Game("SNAKE", require('../../assets/Icons/UnSelected/Gamepad.png'),"ouin");
function GameChoice(props: { navigation: any; }) {
const { navigation } = props
return (
<View style={styles.container}>
<TopBar
skin={UserActu.getCurrentSkin()}
nav={navigation}
/>
<View style={styles.body}>
<GameComponent
game={jeuTest}
nav={navigation}
/>
</View>
<BotBar
nav={navigation}
state='Home'
/>
</View>
);
}
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

@ -1,161 +1,47 @@
import { StatusBar } from 'expo-status-bar' import { StatusBar } from 'expo-status-bar'
import { StyleSheet, View, Text, Alert, Pressable, Image} from 'react-native' import { StyleSheet, View, ImageSourcePropType} from 'react-native'
import React, { Children } from 'react'; import React from 'react';
import { SkinComponent } from '../components/skinAvatar'; import stylesScreen from './style/screens.style'
import { User } from '../core/user'; import { User } from '../core/user';
import { Skin } from '../core/skin'; import { Skin } from '../core/skin';
import { TopBar } from '../components/TopBar'; import { TopBar } from '../components/TopBar';
import { BotBar } from '../components/BotBar'; import { BotBar } from '../components/BotBar';
import { Conversation } from '../core/conversation'; import { Conversation } from '../core/conversation';
import { ButtonGameTypeChoice } from '../components/ButtonGameTypeChoice';
import tabSkinApp from '../constSkin';
import { GameSolo } from '../core/gameSolo';
const avatar = require('../../assets/Icons/BobClassic.png'); //const test= new GameSolo("test", require('bob_party/assets/ImagesJeux/BatailleNavale.jpeg'), "test", );
let tabSkin:Skin[];
const skinTest= new Skin("Bob",require('../../assets/Icons/BobClassic.png'));
const skinTest2= new Skin("wesh",require('../../assets/BobsSkins/BobBlue.png'));
tabSkin=[skinTest];
tabSkin.push(skinTest2);
let tabConv:Conversation[]=[]; let tabConv:Conversation[]=[];
const UserActu=new User("14", "leBg", "ouioui", "grand", "la", 12222, 123324, skinTest, tabSkin, tabConv); const UserActu=new User("14", "leBg", "ouioui", "grand", new Date(2022,12,12), 12222, 123324, 12, tabSkinApp[0], tabSkinApp, tabConv);
const engrenage = require('../../assets/Icons/UnSelected/Cogs.png');
const gamepad = require('../../assets/Icons/Selected/SGamepad.png');
const message = require('../../assets/Icons/UnSelected/Chat.png');
const store = require('../../assets/Icons/UnSelected/Store.png');
function Home(props: { navigation: any; }) { function Home(props: { navigation: any; }) {
const { navigation } = props const { navigation } = props
return ( return (
<View style={styles.container}> <View style={stylesScreen.container}>
<TopBar <TopBar
skin={skinTest} skin={UserActu.getCurrentSkin()}
styleAvatar={styles.avatar}
title="BOB PARTY"
rightIcon={engrenage}
styleIcon={styles.engrenage}
nav={navigation} nav={navigation}
styleTitle={styles.titre} state= 'Home'
styleHeader={styles.header}
/> />
<View style={styles.body}> <View style={stylesScreen.bodyCenter}>
<Button <ButtonGameTypeChoice
title='Jouer Seul' title='Jouer Seul'
onPress={() => Alert.alert('On Joue seul')} onPress={() => navigation.navigate('GameChoice')}
/> />
<Button <ButtonGameTypeChoice
title='Défier mes amis' title='Défier mes amis'
onPress={() => Alert.alert('On Joue avec les potos')} onPress={() => navigation.navigate('GameChoice')}
/> />
</View> </View>
<BotBar <BotBar
messages={message}
games={gamepad}
shop={store}
style={styles.iconFooter}
styleStore={styles.iconStore}
nav={navigation} nav={navigation}
styleBar={styles.footer} state='Home'
/> />
</View> </View>
); );
} }
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({
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,
},
body: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
width: '70%',
},
footer: {
flex: 0.15,
flexDirection: 'row',
backgroundColor: '#2D2C33',
flexWrap: 'wrap',
width: '100%',
justifyContent: 'space-evenly',
},
iconFooter: {
marginBot: 25,
marginTop: 10,
width: 65,
height: 50,
},
iconStore: {
marginBot: 25,
marginTop: 10,
marginLeft: 7,
marginRight: 8,
width: 50,
height: 50,
},
});
export default Home export default Home

@ -1,144 +1,54 @@
import { StatusBar } from 'expo-status-bar' import { StatusBar } from 'expo-status-bar'
import { StyleSheet, View, Text, Alert, Pressable, Image} from 'react-native' import { StyleSheet, View, Text, Image} from 'react-native'
import React, { Children } from 'react'; import React from 'react';
import { SkinComponent } from '../components/skinAvatar'; import stylesScreen from './style/screens.style'
import { User } from '../core/user'; import styles from './style/Profile.style'
import { Skin } from '../core/skin';
import { TopBar } from '../components/TopBar'; import { TopBar } from '../components/TopBar';
import { BotBar } from '../components/BotBar'; import { BotBar } from '../components/BotBar';
import { SkinComponent } from '../components/Skin';
import { User } from '../core/user';
import tabSkinApp from '../constSkin';
import tabConv from '../constCov'
import { ButtonChangeSkin } from '../components/ButtonChangeSkin';
import { ScreenIndicator } from '../components/ScreenIndicator';
const coin = require('../../assets/Icons/Coin.png')
const avatar = require('../../assets/Icons/BobClassic.png'); const UserActu=new User("14", "leBg", "ouioui", "grand", new Date(2022,12,12), 12222, 123324, 12, tabSkinApp[0], tabSkinApp, tabConv);
const skinTest= new Skin("Bob",require('../../assets/Icons/BobClassic.png'));
const engrenage = require('../../assets/Icons/UnSelected/Cogs.png');
const gamepad = require('../../assets/Icons/UnSelected/Gamepad.png');
const message = require('../../assets/Icons/UnSelected/Chat.png');
const store = require('../../assets/Icons/UnSelected/Store.png');
function Profile(props: { navigation: any; }) { function Profile(props: { navigation: any; }) {
const { navigation } = props const { navigation } = props
return ( return (
<View style={styles.container}> <View style={stylesScreen.container}>
<TopBar <TopBar
skin={skinTest} skin={UserActu.getCurrentSkin()}
styleAvatar={styles.avatar} nav={navigation}
title="BOB PARTY" />
rightIcon={engrenage} <View style={stylesScreen.bodyStart}>
styleIcon={styles.engrenage} <ScreenIndicator title='Profil'/>
nav={navigation} styleTitle={styles.titre} styleHeader={styles.header} <View style={styles.coinSkinView}>
<View style={styles.coinView}>
<Image
style={styles.coin}
source={coin}
/> />
<View style={styles.body}> <Text style={styles.coinText}>{UserActu.getCurrentCoins()}</Text>
<Text style={styles.text}>couille</Text> </View>
<View style={styles.skinView}>
<SkinComponent skin={UserActu.getCurrentSkin()} state='profile'/>
<ButtonChangeSkin onPress={() => navigation.navigate('SkinList')}/>
</View>
</View>
<View style={styles.infoView}>
<Text style={styles.infoText}>Total de BobCoin gagnés: {UserActu.getTotalCoins()}</Text>
</View>
</View> </View>
<BotBar <BotBar
messages={message}
games={gamepad}
shop={store}
style={styles.iconFooter}
styleStore={styles.iconStore}
nav={navigation} nav={navigation}
styleBar={styles.footer}
/> />
</View> </View>
); );
} }
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,
},
});
export default Profile export default Profile

@ -1,131 +1,24 @@
import { StatusBar } from 'expo-status-bar' import { StatusBar } from 'expo-status-bar'
import { StyleSheet, View, Text, Alert, Pressable, Image} from 'react-native' import { StyleSheet, View, Text} from 'react-native'
import React from 'react'; import React from 'react';
import stylesScreen from './style/screens.style'
import { TopBar } from '../components/TopBar';
const msc = require('../../assets/Icons/FondGris.png');
const engrenage = require('../../assets/Icons/UnSelected/Cross.png');
function Store(props: { navigation: any; }) { function Store(props: { navigation: any; }) {
const { navigation } = props const { navigation } = props
return ( return (
<View style={styles.container}> <View style={stylesScreen.container}>
<View style={styles.header}> <TopBar
<Image nav={navigation}
style={styles.engrenage} state='settings'
source={msc}
/> />
<Text style={styles.titre}>Paramètres</Text> <View style={stylesScreen.bodyStart}>
<Pressable onPress={() => props.navigation.goBack()}> <Text>couille</Text>
<Image
style={styles.engrenage}
source={engrenage}
/>
</Pressable>
</View>
<View style={styles.body}>
<Text style={styles.text}>couille</Text>
</View> </View>
</View> </View>
); );
} }
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: 10,
width: 50,
height: 50,
},
avatar: {
borderRadius: 10,
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,
},
});
export default Store export default Store

@ -0,0 +1,38 @@
import { StatusBar } from 'expo-status-bar'
import { StyleSheet, View, Text} from 'react-native'
import React from 'react';
import stylesScreen from './style/screens.style'
import { Skin } from '../core/skin';
import { TopBar } from '../components/TopBar';
import { BotBar } from '../components/BotBar';
import { FlatList } from 'react-native-gesture-handler';
import { SkinComponent } from '../components/Skin';
import tabSkinApp from '../constSkin';
import { ScreenIndicator } from '../components/ScreenIndicator';
function SkinList(props: { navigation: any; }) {
const { navigation } = props
return (
<View style={stylesScreen.container}>
<TopBar
skin={tabSkinApp[0]}
nav={navigation}
/>
<View style={stylesScreen.bodyStart}>
<ScreenIndicator title='Mes Skins'/>
<FlatList
data={tabSkinApp}
numColumns={2}
columnWrapperStyle={{ flex: 1, justifyContent: "space-around"}}
keyExtractor={item =>item.getSkinName()}
renderItem={({item}) => <SkinComponent skin={item} state='liste'/>} />
</View>
<BotBar
nav={navigation}
/>
</View>
);
}
export default SkinList

@ -1,145 +1,39 @@
import { StatusBar } from 'expo-status-bar' import { StatusBar } from 'expo-status-bar'
import { StyleSheet, View, Text, Alert, Pressable, Image} from 'react-native' import { StyleSheet, View} from 'react-native'
import React, { Children } from 'react'; import React from 'react';
import { SkinComponent } from '../components/skinAvatar'; import stylesScreen from './style/screens.style'
import { User } from '../core/user';
import { Skin } from '../core/skin'; import { Skin } from '../core/skin';
import { TopBar } from '../components/TopBar'; import { TopBar } from '../components/TopBar';
import { BotBar } from '../components/BotBar'; import { BotBar } from '../components/BotBar';
import { FlatList } from 'react-native-gesture-handler';
import { SkinComponent } from '../components/Skin';
import { ScreenIndicator } from '../components/ScreenIndicator';
import tabSkinApp from '../constSkin';
const avatar = require('../../assets/Icons/BobClassic.png');
const skinTest= new Skin("Bob",require('../../assets/Icons/BobClassic.png'));
const engrenage = require('../../assets/Icons/UnSelected/Cogs.png');
const gamepad = require('../../assets/Icons/UnSelected/Gamepad.png');
const message = require('../../assets/Icons/UnSelected/Chat.png');
const store = require('../../assets/Icons/Selected/SStore.png');
function Store(props: { navigation: any; }) { function Store(props: { navigation: any; }) {
const { navigation } = props const { navigation } = props
return ( return (
<View style={styles.container}> <View style={stylesScreen.container}>
<TopBar <TopBar
skin={skinTest} skin={tabSkinApp[0]}
styleAvatar={styles.avatar} nav={navigation}
title="BOB PARTY"
rightIcon={engrenage}
styleIcon={styles.engrenage}
nav={navigation} styleTitle={styles.titre} styleHeader={styles.header}
/> />
<View style={styles.body}> <View style={stylesScreen.bodyStart}>
<Text style={styles.text}>couille</Text> <ScreenIndicator title='Store'/>
<FlatList
data={tabSkinApp}
numColumns={2}
columnWrapperStyle={{ flex: 1, justifyContent: "space-around"}}
keyExtractor={item =>item.getSkinName()}
renderItem={({item}) => <SkinComponent skin={item} state='shop'/>} />
</View> </View>
<BotBar <BotBar
messages={message}
games={gamepad}
shop={store}
style={styles.iconFooter}
styleStore={styles.iconStore}
nav={navigation} nav={navigation}
styleBar={styles.footer} state='Store'
/> />
</View> </View>
); );
} }
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,
},
});
export default Store export default Store

@ -3,24 +3,20 @@ import { useState } from 'react';
import { StyleSheet, View, Text, Alert, Pressable, Image, ImageBackground} from 'react-native' import { StyleSheet, View, Text, Alert, Pressable, Image, ImageBackground} from 'react-native'
import React from 'react'; import React from 'react';
import { FlatList } from 'react-native-gesture-handler'; import { FlatList } from 'react-native-gesture-handler';
import { SkinComponent } from '../components/Skin';
import { Skin } from '../core/skin';
const BobClassic = require('../../assets/BobsSkins/BobClassic.png'); const skinTest = new Skin("S0001","Bob",require('../../assets/BobsSkins/BobClassic.png'));
const BobBW = require('../../assets/BobsSkins/BobBW.png'); const skinBleu = new Skin("S0001","Bob Bleu", require('../../assets/BobsSkins/BobBlue.png'))
const BobBlue = require('../../assets/BobsSkins/BobBlue.png'); const skinBW = new Skin("S0001","Bob BW", require('../../assets/BobsSkins/BobBW.png'))
const BobGreen = require('../../assets/BobsSkins/BobGreen.png'); const skinGreen = new Skin("S0001","Bob Vert", require('../../assets/BobsSkins/BobGreen.png'))
const skinPT = new Skin("S0001","Bob R&T", require('../../assets/BobsSkins/BobPinkTurquoise.png'))
let listSkin: Array<Skin> = [skinTest, skinBleu, skinBW, skinGreen, skinPT]
function Test(props: { navigation: any; }) { function Test(props: { navigation: any; }) {
const { navigation } = props const { navigation } = props
const [skin, setSkin] = useState([
{ name : 'BobClassic', image: BobClassic, price: 0, id: 's0001'},
{ name : 'BobBW', image: BobBW, price: 150, id: 's0002'},
{ name : 'BobBlue', image: BobBlue, price: 200, id: 's0003'},
{ name : 'BobGreen', image: BobGreen, price: 200, id: 's0004'},
]);
const ItemSeprator = () => <View style={{ const ItemSeprator = () => <View style={{
height: 2, height: 2,
width: "100%", width: "100%",
@ -28,65 +24,15 @@ function Test(props: { navigation: any; }) {
}}/> }}/>
return ( return (
<View style={styles.imageWrapper}> <View style={{backgroundColor: 'blue', flex: 0.7, alignSelf: 'center'}}>
<FlatList <FlatList
data={listSkin}
numColumns={2} numColumns={2}
keyExtractor={( item ) => item.id } columnWrapperStyle={{ flex: 1, justifyContent: "space-around"}}
data={skin} keyExtractor={item =>item.getSkinName()}
ItemSeparatorComponent={ItemSeprator} renderItem={({item}) => <SkinComponent skin={item} state='shop'/>} />
renderItem={({ item }) => (
<ImageBackground
style={styles.theImage}
source={item.image}
>
<Text>{item.price}</Text>
<Text>{item.name}</Text>
</ImageBackground>
)}
/>
</View> </View>
); );
} }
const styles = StyleSheet.create({
imageWrapper: {
height: 200,
width: 200,
overflow : "hidden"
},
theImage: {
flex: 1,
alignItems: "flex-end",
margin: 10,
width: "100%",
height: "100%",
},
container: {
backgroundColor: '#45444E',
flex: 1,
paddingTop: "50%",
paddingBottom: "50%",
alignItems: 'center',
justifyContent: 'center',
height: '100%',
},
Text: {
margin: 15,
paddingVertical: 12,
width: '40%',
borderRadius: 10,
backgroundColor: '#0085FF',
},
item: {
marginTop: 24,
backgroundColor: 'pink',
fontSize: 24,
},
debug:{
flex: 0.2,
backgroundColor: "red",
padding: 50,
},
});
export default Test export default Test

@ -0,0 +1,43 @@
import { StyleSheet } from "react-native";
const coinSkinGap = 10;
const infoGap = 20;
export default StyleSheet.create({
coinSkinView: {
flexDirection:'row',
},
coinView: {
width: '50%',
alignItems: 'center',
justifyContent: 'center',
},
skinView: {
width: '50%',
},
coin: {
width: 75,
height: 75,
marginVertical: (coinSkinGap/2),
},
coinText: {
fontSize: 16,
lineHeight: 21,
fontWeight: 'bold',
letterSpacing: 0.25,
color: 'white',
marginVertical: (coinSkinGap/2),
},
infoView: {
marginLeft: '5%',
marginTop: '5%',
},
infoText: {
fontSize: 16,
lineHeight: 21,
fontWeight: 'bold',
letterSpacing: 0.25,
color: 'white',
marginVertical: (infoGap/2),
}
});

@ -0,0 +1,22 @@
import { StyleSheet } from "react-native";
export default StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#45444E',
flexDirection: "column",
justifyContent: "flex-start",
alignItems: "center",
},
bodyStart: {
flex: 1,
flexDirection: 'column',
width: '100%',
},
bodyCenter: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
width: '100%',
},
});

@ -0,0 +1,12 @@
import { GameSolo } from "./core/gameSolo";
let myMap = new Map<number, number>([
[50, 3],
[75, 4],
[100, 5],
[150, 6]
]);
let game=new GameSolo("bo jeu", require('bob_party/assets/ImagesJeux/blackjack.jpg'), "super jeu", myMap);
export default game;

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save