-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMonopoly.java
More file actions
115 lines (108 loc) · 2.9 KB
/
Monopoly.java
File metadata and controls
115 lines (108 loc) · 2.9 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
package final_project;
import java.util.Scanner;
public class Monopoly {
public static void main (String[] args) {
Windows windows = new Windows();
windows.setVisible(true);
gameProcedure(windows);
}
public static void gameProcedure(Windows windows) {
while(windows.end == false) {
while(true) {
sleep(100);
if(!windows.gameinfo_jl.isVisible()) {
windows.rule_jb.setVisible(true);
break;
}
}
for(windows.currentRole_ID = 0; windows.currentRole_ID <= 3; windows.currentRole_ID++) {
if(windows.isout[windows.currentRole_ID]) {
continue;
}
windows.isroundover = false;
windows.continue_jb.setVisible(true);
while(true) {
sleep(100);
if(windows.iscontinue) {
windows.iscontinue = false;
break;
}
}
windows.alert_jl.setText("輪到玩家"+ (windows.currentRole_ID+1) + "了!");
if(windows.rest[windows.currentRole_ID] != 0) { //檢查玩家是否需要休息
windows.rest[windows.currentRole_ID] -= 1;
windows.continue_jb.setVisible(true);
while(true) {
sleep(100);
if(windows.iscontinue) {
windows.iscontinue = false;
break;
}
}
if(windows.rest[windows.currentRole_ID] != 0) {
windows.alert_jl.setText("這回合要休息哦~還要休息"+ windows.rest[windows.currentRole_ID] + "回合" );
}else {
windows.alert_jl.setText("這回合要休息哦~下回合就換你嘍" );
}
windows.isroundover = true;
}else {
//擲骰子
windows.continue_jb.setVisible(true);
while(true) {
sleep(100);
if(windows.iscontinue) {
windows.iscontinue = false;
break;
}
}
if(windows.isprop) {
windows.alert_jl.setText("請選擇是否兌換道具");
windows.exchange_jb.setVisible(true);
windows.cancel_jb.setVisible(true);
while(true) {
sleep(100);
if(windows.iscancel || windows.isexchange) {
if(windows.isexchange) {
windows.continue_jb.setVisible(true);
while(true) {
sleep(100);
if(windows.iscontinue) {
windows.iscontinue = false;
break;
}
}
}
windows.iscancel = false;
windows.isexchange = false;
break;
}
}
windows.dice_jb.setVisible(true);
windows.alert_jl.setText("請點擊骰骰子按鈕進行擲骰子");
}
else if(windows.isclassic) {
windows.dice_jb.setVisible(true);
windows.alert_jl.setText("請點擊骰骰子按鈕進行擲骰子");
}
}
while(true) {
sleep(100);
if(windows.isroundover) {
break;
}
}
//遊戲結束判定
windows.end = windows.check_end();
if(windows.end == true) {
break;
}
}
}
}
public static void sleep(int time) {
try {
Thread.sleep(time);
} catch(Exception e) {
}
}
}