From a5e4e32d6e912f3e9b7e50449c565930638ba616 Mon Sep 17 00:00:00 2001 From: jrtechs Date: Sun, 3 Jun 2018 11:54:44 -0400 Subject: [PATCH] Updated sizes of second generation nodes --- .../java/net/jrtechs/www/server/Client.java | 21 ++++++++++++++----- website/graph.html | 4 ++-- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/main/java/net/jrtechs/www/server/Client.java b/src/main/java/net/jrtechs/www/server/Client.java index 8e09553..7c8cea5 100644 --- a/src/main/java/net/jrtechs/www/server/Client.java +++ b/src/main/java/net/jrtechs/www/server/Client.java @@ -64,13 +64,13 @@ public class Client extends Thread * * @param p */ - private void sendNodeAdd(Player p, int x, int y) + private void sendNodeAdd(Player p, int x, int y, int size) { JSONObject request = new JSONObject(); request.put("action", 1); request.put("id", p.getId()); request.put("name", p.getName()); - + request.put("size", size); request.put("x", x); request.put("y", y); @@ -126,7 +126,7 @@ public class Client extends Thread { if(gen == 1) { - sendNodeAdd(p, x, y); + sendNodeAdd(p, x, y, 150); } List friends = p.fetchFriends(); @@ -137,8 +137,19 @@ public class Client extends Thread for(Player friend: friends) { - this.sendNodeAdd(friend, (int)(x + Math.cos(currentStep) * - (multiplier/gen)), (int)(y + Math.sin(currentStep) * (multiplier/gen))); + if(gen == 1) + { + this.sendNodeAdd(friend, (int)(x + Math.cos(currentStep) * + (multiplier/gen)), (int)(y + Math.sin(currentStep) * + (multiplier/gen)), 150); + } + else + { + this.sendNodeAdd(friend, (int)(x + Math.cos(currentStep) * + (multiplier/gen)), (int)(y + Math.sin(currentStep) * + (multiplier/gen)), 30); + } + this.sendEdgeAdd(p, friend); diff --git a/website/graph.html b/website/graph.html index f5973a3..d256d6c 100644 --- a/website/graph.html +++ b/website/graph.html @@ -191,7 +191,7 @@ label: request.name, x: request.x, y: request.y, - size: Math.random(), + size: request.size, color: colors[Math.floor(Math.random() * colors.length)] }); s.refresh(); @@ -205,7 +205,7 @@ id: request.id, source: request.p1, target: request.p2, - size: Math.random(), + size: 1 }); s.refresh(); }