• 大小: 5.78MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-09-26
  • 语言: 其他
  • 标签: 中国象棋  源码  

资源简介

中国象棋程序,功能比较简单。包含联网对战,悔棋等功能,必要的注释,重命名类、函数、变量的名字,提高了可读性。 特别说明:这个版本的功能比较弱,用户体验也很差,bug也不少。 主要用来学习用,如果有兴趣,可以自行完善。

资源截图

代码片段和文件信息

/**
 * 项目名称: FansChineseChess
 * 版本号:1.0
 * 名字:雷文
 * 博客: http://FansUnion.cn
 * 邮箱: leiwen@FansUnion.cn
 * QQ:240-370-818
 * 版权:通过Email和QQ等渠道通知我后,则拥有一切权力,包括修改-重新发布等。 
 * 
 */
package cn.fansunion.chinesechess;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.InputEvent;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.NotSerializableException;
import java.io.objectInputStream;
import java.io.objectOutputStream;
import java.net.Socket;
import java.util.linkedList;

import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFileChooser;
import javax.swing.Jframe;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTextArea;
import javax.swing.KeyStroke;
import javax.swing.SwingConstants;
import javax.swing.border.titledBorder;

import cn.fansunion.chinesechess.core.ChessBoard;
import cn.fansunion.chinesechess.core.MoveRecord;
import cn.fansunion.chinesechess.ui.Demo;
import cn.fansunion.chinesechess.ui.MakeChessManual;
import cn.fansunion.chinesechess.util.Constants;
import cn.fansunion.chinesechess.util.DataPacket;
import cn.fansunion.chinesechess.util.ChessUtils;
import cn.fansunion.chinesechess.util.Message;

/**
 * 中国象棋客户端
 * 
 * @author leiwen@fansunion.cnhttp://FansUnion.cn
 *         http://blog.csdn.net/FansUnion
 * 
 */
public class ChessClient extends Jframe implements Constants
ActionListener {

private static final long serialVersionUID = 101L;

private JPanel control;

// 开始、暂停、悔棋、认输、发送消息按钮
private JButton start undo pauseOrContinue giveIn send;

ChessBoard board = null;

Demo demo = null;

MakeChessManual records = null;

JComboBox msgComboBox;

Container container = null;

// 菜单及其选项
JMenuBar bar;

JMenu fileMenu;

JMenuItem newGame saveGame loadGame exitGame;

JMenu settingMenu;

JMenuItem setting;

JMenu helpMenu;

JMenuItem helpContent aboutGame;

JMenu chattingMenu;

JMenuItem chatting;

JFileChooser fileChooser = null;

linkedList moveRecords = null;

// 游戏状态
JLabel gameStatus;

// 组合框中的备选消息
String[] initialMsg = { “见到您真高兴啊“ “快点吧,我等到花都谢了“ “您的棋走得太好了“ “下次再玩吧,我要走了“ };

public JTextArea msgArea;// 便于访问

public ChessClient(String petName) {
// 构造菜单
bar = new JMenuBar();
fileMenu = new JMenu(“中国象棋(G)“);

newGame = new JMenuItem(“新游戏“);
saveGam

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-09-28 16:54  XiangQi\
     目录           0  2013-09-09 09:45  XiangQi\XiangQi\
     目录           0  2013-09-07 20:33  XiangQi\XiangQi\.metadata\
     文件       15536  2013-09-09 09:53  XiangQi\XiangQi\.metadata\.log
     目录           0  2013-09-07 20:33  XiangQi\XiangQi\.metadata\.mylyn\
     目录           0  2012-04-15 22:19  XiangQi\XiangQi\.metadata\.mylyn\contexts\
     文件         438  2012-04-15 22:21  XiangQi\XiangQi\.metadata\.mylyn\repositories.xml.zip
     目录           0  2013-09-09 10:48  XiangQi\XiangQi\.metadata\.plugins\
     目录           0  2013-09-09 09:43  XiangQi\XiangQi\.metadata\.plugins\com.collabnet.subversion.merge\
     目录           0  2013-09-09 09:43  XiangQi\XiangQi\.metadata\.plugins\com.collabnet.subversion.merge\MergeResults\
     目录           0  2013-09-09 09:43  XiangQi\XiangQi\.metadata\.plugins\org.eclipse.core.resources\
     目录           0  2013-09-09 10:49  XiangQi\XiangQi\.metadata\.plugins\org.eclipse.core.resources\.history\
     目录           0  2013-09-09 10:36  XiangQi\XiangQi\.metadata\.plugins\org.eclipse.core.resources\.history\0\
     文件        1499  2013-09-09 10:32  XiangQi\XiangQi\.metadata\.plugins\org.eclipse.core.resources\.history\0\209dc29df81800131346c053eb084607
     目录           0  2013-09-09 10:15  XiangQi\XiangQi\.metadata\.plugins\org.eclipse.core.resources\.history\11\
     文件         517  2013-09-09 10:14  XiangQi\XiangQi\.metadata\.plugins\org.eclipse.core.resources\.history\11\40b167a4f51800131346c053eb084607
     目录           0  2013-09-09 09:55  XiangQi\XiangQi\.metadata\.plugins\org.eclipse.core.resources\.history\15\
     文件         371  2013-09-09 09:54  XiangQi\XiangQi\.metadata\.plugins\org.eclipse.core.resources\.history\15\608817d8f21800131346c053eb084607
     目录           0  2013-09-09 10:19  XiangQi\XiangQi\.metadata\.plugins\org.eclipse.core.resources\.history\16\
     文件         764  2013-09-09 10:18  XiangQi\XiangQi\.metadata\.plugins\org.eclipse.core.resources\.history\16\8037c435f61800131346c053eb084607
     目录           0  2013-09-09 09:54  XiangQi\XiangQi\.metadata\.plugins\org.eclipse.core.resources\.history\17\
     文件        2360  2013-09-09 09:47  XiangQi\XiangQi\.metadata\.plugins\org.eclipse.core.resources\.history\17\30397dc5f11800131346c053eb084607
     文件        3178  2011-12-28 18:22  XiangQi\XiangQi\.metadata\.plugins\org.eclipse.core.resources\.history\17\606484b2f21800131346c053eb084607
     目录           0  2013-09-09 09:55  XiangQi\XiangQi\.metadata\.plugins\org.eclipse.core.resources\.history\19\
     文件        1470  2013-09-09 09:54  XiangQi\XiangQi\.metadata\.plugins\org.eclipse.core.resources\.history\19\02d985f1f21800131346c053eb084607
     目录           0  2013-09-09 09:56  XiangQi\XiangQi\.metadata\.plugins\org.eclipse.core.resources\.history\1b\
     文件        1504  2013-09-09 09:54  XiangQi\XiangQi\.metadata\.plugins\org.eclipse.core.resources\.history\1b\a0cd0212f31800131346c053eb084607
     目录           0  2013-09-09 10:26  XiangQi\XiangQi\.metadata\.plugins\org.eclipse.core.resources\.history\1d\
     文件        4516  2013-09-09 10:08  XiangQi\XiangQi\.metadata\.plugins\org.eclipse.core.resources\.history\1d\109d8c6ef51800131346c053eb084607
     文件        1152  2013-09-09 10:26  XiangQi\XiangQi\.metadata\.plugins\org.eclipse.core.resources\.history\1d\20c33d49f71800131346c053eb084607
     文件        3011  2011-12-28 18:22  XiangQi\XiangQi\.metadata\.plugins\org.eclipse.core.resources\.history\1d\80ee7ab2f21800131346c053eb084607
............此处省略573个文件信息

评论

共有 条评论