[Commit] RRClient ChangeLog, 1.2, 1.3 RRClient.java, 1.15, 1.16 RRMessages.java, 1.1, 1.2 RRNetIn.java, 1.5, 1.6

Keith Packard commit at keithp.com
Wed Jan 7 22:14:15 PST 2004


Committed by: keithp

Update of /local/src/CVS/RRClient
In directory home.keithp.com:/tmp/cvs-serv26254

Modified Files:
	ChangeLog RRClient.java RRMessages.java RRNetIn.java 
Log Message:
	* RRClient.java: (RRClient.main):
	* RRMessages.java: (RRMessages.message):
	* RRNetIn.java: (RRNetIn.TimerHandler),
	(RRNetIn.TimerHandler.match), (RRNetIn), (RRNetIn.UserHandler),
	(RRNetIn.UserHandler.match), (RRNetIn.JoinHandler),
	(RRNetIn.JoinHandler.match), (RRNetIn.PartHandler),
	(RRNetIn.PartHandler.match), (RRNetIn.DefaultHandler.match):
	Add bunches of new commands


Index: ChangeLog
===================================================================
RCS file: /local/src/CVS/RRClient/ChangeLog,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ChangeLog	8 Jan 2004 05:17:27 -0000	1.2
+++ ChangeLog	8 Jan 2004 06:14:13 -0000	1.3
@@ -1,5 +1,16 @@
 2004-01-07  Keith Packard  <keithp at keithp.com>
 
+	* RRClient.java: (RRClient.main):
+	* RRMessages.java: (RRMessages.message):
+	* RRNetIn.java: (RRNetIn.TimerHandler),
+	(RRNetIn.TimerHandler.match), (RRNetIn), (RRNetIn.UserHandler),
+	(RRNetIn.UserHandler.match), (RRNetIn.JoinHandler),
+	(RRNetIn.JoinHandler.match), (RRNetIn.PartHandler),
+	(RRNetIn.PartHandler.match), (RRNetIn.DefaultHandler.match):
+	Add bunches of new commands
+
+2004-01-07  Keith Packard  <keithp at keithp.com>
+
 	* RRBoard.java: (RRBoard.moveRobot):
 	Allow missing robots (happens during reset)
 	* RRNetIn.java: (RRNetIn.ResetHandler.match):

Index: RRClient.java
===================================================================
RCS file: /local/src/CVS/RRClient/RRClient.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- RRClient.java	8 Jan 2004 06:07:44 -0000	1.15
+++ RRClient.java	8 Jan 2004 06:14:13 -0000	1.16
@@ -90,6 +90,19 @@
 	
 	buttonPanel.add(nextButton);
 	
+	/* Zap timer button */
+	class ZapListener implements ActionListener {
+	    public void actionPerformed (ActionEvent e) {
+		ctl.netout.nobid ();
+	    }
+	}
+	ZapListener zap_listener = new ZapListener();
+	
+	Button zapButton = new Button ("Zap Timer");
+	zapButton.addActionListener (zap_listener);
+	
+	buttonPanel.add(zapButton);
+	
 	/* Quit button */
 	class QuitListener implements ActionListener {
 	    public void actionPerformed (ActionEvent e) {

Index: RRMessages.java
===================================================================
RCS file: /local/src/CVS/RRClient/RRMessages.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- RRMessages.java	8 Jan 2004 04:48:46 -0000	1.1
+++ RRMessages.java	8 Jan 2004 06:14:13 -0000	1.2
@@ -21,4 +21,7 @@
     public void message (String user, String message) {
 	this.append (user + ": " + message + "\n");
     }
+    public void message (String message) {
+	this.append (message);
+    }
 }

Index: RRNetIn.java
===================================================================
RCS file: /local/src/CVS/RRClient/RRNetIn.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- RRNetIn.java	8 Jan 2004 04:51:04 -0000	1.5
+++ RRNetIn.java	8 Jan 2004 06:14:13 -0000	1.6
@@ -173,15 +173,63 @@
 	}
     }
 
+    class TimerHandler implements NoticeHandler {
+	public boolean match(String[] notice) {
+	    if (notice.length != 3 ||
+		!notice[0].equals("NOTICE") ||
+		!notice[1].equals("TIMER"))
+		return false;
+	    ctl.messages.message (notice[2]);
+	    ctl.messages.message (" seconds remaining\n");
+	    return true;
+	}
+    }
+
+    class UserHandler implements NoticeHandler {
+	public boolean match(String[] notice) {
+	    if (notice.length != 3 ||
+		!notice[0].equals("NOTICE") ||
+		!notice[1].equals("USER"))
+		return false;
+	    ctl.messages.message (notice[2]);
+	    ctl.messages.message (" has connected to the server.\n");
+	    return true;
+	}
+    }
+    
+    class JoinHandler implements NoticeHandler {
+	public boolean match(String[] notice) {
+	    if (notice.length != 3 ||
+		!notice[0].equals("NOTICE") ||
+		!notice[1].equals("JOIN"))
+		return false;
+	    ctl.messages.message (notice[2]);
+	    ctl.messages.message (" has joined the game.\n");
+	    return true;
+	}
+    }
+    
+    class PartHandler implements NoticeHandler {
+	public boolean match(String[] notice) {
+	    if (notice.length != 3 ||
+		!notice[0].equals("NOTICE") ||
+		!notice[1].equals("PART"))
+		return false;
+	    ctl.messages.message (notice[2]);
+	    ctl.messages.message (" has left the game.\n");
+	    return true;
+	}
+    }
+    
     class DefaultHandler implements NoticeHandler {
 	public boolean match(String[] notice) {
 	    if (notice.length > 0)
-		System.out.print(notice[0]);
+		ctl.messages.message (notice[0]);
 	    for (int i = 1; i < notice.length; i++) {
-		System.out.print(' ');
-		System.out.print(notice[i]);
+		ctl.messages.message (" ");
+		ctl.messages.message (notice[i]);
 	    }
-	    System.out.println();
+	    ctl.messages.message ("\n");
 	    return true;
 	}
     }
@@ -195,6 +243,10 @@
 	new DoneHandler(),
 	new ResetHandler(),
 	new MessageHandler(),
+	new TimerHandler(),
+	new UserHandler (),
+	new JoinHandler(),
+	new PartHandler(),
 	new DefaultHandler()
     };
 




More information about the Commit mailing list