From 231018ce3906f9d3918f8c1f1d8caee4c3cd81d4 Mon Sep 17 00:00:00 2001 From: Djeeberjr Date: Mon, 15 Nov 2021 02:25:41 +0100 Subject: [PATCH] Added all editable decks --- src/components/AllDecks.tsx | 35 ++++++++++++++++++ src/components/App.tsx | 29 +++++++-------- src/types/RetakesConfig.ts | 71 +++++++++++++++++++++++++++++++++++++ 3 files changed, 118 insertions(+), 17 deletions(-) create mode 100644 src/components/AllDecks.tsx create mode 100644 src/types/RetakesConfig.ts diff --git a/src/components/AllDecks.tsx b/src/components/AllDecks.tsx new file mode 100644 index 0000000..5877096 --- /dev/null +++ b/src/components/AllDecks.tsx @@ -0,0 +1,35 @@ +import React, { useState } from "react" +import RetakesConfig from "../types/RetakesConfig" +import Side from "../types/Side" +import DeckComp from "./Deck" + +const AllDecks: React.FC = () => { + const [retakesConfig,setRetakesConfig] = useState(new RetakesConfig()) + + return ( +
+ setRetakesConfig(new RetakesConfig({...retakesConfig,...{ctPistol:newDeck}}))} /> + setRetakesConfig(new RetakesConfig({...retakesConfig,...{tPistol:newDeck}}))} /> + + setRetakesConfig(new RetakesConfig({...retakesConfig,...{ctUpgradedPistol:newDeck}}))} /> + setRetakesConfig(new RetakesConfig({...retakesConfig,...{tUpgradedPistol:newDeck}}))} /> + + setRetakesConfig(new RetakesConfig({...retakesConfig,...{ctLight:newDeck}}))} /> + setRetakesConfig(new RetakesConfig({...retakesConfig,...{tLight:newDeck}}))} /> + + setRetakesConfig(new RetakesConfig({...retakesConfig,...{ctFull:newDeck}}))} /> + setRetakesConfig(new RetakesConfig({...retakesConfig,...{tFull:newDeck}}))} /> + +
+ ) +} + +export default AllDecks \ No newline at end of file diff --git a/src/components/App.tsx b/src/components/App.tsx index fa58937..c36406b 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -1,25 +1,20 @@ -import React, { useState } from 'react'; -import DeckComp from './Deck'; -import Card from '../types/Card'; -import CardGroup from '../types/CardGroup'; -import Deck from '../types/Deck'; -import Item from '../types/Item'; -import Side from '../types/Side'; +import React from 'react'; +import AllDecks from './AllDecks'; function App() { - const [CTDeck,setCTDeck] = useState(new Deck( - 2,new CardGroup( - 2,new Card("AWE fake",false,false,Item.AWP,Item.DECOY), - new Card("M4 Flash",true,true,Item.AK_47_M4,Item.FLASHBANG) - ), - new CardGroup( - 3,new Card("One deag",true,false,Item.DESERT_EAGLE) - ) - )) + // const [CTDeck,setCTDeck] = useState(new Deck( + // 2,new CardGroup( + // 2,new Card("AWE fake",false,false,Item.AWP,Item.DECOY), + // new Card("M4 Flash",true,true,Item.AK_47_M4,Item.FLASHBANG) + // ), + // new CardGroup( + // 3,new Card("One deag",true,false,Item.DESERT_EAGLE) + // ) + // )) return (
- setCTDeck(newDeck)} /> +
); } diff --git a/src/types/RetakesConfig.ts b/src/types/RetakesConfig.ts new file mode 100644 index 0000000..372e231 --- /dev/null +++ b/src/types/RetakesConfig.ts @@ -0,0 +1,71 @@ +import Card from "./Card" +import Deck from "./Deck" + +class RetakesConfig { + readonly ctPistol: Deck + readonly tPistol: Deck + + readonly ctUpgradedPistol: Deck + readonly tUpgradedPistol: Deck + + readonly ctLight: Deck + readonly tLight: Deck + + readonly ctFull: Deck + readonly tFull: Deck + + readonly ctEnemy: Card + readonly tEnemy: Card + + readonly ctBonus: Card + readonly tBonus: Card + + readonly ctBonusAvailability: number[] + readonly tBonusAvailability: number[] + + // TODO: there must be some smarter way to do this + constructor(args? :{ + ctPistol?: Deck, + tPistol?: Deck, + ctUpgradedPistol?: Deck, + tUpgradedPistol?: Deck, + ctLight?: Deck, + tLight?: Deck, + ctFull?: Deck, + tFull?:Deck, + ctEnemy?: Card, + tEnemy?: Card, + ctBonus?: Card, + tBonus?: Card, + ctBonusAvailability?: number[], + tBonusAvailability?: number[], + }){ + this.ctPistol = args?.ctPistol ?? new Deck(0) + this.tPistol = args?.tPistol ?? new Deck(0) + + this.ctUpgradedPistol = args?.ctUpgradedPistol ?? new Deck(0) + this.tUpgradedPistol = args?.tUpgradedPistol ?? new Deck(0) + + this.ctLight = args?.ctLight ?? new Deck(0) + this.tLight = args?.tLight ?? new Deck(0) + + this.ctFull = args?.ctFull ?? new Deck(0) + this.tFull = args?.tFull ?? new Deck(0) + + this.ctEnemy = args?.ctEnemy ?? new Card("CT Enemy card",false,false) + this.tEnemy = args?.tEnemy ?? new Card("T Enemy Card",false,false) + + this.ctBonus = args?.ctBonus ?? new Card("CT Bonus card",false,false) + this.tBonus = args?.tBonus ?? new Card("T Bonus card",false,false) + + this.ctBonusAvailability = args?.ctBonusAvailability ?? [1] // Has to be 1 or the game will crash + this.tBonusAvailability = args?.tBonusAvailability ?? [1] + } + + public toCvar(){ + + } + +} + +export default RetakesConfig