export default class MenuItemRes {
    constructor(data = {}) {
        this.resources = data.resources || []
        this.x = data.x || 0
        this.y = data.y || 0
        this.type = 'resources'
    }

    draw(ctx) {
        ctx.fillStyle = '#000'
        ctx.font = '16px Lato'
        ctx.textAlign = 'left'

        const w = 70
        let offset_x = -this.resources.length / 2 * w + 20
        this.resources.forEach(item => {
            ctx.drawImage(item.icon, this.x + offset_x, this.y, 20, 20)
            ctx.fillText(item.value, this.x + offset_x + 25, this.y + 10)

            offset_x += w
        })
    }
}
