Message.java
Upload User: ptnike
Upload Date: 2007-06-15
Package Size: 61k
Code Size: 2k
Development Platform:

Java

  1. import java.io.Serializable;
  2. /**
  3.  * <p>Title: </p>
  4.  * <p>Description: </p>
  5.  * <p>Copyright: Copyright (c) 2003</p>
  6.  * <p>Company: e-top</p>
  7.  * @author cylix
  8.  * @version 1.0
  9.  */
  10. /**
  11.  * message list
  12.  * type = 1 // request of connected,msg = connector's name
  13.  * type = 2 // put chessman
  14.  * type = 3 // request play with another
  15.  * type = 4 // deny a request for play
  16.  * type = 5 // agree with request
  17.  * type = 6 // send victory message
  18.  * type = 7 // send disconnection
  19.  * type = 8 // save game but not to disk,it will be lost when next start
  20.  * type = 9 // add new player to all client's player list
  21.  * type = 10// response for message type ==1
  22.  * type = 11// play with a player,msg save player's name ,game set by
  23.  *          // the one who create game
  24.  * type = 12// setting information
  25.  * type = 13// setting player color
  26.  * type = 14// msg for acceptor B to setting color and setings
  27.  * type = 15// server update message
  28.  * type = 16// send messages of control or errors
  29.  * type = 17// failed in the game
  30.  * type = 18// server socket close
  31.  * type = 19// player end a game and refresh
  32.  * tyep = 20// computer win / people win
  33.  */
  34. public class Message implements Serializable{
  35.     byte type;            // message type ,eg.1=request of connection
  36.     boolean setting;      // 是否设置禁手
  37.     int color;           // chessman color ,1 = black ,2 = white
  38.     boolean forYourTurn;  // judge whether it is for receiver's turn
  39.     int coordinateX;     // record the coordinate X from 0~14 ,save black or white
  40.     int coordinateY;     // record the coordinate Y from 0~14 ,save black or white
  41.     char[] msg;           // message body
  42.     public Message(){
  43.         setting=true;
  44.         msg = new char[50];
  45. //        StringBuffer ss = new StringBuffer(50);
  46.     }
  47. }///:-)