import java.awt.Color;
import java.awt.Font;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;

import javax.swing.JPanel;

//cette classe est l'affichage dans l'inventaire d'une ressource
//fonctionnement similaire à imageObjet avec moins de fonction

public class ImageInventaire {
	
	BufferedImage image ; 
	int largeur = 100;
	int hauteur = 100;
	Ressource ressource ;
	boolean active  ;
	int numero_panneau;
	FenetreInventaire fenetre_INVENTAIRE ;

	public ImageInventaire (int numero_panneau,Ressource ressource, boolean active,FenetreInventaire fi) {
		
		image = ImageLoader.scale(ressource.image,largeur,hauteur);
		this.ressource=ressource;
		this.active=active;
		this.numero_panneau=numero_panneau;
		fenetre_INVENTAIRE=fi;
	}
	
	public void dessine(Graphics g, JPanel jp,int x,int y){
		
		if(numero_panneau==1){
			
			if(fenetre_INVENTAIRE.afficher_liste_nourriture){
		
				g.setColor(new Color(30,30,30,127));
				g.fillRoundRect(x,y,largeur,hauteur,10,10);
				g.setColor(new Color(100,100,100,127));
				g.drawRoundRect(x+5,y+5,largeur-10,hauteur-10,10,10);
				g.drawRoundRect(x+4,y+4,largeur-8,hauteur-8,10,10);
				
				g.drawImage(image,x,y,jp);
				
				if(ressource.nombre==0){
					g.setColor(new Color(30,30,30,200));
					g.fillRoundRect(x,y,largeur,hauteur,10,10);
				}
					
				
				g.setColor(new Color(20,20,20));
				g.fillOval(x+70,y+70,35,35);
				g.setColor(new Color(100,100,100,127));
				g.drawOval(x+73,y+73,29,29);
				g.setColor(new Color(200,200,200,127));	
				g.setFont(new Font("Tahoma", Font.ITALIC, 13));	
				g.drawString(""+ressource.nombre,x+82,y+92);
				
				if(active){
						
					Graphics2D g2d = (Graphics2D)g;         
					GradientPaint gp = new GradientPaint(0, 0,  new Color(100,100,100,127), 1000, 0,new Color(30,30,30,127), true);                
					g2d.setPaint(gp);
					g2d.fillRoundRect(1100,540,720,220,20,20);
					
					g.setColor( new Color(100,100,100,127));
					g.drawRoundRect(1105,545,710,210,20,20);
					g.drawRoundRect(1104,544,712,212,20,20);
					
					g.setFont(new Font("Tahoma", Font.ITALIC, 30));
					g.setColor(new Color(200,200,200,240));
					g.drawString(this.ressource.description,1130,650);
					
				}
			}
		}
		
		else if(numero_panneau==2){
			
			if(fenetre_INVENTAIRE.afficher_liste_ressources){
		
				g.setColor(new Color(30,30,30,127));
				g.fillRoundRect(x,y,largeur,hauteur,10,10);
				g.setColor(new Color(100,100,100,127));
				g.drawRoundRect(x+5,y+5,largeur-10,hauteur-10,10,10);
				g.drawRoundRect(x+4,y+4,largeur-8,hauteur-8,10,10);
				
				g.drawImage(image,x,y,jp);
				
				if(ressource.nombre==0){
					g.setColor(new Color(30,30,30,200));
					g.fillRoundRect(x,y,largeur,hauteur,10,10);
				}
					
				
				g.setColor(new Color(20,20,20));
				g.fillOval(x+70,y+70,35,35);
				g.setColor(new Color(100,100,100,127));
				g.drawOval(x+73,y+73,29,29);
				g.setColor(new Color(200,200,200,127));	
				g.setFont(new Font("Tahoma", Font.ITALIC, 13));	
				g.drawString(""+ressource.nombre,x+82,y+92);
				
				if(active){
						
					Graphics2D g2d = (Graphics2D)g;         
					GradientPaint gp = new GradientPaint(0, 0,  new Color(100,100,100,127), 1000, 0,new Color(30,30,30,127), true);                
					g2d.setPaint(gp);
					g2d.fillRoundRect(1100,540,720,220,20,20);
					
					g.setColor( new Color(100,100,100,127));
					g.drawRoundRect(1105,545,710,210,20,20);
					g.drawRoundRect(1104,544,712,212,20,20);
					
					g.setFont(new Font("Tahoma", Font.ITALIC, 30));
					g.setColor(new Color(200,200,200,240));
					g.drawString(this.ressource.description,1130,650);
					
				}
			}
		}
	
		else if(numero_panneau==3){
			
			if(fenetre_INVENTAIRE.afficher_liste_armes){
		
				g.setColor(new Color(30,30,30,127));
				g.fillRoundRect(x,y,largeur,hauteur,10,10);
				g.setColor(new Color(100,100,100,127));
				g.drawRoundRect(x+5,y+5,largeur-10,hauteur-10,10,10);
				g.drawRoundRect(x+4,y+4,largeur-8,hauteur-8,10,10);
				
				g.drawImage(image,x,y,jp);
				
				if(ressource.nombre==0){
					g.setColor(new Color(30,30,30,200));
					g.fillRoundRect(x,y,largeur,hauteur,10,10);
				}
					
				
				g.setColor(new Color(20,20,20));
				g.fillOval(x+70,y+70,35,35);
				g.setColor(new Color(100,100,100,127));
				g.drawOval(x+73,y+73,29,29);
				g.setColor(new Color(200,200,200,127));	
				g.setFont(new Font("Tahoma", Font.ITALIC, 13));	
				g.drawString(""+ressource.nombre,x+82,y+92);
				
				if(active){
						
					Graphics2D g2d = (Graphics2D)g;         
					GradientPaint gp = new GradientPaint(0, 0,  new Color(100,100,100,127), 1000, 0,new Color(30,30,30,127), true);                
					g2d.setPaint(gp);
					g2d.fillRoundRect(1100,540,720,220,20,20);
					
					g.setColor( new Color(100,100,100,127));
					g.drawRoundRect(1105,545,710,210,20,20);
					g.drawRoundRect(1104,544,712,212,20,20);
					
					g.setFont(new Font("Tahoma", Font.ITALIC, 30));
					g.setColor(new Color(200,200,200,240));
					g.drawString(this.ressource.description,1130,650);
					
				}
			}
		}

		else if(numero_panneau==4){
			
			if(fenetre_INVENTAIRE.afficher_liste_equipements){
		
				g.setColor(new Color(30,30,30,127));
				g.fillRoundRect(x,y,largeur,hauteur,10,10);
				g.setColor(new Color(100,100,100,127));
				g.drawRoundRect(x+5,y+5,largeur-10,hauteur-10,10,10);
				g.drawRoundRect(x+4,y+4,largeur-8,hauteur-8,10,10);
				
				g.drawImage(image,x,y,jp);
				
				if(ressource.nombre==0){
					g.setColor(new Color(30,30,30,200));
					g.fillRoundRect(x,y,largeur,hauteur,10,10);
				}
					
				
				g.setColor(new Color(20,20,20));
				g.fillOval(x+70,y+70,35,35);
				g.setColor(new Color(100,100,100,127));
				g.drawOval(x+73,y+73,29,29);
				g.setColor(new Color(200,200,200,127));	
				g.setFont(new Font("Tahoma", Font.ITALIC, 13));	
				g.drawString(""+ressource.nombre,x+82,y+92);
				
				if(active){
						
					Graphics2D g2d = (Graphics2D)g;         
					GradientPaint gp = new GradientPaint(0, 0,  new Color(100,100,100,127), 1000, 0,new Color(30,30,30,127), true);                
					g2d.setPaint(gp);
					g2d.fillRoundRect(1100,540,720,220,20,20);
					
					g.setColor( new Color(100,100,100,127));
					g.drawRoundRect(1105,545,710,210,20,20);
					g.drawRoundRect(1104,544,712,212,20,20);
					
					g.setFont(new Font("Tahoma", Font.ITALIC, 30));
					g.setColor(new Color(200,200,200,240));
					g.drawString(this.ressource.description,1130,650);
					
				}
			}
		}
	
		else if(numero_panneau==5){
			
			if(fenetre_INVENTAIRE.afficher_liste_objets){
		
				g.setColor(new Color(30,30,30,127));
				g.fillRoundRect(x,y,largeur,hauteur,10,10);
				g.setColor(new Color(100,100,100,127));
				g.drawRoundRect(x+5,y+5,largeur-10,hauteur-10,10,10);
				g.drawRoundRect(x+4,y+4,largeur-8,hauteur-8,10,10);
				
				g.drawImage(image,x,y,jp);
				
				if(ressource.nombre==0){
					g.setColor(new Color(30,30,30,200));
					g.fillRoundRect(x,y,largeur,hauteur,10,10);
				}
					
				
				g.setColor(new Color(20,20,20));
				g.fillOval(x+70,y+70,35,35);
				g.setColor(new Color(100,100,100,127));
				g.drawOval(x+73,y+73,29,29);
				g.setColor(new Color(200,200,200,127));	
				g.setFont(new Font("Tahoma", Font.ITALIC, 13));	
				g.drawString(""+ressource.nombre,x+82,y+92);
				
				if(active){
						
					Graphics2D g2d = (Graphics2D)g;         
					GradientPaint gp = new GradientPaint(0, 0,  new Color(100,100,100,127), 1000, 0,new Color(30,30,30,127), true);                
					g2d.setPaint(gp);
					g2d.fillRoundRect(1100,540,720,220,20,20);
					
					g.setColor( new Color(100,100,100,127));
					g.drawRoundRect(1105,545,710,210,20,20);
					g.drawRoundRect(1104,544,712,212,20,20);
					
					g.setFont(new Font("Tahoma", Font.ITALIC, 30));
					g.setColor(new Color(200,200,200,240));
					g.drawString(this.ressource.description,1130,650);
					
				}
			}
		}
	
	
	
	
	}
}
