diff --git a/HeatUp/src/de/heatup/ui/StatusPanelAdder.java b/HeatUp/src/de/heatup/ui/StatusPanelAdder.java index 057cdb3..1d12475 100644 --- a/HeatUp/src/de/heatup/ui/StatusPanelAdder.java +++ b/HeatUp/src/de/heatup/ui/StatusPanelAdder.java @@ -18,15 +18,14 @@ import de.heatup.ui.statusPanel.Timer; public class StatusPanelAdder{ - private Score score; - private Timer timer; private static JPanel panel; private static int hgap=30; private static int vgap=9; private static int modifier=-1; + private static int temping=0; + private static int manipulations=0; private static double tempPlus=0.0; private static double tempMinus=0.0; - private static int temping=0; private static double barSpeed=0.01; private static boolean ende=false; private static JLabel labelTempC= new JLabel("§"); @@ -37,7 +36,7 @@ public class StatusPanelAdder{ private static JLabel labelPowerUp = new JLabel("PowerUp"); private static JLabel powerUpLabel = new JLabel(/*new ImageIcon("path_to_image.png")*/"powerUpLabel"); private static JLabel labelTime=new JLabel("Time"); - private static JLabel timeLabel = new JLabel("123456789"); + private static JLabel timeLabel = new JLabel("0"); private static Font emulogicheading; private static Font emulogictext; private static Font ttfBase; @@ -73,20 +72,32 @@ public class StatusPanelAdder{ } public int getScore(){ - return score.getScore(); - } - public double getTime(){ - return timer.getTime(); + return Score.getScore(); } + /** + * @param newPanel das zu verwendende Panel zur Bearbeitung + */ public static void setPanel(JPanel newPanel){ newPanel.setLayout(new FlowLayout(FlowLayout.CENTER, hgap,5)); panel=newPanel; } - + public static void addManipulations(){ + manipulations+=1; + Score.raiseScore(25); + } + public static int getManipulations(){ + return manipulations; + } public static void tick() { + Timer.tickTimer(); + timeLabel.setText(Timer.getMinuteS() + ":" + Timer.getSecondsS()); + + /** + * Temperaturbearbeitung + */ labelTempC.setText(tempBar.getValue() + "°C"); temping=0; if (modifier<0){ @@ -123,7 +134,9 @@ public class StatusPanelAdder{ - + /** + * fügt dem der Klasse übergebenen Panel Objekte hinzu & formatiert diese + */ public static void createPanel(){ implementFont(); emulogicheading = ttfBase.deriveFont(Font.PLAIN, 16); diff --git a/HeatUp/src/de/heatup/ui/statusPanel/Score.java b/HeatUp/src/de/heatup/ui/statusPanel/Score.java index 2d9a2ba..fe2a9a5 100644 --- a/HeatUp/src/de/heatup/ui/statusPanel/Score.java +++ b/HeatUp/src/de/heatup/ui/statusPanel/Score.java @@ -1,35 +1,66 @@ package de.heatup.ui.statusPanel; +import de.heatup.ui.StatusPanelAdder; + public class Score { - private int score; - public Score(){ - score=0; - } - //returns score - public int getScore(){ + private static int score; + private static int bonusTime=180; + /** + * @return Score + */ + public static int getScore(){ return score; } - public String getScoreS(){ + /** + * @return Score as String + */ + public static String getScoreS(){ int score=getScore(); Integer string= new Integer(score); return string.toString(); } - //resets score - public void resetScore(){ - score=0; + /** + * setzt die BonusZeit bis dahin es den Zeitbonus gibt + * @param bonusTime + */ + public static void setBonusTime(int bonusTime){ + Score.bonusTime=bonusTime; } - //raises score - public void raiseScore(int additional){ + + /** + * erhöht den Score um: + * @param additional + */ + public static void raiseScore(int additional){ score+=additional; } - //reduces score; when score<0, score=0; - public void reduceScore(int reduce){ + /** + * senkt den Score um: + * @param reduce + */ + public static void reduceScore(int reduce){ score-=reduce; //when score less than 0 if (score<0){ score=0; } } + /** + * berechnet den endgültigen Score und gibt diesen zurück + * @return endScore + */ + public static int endScore(){ + int manipulations=StatusPanelAdder.getManipulations(); + int manipulationsBonus=600/manipulations; + int endScore=score + manipulationsBonus; + if (Timer.getAllInSeconds()