moving shikigami data to own file

This commit is contained in:
2021-03-16 19:02:54 +00:00
parent 7f024c4ecd
commit 3c480f9b63
3 changed files with 142 additions and 92 deletions

View File

@@ -125,92 +125,13 @@
</template>
<script>
import shikigami from "../data/shikigami_cards.json";
export default {
data: () => ({
selected_shikigami_names: [],
selected_shikigami_data: [],
selected_shikigami_decks: [{ 0: [] }, { 1: [] }, { 2: [] }, { 3: [] }],
shikigami: [
{
header: "Group 1",
},
{
name: "Shiki_0",
cards: [
{ name: "shiki_0_card_0", url: "https://shiki_0_card_0.png" },
{ name: "shiki_0_card_1", url: "https://shiki_0_card_1.png" },
{ name: "shiki_0_card_2", url: "https://shiki_0_card_2.png" },
{ name: "shiki_0_card_3", url: "https://shiki_0_card_3.png" },
{ name: "shiki_0_card_4", url: "https://shiki_0_card_4.png" },
{ name: "shiki_0_card_5", url: "https://shiki_0_card_5.png" },
{ name: "shiki_0_card_6", url: "https://shiki_0_card_6.png" },
{ name: "shiki_0_card_7", url: "https://shiki_0_card_7.png" },
],
avatar: "https://cdn.vuetifyjs.com/images/lists/1.jpg",
},
{
name: "Shiki_1",
cards: [
{ name: "shiki_1_card_0", url: "https://shiki_1_card_0.png" },
{ name: "shiki_1_card_1", url: "https://shiki_1_card_1.png" },
{ name: "shiki_1_card_2", url: "https://shiki_1_card_2.png" },
{ name: "shiki_1_card_3", url: "https://shiki_1_card_3.png" },
{ name: "shiki_1_card_4", url: "https://shiki_1_card_4.png" },
{ name: "shiki_1_card_5", url: "https://shiki_1_card_5.png" },
{ name: "shiki_1_card_6", url: "https://shiki_1_card_6.png" },
{ name: "shiki_1_card_7", url: "https://shiki_1_card_7.png" },
],
avatar: "https://cdn.vuetifyjs.com/images/lists/2.jpg",
},
{
name: "Shiki_2",
cards: [
{ name: "shiki_2_card_0", url: "https://shiki_2_card_0.png" },
{ name: "shiki_2_card_1", url: "https://shiki_2_card_1.png" },
{ name: "shiki_2_card_2", url: "https://shiki_2_card_2.png" },
{ name: "shiki_2_card_3", url: "https://shiki_2_card_3.png" },
{ name: "shiki_2_card_4", url: "https://shiki_2_card_4.png" },
{ name: "shiki_2_card_5", url: "https://shiki_2_card_5.png" },
{ name: "shiki_2_card_6", url: "https://shiki_2_card_6.png" },
{ name: "shiki_2_card_7", url: "https://shiki_2_card_7.png" },
],
avatar: "https://cdn.vuetifyjs.com/images/lists/3.jpg",
},
{
header: "Group 2",
},
{
divider: true,
},
{
name: "Shiki_3",
cards: [
{ name: "shiki_3_card_0", url: "https://shiki_3_card_0.png" },
{ name: "shiki_3_card_1", url: "https://shiki_3_card_1.png" },
{ name: "shiki_3_card_2", url: "https://shiki_3_card_2.png" },
{ name: "shiki_3_card_3", url: "https://shiki_3_card_3.png" },
{ name: "shiki_3_card_4", url: "https://shiki_3_card_4.png" },
{ name: "shiki_3_card_5", url: "https://shiki_3_card_5.png" },
{ name: "shiki_3_card_6", url: "https://shiki_3_card_6.png" },
{ name: "shiki_3_card_7", url: "https://shiki_3_card_7.png" },
],
avatar: "https://cdn.vuetifyjs.com/images/lists/4.jpg",
},
{
name: "Shiki_4",
cards: [
{ name: "shiki_4_card_0", url: "https://shiki_4_card_0.png" },
{ name: "shiki_4_card_1", url: "https://shiki_4_card_1.png" },
{ name: "shiki_4_card_2", url: "https://shiki_4_card_2.png" },
{ name: "shiki_4_card_3", url: "https://shiki_4_card_3.png" },
{ name: "shiki_4_card_4", url: "https://shiki_4_card_4.png" },
{ name: "shiki_4_card_5", url: "https://shiki_4_card_5.png" },
{ name: "shiki_4_card_6", url: "https://shiki_4_card_6.png" },
{ name: "shiki_4_card_7", url: "https://shiki_4_card_7.png" },
],
avatar: "https://cdn.vuetifyjs.com/images/lists/5.jpg",
},
],
shikigami: shikigami,
colors: [
{ id: 1, title: "red" },
{ id: 2, title: "blue" },
@@ -254,21 +175,20 @@ export default {
console.log(shiki_index, card_index);
},
double_cards(index) {
const doubled_cards = [];
console.log("looping");
const doubled_cards = this.doubled_cards;
console.log(doubled_cards[index].index);
console.log(this.doubled_cards[index][index]);
this.selected_shikigami_data[index].cards.forEach(function (el) {
let id_0 = Math.random().toString(36).slice(6);
let id_1 = Math.random().toString(36).slice(6);
doubled_cards.push({ id: id_0, card: el }, { id: id_1, card: el });
doubled_cards[index][index].push(
{ id: id_0, card: el },
{ id: id_1, card: el }
);
});
console.log(doubled_cards);
return doubled_cards;
// return this.selected_shikigami_data[index].cards.concat.apply(
// [],
// this.selected_shikigami_data[index].cards.map(function (el) {
// return [el, el];
// })
// );
this.doubled_cards = doubled_cards;
return this.doubled_cards;
},
},
computed: {