1
0
mirror of https://github.com/exane/not-gwent-online synced 2025-09-05 22:07:42 +00:00

deck view

This commit is contained in:
devfake
2015-06-24 20:34:35 +02:00
parent 61e04610c0
commit 1fcbf0b996
5 changed files with 160 additions and 15 deletions

View File

@@ -8,7 +8,7 @@ module.exports = {
data: function() {
return {
cards: [],
deck: [],
deck: {},
leaders: [],
leader: null,
@@ -18,12 +18,8 @@ module.exports = {
},
ready: function() {
// filter over leaders and store them separately.
this.cards = $.map(cards, (n) => {
if(n.type != 3) return n;
this.leaders.push(n);
});
this.initCards();
this.initDeck();
},
methods: {
@@ -31,11 +27,34 @@ module.exports = {
// todo: load animation
$('.all-cards').addClass('remove');
this.factionFilter = deck;
this.initDeck();
$('.all-cards').scrollTop(0);
setTimeout(function() {
$('.all-cards').removeClass('remove');
}, 500);
},
// Filter for leaders and store them separately.
initCards: function() {
this.cards = $.map(cards, (n) => {
if(n.type != 3) return n;
this.leaders.push(n);
});
},
initDeck: function() {
this.deck = {};
deck[this.factionFilter].forEach((x) => {
this.deck[x] = (this.deck[x] || 0) + 1;
});
},
// test
removeCard: function(el) {
}
}
};