ADD: Ajout d'une page const avec un array de skin

stub-api
Thomas Chazot 3 years ago
parent 830ed3cf6a
commit 59131ffa90

@ -3,7 +3,7 @@ import { Pressable, Image, ImageStyle, Text, View, Alert, ImageSourcePropType, T
import React from "react" import React from "react"
import { Skin } from "../core/skin" import { Skin } from "../core/skin"
import { trace } from "console" import { trace } from "console"
import { Game } from "../core/Game" import { Game } from "../core/game"
export const ElementAffichage : export const ElementAffichage :
FC<{element: any, styleImage: ImageStyle, styleTitle : TextStyle,nav: any}> = FC<{element: any, styleImage: ImageStyle, styleTitle : TextStyle,nav: any}> =

@ -2,6 +2,7 @@ import { FC} from "react"
import {Image, ImageStyle, View } from "react-native" import {Image, ImageStyle, View } from "react-native"
import { Skin } from "../core/Skin" import { Skin } from "../core/Skin"
import React from "react" import React from "react"
import { Asset } from "expo-asset"
export const SkinComponent : FC<{skin: Skin, children: ImageStyle}> = ({skin, children}) => { export const SkinComponent : FC<{skin: Skin, children: ImageStyle}> = ({skin, children}) => {

@ -0,0 +1,14 @@
import { Skin } from "./core/skin";
let tabSkinApp:Skin[]=[
new Skin("0001", "Bob Classsique",require('bob_party/assets/BobsSkins/BobClassic.png')),
new Skin("0002", "Bob Blue",require('bob_party/assets/BobsSkins/BobBlue.png')),
new Skin("0003", "Bob BW",require('bob_party/assets/BobsSkins/BobBW.png')),
new Skin("0004", "Bob Green",require('bob_party/assets/BobsSkins/BobGreen.png')),
new Skin("0005", "Bob Pink Turquoise",require('bob_party/assets/BobsSkins/BobPinkTurquoise.png')),
new Skin("0006", "Bob Red",require('bob_party/assets/BobsSkins/BobRed.png')),
new Skin("0007", "Bob Cute",require('bob_party/assets/BobsSkins/BobYellowGreenBlueHeart.png')),
]
export default tabSkinApp;

@ -1,5 +1,5 @@
import { Game } from './game' import { Game } from './game'
export class GameSolo extends Game{ export class GameSolo extends Game{
private readonly [index:number]:number;
} }

@ -1,10 +1,12 @@
import { ImageSourcePropType } from "react-native"; import { ImageSourcePropType } from "react-native";
export class Skin{ export class Skin{
readonly Id: string;
private Name: string; private Name: string;
private Source: ImageSourcePropType; private Source: ImageSourcePropType;
constructor(name: string, source:ImageSourcePropType){ constructor(id:string, name: string, source:ImageSourcePropType){
this.Id=id;
this.Name=name; this.Name=name;
this.Source=source; this.Source=source;
} }
@ -24,4 +26,8 @@ export class Skin{
getSkinName(){ getSkinName(){
return this.Name; return this.Name;
} }
getSkinId(){
return this.Id;
}
} }

@ -1,7 +1,7 @@
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, Alert, Pressable, Image} from 'react-native'
import React from 'react'; import React from 'react';
import { Game } from '../core/Game'; import { Game } from '../core/game';
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';
@ -11,7 +11,7 @@ import { GoBackBar } from '../components/GoBackBar';
const msc = require('../../assets/Icons/FondGris.png'); const msc = require('../../assets/Icons/FondGris.png');
const avatar = require('../../assets/Icons/BobClassic.png'); const avatar = require('../../assets/Icons/BobClassic.png');
const skinTest= new Skin("Bob",require('../../assets/Icons/BobClassic.png')); const skinTest= new Skin("0001", "Bob",require('../../assets/Icons/BobClassic.png'));
const jeuTest= new Game("SNAKE", require('../../assets/Icons/UnSelected/Gamepad.png'),"ouin"); const jeuTest= new Game("SNAKE", require('../../assets/Icons/UnSelected/Gamepad.png'),"ouin");
const cross = require('../../assets/Icons/UnSelected/Cross.png'); const cross = require('../../assets/Icons/UnSelected/Cross.png');
const gamepad = require('../../assets/Icons/Selected/SGamepad.png'); const gamepad = require('../../assets/Icons/Selected/SGamepad.png');

@ -8,28 +8,20 @@ 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 { ButtonGameChoice } from '../components/ButtonGameChoice'; import { ButtonGameChoice } from '../components/ButtonGameChoice';
import tabSkinApp from '../const';
let test:ImageSourcePropType; const avatar = require('../../assets/Icons/BobClassic.png');
const test2:string="('../../assets/Icons/BobClassic.png')";
test = test2 as ImageSourcePropType;
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", new Date(2022,12,12), 12222, 123324, skinTest, tabSkin, tabConv); const UserActu=new User("14", "leBg", "ouioui", "grand", new Date(2022,12,12), 12222, 123324, tabSkinApp[0], tabSkinApp, tabConv);
function Home(props: { navigation: any; }) { function Home(props: { navigation: any; }) {
const { navigation } = props const { navigation } = props
return ( return (
<View style={stylesScreen.container}> <View style={stylesScreen.container}>
<TopBar <TopBar
skin={skinTest} skin={UserActu.getCurrentSkin()}
nav={navigation} nav={navigation}
/> />
<View style={styles.body}> <View style={styles.body}>

Loading…
Cancel
Save