basic rendering for all three card tiers
This commit is contained in:
@@ -1,8 +1,11 @@
|
|||||||
import '../../styles/GameBoard.css';
|
import '../../styles/GameBoard.css';
|
||||||
import Card from '../Cards/Card';
|
|
||||||
import { CardDeck } from '../../store/CardDeck';
|
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
|
|
||||||
|
import Card from '../Cards/Card';
|
||||||
|
import { TierOneDeck } from '../../store/TierOneDeck';
|
||||||
|
import { TierTwoDeck } from '../../store/TierTwoDeck';
|
||||||
|
import { TierThreeDeck } from '../../store/TierThreeDeck';
|
||||||
|
|
||||||
export default function GameBoard() {
|
export default function GameBoard() {
|
||||||
const [trigger, setTrigger] = useState(true);
|
const [trigger, setTrigger] = useState(true);
|
||||||
const [tierThree, setTierThree] = useState(null);
|
const [tierThree, setTierThree] = useState(null);
|
||||||
@@ -10,6 +13,8 @@ export default function GameBoard() {
|
|||||||
const [tierOne, setTierOne] = useState(null);
|
const [tierOne, setTierOne] = useState(null);
|
||||||
|
|
||||||
const [content, setContent] = useState(null);
|
const [content, setContent] = useState(null);
|
||||||
|
|
||||||
|
const AllDecks = [TierOneDeck, TierTwoDeck, TierThreeDeck];
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// param limit sets limit on number of cards rendered
|
// param limit sets limit on number of cards rendered
|
||||||
@@ -17,13 +22,11 @@ export default function GameBoard() {
|
|||||||
const buildGameBoardRow = (limit, tier) => {
|
const buildGameBoardRow = (limit, tier) => {
|
||||||
let newBoard = [];
|
let newBoard = [];
|
||||||
let iter = 0;
|
let iter = 0;
|
||||||
for (let cardConfig of CardDeck) {
|
while (iter < limit) {
|
||||||
if (cardConfig.tier !== tier) continue;
|
iter++;
|
||||||
while (iter < limit) {
|
|
||||||
iter++;
|
if (!AllDecks[tier-1][iter-1]) continue;
|
||||||
// if (cardConfig.tier !== tier) continue;
|
newBoard.push(<Card state={AllDecks[tier-1][iter-1]} />);
|
||||||
newBoard.push(<Card state={cardConfig} />);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (tier) {
|
switch (tier) {
|
||||||
@@ -45,18 +48,30 @@ export default function GameBoard() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trigger) buildGameBoardRow(6,1);
|
if (trigger) {
|
||||||
|
buildGameBoardRow(4,3);
|
||||||
|
buildGameBoardRow(4,2);
|
||||||
|
buildGameBoardRow(4,1);
|
||||||
|
}
|
||||||
}, [trigger]);
|
}, [trigger]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="gameboard">
|
<div className="gameboard">
|
||||||
<h1 className="gameboard-title">SPLINTER</h1>
|
<h1 className="gameboard-title">SPLINTER</h1>
|
||||||
|
|
||||||
|
<div className="gameboard-row">
|
||||||
|
{tierThree || 'Loading'}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="gameboard-row">
|
||||||
|
{tierTwo || 'Loading'}
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="gameboard-row">
|
<div className="gameboard-row">
|
||||||
{tierOne || 'Loading'}
|
{tierOne || 'Loading'}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2>Deck length: {CardDeck.length}</h2>
|
<h2>Deck length: {TierOneDeck.length}</h2>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
export const CardDeck = [
|
export const TierOneDeck = [
|
||||||
// TIER ONE CARDS
|
// TIER ONE CARDS
|
||||||
// total: 40
|
// total: 40
|
||||||
// cat 1: [2,1] cost cards
|
// cat 1: [2,1] cost cards
|
||||||
115
client/src/store/TierThreeDeck.js
Normal file
115
client/src/store/TierThreeDeck.js
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
export const TierThreeDeck = [
|
||||||
|
// TIER THREE CARDS
|
||||||
|
// total: 20
|
||||||
|
// cat 1: 7 of a kind
|
||||||
|
{
|
||||||
|
tier: 3,
|
||||||
|
points: 5,
|
||||||
|
isWorth: 'cedar',
|
||||||
|
cost: {
|
||||||
|
cedar: 7,
|
||||||
|
birch: 0,
|
||||||
|
walnut: 0,
|
||||||
|
mahogany: 0,
|
||||||
|
cherry: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
tier: 3,
|
||||||
|
points: 5,
|
||||||
|
isWorth: 'birch',
|
||||||
|
cost: {
|
||||||
|
cedar: 0,
|
||||||
|
birch: 7,
|
||||||
|
walnut: 0,
|
||||||
|
mahogany: 0,
|
||||||
|
cherry: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
tier: 3,
|
||||||
|
points: 5,
|
||||||
|
isWorth: 'walnut',
|
||||||
|
cost: {
|
||||||
|
cedar: 0,
|
||||||
|
birch: 0,
|
||||||
|
walnut: 7,
|
||||||
|
mahogany: 0,
|
||||||
|
cherry: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
tier: 3,
|
||||||
|
points: 5,
|
||||||
|
isWorth: 'mahogany',
|
||||||
|
cost: {
|
||||||
|
cedar: 0,
|
||||||
|
birch: 0,
|
||||||
|
walnut: 0,
|
||||||
|
mahogany: 7,
|
||||||
|
cherry: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
tier: 3,
|
||||||
|
points: 5,
|
||||||
|
isWorth: 'cherry',
|
||||||
|
cost: {
|
||||||
|
cedar: 0,
|
||||||
|
birch: 0,
|
||||||
|
walnut: 0,
|
||||||
|
mahogany: 0,
|
||||||
|
cherry: 7
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// cat 2: [7,3] cost cards
|
||||||
|
{
|
||||||
|
tier: 2,
|
||||||
|
points: 5,
|
||||||
|
isWorth: 'cedar',
|
||||||
|
cost: {
|
||||||
|
cedar: 7,
|
||||||
|
birch: 3,
|
||||||
|
walnut: 0,
|
||||||
|
mahogany: 0,
|
||||||
|
cherry: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
tier: 2,
|
||||||
|
points: 5,
|
||||||
|
isWorth: 'birch',
|
||||||
|
cost: {
|
||||||
|
cedar: 0,
|
||||||
|
birch: 7,
|
||||||
|
walnut: 3,
|
||||||
|
mahogany: 0,
|
||||||
|
cherry: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
tier: 2,
|
||||||
|
points: 5,
|
||||||
|
isWorth: 'walnut',
|
||||||
|
cost: {
|
||||||
|
cedar: 0,
|
||||||
|
birch: 0,
|
||||||
|
walnut: 7,
|
||||||
|
mahogany: 3,
|
||||||
|
cherry: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
tier: 2,
|
||||||
|
points: 5,
|
||||||
|
isWorth: 'mahogany',
|
||||||
|
cost: {
|
||||||
|
cedar: 0,
|
||||||
|
birch: 0,
|
||||||
|
walnut: 0,
|
||||||
|
mahogany: 7,
|
||||||
|
cherry: 3
|
||||||
|
}
|
||||||
|
},
|
||||||
|
]
|
||||||
54
client/src/store/TierTwoDeck.js
Normal file
54
client/src/store/TierTwoDeck.js
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
export const TierTwoDeck = [
|
||||||
|
// TIER TWO CARDS
|
||||||
|
// total: 30
|
||||||
|
// cat 1: [5,3] cost cards
|
||||||
|
{
|
||||||
|
tier: 2,
|
||||||
|
points: 3,
|
||||||
|
isWorth: 'cedar',
|
||||||
|
cost: {
|
||||||
|
cedar: 5,
|
||||||
|
birch: 3,
|
||||||
|
walnut: 0,
|
||||||
|
mahogany: 0,
|
||||||
|
cherry: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
tier: 2,
|
||||||
|
points: 3,
|
||||||
|
isWorth: 'birch',
|
||||||
|
cost: {
|
||||||
|
cedar: 0,
|
||||||
|
birch: 5,
|
||||||
|
walnut: 3,
|
||||||
|
mahogany: 0,
|
||||||
|
cherry: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
tier: 2,
|
||||||
|
points: 3,
|
||||||
|
isWorth: 'walnut',
|
||||||
|
cost: {
|
||||||
|
cedar: 0,
|
||||||
|
birch: 0,
|
||||||
|
walnut: 5,
|
||||||
|
mahogany: 3,
|
||||||
|
cherry: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
tier: 2,
|
||||||
|
points: 3,
|
||||||
|
isWorth: 'mahogany',
|
||||||
|
cost: {
|
||||||
|
cedar: 0,
|
||||||
|
birch: 0,
|
||||||
|
walnut: 0,
|
||||||
|
mahogany: 5,
|
||||||
|
cherry: 3
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
]
|
||||||
Reference in New Issue
Block a user