ADD: Ajout du dossier écrit en typescript

typescript
Thomas Chazot 2 years ago
parent 6562ce5116
commit 49d2683673

@ -0,0 +1,4 @@
{
"12bb71342c6255bbf50437ec8f4441c083f47cdb74bd89160c15e4f43e52a1cb": true,
"40b842e832070c58deac6aa9e08fa459302ee3f9da492c7e77d93d2fbf4a56fd": true
}

@ -0,0 +1,14 @@
node_modules/
.expo/
dist/
npm-debug.*
*.jks
*.p8
*.p12
*.key
*.mobileprovision
*.orig.*
web-build/
# macOS
.DS_Store

@ -0,0 +1,6 @@
import React from 'react'
import MainStackNavigator from './src/navigation/AppNavigator'
export default function App() {
return <MainStackNavigator/>
}

@ -0,0 +1,33 @@
{
"expo": {
"name": "bob_party",
"slug": "bob_party",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"userInterfaceStyle": "light",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#FFFFFF"
}
},
"web": {
"favicon": "./assets/favicon.png"
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

@ -0,0 +1,6 @@
module.exports = function(api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
};
};

@ -0,0 +1,25 @@
export class Skin{
private Name: string;
private Source: string;
constructor(name: string, source:string){
this.Name=name;
this.Source=source;
}
setSkinName(name: string){
this.Name=name;
}
setSkinSource(source: string){
this.Source=source;
}
getSkinSource(){
return this.Source;
}
getSkinName(){
return this.Name;
}
}

@ -0,0 +1,98 @@
import { Skin } from './Skin'
export class User{
private Id: string;
private Username: string;
private Nationality: string;
private Sexe: string;
private DateOfBirth: string;
private CurrentCoins: number;
private TotalCoins: number;
private CurrentSkin: Skin;
private TabSkin: Skin[];
constructor(id: string, username: string, nationality: string, sexe: string, dateOfBirth: string, currentCoins: number, totalCoins: number,
currentSkin: Skin, tabSkin: Skin[] ){
this.Id=id;
this.Username=username;
this.Nationality=nationality;
this.Sexe=sexe;
this.DateOfBirth=dateOfBirth;
this.CurrentCoins=currentCoins;
this.TotalCoins=totalCoins;
this.CurrentSkin=currentSkin;
this.TabSkin=tabSkin;
}
getUsername(){
return this.Username;
}
setUsername(username: string){
this.Username=username;
}
getId(){
return this.Id;
}
setId(id: string){
this.Id=id;
}
getCurrentCoins(){
return this.CurrentCoins;
}
setCurrentCoins(currentCoins: number){
this.CurrentCoins=currentCoins;
}
getSexe(){
return this.Sexe;
}
setSexe(sexe: string){
this.Sexe=sexe;
}
getDateOfBirth(){
return this.DateOfBirth;
}
setDateOfBirth(dateOfBirth: string){
this.DateOfBirth=dateOfBirth;
}
getNationality(){
return this.Nationality;
}
setNationality(nationality: string){
this.Nationality=nationality;
}
getTotalCoins(){
return this.TotalCoins;
}
setTotalCoins(totalCoins: number){
this.TotalCoins=totalCoins;
}
getCurrentSkin(){
return this.CurrentSkin;
}
setCurrentSkin(newSkin: Skin){
this.CurrentSkin=newSkin;
}
getTabSkin(){
return this.TabSkin;
}
setTabSkin(tabSkin: Skin[]){
this.TabSkin=tabSkin;
}
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,28 @@
{
"name": "bob_party",
"version": "1.0.0",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web"
},
"dependencies": {
"@react-navigation/native": "^6.0.13",
"@react-navigation/stack": "^6.3.2",
"expo": "~46.0.13",
"expo-status-bar": "~1.4.0",
"react": "18.0.0",
"react-dom": "18.0.0",
"react-native": "0.69.6",
"react-native-web": "~0.18.7"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@types/react": "~18.0.14",
"@types/react-native": "~0.69.1",
"typescript": "~4.3.5"
},
"private": true
}

@ -0,0 +1,39 @@
import * as React from 'react'
import { NavigationContainer } from '@react-navigation/native'
import { createStackNavigator } from '@react-navigation/stack'
import Home from '../screens/Home'
import Store from '../screens/Store'
import Test from '../screens/Test'
const Stack = createStackNavigator()
function MainStackNavigator() {
return (
<NavigationContainer>
<Stack.Navigator
initialRouteName='Test'
screenOptions={{headerShown: false,}}
>
<Stack.Screen
name='Home'
component={Home}
/>
<Stack.Screen
name='Store'
component={Store}
/>
<Stack.Screen
name='Test'
component={Test}
/>
</Stack.Navigator>
</NavigationContainer>
)
}
export default MainStackNavigator

@ -0,0 +1,160 @@
import { StatusBar } from 'expo-status-bar'
import { StyleSheet, View, Text, Alert, Pressable, Image} from 'react-native'
const avatar = require('../../assets/Icons/BobClassic.png');
const engrenage = require('../../assets/Icons/Engrenage.png');
const gamepad = require('../../assets/Icons/Gamepad.png');
const message = require('../../assets/Icons/Messages.png');
const store = require('../../assets/Icons/Store.png');
function Home(props: { navigation: any; }) {
const { navigation } = props
return (
<View style={styles.container}>
<View style={styles.header}>
<Pressable onPress={() => Alert.alert('Profil Joueur')}>
<Image
//style={styles.avatar}
source={avatar}
/>
</Pressable>
<Text style={styles.titre}>BOB PARTY</Text>
<Pressable onPress={() => Alert.alert('Paramètres')}>
<Image
//style={styles.engrenage}
source={engrenage}
/>
</Pressable>
</View>
<View style={styles.body}>
<Button
title='Jouer Seul'
onPress={() => Alert.alert('On Joue seul')}
/>
<Button
title='Défier mes amis'
onPress={() => Alert.alert('On Joue avec les potos')}
/>
</View>
<View style={styles.footer}>
<Pressable onPress={() => Alert.alert('Messagerie')}>
<Image
//style={styles.iconFooter}
source={message}
/>
</Pressable>
<Pressable onPress={() => Alert.alert('Menu des jeux')}>
<Image
//style={styles.iconFooter}
source={gamepad}
/>
</Pressable>
<Pressable onPress={() => navigation.navigate('Store')}>
<Image
//style={styles.iconStore}
source={store}
/>
</Pressable>
</View>
</View>
);
}
function Button(props: { onPress: any; title?: string | 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: {
marginBottom: 25,
marginTop: 10,
width: 65,
height: 50,
},
iconStore: {
marginBottom: 25,
marginTop: 10,
marginLeft: 7,
marginRight: 8,
width: 50,
height: 50,
},
});
export default Home

@ -0,0 +1,155 @@
import { StatusBar } from 'expo-status-bar'
import { StyleSheet, View, Text, Alert, Pressable, Image} from 'react-native'
const avatar = require('../../assets/Icons/BobClassic.png');
const engrenage = require('../../assets/Icons/Engrenage.png');
const gamepad = require('../../assets/Icons/Gamepad.png');
const message = require('../../assets/Icons/Messages.png');
const store = require('../../assets/Icons/Store.png');
function Store(props: { navigation: any; }) {
const { navigation } = props
return (
<View style={styles.container}>
<View style={styles.header}>
<Pressable onPress={() => Alert.alert('Profil Joueur')}>
<Image
//style={styles.avatar}
source={avatar}
/>
</Pressable>
<Text style={styles.titre}>BOB PARTY</Text>
<Pressable onPress={() => Alert.alert('Paramètres')}>
<Image
//style={styles.engrenage}
source={engrenage}
/>
</Pressable>
</View>
<View style={styles.body}>
<Text style={styles.text}>couille</Text>
</View>
<View style={styles.footer}>
<Pressable onPress={() => Alert.alert('Messagerie')}>
<Image
//style={styles.iconFooter}
source={message}
/>
</Pressable>
<Pressable onPress={() => navigation.navigate('Home')}>
<Image
//style={styles.iconFooter}
source={gamepad}
/>
</Pressable>
<Pressable onPress={() => Alert.alert('le magasin')}>
<Image
//style={styles.iconStore}
source={store}
/>
</Pressable>
</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: 10,
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

@ -0,0 +1,91 @@
import { StatusBar } from 'expo-status-bar'
import { useState } from 'react';
import { StyleSheet, View, Text, Alert, Pressable, Image, ImageBackground} from 'react-native'
import { FlatList } from 'react-native-gesture-handler';
const BobClassic = require('../../assets/BobsSkins/BobClassic.png');
const BobBW = require('../../assets/BobsSkins/BobBW.png');
const BobBlue = require('../../assets/BobsSkins/BobBlue.png');
const BobGreen = require('../../assets/BobsSkins/BobGreen.png');
function Test(props: { navigation: any; }) {
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={{
height: 2,
width: "100%",
backgroundColor: "red",
}}/>
return (
<View style={styles.imageWrapper}>
<FlatList
numColumns={2}
keyExtractor={( item ) => item.id }
data={skin}
ItemSeparatorComponent={ItemSeprator}
renderItem={({ item }) => (
<ImageBackground
style={styles.theImage}
source={item.image}
>
<Text>{item.price}</Text>
<Text>{item.name}</Text>
</ImageBackground>
)}
/>
</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: {
flex: 1,
backgroundColor: '#45444E',
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

@ -0,0 +1,6 @@
{
"extends": "expo/tsconfig.base",
"compilerOptions": {
"strict": true
}
}
Loading…
Cancel
Save