Skip to content

Commit

Permalink
Merge pull request #13 from AdvancedProgrammingSUT2022/aqaDanial
Browse files Browse the repository at this point in the history
Aqa danial
  • Loading branch information
Danial-Gharib authored Apr 18, 2022
2 parents e73ef73 + a9dbbb3 commit 365a399
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 22 deletions.
8 changes: 4 additions & 4 deletions src/main/java/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ public static void main(String[] args){
GameMenu gameMenu = new GameMenu(scanner , new GameMenuController());

while(MenuName.getCurrentMenu() != MenuName.TERMINATE) {
LoginMenu.run();
MainMenu.run();
ProfileMenu.run();
GameMenu.run();
loginMenu.run();
mainMenu.run();
profileMenu.run();
gameMenu.run();
}
System.out.println("khaste nabashi ayoub jan!");
}
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/View/GameMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@
import java.util.Scanner;
import java.util.regex.Matcher;

public class GameMenu{
public class GameMenu extends Menu{
private final GameMenuController gameMenuController;
private static Scanner scanner;

public GameMenu(Scanner scanner, GameMenuController gameMenuController){
super(scanner);
this.gameMenuController = gameMenuController;
GameMenu.scanner = scanner;
}

public static void run() {
public void run() {
String input;
Matcher matcher;

Expand Down
7 changes: 3 additions & 4 deletions src/main/java/View/LoginMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@
import java.util.Scanner;
import java.util.regex.Matcher;

public class LoginMenu {
public class LoginMenu extends Menu{

private final LoginMenuController loginMenuController;
private static Scanner scanner;
public LoginMenu(Scanner scanner , LoginMenuController loginMenuController) {
LoginMenu.scanner = scanner;
super(scanner);
this.loginMenuController = loginMenuController;
}

public static void run() {
public void run() {
String input;
Matcher matcher;

Expand Down
10 changes: 5 additions & 5 deletions src/main/java/View/MainMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
import java.util.Scanner;
import java.util.regex.Matcher;

public class MainMenu {
public class MainMenu extends Menu{
private final MainMenuController mainMenuController;
private static Scanner scanner;

public MainMenu(Scanner scanner , MainMenuController mainMenuController) {
MainMenu.scanner = scanner;
super(scanner);
this.mainMenuController = mainMenuController;
}

public static void run() {
public void run() {
String input;
Matcher matcher;

while (MenuName.getCurrentMenu() == MenuName.MAIN_MENU) {
input = scanner.nextLine();
//TODO commands!
}
}
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/View/Menu.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package View;

import java.util.Scanner;
import java.util.regex.Matcher;

public abstract class Menu {

protected Scanner scanner;
public abstract void run();

public Menu(Scanner scanner) {this.scanner = scanner;}
}
15 changes: 10 additions & 5 deletions src/main/java/View/ProfileMenu.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
package View;

import Controller.menu.ProfileMenuController;

import Enum.MenuName;
import java.util.Scanner;
import java.util.regex.Matcher;

public class ProfileMenu {
public class ProfileMenu extends Menu{
private final ProfileMenuController profileMenuController;
private static Scanner scanner;
public ProfileMenu(Scanner scanner, ProfileMenuController profileMenuController){
ProfileMenu.scanner = scanner;
super(scanner);
this.profileMenuController = profileMenuController;
}

public static void run() {

public void run() {
String input;
Matcher matcher;
while (MenuName.getCurrentMenu() == MenuName.PROFILE_MENU) {
input = scanner.nextLine();
}
}
}

0 comments on commit 365a399

Please sign in to comment.