Skip to content

Commit 17fd2be

Browse files
committed
Last Commit :")
1 parent 7d7d313 commit 17fd2be

12 files changed

Lines changed: 101 additions & 34 deletions

File tree

src/main/java/Network/Responses/Battle/MatchmakingResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public void handleRequest() {
2525
Server.getLoggedInUsers().get(Server.getOneRoundGames().get(0)).getUsername(),
2626
trueRequest.getNumberOfRounds(),
2727
false);
28-
//Math.random() % 1 == 1 ? true : false); // TODO: a simple coin toss by the server!
28+
//Math.random() % 1 == 1 ? true : false); // TODO: a simple coin toss by the server!
2929
StartOnlineDuelResponse response = new StartOnlineDuelResponse(startOnlineDuelRequest);
3030
response.handleRequest();
3131
String username = ((StartOnlineDuelRequest) response.getRequest()).getOpponentUsername();

src/main/java/view/LoginView.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import Network.Responses.Response;
99
import com.jfoenix.controls.JFXPasswordField;
1010
import com.jfoenix.controls.JFXTextField;
11+
import controller.RegisterController;
1112
import javafx.fxml.FXML;
1213
import javafx.scene.control.Label;
1314
import javafx.scene.input.MouseEvent;
@@ -70,7 +71,11 @@ public void login(MouseEvent event) {
7071
}
7172
Request request = new LoginRequest(username, password);
7273
Client.getInstance().sendData(request.toString());
73-
// RegisterController.getInstance().loginUser(username, password);
74+
try {
75+
RegisterController.getInstance().loginUser(username, password);
76+
} catch (Exception e) {
77+
e.printStackTrace();
78+
}
7479
}
7580

7681
public boolean loginResponse(Response response) {

src/main/java/view/MainView.java

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,23 @@
22

33
import Network.Client.Client;
44
import Network.Requests.Account.LogoutRequest;
5-
import Network.Server.Server;
65
import controller.RegisterController;
76
import javafx.animation.FadeTransition;
87
import javafx.animation.KeyFrame;
98
import javafx.animation.Timeline;
109
import javafx.fxml.FXML;
10+
import javafx.scene.control.Alert;
1111
import javafx.scene.image.Image;
12-
import javafx.scene.image.ImageView;
1312
import javafx.scene.input.MouseEvent;
1413
import javafx.scene.layout.Pane;
1514
import javafx.scene.paint.Color;
1615
import javafx.scene.paint.ImagePattern;
1716
import javafx.scene.shape.Rectangle;
1817
import javafx.util.Duration;
19-
import org.apache.commons.logging.Log;
2018
import view.transions.Lighting;
2119

22-
import java.awt.*;
2320
import java.time.LocalDateTime;
2421
import java.util.Random;
25-
import java.util.Timer;
2622

2723
public class MainView implements GraphicalView {
2824
Pane mainPane;
@@ -119,16 +115,30 @@ private void startProfileView() {
119115
}
120116

121117
@FXML
122-
private void startGamePreview() { ViewSwitcher.switchTo(View.PRE_GAME); }
118+
private void startGamePreview() {
119+
ViewSwitcher.switchTo(View.PRE_GAME);
120+
}
123121

124122
@FXML
125-
private void startChatView() { ViewSwitcher.switchTo(View.CHAT); }
123+
private void startChatView() {
124+
ViewSwitcher.switchTo(View.CHAT);
125+
}
126126

127127
@FXML
128128
public void startCardCreator(MouseEvent event) {
129129
ViewSwitcher.switchTo(View.CARD_CREATOR);
130130
}
131131

132132
@FXML
133-
public void startAdminView(MouseEvent mouseEvent) { ViewSwitcher.switchTo(View.ADMIN_PANEL);}
133+
public void startAdminView(MouseEvent mouseEvent) {
134+
if (RegisterController.onlineUser.getUsername().equals("a"))
135+
ViewSwitcher.switchTo(View.ADMIN_PANEL);
136+
else
137+
new MyAlert(Alert.AlertType.ERROR,"you are not Admin bro").show();
138+
}
139+
140+
@FXML
141+
public void startTv(MouseEvent mouseEvent) {
142+
ViewSwitcher.switchTo(View.TV);
143+
}
134144
}

src/main/java/view/TView.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package view;
2+
3+
import javafx.scene.input.MouseEvent;
4+
import javafx.scene.media.Media;
5+
import javafx.scene.media.MediaPlayer;
6+
import javafx.scene.media.MediaView;
7+
8+
public class TView {
9+
10+
public MediaView mediaView;
11+
MediaPlayer mediaPlayer;
12+
13+
public void initialize() {
14+
Media media = new Media(getClass().getResource("/Assets/YuGiOhGx.mp4").toExternalForm());
15+
mediaPlayer = new MediaPlayer(media);
16+
mediaPlayer.setCycleCount(MediaPlayer.INDEFINITE);
17+
mediaView.setMediaPlayer(mediaPlayer);
18+
mediaPlayer.play();
19+
}
20+
21+
public void back(MouseEvent mouseEvent) {
22+
mediaPlayer.stop();
23+
ViewSwitcher.switchTo(View.MAIN);
24+
}
25+
}

src/main/java/view/View.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ public enum View {
1313
GAME_VIEW("GameView.fxml"),
1414
CARD_CREATOR("card_creator.fxml"),
1515
CHAT("chat.fxml"),
16-
ADMIN_PANEL("admin_panel.fxml");
17-
16+
ADMIN_PANEL("admin_panel.fxml"),
17+
TV("tv.fxml");
1818
private String fileName;
1919

2020
View(String fileName) {

src/main/resources/view/Main.fxml

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,48 +4,52 @@
44
<?import javafx.scene.layout.AnchorPane?>
55
<?import javafx.scene.layout.VBox?>
66
<?import java.net.URL?>
7-
<AnchorPane xmlns="http://javafx.com/javafx"
8-
xmlns:fx="http://javafx.com/fxml"
9-
fx:controller="view.MainView"
10-
prefHeight="720.0" prefWidth="1366.0" styleClass="main">
7+
<AnchorPane prefHeight="720.0" prefWidth="1366.0" styleClass="main" xmlns="http://javafx.com/javafx/16"
8+
xmlns:fx="http://javafx.com/fxml/1" fx:controller="view.MainView">
119
<stylesheets>
1210
<URL value="@main.css"/>
1311
</stylesheets>
1412
<VBox spacing="10" translateX="40" translateY="50">
15-
<ImageView fitWidth="237" fitHeight="99" styleClass="button" onMouseClicked="#startGamePreview">
13+
<ImageView fitHeight="99" fitWidth="237" onMouseClicked="#startGamePreview" styleClass="button">
1614
<Image url="@duelbox.png"/>
1715
</ImageView>
18-
<ImageView fitWidth="237" fitHeight="99" styleClass="button" onMouseClicked="#startScoreboardView">
16+
<ImageView fitHeight="99" fitWidth="237" onMouseClicked="#startScoreboardView" styleClass="button">
1917
<Image url="@scoreboardbox.png"/>
2018
</ImageView>
21-
<ImageView fitWidth="237" fitHeight="99" styleClass="button" onMouseClicked="#startDeckView">
19+
<ImageView fitHeight="99" fitWidth="237" onMouseClicked="#startDeckView" styleClass="button">
2220
<Image url="@deckbox.png"/>
2321
</ImageView>
24-
<ImageView fitWidth="237" fitHeight="99" styleClass="button" onMouseClicked="#startProfileView">
22+
<ImageView fitHeight="99" fitWidth="237" onMouseClicked="#startProfileView" styleClass="button">
2523
<Image url="@profilebox.png"/>
2624
</ImageView>
27-
<ImageView fitWidth="237" fitHeight="99" styleClass="button" onMouseClicked="#startImportExportView">
25+
<ImageView fitHeight="99" fitWidth="237" onMouseClicked="#startImportExportView" styleClass="button">
2826
<Image url="@importexportbox.png"/>
2927
</ImageView>
30-
<ImageView fitWidth="90" fitHeight="90" translateX="810" translateY="-20" styleClass="button"
31-
onMouseClicked="#startCardCreator">
28+
<ImageView fitHeight="90" fitWidth="90" onMouseClicked="#startCardCreator" styleClass="button" translateX="810"
29+
translateY="-20">
3230
<Image url="@hammer.png"/>
3331
</ImageView>
34-
<ImageView fitWidth="90" fitHeight="90" translateX="1190" translateY="-120" styleClass="button"
35-
onMouseClicked="#logout">
32+
<ImageView fitHeight="90" fitWidth="90" onMouseClicked="#logout" styleClass="button" translateX="1190"
33+
translateY="-120">
3634
<Image url="@icons8-shutdown-80.png"/>
3735
</ImageView>
38-
<ImageView fitWidth="90" fitHeight="90" translateX="1080" translateY="-220" styleClass="button"
39-
onMouseClicked="#startAdminView">
36+
<ImageView fitHeight="90" fitWidth="90" onMouseClicked="#startAdminView" styleClass="button" translateX="1080"
37+
translateY="-220">
4038
<Image url="@admin.png"/>
4139
</ImageView>
42-
<ImageView fitWidth="110" fitHeight="110" translateX="940" translateY="-330" styleClass="button"
43-
onMouseClicked="#startShopView">
40+
<ImageView fitHeight="110" fitWidth="110" onMouseClicked="#startShopView" styleClass="button" translateX="940"
41+
translateY="-330">
4442
<Image url="@icons8-buy-100.png"/>
4543
</ImageView>
46-
<ImageView fitWidth="100" fitHeight="99" translateX="670" translateY="-440" styleClass="button"
47-
onMouseClicked="#startChatView">
44+
<ImageView fitHeight="99.0" fitWidth="101.0" onMouseClicked="#startChatView" styleClass="button"
45+
translateX="670" translateY="-440">
4846
<Image url="@Chat.png"/>
4947
</ImageView>
5048
</VBox>
49+
<ImageView fitHeight="90.0" fitWidth="90.0" layoutX="593.0" layoutY="585.0" onMouseClicked="#startTv"
50+
styleClass="button">
51+
<image>
52+
<Image url="@TV.png"/>
53+
</image>
54+
</ImageView>
5155
</AnchorPane>

src/main/resources/view/TV.png

129 KB
Loading

src/main/resources/view/tv.fxml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<?import javafx.scene.control.Button?>
4+
<?import javafx.scene.image.Image?>
5+
<?import javafx.scene.image.ImageView?>
6+
<?import javafx.scene.layout.AnchorPane?>
7+
<?import javafx.scene.media.MediaView?>
8+
9+
<AnchorPane prefHeight="720.0" prefWidth="1366.0" style="-fx-background-color: white;" stylesheets="@game.css" xmlns="http://javafx.com/javafx/16" xmlns:fx="http://javafx.com/fxml/1" fx:controller="view.TView">
10+
<children>
11+
<AnchorPane layoutX="345.0" layoutY="8.0" prefHeight="700.0" prefWidth="700.0">
12+
<children>
13+
<ImageView fitHeight="700.0" fitWidth="700.0" pickOnBounds="true" preserveRatio="true">
14+
<image>
15+
<Image url="@tv.jpg" />
16+
</image>
17+
</ImageView>
18+
<MediaView fx:id="mediaView" fitHeight="280.0" fitWidth="280.0" layoutX="210.0" layoutY="175.0" />
19+
</children>
20+
</AnchorPane>
21+
<Button layoutX="180.0" layoutY="316.0" mnemonicParsing="false" onMouseClicked="#back" text="BACK" />
22+
</children>
23+
</AnchorPane>

src/main/resources/view/tv.jpg

51.3 KB
Loading
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
[{"amount":40,"isAllowed":true,"cardName":"Battle OX"},{"amount":40,"isAllowed":false,"cardName":"Axe Raider"},{"amount":40,"isAllowed":true,"cardName":"Yomi Ship"},{"amount":39,"isAllowed":true,"cardName":"Horn Imp"},{"amount":40,"isAllowed":true,"cardName":"Silver Fang"},{"amount":40,"isAllowed":true,"cardName":"Suijin"},{"amount":40,"isAllowed":true,"cardName":"Fireyarou"},{"amount":40,"isAllowed":true,"cardName":"Curtain of the dark ones"},{"amount":40,"isAllowed":true,"cardName":"Feral Imp"},{"amount":40,"isAllowed":true,"cardName":"Dark magician"},{"amount":40,"isAllowed":true,"cardName":"Wattkid"},{"amount":40,"isAllowed":true,"cardName":"Baby dragon"},{"amount":40,"isAllowed":true,"cardName":"Hero of the east"},{"amount":40,"isAllowed":true,"cardName":"Battle warrior"},{"amount":40,"isAllowed":true,"cardName":"Crawling dragon"},{"amount":40,"isAllowed":true,"cardName":"Flame manipulator"},{"amount":40,"isAllowed":true,"cardName":"Blue-Eyes white dragon"},{"amount":40,"isAllowed":true,"cardName":"Crab Turtle"},{"amount":40,"isAllowed":true,"cardName":"Skull Guardian"},{"amount":40,"isAllowed":true,"cardName":"Slot Machine"},{"amount":40,"isAllowed":true,"cardName":"Haniwa"},{"amount":40,"isAllowed":true,"cardName":"Man-Eater Bug"},{"amount":39,"isAllowed":true,"cardName":"Gate Guardian"},{"amount":40,"isAllowed":true,"cardName":"Scanner"},{"amount":40,"isAllowed":true,"cardName":"Bitron"},{"amount":40,"isAllowed":true,"cardName":"Marshmallon"},{"amount":40,"isAllowed":true,"cardName":"Beast King Barbaros"},{"amount":40,"isAllowed":true,"cardName":"Texchanger"},{"amount":40,"isAllowed":true,"cardName":"Leotron "},{"amount":40,"isAllowed":true,"cardName":"The Calculator"},{"amount":40,"isAllowed":true,"cardName":"Alexandrite Dragon"},{"amount":40,"isAllowed":true,"cardName":"Mirage Dragon"},{"amount":40,"isAllowed":true,"cardName":"Herald of Creation"},{"amount":40,"isAllowed":true,"cardName":"Exploder Dragon"},{"amount":40,"isAllowed":true,"cardName":"Warrior Dai Grepher"},{"amount":40,"isAllowed":true,"cardName":"Dark Blade"},{"amount":40,"isAllowed":true,"cardName":"Wattaildragon"},{"amount":40,"isAllowed":true,"cardName":"Terratiger, the Empowered Warrior"},{"amount":40,"isAllowed":true,"cardName":"The Tricky"},{"amount":40,"isAllowed":true,"cardName":"Spiral Serpent"},{"amount":40,"isAllowed":true,"cardName":"Command Knight"},{"amount":40,"isAllowed":true,"cardName":"Trap Hole"},{"amount":40,"isAllowed":true,"cardName":"Mirror Force"},{"amount":40,"isAllowed":true,"cardName":"Magic Cylinder"},{"amount":40,"isAllowed":true,"cardName":"Mind Crush"},{"amount":40,"isAllowed":true,"cardName":"Torrential Tribute"},{"amount":40,"isAllowed":true,"cardName":"Time Seal"},{"amount":40,"isAllowed":true,"cardName":"Negate Attack"},{"amount":40,"isAllowed":true,"cardName":"Solemn Warning"},{"amount":40,"isAllowed":true,"cardName":"Magic Jammer"},{"amount":40,"isAllowed":true,"cardName":"Call of The Haunted"},{"amount":40,"isAllowed":true,"cardName":"Vanity\u0027s Emptiness"},{"amount":40,"isAllowed":true,"cardName":"Wall of Revealing Light"},{"amount":40,"isAllowed":true,"cardName":"Monster Reborn"},{"amount":40,"isAllowed":true,"cardName":"Terraforming"},{"amount":40,"isAllowed":true,"cardName":"Pot of Greed"},{"amount":40,"isAllowed":true,"cardName":"Raigeki"},{"amount":40,"isAllowed":true,"cardName":"Change of Heart"},{"amount":40,"isAllowed":true,"cardName":"Swords of Revealing Light"},{"amount":40,"isAllowed":true,"cardName":"Harpie\u0027s Feather Duster"},{"amount":40,"isAllowed":true,"cardName":"Dark Hole"},{"amount":40,"isAllowed":true,"cardName":"Supply Squad"},{"amount":40,"isAllowed":true,"cardName":"Spell Absorption"},{"amount":40,"isAllowed":true,"cardName":"Messenger of peace"},{"amount":40,"isAllowed":true,"cardName":"Twin Twisters"},{"amount":40,"isAllowed":true,"cardName":"Mystical space typhoon"},{"amount":40,"isAllowed":true,"cardName":"Ring of defense"},{"amount":40,"isAllowed":true,"cardName":"Yami"},{"amount":40,"isAllowed":true,"cardName":"Forest"},{"amount":40,"isAllowed":true,"cardName":"Closed Forest"},{"amount":40,"isAllowed":true,"cardName":"Umiiruka"},{"amount":40,"isAllowed":true,"cardName":"Sword of dark destruction"},{"amount":40,"isAllowed":true,"cardName":"Black Pendant"},{"amount":40,"isAllowed":true,"cardName":"United We Stand"},{"amount":40,"isAllowed":true,"cardName":"Magnum Shield"},{"amount":40,"isAllowed":true,"cardName":"Advanced Ritual Art"}]
1+
[{"amount":40,"isAllowed":true,"cardName":"Battle OX"},{"amount":10,"isAllowed":true,"cardName":"Axe Raider"},{"amount":40,"isAllowed":true,"cardName":"Yomi Ship"},{"amount":39,"isAllowed":true,"cardName":"Horn Imp"},{"amount":40,"isAllowed":true,"cardName":"Silver Fang"},{"amount":40,"isAllowed":true,"cardName":"Suijin"},{"amount":40,"isAllowed":true,"cardName":"Fireyarou"},{"amount":40,"isAllowed":true,"cardName":"Curtain of the dark ones"},{"amount":40,"isAllowed":true,"cardName":"Feral Imp"},{"amount":40,"isAllowed":true,"cardName":"Dark magician"},{"amount":40,"isAllowed":true,"cardName":"Wattkid"},{"amount":40,"isAllowed":true,"cardName":"Baby dragon"},{"amount":40,"isAllowed":true,"cardName":"Hero of the east"},{"amount":40,"isAllowed":true,"cardName":"Battle warrior"},{"amount":40,"isAllowed":true,"cardName":"Crawling dragon"},{"amount":40,"isAllowed":true,"cardName":"Flame manipulator"},{"amount":40,"isAllowed":true,"cardName":"Blue-Eyes white dragon"},{"amount":40,"isAllowed":true,"cardName":"Crab Turtle"},{"amount":40,"isAllowed":true,"cardName":"Skull Guardian"},{"amount":40,"isAllowed":true,"cardName":"Slot Machine"},{"amount":40,"isAllowed":true,"cardName":"Haniwa"},{"amount":40,"isAllowed":true,"cardName":"Man-Eater Bug"},{"amount":39,"isAllowed":true,"cardName":"Gate Guardian"},{"amount":40,"isAllowed":true,"cardName":"Scanner"},{"amount":40,"isAllowed":true,"cardName":"Bitron"},{"amount":40,"isAllowed":true,"cardName":"Marshmallon"},{"amount":40,"isAllowed":true,"cardName":"Beast King Barbaros"},{"amount":40,"isAllowed":true,"cardName":"Texchanger"},{"amount":40,"isAllowed":true,"cardName":"Leotron "},{"amount":40,"isAllowed":true,"cardName":"The Calculator"},{"amount":40,"isAllowed":true,"cardName":"Alexandrite Dragon"},{"amount":40,"isAllowed":true,"cardName":"Mirage Dragon"},{"amount":40,"isAllowed":true,"cardName":"Herald of Creation"},{"amount":40,"isAllowed":true,"cardName":"Exploder Dragon"},{"amount":40,"isAllowed":true,"cardName":"Warrior Dai Grepher"},{"amount":40,"isAllowed":true,"cardName":"Dark Blade"},{"amount":40,"isAllowed":true,"cardName":"Wattaildragon"},{"amount":40,"isAllowed":true,"cardName":"Terratiger, the Empowered Warrior"},{"amount":40,"isAllowed":true,"cardName":"The Tricky"},{"amount":40,"isAllowed":true,"cardName":"Spiral Serpent"},{"amount":40,"isAllowed":true,"cardName":"Command Knight"},{"amount":40,"isAllowed":true,"cardName":"Trap Hole"},{"amount":40,"isAllowed":true,"cardName":"Mirror Force"},{"amount":40,"isAllowed":true,"cardName":"Magic Cylinder"},{"amount":40,"isAllowed":true,"cardName":"Mind Crush"},{"amount":40,"isAllowed":true,"cardName":"Torrential Tribute"},{"amount":40,"isAllowed":true,"cardName":"Time Seal"},{"amount":40,"isAllowed":true,"cardName":"Negate Attack"},{"amount":40,"isAllowed":true,"cardName":"Solemn Warning"},{"amount":40,"isAllowed":true,"cardName":"Magic Jammer"},{"amount":40,"isAllowed":true,"cardName":"Call of The Haunted"},{"amount":40,"isAllowed":true,"cardName":"Vanity\u0027s Emptiness"},{"amount":40,"isAllowed":true,"cardName":"Wall of Revealing Light"},{"amount":40,"isAllowed":true,"cardName":"Monster Reborn"},{"amount":40,"isAllowed":true,"cardName":"Terraforming"},{"amount":40,"isAllowed":true,"cardName":"Pot of Greed"},{"amount":40,"isAllowed":true,"cardName":"Raigeki"},{"amount":40,"isAllowed":true,"cardName":"Change of Heart"},{"amount":40,"isAllowed":true,"cardName":"Swords of Revealing Light"},{"amount":40,"isAllowed":true,"cardName":"Harpie\u0027s Feather Duster"},{"amount":40,"isAllowed":true,"cardName":"Dark Hole"},{"amount":40,"isAllowed":true,"cardName":"Supply Squad"},{"amount":40,"isAllowed":true,"cardName":"Spell Absorption"},{"amount":40,"isAllowed":true,"cardName":"Messenger of peace"},{"amount":40,"isAllowed":true,"cardName":"Twin Twisters"},{"amount":40,"isAllowed":true,"cardName":"Mystical space typhoon"},{"amount":40,"isAllowed":true,"cardName":"Ring of defense"},{"amount":40,"isAllowed":true,"cardName":"Yami"},{"amount":40,"isAllowed":true,"cardName":"Forest"},{"amount":40,"isAllowed":true,"cardName":"Closed Forest"},{"amount":40,"isAllowed":true,"cardName":"Umiiruka"},{"amount":40,"isAllowed":true,"cardName":"Sword of dark destruction"},{"amount":40,"isAllowed":true,"cardName":"Black Pendant"},{"amount":40,"isAllowed":true,"cardName":"United We Stand"},{"amount":40,"isAllowed":true,"cardName":"Magnum Shield"},{"amount":40,"isAllowed":true,"cardName":"Advanced Ritual Art"}]

0 commit comments

Comments
 (0)