|
|
@@ -1,9 +1,12 @@
|
|
|
package gui.simulator;
|
|
|
|
|
|
import gui.simulator.Images.ImageType;
|
|
|
+import gui.simulator.facilities.Fence;
|
|
|
+import gui.simulator.facilities.PalmTree1;
|
|
|
import gui.simulator.facilities.RestRoom;
|
|
|
import gui.simulator.facilities.SimulatorStage;
|
|
|
import gui.simulator.facilities.SnackBar;
|
|
|
+import gui.simulator.facilities.Tree1;
|
|
|
import gui.simulator.facilities.WayPoint;
|
|
|
|
|
|
import java.awt.BasicStroke;
|
|
|
@@ -28,10 +31,11 @@ public class Sidebar implements Serializable {
|
|
|
private Terrain terrain;
|
|
|
private LinkedHashMap<String, DrawEngine> drawableStages = new LinkedHashMap<String, DrawEngine>();
|
|
|
private LinkedHashMap<String, DrawEngine> drawableFacilities = new LinkedHashMap<String, DrawEngine>();
|
|
|
+ private LinkedHashMap<String, DrawEngine> drawableOrnaments = new LinkedHashMap<String, DrawEngine>();
|
|
|
private LinkedHashMap<String, Images.ImageType> drawablePaths = new LinkedHashMap<String, Images.ImageType>();
|
|
|
private ArrayList<LinkedHashMap<String, DrawEngine>> drawableArrays = new ArrayList<LinkedHashMap<String, DrawEngine>>();
|
|
|
public enum SideBarTab{
|
|
|
- STAGES(0), FACILITIES(1), PATHS(2);
|
|
|
+ STAGES(0), FACILITIES(1), ORNAMENTS(2), PATHS(3);
|
|
|
|
|
|
public final int value;
|
|
|
SideBarTab(int value){
|
|
|
@@ -91,11 +95,15 @@ public class Sidebar implements Serializable {
|
|
|
drawablePaths.put("Ground-stone", Images.ImageType.PathGroundStone);
|
|
|
drawablePaths.put("Dirt", Images.ImageType.PathDirt);
|
|
|
drawablePaths.put("Stone", Images.ImageType.PathStone);
|
|
|
-
|
|
|
- //drawablePaths.add("My awesome path name", new AwesomePath());
|
|
|
+
|
|
|
+ //ornaments
|
|
|
+ drawableOrnaments.put("Tree1", new Tree1(0, 0, 0.7, 1, this.terrain));
|
|
|
+ drawableOrnaments.put("PalmTree1", new PalmTree1(0, 0, 0.7, 1, this.terrain));
|
|
|
+ drawableOrnaments.put("Fence", new Fence(0, 0, 0.4, 1, this.terrain));
|
|
|
|
|
|
drawableArrays.add(drawableStages);
|
|
|
drawableArrays.add(drawableFacilities);
|
|
|
+ drawableArrays.add(drawableOrnaments);
|
|
|
}
|
|
|
|
|
|
public void draw(Graphics2D g2){
|
|
|
@@ -108,7 +116,8 @@ public class Sidebar implements Serializable {
|
|
|
g2.fill3DRect(0, 0, sideBarWidth, 30, true);
|
|
|
g2.fill3DRect(tab1X, 30, tabWidth, 30, true);
|
|
|
g2.fill3DRect(tab2X, 30, tabWidth, 30, true);
|
|
|
- g2.fill3DRect(tab3X, 30, tabWidth, 30, true);
|
|
|
+ g2.fill3DRect(tab3X, 30, tabWidth, 30, true);
|
|
|
+ g2.fill3DRect(0, 60, sideBarWidth, 30, true);
|
|
|
g2.setColor(Color.WHITE);
|
|
|
g2.setFont(new Font("SansSerif", Font.BOLD, 20));
|
|
|
//g2.drawString(str, x, y);
|
|
|
@@ -117,6 +126,7 @@ public class Sidebar implements Serializable {
|
|
|
g2.drawString("Stages", tab1X+10, 50);
|
|
|
g2.drawString("Facilities", tab2X+3, 50);
|
|
|
g2.drawString("Paths", tab3X+15, 50);
|
|
|
+ g2.drawString("Ornaments", sideBarWidth/3, 80);
|
|
|
switch (currentTab) {
|
|
|
case STAGES:
|
|
|
g2.drawLine(tab1X+10, 55, tab1X+60, 55);
|
|
|
@@ -127,6 +137,9 @@ public class Sidebar implements Serializable {
|
|
|
case PATHS:
|
|
|
g2.drawLine(tab3X+15, 55, tab3X+55, 55);
|
|
|
break;
|
|
|
+ case ORNAMENTS:
|
|
|
+ g2.drawLine(sideBarWidth/3, 85, (sideBarWidth/3)+80, 85);
|
|
|
+ break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
@@ -134,7 +147,7 @@ public class Sidebar implements Serializable {
|
|
|
//draw objects
|
|
|
g2.setColor(Color.BLACK);
|
|
|
int objectPlacementX = 0;
|
|
|
- int objectPlacementY = 61;
|
|
|
+ int objectPlacementY = 91;
|
|
|
|
|
|
if(currentTab == SideBarTab.PATHS){
|
|
|
for(Entry<String, ImageType> object : drawablePaths.entrySet()){
|
|
|
@@ -152,6 +165,8 @@ public class Sidebar implements Serializable {
|
|
|
for(Entry<String, DrawEngine> object : drawableArrays.get(currentTab.getValue()).entrySet()){
|
|
|
object.getValue().setX(objectPlacementX);
|
|
|
object.getValue().setY(objectPlacementY);
|
|
|
+ if(object.getValue().getFacilityName() == "Fence")
|
|
|
+ object.getValue().setY(objectPlacementY+50);
|
|
|
object.getValue().draw(g2);
|
|
|
g2.drawString(object.getKey(), objectPlacementX+2, objectPlacementY + 95);
|
|
|
g2.drawRect(objectPlacementX, objectPlacementY, sideBarWidth/2, 100);
|
|
|
@@ -188,6 +203,9 @@ public class Sidebar implements Serializable {
|
|
|
currentTab = SideBarTab.PATHS;
|
|
|
}
|
|
|
}
|
|
|
+ if(e.getY() > 60 && e.getY() < 90){
|
|
|
+ currentTab = SideBarTab.ORNAMENTS;
|
|
|
+ }
|
|
|
//check for object selection
|
|
|
int objectPlacementX = 0;
|
|
|
int objectPlacementY = 61;
|