Compare commits
7 Commits
231018ce39
...
4273b5c8ca
| Author | SHA1 | Date | |
|---|---|---|---|
| 4273b5c8ca | |||
| cfbb358115 | |||
| 39df588c7a | |||
| ba61a5258c | |||
| 3412e78237 | |||
| a913d2d5cb | |||
| 49fb1d90a0 |
@@ -1,6 +1,7 @@
|
|||||||
import React, { useState } from "react"
|
import React, { useState } from "react"
|
||||||
import RetakesConfig from "../types/RetakesConfig"
|
import RetakesConfig from "../types/RetakesConfig"
|
||||||
import Side from "../types/Side"
|
import Side from "../types/Side"
|
||||||
|
import CardComp from "./Card"
|
||||||
import DeckComp from "./Deck"
|
import DeckComp from "./Deck"
|
||||||
|
|
||||||
const AllDecks: React.FC = () => {
|
const AllDecks: React.FC = () => {
|
||||||
@@ -28,6 +29,19 @@ const AllDecks: React.FC = () => {
|
|||||||
<DeckComp title="T Full" side={Side.T} deck={retakesConfig.tFull}
|
<DeckComp title="T Full" side={Side.T} deck={retakesConfig.tFull}
|
||||||
onChange={(newDeck)=> setRetakesConfig(new RetakesConfig({...retakesConfig,...{tFull:newDeck}}))} />
|
onChange={(newDeck)=> setRetakesConfig(new RetakesConfig({...retakesConfig,...{tFull:newDeck}}))} />
|
||||||
|
|
||||||
|
<div className="flex">
|
||||||
|
<CardComp card={retakesConfig.ctEnemy} side={Side.T}
|
||||||
|
onChange={(newCard)=>setRetakesConfig(new RetakesConfig({...retakesConfig,...{ctEnemy:newCard}}))} />
|
||||||
|
<CardComp card={retakesConfig.tEnemy} side={Side.CT}
|
||||||
|
onChange={(newCard)=>setRetakesConfig(new RetakesConfig({...retakesConfig,...{tEnemy:newCard}}))} />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex">
|
||||||
|
<CardComp card={retakesConfig.ctBonus} side={Side.CT}
|
||||||
|
onChange={(newCard)=>setRetakesConfig(new RetakesConfig({...retakesConfig,...{ctBonus:newCard}}))} />
|
||||||
|
<CardComp card={retakesConfig.tBonus} side={Side.T}
|
||||||
|
onChange={(newCard)=>setRetakesConfig(new RetakesConfig({...retakesConfig,...{tBonus:newCard}}))} />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import AllDecks from './AllDecks';
|
import AllDecks from './AllDecks';
|
||||||
|
import MenuBar from './MenuBar';
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
// const [CTDeck,setCTDeck] = useState<Deck>(new Deck(
|
// const [CTDeck,setCTDeck] = useState<Deck>(new Deck(
|
||||||
@@ -14,6 +15,7 @@ function App() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="text-white">
|
<div className="text-white">
|
||||||
|
<MenuBar />
|
||||||
<AllDecks />
|
<AllDecks />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ interface Props {
|
|||||||
|
|
||||||
const CardComp: React.FC<Props> = ({card,side,onChange,onRemove}) => {
|
const CardComp: React.FC<Props> = ({card,side,onChange,onRemove}) => {
|
||||||
return (
|
return (
|
||||||
<div className="bg-gray-600 m-1 p-1 w-72 min-h-12">
|
<div className="bg-gray-600 m-1 p-1 w-72 min-h-card">
|
||||||
<span className="float-right cursor-pointer" onClick={()=>{onRemove?.()}}>X</span>
|
<span className="float-right cursor-pointer" onClick={()=>{onRemove?.()}}>X</span>
|
||||||
<span className="font-bold"><TextEdit
|
<span className="font-bold"><TextEdit
|
||||||
text={card.title}
|
text={card.title}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ const CardGroupComp: React.FC<Props> = ({cardGroup,side,onChange,onRemove}) => {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<div
|
<div
|
||||||
className="bg-gray-600 m-1 p-1 cursor-pointer my-auto"
|
className="bg-gray-600 my-auto button"
|
||||||
onClick={()=>onChange?.(
|
onClick={()=>onChange?.(
|
||||||
new CardGroup(
|
new CardGroup(
|
||||||
cardGroup.numInDeck,
|
cardGroup.numInDeck,
|
||||||
|
|||||||
@@ -15,10 +15,10 @@ interface Props {
|
|||||||
|
|
||||||
const DeckComp: React.FC<Props> = ({deck,side,title,onChange}) => {
|
const DeckComp: React.FC<Props> = ({deck,side,title,onChange}) => {
|
||||||
return (
|
return (
|
||||||
<div className="bg-gray-800 m-1 p-1">
|
<div className="bg-gray-800 m-1 p-1 overflow-x-scroll">
|
||||||
<span className="font-bold">{title}</span>
|
<span className="font-bold">{title}</span>
|
||||||
{ side === Side.CT && <span>
|
{ side === Side.CT && <span className="px-2">
|
||||||
D: <NumEdit
|
Defuser: <NumEdit
|
||||||
value={deck.numDefusers}
|
value={deck.numDefusers}
|
||||||
onChange={newNum => onChange?.(new Deck(Math.max(newNum,0),...deck.cardGroups))}
|
onChange={newNum => onChange?.(new Deck(Math.max(newNum,0),...deck.cardGroups))}
|
||||||
/> </span> }
|
/> </span> }
|
||||||
@@ -42,7 +42,7 @@ const DeckComp: React.FC<Props> = ({deck,side,title,onChange}) => {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<div className="bg-gray-700 m-1 p-1 cursor-pointer my-auto"
|
<div className="bg-gray-700 button my-auto"
|
||||||
onClick={()=>onChange?.(
|
onClick={()=>onChange?.(
|
||||||
new Deck(
|
new Deck(
|
||||||
deck.numDefusers,
|
deck.numDefusers,
|
||||||
|
|||||||
22
src/components/MenuBar.tsx
Normal file
22
src/components/MenuBar.tsx
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import React from "react"
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
onExport?: ()=>void
|
||||||
|
}
|
||||||
|
|
||||||
|
const MenuBar: React.FC<Props> = ({onExport}) => {
|
||||||
|
return (
|
||||||
|
<div className="bg-gray-800 h-10 m-1 p-1 flex">
|
||||||
|
<div className="bg-gray-700 button" onClick={onExport}>
|
||||||
|
Export
|
||||||
|
</div>
|
||||||
|
<a href="https://developer.valvesoftware.com/wiki/CS:GO_Game_Mode_-_Retakes" target="_blank" rel='noreferrer'>
|
||||||
|
<div className="bg-gray-700 button">
|
||||||
|
Help
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default MenuBar
|
||||||
@@ -2,6 +2,10 @@
|
|||||||
@tailwind components;
|
@tailwind components;
|
||||||
@tailwind utilities;
|
@tailwind utilities;
|
||||||
|
|
||||||
.min-h-12 {
|
.min-h-card {
|
||||||
min-height: 12rem;
|
min-height: 10rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button {
|
||||||
|
@apply py-1 px-2 mx-2 hover:bg-gray-900 cursor-pointer
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,26 +2,27 @@ import Card from "./Card"
|
|||||||
import Deck from "./Deck"
|
import Deck from "./Deck"
|
||||||
|
|
||||||
class RetakesConfig {
|
class RetakesConfig {
|
||||||
readonly ctPistol: Deck
|
readonly ctPistol: Deck = new Deck(0)
|
||||||
readonly tPistol: Deck
|
readonly tPistol: Deck = new Deck(0)
|
||||||
|
|
||||||
readonly ctUpgradedPistol: Deck
|
readonly ctUpgradedPistol: Deck = new Deck(0)
|
||||||
readonly tUpgradedPistol: Deck
|
readonly tUpgradedPistol: Deck = new Deck(0)
|
||||||
|
|
||||||
readonly ctLight: Deck
|
readonly ctLight: Deck = new Deck(0)
|
||||||
readonly tLight: Deck
|
readonly tLight: Deck = new Deck(0)
|
||||||
|
|
||||||
readonly ctFull: Deck
|
readonly ctFull: Deck = new Deck(0)
|
||||||
readonly tFull: Deck
|
readonly tFull: Deck = new Deck(0)
|
||||||
|
|
||||||
readonly ctEnemy: Card
|
readonly ctEnemy: Card = new Card("CT Enemy card",false,false)
|
||||||
readonly tEnemy: Card
|
readonly tEnemy: Card = new Card("T Enemy card",false,false)
|
||||||
|
|
||||||
readonly ctBonus: Card
|
readonly ctBonus: Card = new Card("CT Bonus card",false,false)
|
||||||
readonly tBonus: Card
|
readonly tBonus: Card = new Card("T Bonus card",false,false)
|
||||||
|
|
||||||
readonly ctBonusAvailability: number[]
|
// If not set to [1] or a valid value the game will crash
|
||||||
readonly tBonusAvailability: number[]
|
readonly ctBonusAvailability: number[] = [1]
|
||||||
|
readonly tBonusAvailability: number[] = [1]
|
||||||
|
|
||||||
// TODO: there must be some smarter way to do this
|
// TODO: there must be some smarter way to do this
|
||||||
constructor(args? :{
|
constructor(args? :{
|
||||||
@@ -40,30 +41,26 @@ class RetakesConfig {
|
|||||||
ctBonusAvailability?: number[],
|
ctBonusAvailability?: number[],
|
||||||
tBonusAvailability?: number[],
|
tBonusAvailability?: number[],
|
||||||
}){
|
}){
|
||||||
this.ctPistol = args?.ctPistol ?? new Deck(0)
|
if (args){
|
||||||
this.tPistol = args?.tPistol ?? new Deck(0)
|
args.ctPistol && (this.ctPistol = args.ctPistol)
|
||||||
|
args.tPistol && (this.tPistol = args.tPistol)
|
||||||
this.ctUpgradedPistol = args?.ctUpgradedPistol ?? new Deck(0)
|
args.ctUpgradedPistol && (this.ctUpgradedPistol = args.ctUpgradedPistol)
|
||||||
this.tUpgradedPistol = args?.tUpgradedPistol ?? new Deck(0)
|
args.tUpgradedPistol && (this.tUpgradedPistol = args.tUpgradedPistol)
|
||||||
|
args.ctLight && (this.ctLight = args.ctLight)
|
||||||
this.ctLight = args?.ctLight ?? new Deck(0)
|
args.tLight && (this.tLight = args.tLight)
|
||||||
this.tLight = args?.tLight ?? new Deck(0)
|
args.ctFull && (this.ctFull = args.ctFull)
|
||||||
|
args.tFull && (this.tFull = args.tFull)
|
||||||
this.ctFull = args?.ctFull ?? new Deck(0)
|
args.ctEnemy && (this.ctEnemy = args.ctEnemy)
|
||||||
this.tFull = args?.tFull ?? new Deck(0)
|
args.tEnemy && (this.tEnemy = args.tEnemy)
|
||||||
|
args.ctBonus && (this.ctBonus = args.ctBonus)
|
||||||
this.ctEnemy = args?.ctEnemy ?? new Card("CT Enemy card",false,false)
|
args.tBonus && (this.tBonus = args.tBonus)
|
||||||
this.tEnemy = args?.tEnemy ?? new Card("T Enemy Card",false,false)
|
args.ctBonusAvailability && (this.ctBonusAvailability = args.ctBonusAvailability)
|
||||||
|
args.tBonusAvailability && (this.tBonusAvailability = args.tBonusAvailability)
|
||||||
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(){
|
public toCvar(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user