mirror of
https://github.com/jokerx3/HeatUp
synced 2026-07-27 11:29:46 +02:00
TempBar Veränderung implementiert
This commit is contained in:
@@ -13,18 +13,41 @@ import de.heatup.ui.statusPanel.Timer;
|
|||||||
|
|
||||||
|
|
||||||
public class StatusPanelAdder{
|
public class StatusPanelAdder{
|
||||||
private Temperature temp;
|
|
||||||
private Score score;
|
private Score score;
|
||||||
private Timer timer;
|
private Timer timer;
|
||||||
private static JPanel panel;
|
private static JPanel panel;
|
||||||
private static JLabel labelTemp= new JLabel("temperature");
|
|
||||||
private static JProgressBar tempBar;
|
|
||||||
private static int hgap=30;
|
private static int hgap=30;
|
||||||
private static int vgap=9;
|
private static int vgap=9;
|
||||||
private static boolean updown = true;
|
private static int modifier=-1;
|
||||||
|
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 JLabel labelTemp= new JLabel("temperature");
|
||||||
|
private static JProgressBar tempBar;
|
||||||
|
private static JLabel labelScore= new JLabel("score");
|
||||||
|
private static JLabel scoreLabel= new JLabel("new Score Label");
|
||||||
|
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");
|
||||||
|
|
||||||
|
public static void raiseMod(){
|
||||||
|
if (modifier==-1){
|
||||||
|
modifier=1;
|
||||||
|
} else {
|
||||||
|
modifier+=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static void reduceMod(){
|
||||||
|
if (modifier==1){
|
||||||
|
modifier=-1;
|
||||||
|
} else if(modifier==-1){
|
||||||
|
} else {
|
||||||
|
modifier-=1;
|
||||||
|
}
|
||||||
|
|
||||||
public int getTemp(){
|
|
||||||
return temp.getTemp();
|
|
||||||
}
|
}
|
||||||
public int getScore(){
|
public int getScore(){
|
||||||
return score.getScore();
|
return score.getScore();
|
||||||
@@ -38,29 +61,45 @@ public class StatusPanelAdder{
|
|||||||
panel=newPanel;
|
panel=newPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static void tick() {
|
public static void tick() {
|
||||||
int mod;
|
temping=0;
|
||||||
if (tempBar.getValue()==90) {
|
if (modifier<0){
|
||||||
updown = false;
|
barSpeed=0.015;
|
||||||
|
tempMinus+=barSpeed*modifier;
|
||||||
|
if (tempMinus<-1){
|
||||||
|
temping=-1;
|
||||||
|
tempMinus+=1;
|
||||||
|
}
|
||||||
|
} else if (modifier>0){
|
||||||
|
barSpeed=0.02;
|
||||||
|
tempPlus+=barSpeed*modifier;
|
||||||
|
if (tempPlus>1){
|
||||||
|
temping=1;
|
||||||
|
tempPlus=-1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (tempBar.getValue()==30) {
|
|
||||||
updown = true;
|
|
||||||
}
|
if (tempBar.getValue()<=30 && modifier==-1) {
|
||||||
if (updown) {
|
|
||||||
mod = 1;
|
|
||||||
} else {
|
} else {
|
||||||
mod = -1;
|
tempBar.setValue(tempBar.getValue()+temping);
|
||||||
}
|
}
|
||||||
tempBar.setValue((tempBar.getValue()+mod));
|
System.out.println(tempBar.getValue() + " " + modifier);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static void createPanel(){
|
public static void createPanel(){
|
||||||
|
|
||||||
labelTemp.setFont(new Font("emulogic", Font.CENTER_BASELINE, 16));
|
labelTemp.setFont(new Font("emulogic", Font.CENTER_BASELINE, 16));
|
||||||
labelTemp.setForeground(Color.YELLOW);
|
labelTemp.setForeground(Color.YELLOW);
|
||||||
tempBar= new JProgressBar(30,90);
|
tempBar= new JProgressBar(30,200);
|
||||||
tempBar.setValue(45);
|
tempBar.setValue(45);
|
||||||
|
|
||||||
JPanel tempPanel=new JPanel();
|
JPanel tempPanel=new JPanel();
|
||||||
@@ -70,10 +109,10 @@ public class StatusPanelAdder{
|
|||||||
tempPanel.setBackground(Color.BLACK);
|
tempPanel.setBackground(Color.BLACK);
|
||||||
|
|
||||||
|
|
||||||
JLabel labelScore= new JLabel("score");
|
|
||||||
labelScore.setFont(new Font("emulogic", Font.CENTER_BASELINE, 16));
|
labelScore.setFont(new Font("emulogic", Font.CENTER_BASELINE, 16));
|
||||||
labelScore.setForeground(Color.YELLOW);
|
labelScore.setForeground(Color.YELLOW);
|
||||||
JLabel scoreLabel= new JLabel("new Score Label");
|
|
||||||
scoreLabel.setFont(new Font("emulogic", Font.CENTER_BASELINE, 12));
|
scoreLabel.setFont(new Font("emulogic", Font.CENTER_BASELINE, 12));
|
||||||
scoreLabel.setForeground(Color.YELLOW);
|
scoreLabel.setForeground(Color.YELLOW);
|
||||||
JPanel scorePanel=new JPanel();
|
JPanel scorePanel=new JPanel();
|
||||||
@@ -82,10 +121,10 @@ public class StatusPanelAdder{
|
|||||||
scorePanel.add(scoreLabel, BorderLayout.SOUTH);
|
scorePanel.add(scoreLabel, BorderLayout.SOUTH);
|
||||||
scorePanel.setBackground(Color.BLACK);
|
scorePanel.setBackground(Color.BLACK);
|
||||||
|
|
||||||
JLabel labelPowerUp = new JLabel("PowerUp");
|
|
||||||
labelPowerUp.setFont(new Font("emulogic", Font.CENTER_BASELINE, 16));
|
labelPowerUp.setFont(new Font("emulogic", Font.CENTER_BASELINE, 16));
|
||||||
labelPowerUp.setForeground(Color.YELLOW);
|
labelPowerUp.setForeground(Color.YELLOW);
|
||||||
JLabel powerUpLabel = new JLabel(/*new ImageIcon("path_to_image.png")*/"powerUpLabel");
|
|
||||||
powerUpLabel.setFont(new Font("emulogic", Font.CENTER_BASELINE, 12));
|
powerUpLabel.setFont(new Font("emulogic", Font.CENTER_BASELINE, 12));
|
||||||
powerUpLabel.setForeground(Color.YELLOW);
|
powerUpLabel.setForeground(Color.YELLOW);
|
||||||
|
|
||||||
@@ -96,11 +135,10 @@ public class StatusPanelAdder{
|
|||||||
powerUpPanel.setBackground(Color.BLACK);
|
powerUpPanel.setBackground(Color.BLACK);
|
||||||
|
|
||||||
|
|
||||||
JLabel labelTime=new JLabel("Time");
|
|
||||||
labelTime.setFont(new Font("emulogic", Font.CENTER_BASELINE, 16));
|
labelTime.setFont(new Font("emulogic", Font.CENTER_BASELINE, 16));
|
||||||
labelTime.setSize(100,10);
|
labelTime.setSize(100,10);
|
||||||
labelTime.setForeground(Color.YELLOW);
|
labelTime.setForeground(Color.YELLOW);
|
||||||
JLabel timeLabel = new JLabel("123456789");
|
|
||||||
timeLabel.setFont(new Font("emulogic", Font.CENTER_BASELINE, 12));
|
timeLabel.setFont(new Font("emulogic", Font.CENTER_BASELINE, 12));
|
||||||
timeLabel.setForeground(Color.YELLOW);
|
timeLabel.setForeground(Color.YELLOW);
|
||||||
JPanel timePanel=new JPanel();
|
JPanel timePanel=new JPanel();
|
||||||
|
|||||||
Reference in New Issue
Block a user