Browse Source

Updated sizes of second generation nodes

pull/8/head
Jeffery Russell 6 years ago
parent
commit
a5e4e32d6e
2 changed files with 18 additions and 7 deletions
  1. +16
    -5
      src/main/java/net/jrtechs/www/server/Client.java
  2. +2
    -2
      website/graph.html

+ 16
- 5
src/main/java/net/jrtechs/www/server/Client.java View File

@ -64,13 +64,13 @@ public class Client extends Thread
* *
* @param p * @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(); JSONObject request = new JSONObject();
request.put("action", 1); request.put("action", 1);
request.put("id", p.getId()); request.put("id", p.getId());
request.put("name", p.getName()); request.put("name", p.getName());
request.put("size", size);
request.put("x", x); request.put("x", x);
request.put("y", y); request.put("y", y);
@ -126,7 +126,7 @@ public class Client extends Thread
{ {
if(gen == 1) if(gen == 1)
{ {
sendNodeAdd(p, x, y);
sendNodeAdd(p, x, y, 150);
} }
List<Player> friends = p.fetchFriends(); List<Player> friends = p.fetchFriends();
@ -137,8 +137,19 @@ public class Client extends Thread
for(Player friend: friends) 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); this.sendEdgeAdd(p, friend);

+ 2
- 2
website/graph.html View File

@ -191,7 +191,7 @@
label: request.name, label: request.name,
x: request.x, x: request.x,
y: request.y, y: request.y,
size: Math.random(),
size: request.size,
color: colors[Math.floor(Math.random() * colors.length)] color: colors[Math.floor(Math.random() * colors.length)]
}); });
s.refresh(); s.refresh();
@ -205,7 +205,7 @@
id: request.id, id: request.id,
source: request.p1, source: request.p1,
target: request.p2, target: request.p2,
size: Math.random(),
size: 1
}); });
s.refresh(); s.refresh();
} }

Loading…
Cancel
Save