|
|
|
@ -129,6 +129,11 @@ function drawEntities(){
|
|
|
|
drawCardInHand(key);
|
|
|
|
drawCardInHand(key);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(key in gameData.inInteractionMenu){
|
|
|
|
|
|
|
|
// Add the menu with 'play', 'activate effect', 'inspect', etc.
|
|
|
|
|
|
|
|
drawInteractionMenu(key);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -186,7 +191,7 @@ function drawCardInHand(entity){
|
|
|
|
// The draw all the card data, name, colour, etc.
|
|
|
|
// The draw all the card data, name, colour, etc.
|
|
|
|
function drawCardDetails(entity){
|
|
|
|
function drawCardDetails(entity){
|
|
|
|
|
|
|
|
|
|
|
|
console.log(gameData.cardData[entity]);
|
|
|
|
//console.log(gameData.cardData[entity]);
|
|
|
|
drawCardImage(entity); // TODO: Use a sprite per card, not just temp.
|
|
|
|
drawCardImage(entity); // TODO: Use a sprite per card, not just temp.
|
|
|
|
drawCardText(entity);
|
|
|
|
drawCardText(entity);
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
@ -347,8 +352,6 @@ function drawCardBack(entity){
|
|
|
|
// console. An issue that comes with making this in JS...
|
|
|
|
// console. An issue that comes with making this in JS...
|
|
|
|
function drawFakeHand(){
|
|
|
|
function drawFakeHand(){
|
|
|
|
|
|
|
|
|
|
|
|
console.log('Draw FAKE hand');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// itemList length is the count (/highest listPosition) in the hand in this case
|
|
|
|
// itemList length is the count (/highest listPosition) in the hand in this case
|
|
|
|
// i is the listPosition of the entity (which since this isn't using the entities at the mo...)
|
|
|
|
// i is the listPosition of the entity (which since this isn't using the entities at the mo...)
|
|
|
|
|
|
|
|
|
|
|
|
@ -393,3 +396,84 @@ function drawFakeHand(){
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function clearInteractionMenu(){
|
|
|
|
|
|
|
|
// Clear the existing interaction menu
|
|
|
|
|
|
|
|
gameData.inInteractionMenu = {};
|
|
|
|
|
|
|
|
gameData.interactionOption = {};
|
|
|
|
|
|
|
|
drawGameBoard();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function openInteractionMenu(entity){
|
|
|
|
|
|
|
|
// Only one interaction menu up at once (for now)
|
|
|
|
|
|
|
|
clearInteractionMenu();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add the 'new' entity interactionMenu
|
|
|
|
|
|
|
|
gameData.inInteractionMenu[entity] = entity;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add the available interaction(s) with size+positions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: Actually add the corresponding interactions depending on card, and boardElement
|
|
|
|
|
|
|
|
gameData.interactionOption['Play to Board'] = {
|
|
|
|
|
|
|
|
x: gameData.position[entity][0] + gameData.size[entity][0]*.1/2,
|
|
|
|
|
|
|
|
y: gameData.position[entity][1] + gameData.size[entity][1] - (35 * (Object.entries(gameData.interactionOption).length + 1)),
|
|
|
|
|
|
|
|
width: gameData.size[entity][0]*.9,
|
|
|
|
|
|
|
|
height: 30
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
gameData.interactionOption['Play as Mana'] = {
|
|
|
|
|
|
|
|
x: gameData.position[entity][0] + gameData.size[entity][0]*.1/2,
|
|
|
|
|
|
|
|
y: gameData.position[entity][1] + gameData.size[entity][1] - (35 * (Object.entries(gameData.interactionOption).length + 1)),
|
|
|
|
|
|
|
|
width: gameData.size[entity][0]*.9,
|
|
|
|
|
|
|
|
height: 30
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Interact
|
|
|
|
|
|
|
|
// Attack
|
|
|
|
|
|
|
|
// Tap
|
|
|
|
|
|
|
|
// Do, x/y
|
|
|
|
|
|
|
|
// Yadda yadda
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add interaction options for effects of the card
|
|
|
|
|
|
|
|
if(gameData.cardData[entity] !== undefined && gameData.cardData[entity].effect.length > 0){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(let i = 0; i < gameData.cardData[entity].effect.length; i++){
|
|
|
|
|
|
|
|
gameData.interactionOption['Trigger Effect '+(i+1)] = {
|
|
|
|
|
|
|
|
x: gameData.position[entity][0] + gameData.size[entity][0]*.1/2,
|
|
|
|
|
|
|
|
y: gameData.position[entity][1] + gameData.size[entity][1] - (35 * (Object.entries(gameData.interactionOption).length + 1)),
|
|
|
|
|
|
|
|
width: gameData.size[entity][0]*.9,
|
|
|
|
|
|
|
|
height: 30
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
drawGameBoard();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function drawInteractionMenu(entity){
|
|
|
|
|
|
|
|
// Draws the interactable options availabe for an entity
|
|
|
|
|
|
|
|
// TODO: Draw atop/below depening on position, etc.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (const [key, value] of Object.entries(gameData.interactionOption)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Draw the interaction box (TODO: make much better);
|
|
|
|
|
|
|
|
let menuItem = new Shape({
|
|
|
|
|
|
|
|
x: value.x,
|
|
|
|
|
|
|
|
y: value.y,
|
|
|
|
|
|
|
|
width: value.width,
|
|
|
|
|
|
|
|
height: value.height,
|
|
|
|
|
|
|
|
fillStyle: '#DDD',
|
|
|
|
|
|
|
|
strokeStyle: '#666'
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
menuItem.draw();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add the text
|
|
|
|
|
|
|
|
printText(
|
|
|
|
|
|
|
|
key
|
|
|
|
|
|
|
|
,value.x + value.width/2
|
|
|
|
|
|
|
|
,value.y + value.height/2
|
|
|
|
|
|
|
|
, 'center', 'middle', 'normal', 'normal', 8, 'Arial', '#333', false, false, false
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|