package game;
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
import dialog.*;
import net.*;
import server.*;
/**
* <p>Title: 俄罗斯方块游戏</p>
* <p>Description: 基于Internet的俄罗斯方块游戏</p>
* <p>Copyright: Copyright (c) 2005</p>
* <p>Company: WXHY/u2014ZJC</p>
* @author 赵建川
* @version 1.0
*/
/**
* 负责监听MenuBar的监听器
* 根据监听到的消息执行游戏组织者的方法
*/
public class ActionHandler implements ActionListener {
private GameFrame m_tFrame;
public ActionHandler() {
}
/**
* ActionHandler的构造器
* @param tframe 游戏的组织类
*/
public ActionHandler(GameFrame tframe) {
m_tFrame=tframe;
}
/**
*回调方法
* @param e 事件
*/
public void actionPerformed(ActionEvent e)
{
String sCommand = e.getActionCommand();
if (sCommand.equals("开始")) { m_tFrame.startGame();}
else if (sCommand.equals("暂停")) { m_tFrame.pauseGame();}
else if (sCommand.equals("结束")) { m_tFrame.endGame();}
else if (sCommand.equals("关闭")) { m_tFrame.exitGame();}
else if (sCommand.equals("设置级别")) { m_tFrame.setLevel();}
else if (sCommand.equals("创建游戏")) { m_tFrame.createGame();}
else if (sCommand.equals("加入游戏")) { m_tFrame.addGame();}
else if (sCommand.equals("退出游戏")) { m_tFrame.exitConn();}
else if (sCommand.equals("记录")) { m_tFrame.seeRecord();}
else if (sCommand.equals("关于")) { m_tFrame.seeAbout();}
}
}
游戏代码部分-------game包------ActionHandler.java
最新推荐文章于 2021-03-04 08:05:24 发布