now Display's visuals are in order

This commit is contained in:
Kjistóf 2016-05-14 17:48:30 +02:00
parent 759322c6e1
commit f16571390d

View File

@ -1,8 +1,12 @@
package cicaprojekt; package cicaprojekt;
import jdk.internal.util.xml.impl.Pair;
import javax.swing.*; import javax.swing.*;
import java.awt.*;
import java.io.*; import java.io.*;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
public class Dungeon { public class Dungeon {
@ -60,6 +64,7 @@ public class Dungeon {
mapHeight = height; mapHeight = height;
Tile[][] dungeon = new Tile[height][width]; Tile[][] dungeon = new Tile[height][width];
Map<Point, AbstractDrawer> gatescalemap = new HashMap<>();
String line; String line;
Gate tempgate = new Gate(); Gate tempgate = new Gate();
@ -110,10 +115,16 @@ public class Dungeon {
case 'G': case 'G':
tile = tempgate; tile = tempgate;
AbstractDrawer vg = new GateDrawer((Gate) tile);
display.addVisual(vg);
gatescalemap.put(new Point(x, y), vg);
break; break;
case 'S': case 'S':
tile = tempscale; tile = tempscale;
AbstractDrawer vs = new ScaleDrawer((Scale) tile);
display.addVisual(vs);
gatescalemap.put(new Point(x, y), vs);
scalecount++; scalecount++;
break; break;
@ -146,12 +157,12 @@ public class Dungeon {
int triggerweight = Integer.parseInt(scaledata[4]); int triggerweight = Integer.parseInt(scaledata[4]);
Gate gate = new Gate(); Gate gate = new Gate();
display.addVisual(new GateDrawer(gate)); ((GateDrawer)gatescalemap.get(new Point(gx, gy))).setGate(gate);
gate.setY(gy); gate.setY(gy);
gate.setX(gx); gate.setX(gx);
Scale scale = new Scale(gate, triggerweight); Scale scale = new Scale(gate, triggerweight);
display.addVisual(new ScaleDrawer(scale)); ((ScaleDrawer)gatescalemap.get(new Point(sx, sy))).setScale(scale);
scale.setY(sy); scale.setY(sy);
scale.setX(sx); scale.setX(sx);