Skip to content

Commit

Permalink
Client Side Almost Complete
Browse files Browse the repository at this point in the history
  • Loading branch information
pa8sa committed Jun 17, 2023
1 parent 5a98d83 commit 463c7b8
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 11 deletions.
3 changes: 2 additions & 1 deletion Files/UsersInfo.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
parsa,11111111,09036770230,elahie,[email protected],965623.0

parsa,11111111,09036770230,elahie,[email protected],0.0
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>19.0.2</version>
</dependency>
</dependencies>

<build>
Expand Down
13 changes: 6 additions & 7 deletions src/main/java/com/example/blinkfood/BankController.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,33 +57,32 @@ void Done(MouseEvent event) throws IOException {
if (NBank.Buy(NBank.getBalance(), NBank.getCost()) != -1) {
NBank.setBalance(NBank.Buy(NBank.getBalance(), NBank.getCost()));
Server.ClientHandler.EditUser(Server.user.getUserName(), NBank.getBalance());
BackMainMenu();
DoneScene();
}
}
else if (LimitedBank.isSelected()) {
Bank_Limit LBank = new Bank_Limit(TotalCost, Server.user.getBalance());
if (LBank.Buy(LBank.getBalance(), LBank.getCost()) != -1) {
LBank.setBalance(LBank.Buy(LBank.getBalance(), LBank.getCost()));
Server.ClientHandler.EditUser(Server.user.getUserName(), LBank.getBalance());
BackMainMenu();
DoneScene();
}
}
else if (TaxBank.isSelected()) {
Bank_Tax TBank = new Bank_Tax(TotalCost, Server.user.getBalance());
if (TBank.Buy(TBank.getBalance(), TBank.getCost()) != -1) {
TBank.setBalance(TBank.Buy(TBank.getBalance(), TBank.getCost()));
Server.ClientHandler.EditUser(Server.user.getUserName(), TBank.getBalance());
BackMainMenu();
DoneScene();
}
}
}

private void BackMainMenu () throws IOException {
Server.ClientHandler.ResetRestaurants();
FXMLLoader loader = new FXMLLoader(getClass().getResource("MainMenu.fxml"));
private void DoneScene () throws IOException {
FXMLLoader loader = new FXMLLoader(getClass().getResource("Done.fxml"));
Parent root = loader.load();
Stage stage = (Stage) TaxBank.getScene().getWindow();
stage.setTitle("MainMenu");
stage.setTitle("Done !");
stage.setScene(new Scene(root));
}

Expand Down
24 changes: 24 additions & 0 deletions src/main/java/com/example/blinkfood/DoneController.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,28 @@
package com.example.blinkfood;

import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.input.MouseEvent;
import javafx.stage.Stage;

import java.io.IOException;

public class DoneController {

@FXML
private Button BackButton;

@FXML
void Back(MouseEvent event) throws IOException {
Server.ClientHandler.ResetRestaurants();
FXMLLoader loader = new FXMLLoader(getClass().getResource("MainMenu.fxml"));
Parent root = loader.load();
Stage stage = (Stage) BackButton.getScene().getWindow();
stage.setTitle("MainMenu");
stage.setScene(new Scene(root));
}

}
5 changes: 2 additions & 3 deletions src/main/resources/com/example/blinkfood/Done.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>


<AnchorPane prefHeight="524.0" prefWidth="766.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.example.blinkfood.Done">
<AnchorPane prefHeight="524.0" prefWidth="766.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.example.blinkfood.DoneController">
<children>
<Text layoutX="254.0" layoutY="266.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Purchase Done !">
<font>
<Font size="36.0" />
</font>
</Text>
<Button layoutX="363.0" layoutY="422.0" mnemonicParsing="false" text="Back" />
<Button fx:id="BackButton" layoutX="363.0" layoutY="422.0" mnemonicParsing="false" onMouseClicked="#Back" text="Back" />
</children>
</AnchorPane>

0 comments on commit 463c7b8

Please sign in to comment.