disconnect logic and world clear logic added
git-svn-id: svn://anubis/gvsu@103 45c1a28c-8058-47b2-ae61-ca45b979098e
This commit is contained in:
parent
262753ed65
commit
e8b697c75f
@ -27,16 +27,6 @@ public class BlobWars extends JFrame
|
||||
|
||||
m_serverUpdates = new Vector<String>();
|
||||
m_world = new BlobWarsWorld();
|
||||
/* TODO: REMOVE */
|
||||
m_world.addPlayer("Alice");
|
||||
m_world.getPlayer("Alice").health = 0.8;
|
||||
m_world.addPlayer("Bob the Bad");
|
||||
m_world.getPlayer("Bob the Bad").health = 0.6;
|
||||
m_world.addPlayer("Jo");
|
||||
m_world.getPlayer("Jo").health = 0.4;
|
||||
m_world.addPlayer("Triskaidekaphobia");
|
||||
m_world.getPlayer("Triskaidekaphobia").health = 0.2;
|
||||
/* END TODO */
|
||||
|
||||
m_handler = new EventHandler();
|
||||
m_panel = new BlobWarsPanel(this, m_world);
|
||||
@ -105,6 +95,7 @@ public class BlobWars extends JFrame
|
||||
m_connectButton.setEnabled(true);
|
||||
m_nameField.setEnabled(true);
|
||||
m_serverField.setEnabled(true);
|
||||
m_world.clear();
|
||||
}
|
||||
|
||||
private class ClientHandler implements Runnable
|
||||
@ -138,9 +129,12 @@ public class BlobWars extends JFrame
|
||||
m_serverUpdates.add(line);
|
||||
}
|
||||
}
|
||||
/* TODO: disconnected logic */
|
||||
System.out.println("client disconnected");
|
||||
// SwingUtilities .... doDisconnect();
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run()
|
||||
{
|
||||
doDisconnect();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,12 @@ public class BlobWarsWorld
|
||||
m_shots = new HashMap<Integer, Shot>();
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
m_players.clear();
|
||||
m_shots.clear();
|
||||
}
|
||||
|
||||
public boolean playerExists(String name)
|
||||
{
|
||||
return m_players.containsKey(name);
|
||||
|
Loading…
x
Reference in New Issue
Block a user