blah
This commit is contained in:
parent
39dff70a1b
commit
975dcb9919
@ -33,13 +33,11 @@ const dragEnd = e => {
|
|||||||
|
|
||||||
(last.val + 1 === from.val ? to : pile).push(from);
|
(last.val + 1 === from.val ? to : pile).push(from);
|
||||||
|
|
||||||
if(last.val + 1 === 12) {
|
if(last.val + 1 === 12)
|
||||||
console.log(from.val);
|
render.mainstack[mpileid].length = 0; // clear stack
|
||||||
render.mainstack[mpileid] = [];
|
|
||||||
console.log(render.mainstack);
|
|
||||||
}
|
|
||||||
|
|
||||||
render.renderAll();
|
render.render(render.stackables.getName(parseInt(pstack.slice(-1))));
|
||||||
|
render.renderMain();
|
||||||
|
|
||||||
//dropto.insertAdjacentHTML("beforeend", `<div class="card_outer" data-val="${activeElement.dataset.val}">${activeElement.innerHTML}</div>`);
|
//dropto.insertAdjacentHTML("beforeend", `<div class="card_outer" data-val="${activeElement.dataset.val}">${activeElement.innerHTML}</div>`);
|
||||||
//activeElement.parentNode.removeChild(activeElement);
|
//activeElement.parentNode.removeChild(activeElement);
|
||||||
|
@ -19,6 +19,8 @@ export const clearAll = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const render = player => {
|
export const render = player => {
|
||||||
|
console.log(`render ${player}`);
|
||||||
|
clear(player);
|
||||||
const _player = stackables.get(player);
|
const _player = stackables.get(player);
|
||||||
document.querySelector(`#player${_player.id}_name`).innerHTML = player.toString();
|
document.querySelector(`#player${_player.id}_name`).innerHTML = player.toString();
|
||||||
_player.pile.forEach((slots, slotid) => {
|
_player.pile.forEach((slots, slotid) => {
|
||||||
@ -31,6 +33,8 @@ export const render = player => {
|
|||||||
events.createCardEvents();
|
events.createCardEvents();
|
||||||
};
|
};
|
||||||
export const renderMain = () => {
|
export const renderMain = () => {
|
||||||
|
console.log("render Main");
|
||||||
|
clearMain();
|
||||||
mainstack.forEach((cards, slotid) => {
|
mainstack.forEach((cards, slotid) => {
|
||||||
cards.forEach(card => {
|
cards.forEach(card => {
|
||||||
document.querySelector(`#mainstock_pile_slot_${slotid}`).insertAdjacentHTML("beforeend",
|
document.querySelector(`#mainstock_pile_slot_${slotid}`).insertAdjacentHTML("beforeend",
|
||||||
@ -40,7 +44,7 @@ export const renderMain = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
export const renderAll = () => {
|
export const renderAll = () => {
|
||||||
clearAll();
|
//clearAll();
|
||||||
stackables.forEach((e, player) => render(player));
|
stackables.forEach((e, player) => render(player));
|
||||||
renderMain();
|
renderMain();
|
||||||
};
|
};
|
||||||
@ -50,3 +54,8 @@ Map.prototype.getID = function(id) {
|
|||||||
if(val.id === id)
|
if(val.id === id)
|
||||||
return val;
|
return val;
|
||||||
};
|
};
|
||||||
|
Map.prototype.getName = function(id) {
|
||||||
|
for(let [key, val] of this.entries())
|
||||||
|
if(val.id === id)
|
||||||
|
return key;
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user