📄 message.java
字号:
import java.io.Serializable;
/*
* 创建日期 2005-7-23
*
* TODO 要更改此生成的文件的模板,请转至
* 窗口 - 首选项 - Java - 代码样式 - 代码模板
*/
/**
* @author 叶少伟 TODO 要更改此生成的类型注释的模板,请转至 窗口 - 首选项 - Java - 代码样式 - 代码模板
*/
public class Message implements Serializable
{
public static final int STRING = 1;
public static final int CONTROL = 2;
public static final int PLAYER = 3;
public static final int NUMBER = 4;
public static final int PLAYERCARDS = 5;
public static final int LASTCARDS = 6;
private int type;
private Object content;
private int [] number = new int [3];
private String [] playerNames = new String [17];
private String [] lastNames = new String [3];
public Message(int t, Object c)
{
this.type = t;
this.content = c;
}
public Message(int [] n)
{
this.type = Message.NUMBER;
this.number = n;
}
public Message(int t, PKCard [] c)
{
this.type = t;
if(t == Message.PLAYERCARDS)
{
for(int i = 0; i < 17; i++)
{
playerNames[i] = c[i].getCardName();
}
}
else if(t == Message.LASTCARDS)
{
for(int i = 0; i < 3; i++)
{
lastNames[i] = c[i].getCardName();
}
}
}
public int getType()
{
return this.type;
}
public PKCard [] getPlayerCards()
{
PKCard [] cards = new PKCard [17];
for(int i = 0; i < 17; i++)
{
cards[i] = new PKCard(playerNames[i]);
}
return cards;
}
public PKCard [] getLastCards()
{
PKCard [] cards = new PKCard [3];
for(int i = 0; i < 3; i++)
{
cards[i] = new PKCard(lastNames[i]);
}
return cards;
}
public int [] getNumber()
{
return number;
}
public Object getContent()
{
return this.content;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -