-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy paths1controller.java
More file actions
164 lines (124 loc) · 3.52 KB
/
Copy paths1controller.java
File metadata and controls
164 lines (124 loc) · 3.52 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
package hello.pages;
import java.io.IOException;
import hello.ExceptionClass;
import hello.Main;
import hello.pages.s2controller;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Border;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.Pane;
import javafx.scene.shape.Line;
import javafx.scene.control.Button;
public class s1controller extends AnchorPane
{
ObservableList<String> lst =FXCollections.observableArrayList("2 Player Game","3 Player Game","4 Player Game","5 Player Game","6 Player Game","7 Player Game","8 Player Game");
static String a =Integer.toString(Main.num_players);
static String init=a+" Player Game";
static int num=0;
public static Button undo;
@FXML
private AnchorPane subroots1;
@FXML
private ComboBox<String> nplayers;
@FXML
private Button PLay1;
@FXML
private Button PLay2;
@FXML
private Button Resume;
@FXML
private Button Aboutgame;
@FXML
private Button Settings;
@FXML
private Button Oneplayer;
@FXML
private void aboutgame() throws IOException
{
AnchorPane a1=FXMLLoader.load(Main.class.getResource("pages/s11.fxml"));
subroots1.getChildren().setAll(a1);
}
@FXML
private void resumegame() throws IOException, ClassNotFoundException, ExceptionClass
{
// to_serialize obj=Main.deserialize("1");
// AnchorPane a1=FXMLLoader.load(Main.class.getResource("pages/top1.fxml"));
// s2controller obj1=new s2controller();
try
{
Main obj=new Main();
obj.resumeGame();
}
catch(ExceptionClass e)
{
System.out.println(e.getMessage());
}
}
@FXML
public void settings() throws IOException
{
AnchorPane a1=FXMLLoader.load(Main.class.getResource("pages/s2.fxml"));
subroots1.getChildren().setAll(a1);
}
@FXML
private void initialize() throws IOException, ClassNotFoundException
{
int a=Main.give_num_player();
if(a!=0)
{
init=Integer.toString(a)+ " Player Game";
num=a-2;
}
nplayers.setItems(lst);
nplayers.setValue(init);
}
@FXML
private void todo() throws IOException
{
init=nplayers.getSelectionModel().getSelectedItem();
// Main obj=new Main();
num=nplayers.getSelectionModel().getSelectedIndex();
// System.out.println(num);
Main.num_players=num+2;
Main.give_obj();
}
@FXML
public void play1() throws IOException
{
AnchorPane a1=FXMLLoader.load(Main.class.getResource("pages/top.fxml"));
s2controller obj1=new s2controller();
Main obj=new Main();
obj.play1(undo,a1,num,obj1.red,obj1.green,obj1.blue,6,9);
}
@FXML
public void play2( ) throws IOException
{
AnchorPane a1=FXMLLoader.load(Main.class.getResource("pages/top1.fxml"));
s2controller obj1=new s2controller();
Main obj=new Main();
obj.play1(undo,a1,num,obj1.red,obj1.green,obj1.blue,10,15);
}
@FXML
private void oneplayer() throws IOException
{
Main obj=new Main();
obj.oneplayer();
}
// @FXML
// public void play2(AnchorPane a2) throws IOException
// {
//
//
// AnchorPane a1=FXMLLoader.load(Main.class.getResource("pages/top.fxml"));
// a2.getChildren().setAll(a1);
// Main obj=new Main();
// obj.play1(a1);
// }
}