-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRegionScene.java
More file actions
113 lines (99 loc) · 3.17 KB
/
RegionScene.java
File metadata and controls
113 lines (99 loc) · 3.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
package primary.scenes;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.control.Button;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.*;
import javafx.scene.text.Text;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
public class RegionScene extends SceneLoader {
@FXML
private BorderPane pane;
@FXML
private Text regionInfo;
@FXML
private Text regionTitle;
@FXML
private ImageView marketPlaceImage;
@FXML
private ImageView mapIcon;
@FXML
private Button regionBackButton = new Button("Back to Map");
@FXML
private Button enterMarket = new Button(" ");
private BackgroundImage back;
{
try {
back = new BackgroundImage(
new Image(new File("src/resources/images/map_background.jpg")
.toURI().toURL().toString()),
BackgroundRepeat.REPEAT, BackgroundRepeat.REPEAT,
BackgroundPosition.DEFAULT, BackgroundSize.DEFAULT);
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
@FXML
private void initialize() {
pane.setBackground(new Background(back));
regionScene();
}
@Override
public Parent build() {
FXMLLoader loader = new FXMLLoader();
loader.setController(this);
try {
return loader.load(new File("src/resources/RegionScene.fxml")
.toURI().toURL());
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
private void regionScene() {
/*
Title
*/
regionTitle.setText(currentLocation.getName());
regionInfo.setText(" Location: " + currentLocation.getName() + " \n"
+ " Tech Level: " + currentLocation.getTechLevel() + " \n"
+ " Coordinates: " + "(X:" + currentLocation.getxCoordinate()
+ " | Y:" + currentLocation.getyCoordinate() + ")" + " \n"
+ " Description: " + currentLocation.getDescription() + " \n");
/*
Tile Pane with options
*/
//every tile/option is a stack pane with the icon and blank
// button on top, everything inside a VBox
//the top of the VBox has the icon, the bottom has the title
/*
Icon resources.images
*/
/*
Graphics
*/
int iconSize = 100;
marketPlaceImage.fitHeightProperty().setValue(iconSize);
marketPlaceImage.fitWidthProperty().setValue(iconSize);
mapIcon.fitHeightProperty().setValue(iconSize);
mapIcon.fitWidthProperty().setValue(iconSize);
regionBackButton.setOnAction(e -> {
try {
setStage(new MapScene());
} catch (Throwable f) {
f.printStackTrace();
}
});
enterMarket.setOnAction(e -> {
try {
setStage(new MarketScene());
} catch (Throwable f) {
f.printStackTrace();
}
});
}
}