From 9fc76cf768a102fb071ed196de2fb2f36e024b2c Mon Sep 17 00:00:00 2001 From: Thomas Chazot Date: Fri, 14 Oct 2022 11:43:23 +0200 Subject: [PATCH] Changement de la class Game --- bob_party/src/components/skinAvatar.tsx | 1 + bob_party/src/core/Game.ts | 23 +++++++++++++---------- bob_party/src/core/gameSolo.ts | 0 bob_party/src/core/skin.ts | 8 +++++--- bob_party/src/screens/Home.tsx | 2 +- 5 files changed, 20 insertions(+), 14 deletions(-) create mode 100644 bob_party/src/core/gameSolo.ts diff --git a/bob_party/src/components/skinAvatar.tsx b/bob_party/src/components/skinAvatar.tsx index 2e1eb8a..5ede0ad 100644 --- a/bob_party/src/components/skinAvatar.tsx +++ b/bob_party/src/components/skinAvatar.tsx @@ -1,6 +1,7 @@ import { FC, ReactNode } from "react" import { Button, Image, ImageStyle, Text, View } from "react-native" import { Skin } from "../core/Skin" +import { Asset } from 'expo-asset'; import React from "react" export const SkinComponent : FC<{skin: Skin, children: ImageStyle}> = ({skin, children}) => { diff --git a/bob_party/src/core/Game.ts b/bob_party/src/core/Game.ts index 8104ba9..2b6ea66 100644 --- a/bob_party/src/core/Game.ts +++ b/bob_party/src/core/Game.ts @@ -1,11 +1,14 @@ -export interface Game{ - private Name:String; - private ImageSource:String; - private GameSource:String; +import { randomBytes } from "crypto"; +import { ImageSourcePropType } from "react-native"; - constructor(name:String, imageSource:String, gameSource:String){ +export class Game{ + private Name:string; + private ImageSource:ImageSourcePropType; + private GameSource:string ; + + constructor (name:string, imageSource:ImageSourcePropType, gameSource:string){ this.Name=name; - this.ImageSource=imageSource + this.ImageSource=imageSource; this.GameSource=gameSource; } @@ -13,15 +16,15 @@ export interface Game{ return this.Name; } - setName(name:String){ + setName(name:string){ this.Name=name; } - getImageSource(imageSource:String){ + getImageSource(){ return this.ImageSource; } - setImageSource(imageSource:String){ + setImageSource(imageSource:ImageSourcePropType){ this.ImageSource=imageSource; } @@ -29,7 +32,7 @@ export interface Game{ return this.GameSource; } - setGameSource(gameSource:String){ + setGameSource(gameSource:string){ this.GameSource=gameSource; } } \ No newline at end of file diff --git a/bob_party/src/core/gameSolo.ts b/bob_party/src/core/gameSolo.ts new file mode 100644 index 0000000..e69de29 diff --git a/bob_party/src/core/skin.ts b/bob_party/src/core/skin.ts index 6f6bfde..9cd6915 100644 --- a/bob_party/src/core/skin.ts +++ b/bob_party/src/core/skin.ts @@ -1,8 +1,10 @@ +import { ImageSourcePropType } from "react-native"; + export class Skin{ private Name: string; - private Source: any; + private Source: ImageSourcePropType; - constructor(name: string, source:any){ + constructor(name: string, source:ImageSourcePropType){ this.Name=name; this.Source=source; } @@ -11,7 +13,7 @@ export class Skin{ this.Name=name; } - setSkinSource(source: any){ + setSkinSource(source: ImageSourcePropType){ this.Source=source; } diff --git a/bob_party/src/screens/Home.tsx b/bob_party/src/screens/Home.tsx index e8dadba..4d08e62 100644 --- a/bob_party/src/screens/Home.tsx +++ b/bob_party/src/screens/Home.tsx @@ -17,7 +17,7 @@ const skinTest2= new Skin("wesh",require('../../assets/BobsSkins/BobBlue.png')); tabSkin=[skinTest]; tabSkin.push(skinTest2); 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, skinTest, tabSkin, 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');