Skip to content

Commit

Permalink
Merge pull request #57 from gnpurvin/GUI
Browse files Browse the repository at this point in the history
fixed bugs
  • Loading branch information
sjwhyatt committed Apr 25, 2019
2 parents 4e8914c + 50ccc63 commit 5153247
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 10 deletions.
5 changes: 2 additions & 3 deletions DPS/src/Connectivity/Client.java
Expand Up @@ -273,9 +273,8 @@ private String getHostIP(){

//CALL THIS METHOD FROM GUI WHEN MAP CHANGES
public void handleSendMap(String mapStr) throws IOException {
this.sendMsg(mapStr);
System.out.println(mapStr);
System.out.println("Handlesendmap");
String cmd = mapStr + "\n";
this.serverOut.write(cmd.getBytes());
}

private void handleRecieveMap(String tokens[]) {
Expand Down
3 changes: 0 additions & 3 deletions DPS/src/Connectivity/ServerWorker.java
Expand Up @@ -55,10 +55,8 @@ public void HandleClient() throws IOException {

//loop to constantly grab input
while ((line = reader.readLine()) != null) {
System.out.println(line);
//divide the input byte array by whitespace and get commands accordingly
String[] tokens = line.split(" ");
System.out.println(tokens);

if (tokens != null && tokens.length > 0) {
String cmd = tokens[0];
Expand All @@ -72,7 +70,6 @@ public void HandleClient() throws IOException {
HandleRollDice(tokens);
} else if ("map".equalsIgnoreCase(cmd)){
HandleMap(tokens);
System.out.println("handlingthings");
} else if("tokenmove".equalsIgnoreCase(cmd)){
HandleTokenMove(tokens);
} else if (cmd.startsWith("#")) { //if # is the first character, then it's a direct message.
Expand Down
6 changes: 3 additions & 3 deletions DPS/src/GUI/PlayerSessionController.java
Expand Up @@ -148,7 +148,7 @@ public void initialize(URL url, ResourceBundle rb) {
try {
OpenMap(temp);
} catch (IOException ex) {
Logger.getLogger(PlayerSessionController.class.getName()).log(Level.SEVERE, null, ex);
System.out.println("nope");
}
});
if(mapIds.size() != 0)
Expand All @@ -161,7 +161,7 @@ public void initialize(URL url, ResourceBundle rb) {
@FXML
protected void ChatSend(ActionEvent action) throws IOException{
Player.sendMsg(ChatOut.getText());
ChatIn.setText(ChatIn.getText() + "/n" + username + ": " + ChatOut.getText());
ChatIn.setText(ChatIn.getText() + "\n" + username + ": " + ChatOut.getText());
ChatOut.clear();
}

Expand Down Expand Up @@ -368,6 +368,6 @@ public void mapLoad(String s){
Map map = mapCon.loadMap(s);
mapCon.c = MapCanvas;
mapCon.currMap = map;
mapCon.drawMap(MapCanvas);
mapCon.drawMap2(MapCanvas);
}
}
1 change: 0 additions & 1 deletion DPS/src/dps/Map.java
Expand Up @@ -255,7 +255,6 @@ public final String toString(){
}
}
}
System.out.println(dungeon);
return dungeon;
}

Expand Down
22 changes: 22 additions & 0 deletions DPS/src/dps/mapController.java
Expand Up @@ -84,7 +84,29 @@ public void drawMap(Canvas c){
}

}
public void drawMap2(Canvas c){
gc = c.getGraphicsContext2D();

//iterates across each row
for(int i = 0; i < currMap.sizeX; i++){

//iterates down each column
for(int j = 0; j < currMap.sizeY; j++){

if(this.currMap.getTileAt(i, j).getIsRoom() == true){
gc.setFill(roomColor);
}
else {
gc.setFill(wallColor);
}

gc.strokeRect((i*20), (j*20), 19, 19);
gc.fillRect((i*20), (j*20), 19, 19);

}
}

}

////////////////////////////////////////
/// Section for
Expand Down

0 comments on commit 5153247

Please sign in to comment.