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);
|
||||
|
||||
if(last.val + 1 === 12) {
|
||||
console.log(from.val);
|
||||
render.mainstack[mpileid] = [];
|
||||
console.log(render.mainstack);
|
||||
}
|
||||
if(last.val + 1 === 12)
|
||||
render.mainstack[mpileid].length = 0; // clear stack
|
||||
|
||||
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>`);
|
||||
//activeElement.parentNode.removeChild(activeElement);
|
||||
|
@ -19,6 +19,8 @@ export const clearAll = () => {
|
||||
};
|
||||
|
||||
export const render = player => {
|
||||
console.log(`render ${player}`);
|
||||
clear(player);
|
||||
const _player = stackables.get(player);
|
||||
document.querySelector(`#player${_player.id}_name`).innerHTML = player.toString();
|
||||
_player.pile.forEach((slots, slotid) => {
|
||||
@ -31,6 +33,8 @@ export const render = player => {
|
||||
events.createCardEvents();
|
||||
};
|
||||
export const renderMain = () => {
|
||||
console.log("render Main");
|
||||
clearMain();
|
||||
mainstack.forEach((cards, slotid) => {
|
||||
cards.forEach(card => {
|
||||
document.querySelector(`#mainstock_pile_slot_${slotid}`).insertAdjacentHTML("beforeend",
|
||||
@ -40,7 +44,7 @@ export const renderMain = () => {
|
||||
});
|
||||
};
|
||||
export const renderAll = () => {
|
||||
clearAll();
|
||||
//clearAll();
|
||||
stackables.forEach((e, player) => render(player));
|
||||
renderMain();
|
||||
};
|
||||
@ -49,4 +53,9 @@ Map.prototype.getID = function(id) {
|
||||
for(let [key, val] of this.entries())
|
||||
if(val.id === id)
|
||||
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