|
|
|
|
@ -868,69 +868,7 @@ function loadBoard(data) {
|
|
|
|
|
// Decks can be as-is for getting deckLists for deckselection, but
|
|
|
|
|
// TODO: for matches need something to generate and return every item, and attribute
|
|
|
|
|
|
|
|
|
|
if(false){
|
|
|
|
|
// Temp solution
|
|
|
|
|
// Loop all items, and set their related missing attributes
|
|
|
|
|
// TODO: some more jank to get it 'playable' with DB entries
|
|
|
|
|
let player0DeckCount = 0;
|
|
|
|
|
let player1DeckCount = 0;
|
|
|
|
|
for(let i = 0; i < itemCount; i++){
|
|
|
|
|
// Set player for decks (to just be their array index for now) TODO: Properly
|
|
|
|
|
if(boardElement[i] == 'realDeck'){
|
|
|
|
|
player[i] = i; // Jank...
|
|
|
|
|
//player[i] = deckData[i];
|
|
|
|
|
//console.log(deckData[i]);
|
|
|
|
|
}else{
|
|
|
|
|
// Everything else missing in a jank fashion
|
|
|
|
|
player[i] = deckIn[i]; // 1-1 here, but likely not in future
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cardStatus[i] = null; // Just building on first load, as deck gen
|
|
|
|
|
// substite at the mo, so all cards are free of status
|
|
|
|
|
cardFace[i] = 0; // As above, deck gen sub. Everything starts facedown
|
|
|
|
|
|
|
|
|
|
// Set position for cards in each deck...
|
|
|
|
|
// TODO: JANK, tidy, remove, make good!!
|
|
|
|
|
// using the new player set just above, which in itself is jank
|
|
|
|
|
if(player[i] == 0 && boardElement[i] != 'realDeck'){
|
|
|
|
|
listPosition[i] = player0DeckCount+1;
|
|
|
|
|
player0DeckCount++;
|
|
|
|
|
}
|
|
|
|
|
// Just an else, as in DB/for this test only 2 decks
|
|
|
|
|
// TODO: MAKE BETTER!
|
|
|
|
|
else{
|
|
|
|
|
listPosition[i] = player0DeckCount+1;
|
|
|
|
|
player0DeckCount++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO: JANK IN, CHANGE CODE TO USE NEW ARRAY!!
|
|
|
|
|
// Temp jank, set colour to first colour req.
|
|
|
|
|
if(cardData[i] !== undefined){ // i may not have carddata, as realDeck
|
|
|
|
|
cardData[i].colour = 0;//cardData[itemCount].colour[0];
|
|
|
|
|
// Set the artwork (this would be done front-end I think)
|
|
|
|
|
cardSprite[i] = [0,0];
|
|
|
|
|
// Temp sprite set based on colour TODO: Change to set correct sprite from DB
|
|
|
|
|
switch (cardData[i].colour){
|
|
|
|
|
case 0: // White
|
|
|
|
|
cardSprite[i] = [0,0];
|
|
|
|
|
break;
|
|
|
|
|
case 1: // Blue
|
|
|
|
|
cardSprite[i] = [0,1];
|
|
|
|
|
break;
|
|
|
|
|
case 2: // Red
|
|
|
|
|
cardSprite[i] = [1,0];
|
|
|
|
|
break;
|
|
|
|
|
case 3: // Green
|
|
|
|
|
cardSprite[i] = [1,1];
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // END FALSE/TEMP DISABLE
|
|
|
|
|
// TODO: Loop these for the amount of players in players (and use the correct itemKey)
|
|
|
|
|
shuffleDeck(0); // Shuffle player 0 deck
|
|
|
|
|
shuffleDeck(1); // Shuffle player 1 deck
|
|
|
|
|
|
|
|
|
|
@ -1026,6 +964,8 @@ canvas.addEventListener('click', function(event) {
|
|
|
|
|
if(boardElement[itemKey] == 'deck'){
|
|
|
|
|
continue;
|
|
|
|
|
}else{
|
|
|
|
|
// Will print everything that's clickable (or should be clickable)
|
|
|
|
|
// any undefined attributes and such should display with this too
|
|
|
|
|
//printECSData([itemKey]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|