mirror of
https://github.com/jokerx3/HeatUp
synced 2026-07-27 11:29:46 +02:00
Merge branch 'master' of github.com:jokerx3/prp
This commit is contained in:
@@ -1,16 +1,147 @@
|
|||||||
package de.heatup.highscore;
|
package de.heatup.highscore;
|
||||||
|
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.ObjectInputStream;
|
||||||
|
import java.io.ObjectOutputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import com.sun.org.apache.xml.internal.serializer.SerializationHandler;
|
||||||
|
|
||||||
import de.heatup.cfg.Config;
|
import de.heatup.cfg.Config;
|
||||||
import de.heatup.logging.Logger;
|
import de.heatup.logging.Logger;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author daniel
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class HighscoreHandler {
|
public class HighscoreHandler {
|
||||||
private int mapHash;
|
private int mapHash;
|
||||||
|
private MapHighscores mapHighscores;
|
||||||
/**
|
/**
|
||||||
* Es muss vorher eine Karte geladen sein
|
* Es muss vorher eine Karte geladen sein
|
||||||
*/
|
*/
|
||||||
public HighscoreHandler(String mapString) {
|
public HighscoreHandler(String mapString) {
|
||||||
mapHash = mapString.hashCode();
|
mapHash = mapString.hashCode();
|
||||||
// load file for serialization
|
|
||||||
|
try {
|
||||||
|
FileInputStream fileIn = new FileInputStream("highscore.dat");
|
||||||
|
ObjectInputStream in = new ObjectInputStream(fileIn);
|
||||||
|
mapHighscores = (MapHighscores) in.readObject();
|
||||||
|
in.close();
|
||||||
|
fileIn.close();
|
||||||
|
Logger.write("loaded highscore.dat");
|
||||||
|
} catch (FileNotFoundException fe) {
|
||||||
|
mapHighscores = new MapHighscores();
|
||||||
|
FileOutputStream fileOut = null;
|
||||||
|
try {
|
||||||
|
fileOut = new FileOutputStream("highscore.dat");
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
ObjectOutputStream out = null;
|
||||||
|
try {
|
||||||
|
out = new ObjectOutputStream(fileOut);
|
||||||
|
} catch (IOException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
out.writeObject(mapHighscores);
|
||||||
|
} catch (IOException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
out.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
fileOut.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
Logger.write("created new highscore.dat");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
FileInputStream fileIn = null;
|
||||||
|
try {
|
||||||
|
fileIn = new FileInputStream("highscore.dat");
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
ObjectInputStream in = null;
|
||||||
|
try {
|
||||||
|
in = new ObjectInputStream(fileIn);
|
||||||
|
} catch (IOException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
mapHighscores = (MapHighscores) in.readObject();
|
||||||
|
} catch (ClassNotFoundException e1) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e1.printStackTrace();
|
||||||
|
} catch (IOException e1) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
in.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
fileIn.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
Logger.write("loaded highscore.dat");
|
||||||
|
} catch (IOException e) {
|
||||||
|
|
||||||
|
e.printStackTrace();
|
||||||
|
return;
|
||||||
|
} catch (ClassNotFoundException ce) {
|
||||||
|
Logger.write("MapHighscore class not found");
|
||||||
|
ce.printStackTrace();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
public int getCurrentMapHash() {
|
||||||
|
return mapHash;
|
||||||
|
}
|
||||||
|
public void setHighscore(int mapHash, String name, int score) {
|
||||||
|
mapHighscores.setHighscore(mapHash, name, score);
|
||||||
|
}
|
||||||
|
public ArrayList<ScoreEntry> getHighscores(int mapHash) {
|
||||||
|
return mapHighscores.getHighscores(mapHash);
|
||||||
|
}
|
||||||
|
public boolean saveHighscores() {
|
||||||
|
try {
|
||||||
|
FileOutputStream fileOut = new FileOutputStream("highscore.dat");
|
||||||
|
ObjectOutputStream out = new ObjectOutputStream(fileOut);
|
||||||
|
out.writeObject(mapHighscores);
|
||||||
|
out.close();
|
||||||
|
fileOut.close();
|
||||||
|
Logger.write("saved highscore.dat");
|
||||||
|
return true;
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
Logger.write("error saving highscore.dat");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-10
@@ -4,29 +4,33 @@ import java.io.Serializable;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
/**
|
||||||
public class MapHighscore implements Serializable {
|
*
|
||||||
|
* @author daniel
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class MapHighscores implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private Map<Integer, ArrayList<Score>> highscoreOfAllMaps = new HashMap<Integer, ArrayList<Score>>();
|
private Map<Integer, ArrayList<ScoreEntry>> highscoreOfAllMaps = new HashMap<Integer, ArrayList<ScoreEntry>>();
|
||||||
|
|
||||||
public ArrayList<Score> getHighscores(int mapHash) {
|
protected ArrayList<ScoreEntry> getHighscores(int mapHash) {
|
||||||
if (highscoreOfAllMaps.get(mapHash) == null) {
|
if (highscoreOfAllMaps.get(mapHash) == null) {
|
||||||
ArrayList<Score> mapHighscores = new ArrayList<Score>();
|
ArrayList<ScoreEntry> mapHighscores = new ArrayList<ScoreEntry>();
|
||||||
for (int n = 0; n<10; n++) {
|
for (int n = 0; n<10; n++) {
|
||||||
mapHighscores.add(new Score());
|
mapHighscores.add(new ScoreEntry());
|
||||||
}
|
}
|
||||||
highscoreOfAllMaps.put(mapHash, mapHighscores);
|
highscoreOfAllMaps.put(mapHash, mapHighscores);
|
||||||
}
|
}
|
||||||
return highscoreOfAllMaps.get(mapHash);
|
return highscoreOfAllMaps.get(mapHash);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHighscore(int mapHash, String name, int score) {
|
protected void setHighscore(int mapHash, String name, int score) {
|
||||||
|
|
||||||
ArrayList<Score> mapHighscores = highscoreOfAllMaps.get(mapHash);
|
ArrayList<ScoreEntry> mapHighscores = highscoreOfAllMaps.get(mapHash);
|
||||||
|
|
||||||
ArrayList<Score> newMapHighscores = new ArrayList<Score>();
|
ArrayList<ScoreEntry> newMapHighscores = new ArrayList<ScoreEntry>();
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
@@ -35,7 +39,7 @@ public class MapHighscore implements Serializable {
|
|||||||
if (mapHighscores.get(i).getScore() > score) {
|
if (mapHighscores.get(i).getScore() > score) {
|
||||||
newMapHighscores.add(mapHighscores.get(i));
|
newMapHighscores.add(mapHighscores.get(i));
|
||||||
} else {
|
} else {
|
||||||
newMapHighscores.add(new Score(name, score));
|
newMapHighscores.add(new ScoreEntry(name, score));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
+3
-3
@@ -2,19 +2,19 @@ package de.heatup.highscore;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
public class Score implements Serializable {
|
public class ScoreEntry implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
private int score;
|
private int score;
|
||||||
|
|
||||||
public Score() {
|
public ScoreEntry() {
|
||||||
name = "default";
|
name = "default";
|
||||||
score = 2342;
|
score = 2342;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Score(String name, int score) {
|
public ScoreEntry(String name, int score) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.score = score;
|
this.score = score;
|
||||||
}
|
}
|
||||||
@@ -34,7 +34,7 @@ public class MapEngine {
|
|||||||
|
|
||||||
private static String mapString = "";
|
private static String mapString = "";
|
||||||
|
|
||||||
private final HighscoreHandler mapHighscore;
|
private HighscoreHandler highscoreHandler;
|
||||||
|
|
||||||
HashMap<Character, ArrayList<Point>> allMapTiles = new HashMap<Character, ArrayList<Point>>();
|
HashMap<Character, ArrayList<Point>> allMapTiles = new HashMap<Character, ArrayList<Point>>();
|
||||||
ArrayList<Character> availableHardwareTileTypes = new ArrayList<Character>();
|
ArrayList<Character> availableHardwareTileTypes = new ArrayList<Character>();
|
||||||
@@ -46,9 +46,8 @@ public class MapEngine {
|
|||||||
Scanner input = null;
|
Scanner input = null;
|
||||||
MapLoader ml = new MapLoader();
|
MapLoader ml = new MapLoader();
|
||||||
input = new Scanner(ml.loadMap(mapNumber));
|
input = new Scanner(ml.loadMap(mapNumber));
|
||||||
|
|
||||||
this.createTiles(input);
|
this.createTiles(input);
|
||||||
mapHighscore = new HighscoreHandler(mapString);
|
highscoreHandler = new HighscoreHandler(mapString);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Öffnet einen File Chooser um eine Custom Map auszuwählen, welche anschließend geladen wird.
|
* Öffnet einen File Chooser um eine Custom Map auszuwählen, welche anschließend geladen wird.
|
||||||
@@ -63,7 +62,10 @@ public class MapEngine {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
this.createTiles(input);
|
this.createTiles(input);
|
||||||
mapHighscore = new HighscoreHandler(mapString);
|
highscoreHandler = new HighscoreHandler(mapString);
|
||||||
|
}
|
||||||
|
public HighscoreHandler getHighscoreHandler() {
|
||||||
|
return highscoreHandler;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Erstellt aus einem gegebenen Scanner, welche eine Datei einliest,
|
* Erstellt aus einem gegebenen Scanner, welche eine Datei einliest,
|
||||||
@@ -260,4 +262,7 @@ public class MapEngine {
|
|||||||
gamePanel.add(currentStaticObject);
|
gamePanel.add(currentStaticObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public int getMapHash() {
|
||||||
|
return highscoreHandler.getCurrentMapHash();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public class Main extends JFrame implements Runnable {
|
|||||||
|
|
||||||
private boolean running = false;
|
private boolean running = false;
|
||||||
private static boolean pause = false;
|
private static boolean pause = false;
|
||||||
private boolean fullscreen = true;
|
private boolean fullscreen = false;
|
||||||
|
|
||||||
private Thread thread;
|
private Thread thread;
|
||||||
|
|
||||||
@@ -108,7 +108,7 @@ public class Main extends JFrame implements Runnable {
|
|||||||
/*
|
/*
|
||||||
* entfernen wenn getter verwendet wird.
|
* entfernen wenn getter verwendet wird.
|
||||||
*/
|
*/
|
||||||
player01 = PanelBuilder.player01;
|
player01 = PanelBuilder.getPlayer();
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -170,7 +170,7 @@ public class Main extends JFrame implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Player getPlayer() {
|
public static Player getPlayer() {
|
||||||
return PanelBuilder.player01;
|
return PanelBuilder.getPlayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void start() {
|
public synchronized void start() {
|
||||||
@@ -243,38 +243,7 @@ public class Main extends JFrame implements Runnable {
|
|||||||
private void tick() {
|
private void tick() {
|
||||||
PanelBuilder.kb.checkKeyActivity();
|
PanelBuilder.kb.checkKeyActivity();
|
||||||
if (!pause) {
|
if (!pause) {
|
||||||
EventQueue.invokeLater(new Runnable() {
|
PanelBuilder.tick();
|
||||||
@Override public void run() {
|
|
||||||
ActionWatcher.tick();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
EventQueue.invokeLater(new Runnable() {
|
|
||||||
@Override public void run() {
|
|
||||||
ActionControl.tick();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
EventQueue.invokeLater(new Runnable() {
|
|
||||||
@Override public void run() {
|
|
||||||
HardwareResetTimers.tick();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
for (final Player object : PanelBuilder.getInstancedObjects().getObjects()) {
|
|
||||||
EventQueue.invokeLater(new Runnable() {
|
|
||||||
@Override public void run() {
|
|
||||||
object.tick();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
EventQueue.invokeLater(new Runnable() {
|
|
||||||
@Override public void run() {
|
|
||||||
CollisionHandler.tick();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
EventQueue.invokeLater(new Runnable() {
|
|
||||||
@Override public void run() {
|
|
||||||
StatusPanelAdder.tick();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// alles was animiert wird hier rein (paints)
|
// alles was animiert wird hier rein (paints)
|
||||||
|
|||||||
@@ -1,16 +1,23 @@
|
|||||||
package de.heatup.ui;
|
package de.heatup.ui;
|
||||||
|
|
||||||
|
import java.awt.EventQueue;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
|
import de.heatup.highscore.ScoreEntry;
|
||||||
|
import de.heatup.logging.Logger;
|
||||||
|
import de.heatup.mapengine.CollisionHandler;
|
||||||
import de.heatup.mapengine.MapEngine;
|
import de.heatup.mapengine.MapEngine;
|
||||||
import de.heatup.mapengine.SpawnAssistant;
|
import de.heatup.mapengine.SpawnAssistant;
|
||||||
import de.heatup.objects.ImageLoader;
|
import de.heatup.objects.ImageLoader;
|
||||||
import de.heatup.objects.InstancedObjects;
|
import de.heatup.objects.InstancedObjects;
|
||||||
import de.heatup.objects.Opponent;
|
import de.heatup.objects.Opponent;
|
||||||
import de.heatup.objects.Player;
|
import de.heatup.objects.Player;
|
||||||
|
import de.heatup.timers.HardwareResetTimers;
|
||||||
import de.heatup.ui.actionPanel.ActionControl;
|
import de.heatup.ui.actionPanel.ActionControl;
|
||||||
|
import de.heatup.ui.actionPanel.ActionWatcher;
|
||||||
|
|
||||||
public class PanelBuilder {
|
public class PanelBuilder {
|
||||||
private static JPanel actionPanel;
|
private static JPanel actionPanel;
|
||||||
@@ -20,17 +27,66 @@ public class PanelBuilder {
|
|||||||
|
|
||||||
public static KeyBindings kb;
|
public static KeyBindings kb;
|
||||||
|
|
||||||
public static Player player01;
|
private static Player player01;
|
||||||
|
|
||||||
private static InstancedObjects instancedObjects;
|
private static InstancedObjects instancedObjects;
|
||||||
private static ImageLoader imageLoader;
|
private static ImageLoader imageLoader;
|
||||||
|
|
||||||
|
private static int gameState = 2; /* 1=menu; 2=game running */
|
||||||
|
private static boolean gameLoaded = false;
|
||||||
|
|
||||||
public static InstancedObjects getInstancedObjects() {
|
public static InstancedObjects getInstancedObjects() {
|
||||||
return instancedObjects;
|
return instancedObjects;
|
||||||
}
|
}
|
||||||
|
public static Player getPlayer() {
|
||||||
|
return player01;
|
||||||
|
}
|
||||||
|
public static void toMenu() {
|
||||||
|
|
||||||
|
}
|
||||||
public static void tick() {
|
public static void tick() {
|
||||||
|
switch (gameState) {
|
||||||
|
case 1:
|
||||||
|
Logger.write("Menu tick");
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
EventQueue.invokeLater(new Runnable() {
|
||||||
|
@Override public void run() {
|
||||||
|
ActionWatcher.tick();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
EventQueue.invokeLater(new Runnable() {
|
||||||
|
@Override public void run() {
|
||||||
|
ActionControl.tick();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
EventQueue.invokeLater(new Runnable() {
|
||||||
|
@Override public void run() {
|
||||||
|
HardwareResetTimers.tick();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
for (final Player object : PanelBuilder.getInstancedObjects().getObjects()) {
|
||||||
|
EventQueue.invokeLater(new Runnable() {
|
||||||
|
@Override public void run() {
|
||||||
|
object.tick();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
EventQueue.invokeLater(new Runnable() {
|
||||||
|
@Override public void run() {
|
||||||
|
CollisionHandler.tick();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
EventQueue.invokeLater(new Runnable() {
|
||||||
|
@Override public void run() {
|
||||||
|
StatusPanelAdder.tick();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Logger.write("Invalid gameState");
|
||||||
|
System.exit(-1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setPanels(JPanel actionPanel, JPanel outerPanel, JPanel statusPanel, JPanel gamePanel) {
|
public static void setPanels(JPanel actionPanel, JPanel outerPanel, JPanel statusPanel, JPanel gamePanel) {
|
||||||
@@ -86,12 +142,27 @@ public class PanelBuilder {
|
|||||||
}
|
}
|
||||||
me.addAllToPanel(gamePanel);
|
me.addAllToPanel(gamePanel);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Highscore tests
|
||||||
|
*/
|
||||||
|
|
||||||
|
// for (ScoreEntry score : me.getHighscoreHandler().getHighscores(me.getMapHash())) {
|
||||||
|
// Logger.write(score.getName()+" "+score.getScore());
|
||||||
|
// }
|
||||||
|
// me.getHighscoreHandler().setHighscore(me.getMapHash(), "Daniel", 3134);
|
||||||
|
// me.getHighscoreHandler().saveHighscores();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ende Highscore tests
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
for (Player movingObject : instancedObjects.getObjects()) {
|
for (Player movingObject : instancedObjects.getObjects()) {
|
||||||
Point spawnPoint = SpawnAssistant.getPathLocationOnGrid();
|
Point spawnPoint = SpawnAssistant.getPathLocationOnGrid();
|
||||||
movingObject.spawnAt(spawnPoint);
|
movingObject.spawnAt(spawnPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gameLoaded = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ public class ActionControl{
|
|||||||
resetActionPanel();
|
resetActionPanel();
|
||||||
}
|
}
|
||||||
public static void setAction(int rd){
|
public static void setAction(int rd){
|
||||||
System.out.println(" 33 "+Thread.currentThread());
|
|
||||||
setKeyA();
|
setKeyA();
|
||||||
if(rd==1){
|
if(rd==1){
|
||||||
option=1;
|
option=1;
|
||||||
@@ -112,7 +111,7 @@ public class ActionControl{
|
|||||||
}else{
|
}else{
|
||||||
resetActionPanel();
|
resetActionPanel();
|
||||||
actionLabel.setText("Manipulation erfolgreich!");
|
actionLabel.setText("Manipulation erfolgreich!");
|
||||||
HardewareManipulate.setHardware(MapGrid.getGridCell(Main.player01.getGridLocation().x, Main.player01.getGridLocation().y).getCorrespondingHardwareToTrigger());
|
HardewareManipulate.setHardware(MapGrid.getGridCell(Main.getPlayer().getGridLocation().x, Main.getPlayer().getGridLocation().y).getCorrespondingHardwareToTrigger());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private static void setAchiv(){
|
private static void setAchiv(){
|
||||||
|
|||||||
@@ -19,16 +19,16 @@ public class ActionWatcher{
|
|||||||
}
|
}
|
||||||
public static void tick(){
|
public static void tick(){
|
||||||
//Infotext, wenn man in der n�he von einem Hardwareteil steht
|
//Infotext, wenn man in der n�he von einem Hardwareteil steht
|
||||||
if(MapGrid.getGridCell(Main.player01.getGridLocation().x, Main.player01.getGridLocation().y).isTrigger() && !action && !setAction){
|
if(MapGrid.getGridCell(Main.getPlayer().getGridLocation().x, Main.getPlayer().getGridLocation().y).isTrigger() && !action && !setAction){
|
||||||
infoText=true;
|
infoText=true;
|
||||||
if(!HardewareManipulate.getHardware(MapGrid.getGridCell(Main.player01.getGridLocation().x, Main.player01.getGridLocation().y).getCorrespondingHardwareToTrigger())){
|
if(!HardewareManipulate.getHardware(MapGrid.getGridCell(Main.getPlayer().getGridLocation().x, Main.getPlayer().getGridLocation().y).getCorrespondingHardwareToTrigger())){
|
||||||
ActionControl.setTextforA();
|
ActionControl.setTextforA();
|
||||||
}else{
|
}else{
|
||||||
ActionControl.setTextforManipulate();
|
ActionControl.setTextforManipulate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Entfernt InfoText
|
//Entfernt InfoText
|
||||||
if(!MapGrid.getGridCell(Main.player01.getGridLocation().x, Main.player01.getGridLocation().y).isTrigger() && infoText){
|
if(!MapGrid.getGridCell(Main.getPlayer().getGridLocation().x, Main.getPlayer().getGridLocation().y).isTrigger() && infoText){
|
||||||
ActionControl.resetActionPanel();
|
ActionControl.resetActionPanel();
|
||||||
infoText=false;
|
infoText=false;
|
||||||
}
|
}
|
||||||
@@ -39,7 +39,7 @@ public class ActionWatcher{
|
|||||||
ActionControl.setAction(new Random().nextInt(2)+1);
|
ActionControl.setAction(new Random().nextInt(2)+1);
|
||||||
}
|
}
|
||||||
//Entfernt jeglichen Text wenn man sich von dem Hardwarest�ck entfernt, nachdem Aktion bereits eingeleitet wurde, und setzt Booleans/Counter wieder auf die Ausgangssituation
|
//Entfernt jeglichen Text wenn man sich von dem Hardwarest�ck entfernt, nachdem Aktion bereits eingeleitet wurde, und setzt Booleans/Counter wieder auf die Ausgangssituation
|
||||||
if(!MapGrid.getGridCell(Main.player01.getGridLocation().x, Main.player01.getGridLocation().y).isTrigger() && setAction){
|
if(!MapGrid.getGridCell(Main.getPlayer().getGridLocation().x, Main.getPlayer().getGridLocation().y).isTrigger() && setAction){
|
||||||
ActionControl.resetActionPanel();
|
ActionControl.resetActionPanel();
|
||||||
ActionControl.resetKeyA();
|
ActionControl.resetKeyA();
|
||||||
infoText=false;
|
infoText=false;
|
||||||
|
|||||||
Reference in New Issue
Block a user