package aitgame.menu;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.util.Iterator;
import aitgame.diploma.GradeManager;
import aitgame.diploma.Subject;
import aitgame.input.InputManager;
/**
* This is a submenu that displays the diploma of the player. This only displays
* a paper of the diploma.
*/
public class GameDiploma extends GameMenuBase{
private GradeManager gradeManager;
public GameDiploma(InputManager inputManager, GradeManager gradeManager) {
super(inputManager);
this.gradeManager = gradeManager;
}
/**
* Checks the players inputs.
*/
@Override
public void CheckInput(long elapsedTime) {
if (inputManager.enter.isPressed()) {
isRunning = false;
}
}
/**
* Draws the Diploma for the player and shows what classes the
* player has taken and grade of that subject.
*/
@Override
public void draw(Graphics2D g, int screenWidth, int screenHeight) {
g.setColor(Color.black);
g.fillRect(0, 0, screenWidth, screenHeight);
g.setColor(Color.white);
g.fillRect(250, 50, 500, 640);
g.setColor(Color.black);
g.drawRect(250, 50, 500, 640);
g.drawRect(260, 55, 480, 70);
g.drawRect(260, 130, 480, 30);
g.drawRect(260, 200, 480, 430);
g.drawLine(500, 200, 500, 630);
g.drawLine(560, 200, 560, 630);
g.drawLine(620, 200, 620, 630);
g.drawLine(260, 230, 740, 230);
g.drawLine(300, 665, 600, 665);
g.setFont(new Font("Dialog", Font.PLAIN, 12));
g.drawString("Arlandagymnasiet", 265, 70);
g.drawString("Sigtuna", 265, 85);
g.setFont(new Font("Dialog", Font.PLAIN, 20));
if(gradeManager.isExaminated()){
g.drawString("Slutbetyg", 500, 80);
}else{
g.drawString("Samlat Betygsdokument", 500, 80);
}
g.setFont(new Font("Dialog", Font.PLAIN, 10));
g.drawString("Elevens namn", 265, 140);
g.drawString("Kurs, projektarbete", 265, 225);
g.drawString("Betyg", 505, 225);
g.drawString("Po�ng", 565, 225);
g.drawString("Datum", 625, 225);
g.setFont(new Font("Dialog", Font.BOLD, 13));
g.drawString(gradeManager.getPlayerName(), 265, 155);
g.setFont(new Font("Dialog", Font.BOLD, 10));
int i = 0;
Iterator<Subject> subjects = gradeManager.getSubjects();
while(subjects.hasNext()){
Subject sub = subjects.next();
g.drawString(sub.getSubjectName(), 265, 245+i*12);
g.drawString(sub.getSubjectGrade(), 505, 245+i*12);
g.drawString("" + sub.getSubjectPoints(), 565, 245+i*12);
g.drawString(sub.getSubjectDate(), 625, 245+i*12);
i++;
}
}
}