From aa6cda5ed3634a50b67e6a3741d05354b4461a34 Mon Sep 17 00:00:00 2001 From: Pierre Ferreira Date: Fri, 7 Apr 2023 09:37:48 +0200 Subject: [PATCH] ajout d'info pour les details :package: --- models/Card.tsx | 66 ++++++++++++++++++++++--------- redux/actions/actionSelection.tsx | 6 ++- screens/DetailCard.tsx | 13 ++++-- 3 files changed, 62 insertions(+), 23 deletions(-) diff --git a/models/Card.tsx b/models/Card.tsx index 6b1dcac..7eb5b26 100644 --- a/models/Card.tsx +++ b/models/Card.tsx @@ -5,7 +5,7 @@ import {Classe} from "./Classe"; export class Card { - constructor(id: number,name :string,health : number, attack : number, manaCost : number, flavorText : string, img : string, imgGold : string){//,set : CardSet,type : Type,clas : Classe,rarity : string,, desc : string,flavor : string,artist : string,collectible : boolean,elite : boolean,race : string, cropImg :string) { + constructor(id: number,name :string,health : number, attack : number, manaCost : number, rarityId : number, flavorText : string, classId : number, multiClassIds : any, img : string, imgGold : string, cropImage : string, artistName : string){//,set : CardSet,type : Type,clas : Classe,rarity : string,, desc : string,flavor : string,artist : string,collectible : boolean,elite : boolean,race : string, cropImg :string) { this._id=id this._name=name //this._set=set @@ -15,13 +15,17 @@ export class Card { this._manaCost=manaCost this._attack = attack this._health = health + this._rarityId = rarityId // this._desc = desc this._flavorText = flavorText - // this._artist = artist + + this._classId = classId + this._multiClassIds = multiClassIds + this._artistName = artistName // this._collectible = collectible this._img = img this._imgGold = imgGold - // this._cropImg = cropImg + this._cropImage = cropImage } @@ -109,6 +113,14 @@ export class Card { // set desc(value: string) { // this._desc = value ; // } + private _classId : number; + + get classId(): number { + return this._classId; + } + set classId(value: number) { + this._classId = value ; + } private _flavorText : string; get flavorText(): string { @@ -118,13 +130,31 @@ export class Card { this._flavorText = value ; } - // private _artist : string - // get artist(): string { - // return this._artist; - // } - // set artist(value: string) { - // this._artist = value ; - // } + private _rarityId : number; + get rarityId(): number { + return this._rarityId; + } + set rarityId(value: number) { + this._rarityId = value ; + } + + + private _multiClassIds : string; + get multiClassIds(): string { + return this._multiClassIds; + } + set multiClassIds(value: string) { + this._multiClassIds = value ; + } + + + private _artistName : string; + get artistName(): string { + return this._artistName; + } + set artistName(value: string) { + this._artistName = value ; + } // private _collectible : boolean // get collectible(): boolean { // return this._collectible; @@ -149,12 +179,12 @@ export class Card { set imgGold(value: string) { this._imgGold = value ; } - // private _cropImg : string - - // get cropImg(): string { - // return this._cropImg; - // } - // set cropImg(value: string) { - // this._cropImg = value; - // } + + private _cropImage : string; + get cropImage(): string { + return this._cropImage; + } + set cropImage(value: string) { + this._cropImage = value; + } } \ No newline at end of file diff --git a/redux/actions/actionSelection.tsx b/redux/actions/actionSelection.tsx index a890fdc..c39c2c4 100644 --- a/redux/actions/actionSelection.tsx +++ b/redux/actions/actionSelection.tsx @@ -78,10 +78,14 @@ export const getAllCards = () => { elt["health"] ? elt["health"] : 0, elt["attack"] ? elt["attack"] : 0, elt["manaCost"] ? elt["manaCost"] : 0, + elt["rarityId"] ? elt["rarityId"] : 0, elt["flavorText"] ? elt["flavorText"] : "", + elt["classId"] ? elt["classId"] : 0, + elt["multiClassIds"] ? elt["multiClassIds"] : "Nothing", elt["image"] ? elt["image"] : "", elt["imageGold"] ? elt["imageGold"] : "", - + elt["cropImage"] ? elt["cropImage"] : "", + elt["artistName"] ? elt["artistName"] : "", )); //, elt["cardSet"], elt["type"], elt["faction"], elt["rarity"], elt["cost"], elt["attack"], elt["health"],elt["text"], elt["flavor"], elt["artist"], elt["collectible"], elt["elite"], elt["race"], elt["img"], elt["imgGold"] //elt["cardId"] == null ? elt["cardId"] : "" diff --git a/screens/DetailCard.tsx b/screens/DetailCard.tsx index a252012..e90ef76 100644 --- a/screens/DetailCard.tsx +++ b/screens/DetailCard.tsx @@ -16,9 +16,12 @@ export default function DetailMain({ route }){ const tableHead = ['Stat', 'Value']; const tableData = [ - ['cost :', card.manaCost], - ['attack : ', card.attack], - ['health : ', card.health], + ['Mana cost :', card.manaCost], + ['Attack : ', card.attack], + ['Health : ', card.health], + ['Rarity : ', card.rarity], + ['Artist : ', card.artistName], + ['Class : ', card.classId], ] let pressed : Boolean = false @@ -75,11 +78,13 @@ const styles = StyleSheet.create({ flex: 1, justifyContent: 'center', paddingVertical: 0, + paddingHorizontal : 15, backgroundColor: '#fff', borderRadius : 10, borderWidth: 10, borderColor: '#efefef', - maxHeight:100 + maxHeight:100, + minHeight: 100 }, head: { height: 40, backgroundColor: '#f1f8ff', minWidth: '90%'}, text: { margin: 6 }