Permalink
Browse files

Merge pull request #129 from Manuel-777/tags

Deck Tags
  • Loading branch information...
Manuel-777 committed Dec 16, 2018
2 parents 2ba2c32 + 1039eee commit 5f0d8f81ce214b2d3551673d6c04950eec3bf577
Showing with 440 additions and 127 deletions.
  1. BIN images/close_tag.png
  2. +40 −2 window_background/background.js
  3. +333 −125 window_main/decks.js
  4. +58 −0 window_main/index.css
  5. +9 −0 window_main/renderer.js
BIN +2.91 KB images/close_tag.png
Binary file not shown.
@@ -82,6 +82,8 @@ const defaultCfg = {
gems_history:[],
gold_history:[],
decks_index: [],
decks_tags: {},
tags_colors: {},
decks: {},
wildcards_history:[]
}
@@ -186,7 +188,8 @@ var lastDeckUpdate = new Date();

var deck_changes_index = [];
var deck_changes = {};

var decks_tags = {};
var tags_colors = {};

// Begin of IPC messages recievers
function ipc_send(method, arg, to = windowRenderer) {
@@ -466,8 +469,38 @@ ipc.on('tou_drop', function (event, arg) {
httpTournamentDrop(arg);
});

ipc.on('edit_tag', function (event, arg) {
Object.keys(tags_colors).forEach(function(key) {
if (key == arg.tag) {
tags_colors[key] = arg.color;
}
});

store.set("tags_colors", tags_colors);
});


ipc.on('delete_tag', function (event, arg) {
if (decks_tags[arg.deck]) {
decks_tags[arg.deck].forEach((tag, index) => {
if (tag == arg.name) {
decks_tags[arg.deck].splice(index, 1);
}
});
}
store.set("decks_tags", decks_tags);
});

ipc.on('add_tag', function (event, arg) {
if (decks_tags[arg.deck]) {
decks_tags[arg.deck].push(arg.name);
}
else {
decks_tags[arg.deck] = [arg.name];
}
store.set("decks_tags", decks_tags);
});

ipc.on('set_deck_mode', function (event, state) {
overlayDeckMode = state;
update_deck(true);
@@ -566,7 +599,9 @@ function loadPlayerConfig(playerId) {

if (id != null) {
let deck = entireConfig.decks[id];
let tags = entireConfig.decks_tags[id];
if (deck != undefined) {
deck.tags = tags;
decks[id] = deck;
}
}
@@ -583,8 +618,12 @@ function loadPlayerConfig(playerId) {

deck_changes_index = entireConfig["deck_changes_index"];
deck_changes = entireConfig["deck_changes"];
decks_tags = entireConfig["decks_tags"];
tags_colors = entireConfig["tags_colors"];

var obj = store.get('overlayBounds');

ipc_send("set_tags_colors", tags_colors);
ipc_send("overlay_set_bounds", obj);

loadSettings();
@@ -931,7 +970,6 @@ function dataChop(data, startStr, endStr) {
return data;
}


function setDraftCards(json) {
ipc.send("set_draft_cards", json.draftPack, json.pickedCards, json.packNumber+1, json.pickNumber);
}
Oops, something went wrong.

0 comments on commit 5f0d8f8

Please sign in to comment.