Skip to content

Commit

Permalink
implemented onOpen() and restructured Game.java
Browse files Browse the repository at this point in the history
  • Loading branch information
tienthedev committed Apr 15, 2024
1 parent 0e60a95 commit 381c718
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 43 deletions.
47 changes: 30 additions & 17 deletions html/match.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
width: 15rpx;
height:15px;
text-align: center;
line-height: 15px; /* Adjust the line-height */
margin: 0; /* Remove any default margin */
line-height: 15px;
margin: 0;
}
</style>
</head>
Expand All @@ -35,7 +35,6 @@
<nav class="navbar navbar-expand-sm navbar-dark container">
<a href="index.html" class="navbar-brand" ><img src="../asset/navBarIcon.png" width="200" height="70"></a>


<!-- Create ticket to fix this, doesn't respone on click -->
<!-- <button class="navbar-toggler collapsed d-flex d-lg-none flex-column justify-content-around"
type="button"
Expand All @@ -51,7 +50,6 @@
</button> -->


<div class="collapse navbar-collapse" id="toggleMobileMenu">
<ul class="navbar-nav ms-auto text-end">
<li>
Expand All @@ -66,17 +64,13 @@
<li>
<a class="nav-link" href="#contact">SUPPORT</a>
</li>


</ul>
</div>
</nav>
</div>
<div class=" custom-body h-auto">
<div id="home" class="container-fluid text-center flex-column d-flex justify-content-center align-items-center py-3"
style="height: fit-content">

<div ">
<div class="container custom-body h-auto">
<div id="home" class="container text-center d-flex justify-content-center align-items-center py-3" style="height: fit-content">
<div>
<table class="h4 table table-light">
<tr class="h3">
<td id="playerOneName">@</td>
Expand All @@ -86,15 +80,34 @@
<td id="playerTwoName">@</td>
</tr>
</table>
<p>FIND THE WORDS: <span id="wordList"></span></p>
<!-- Multi-user chat box -->
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">Chat</div>
<div class="card-body" id="chatBox">
<!-- Chat messages will be displayed here -->
</div>
<div class="card-footer">
<input type="text" class="form-control" id="chatMessage" placeholder="Type your message">
<button class="btn btn-primary mt-2" id="sendMessage">Send</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="py-3 justify-content-center text-center flex-column d-flex container" >
<p >FIND THE WORDS: <span id="wordList"></span></p>
<table class="wordSearchTable" id="wordSearchTable"></table>
<div class="container">
<div class="py-3 justify-content-center text-center flex-column d-flex container ">
<table class="wordSearchTable" id="wordSearchTable"></table>
</div>
<div class="flex"></div>
</div>
</div>


</div>

<section data-aos="fade-up" id="contact">
<div class="container-fluid custom-footer">
<div id="contact"
Expand Down Expand Up @@ -191,4 +204,4 @@
</script>
</body>

</html>
</html>
8 changes: 5 additions & 3 deletions src/main/java/com/cse3310/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ public App(int port, Draft_6455 draft){

@Override
public void onOpen(WebSocket conn, ClientHandshake handshake) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'onOpen'");
}
System.out.println("New connection opened: " + conn.getRemoteSocketAddress());
Game game = new Game();
conn.setAttachment(game);
}


@Override
public void onClose(WebSocket conn, int code, String reason, boolean remote) {
Expand Down
9 changes: 3 additions & 6 deletions src/main/java/com/cse3310/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

import java.util.ArrayList;

public class Game{
public class Game {
private ArrayList<User> users;
public int GameId;
public char[][] grid;

public Game(ArrayList words)
{
public Game() {
grid = new char[50][50];

}

public boolean checkVertical(ArrayList<User> selectedLetters, int length){
Expand All @@ -34,11 +32,10 @@ public void checkWin(User user){
}

public String keepScore(ArrayList<User> score){

return "";
}

public void Tick(){

}
}
}
Binary file removed target/classes/com/cse3310/App.class
Binary file not shown.
Binary file removed target/classes/com/cse3310/Coordinate.class
Binary file not shown.
Binary file removed target/classes/com/cse3310/Game.class
Binary file not shown.
Binary file removed target/classes/com/cse3310/HttpServer$1.class
Binary file not shown.
Binary file removed target/classes/com/cse3310/HttpServer.class
Binary file not shown.
Binary file removed target/classes/com/cse3310/Locations.class
Binary file not shown.
Binary file removed target/classes/com/cse3310/ServerEvent.class
Binary file not shown.
Binary file removed target/classes/com/cse3310/User.class
Binary file not shown.
Binary file removed target/classes/com/cse3310/UserEvent.class
Binary file not shown.

This file was deleted.

This file was deleted.

0 comments on commit 381c718

Please sign in to comment.