-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSettings.java
More file actions
221 lines (181 loc) · 3.92 KB
/
Settings.java
File metadata and controls
221 lines (181 loc) · 3.92 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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
package MemoryGrid;
import java.util.Scanner;
import java.io.*;
public class Settings {
Scanner scan= new Scanner(System.in);
public String description="This module is used to chnage the settings of the game";
public void changepassword(User u) throws IOException
{
Authentication auth= new Authentication();
String pass1;
String pass2;
System.out.println("Enter new pasword");
pass1=scan.nextLine();
System.out.println("retype new password");
pass2=scan.nextLine();
if (pass1.equals(pass2))
{
auth.validate_password(pass1);
if (auth.result!=-1)
{
System.out.println("password already taken");
return;
}
else
{
auth.validate_password(u.password);
DB_Accessor.setpassword(auth.result+1, pass1);
return;
}
}
else
{
System.out.println("passwords does not match");
}
System.out.println("here");
return;
}
public void changediff()
{
String difficulty;
System.out.println("Enter 1 for easy");
System.out.println("Enter 2 for moderate");
System.out.println("Enter 3 for hard");
difficulty=scan.nextLine();
boolean proceed=true;
switch(difficulty)
{
case "1":
Grid.cd=240;
if (GameSystem.theme_no==0)
{
GameSystem.theme="./src/MemoryGrid/Image_links/house_easy.txt";
}
else
{
GameSystem.theme="./src/MemoryGrid/Image_links/emoji_easy.txt";
}
break;
case "2":
Grid.cd=160;
if (GameSystem.theme_no==0)
{
GameSystem.theme="./src/MemoryGrid/Image_links/house_medium.txt";
}
else
{
GameSystem.theme="./src/MemoryGrid/Image_links/emoji_medium.txt";
}
break;
case "3":
Grid.cd=120;
if (GameSystem.theme_no==0)
{
GameSystem.theme="./src/MemoryGrid/Image_links/house_hard.txt";
}
else
{
GameSystem.theme="./src/MemoryGrid/Image_links/emoji_hard.txt";
}
break;
default:
System.out.println("Invalid input");
proceed=false;
break;
}
if (proceed)
{
changemode();
}
}
public void changemode()
{
String mode;
System.out.println("Enter c for cranky mode");
System.out.println("otherwise its in normal mode");
mode=scan.nextLine();
if (mode.equals("c"))
{
Grid.mode=1;
}
else
{
Grid.mode=0;
}
}
public void changetheme()
{
String choice;
System.out.println("Select any one of the folowing themes");
System.out.println("Enter e for emoji theme");
System.out.println("otherwise its home(default) theme");
choice=scan.nextLine();
if (choice.equals("e"))
{
GameSystem.theme_no=1;
if (Grid.cd==240)
{
GameSystem.theme="./src/MemoryGrid/Image_links/emoji_easy.txt";
}
else if (Grid.cd==160)
{
GameSystem.theme="./src/MemoryGrid/Image_links/emoji_medium.txt";
}
else
{
GameSystem.theme="./src/MemoryGrid/Image_links/emoji_hard.txt";
}
}
else
{
GameSystem.theme_no=0;
if (Grid.cd==240)
{
GameSystem.theme="./src/MemoryGrid/Image_links/house_easy.txt";
}
else if (Grid.cd==160)
{
GameSystem.theme="./src/MemoryGrid/Image_links/house_medium.txt";
}
else
{
GameSystem.theme="./src/MemoryGrid/Image_links/house_hard.txt";
}
}
}
public void main(User u) throws IOException
{
String choice;
while (true)
{
choice=" ";
System.out.println("Press 1 to change difficulty and mode");
System.out.println("Press 2 to change theme");
System.out.println("Press 3 to change password");
System.out.println("Press 4 to return to main menu");
choice =scan.nextLine();
if (choice.equals("1"))
{
changediff();
}
else if (choice.equals("2"))
{
changetheme();
}
else if (choice.equals("3"))
{
changepassword(u);
}
else if (choice.equals("4"))
{
System.out.println("Retuning to main menu...");
break;
}
else
{
System.out.println("Invalid input.try again");
}
}
return;
}
}