-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainer.java
More file actions
90 lines (69 loc) · 1.77 KB
/
Mainer.java
File metadata and controls
90 lines (69 loc) · 1.77 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
package MemoryGrid;
import java.util.Scanner;
import java.awt.Dimension;
import javax.swing.JFrame;
import java.io.*;
import java.awt.*;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.awt.event.WindowAdapter;
public class Mainer {
public static void main(String args[]) throws IOException
{
//Just a message
System.out.println("Hello,Welcome to the GAME.Enjoy yourself");
//Initializing the Game System and a User
GameSystem GS= new GameSystem();
User u=new User();
//Getting game info
File Sysfile = new File("./src/MemoryGrid/Database/Systeminfo.txt");
Scanner sc = new Scanner(Sysfile);
GameSystem.no_of_users=sc.nextInt();
sc.close();
//Login process start
GS.L.main(u);
if (GS.L.usertype==1)
{
GameSystem.no_of_users+=1;
GS.reflect_data(u);
}
//Login process end
int i=0;
while (true)
{
i=GS.m.main(u);
if(i==4) //Quit condition
{
break;
}
Thread t= new Thread();
GameWindow b = new GameWindow();
b.begin(u,t);
b.setPreferredSize(new Dimension(Grid.dimension,Grid.dimension));
b.setLocation(400,40);
//b.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
b.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
b.dispose();
synchronized(t)
{
t.notify();
}
}
});
b.pack();
b.setVisible(true);
System.out.println("over");
synchronized(t) {
try {
t.wait();
} catch (InterruptedException e) {
//.
}
}
System.out.println("double over");
}
}
}