Merge branch 'typescript' of https://codefirst.iut.uca.fr/git/BOB_PARTEAM/BOB_PARTY into typescript
commit
25f9d01413
@ -1,47 +0,0 @@
|
|||||||
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 { trace } from "console"
|
|
||||||
import { Game } from "../core/game"
|
|
||||||
|
|
||||||
export const ElementAffichage :
|
|
||||||
FC<{element: any, styleImage: ImageStyle, styleTitle : TextStyle,nav: any}> =
|
|
||||||
({element, styleImage, styleTitle, nav}) =>
|
|
||||||
{
|
|
||||||
if (element instanceof Skin)
|
|
||||||
{
|
|
||||||
return(
|
|
||||||
<View>
|
|
||||||
<Pressable onPress={() => Alert.alert("Achat du skin")}>
|
|
||||||
<Image
|
|
||||||
style={styleImage}
|
|
||||||
source={element.getSkinSource()}
|
|
||||||
/>
|
|
||||||
<Text style={styleTitle}>{element.getSkinName()}</Text>
|
|
||||||
</Pressable>
|
|
||||||
</View>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
if(element instanceof Game)
|
|
||||||
{
|
|
||||||
return (
|
|
||||||
<View>
|
|
||||||
<Pressable onPress={() => Alert.alert("Lancement du jeu")}>
|
|
||||||
<Image
|
|
||||||
style={styleImage}
|
|
||||||
source={element.getImageSource()}
|
|
||||||
/>
|
|
||||||
<Text style={styleTitle}>{element.getName()}</Text>
|
|
||||||
</Pressable>
|
|
||||||
</View>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
console.log('Type invalide pour ce composant')
|
|
||||||
return(
|
|
||||||
<View>
|
|
||||||
<Text>Type invalide pour ce composant</Text>
|
|
||||||
</View>
|
|
||||||
)
|
|
||||||
|
|
||||||
}
|
|
@ -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,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',
|
||||||
|
},
|
||||||
|
})
|
Loading…
Reference in new issue