Solved the 'joker' problem unique cards and classes of cards implemented
This commit is contained in:
parent
902940774d
commit
9b23be4bbb
16
README.md
16
README.md
@ -14,7 +14,17 @@ An example of a deck definition file:
|
||||
|
||||
Using this you can make all kinds of decks.
|
||||
|
||||
A more advanced example uses an array of "decks" to build a single deck.
|
||||
|
||||
```
|
||||
[{
|
||||
"value":["A","2","3","4","5","6","7","8","9","10","J","Q","K"],
|
||||
"shape":["♥","♣","♠","♦"]
|
||||
},{
|
||||
"color":["red ", "black "],
|
||||
"joker":["joker"]
|
||||
}]
|
||||
```
|
||||
|
||||
Things not yet supported:
|
||||
* Unique cards
|
||||
* Multipul card classes
|
||||
* Mixing decks
|
||||
* Mixing decks
|
10
index.html
10
index.html
@ -54,7 +54,15 @@ buttonAdd("#menu","upload","Upload Deck", function () {
|
||||
var myFile = new FileReader();
|
||||
myFile.onload = function (file) {
|
||||
// Probably validate the file somehow befor eating it
|
||||
window.deck = generateDeck(JSON.parse(file.target.result));
|
||||
var ourFile = JSON.parse(file.target.result);
|
||||
if ( Array.isArray(ourFile) ) {
|
||||
window.deck = [];
|
||||
ourFile.forEach(function (deck) {
|
||||
window.deck = window.deck.concat(generateDeck(deck));
|
||||
});
|
||||
} else {
|
||||
window.deck = generateDeck(JSON.parse(file.target.result));
|
||||
}
|
||||
window.hand = [];
|
||||
updateEvent();
|
||||
}
|
||||
|
25
jokers.ddf
Normal file
25
jokers.ddf
Normal file
@ -0,0 +1,25 @@
|
||||
[{"value":[
|
||||
"A",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5",
|
||||
"6",
|
||||
"7",
|
||||
"8",
|
||||
"9",
|
||||
"10",
|
||||
"J",
|
||||
"Q",
|
||||
"K"],
|
||||
"shape":[
|
||||
"♥",
|
||||
"♣",
|
||||
"♠",
|
||||
"♦"
|
||||
]},
|
||||
{
|
||||
"color":["red ", "black "],
|
||||
"joker":["joker"]
|
||||
}
|
||||
]
|
Loading…
x
Reference in New Issue
Block a user