116 lines
4.4 KiB
Java
116 lines
4.4 KiB
Java
|
|
package extend.mj;
|
||
|
|
|
||
|
|
import java.util.Map;
|
||
|
|
|
||
|
|
import com.game.GameController;
|
||
|
|
import com.game.Global;
|
||
|
|
import com.game.MainServer;
|
||
|
|
import com.game.data.Player;
|
||
|
|
import com.game.data.Room;
|
||
|
|
import com.game.player.state.PlayerWaitState;
|
||
|
|
import com.game.room.state.RoomStartGameState;
|
||
|
|
|
||
|
|
import extend.mj.player.rulestate.PRChowState;
|
||
|
|
import extend.mj.player.rulestate.PROtherKongState;
|
||
|
|
import extend.mj.player.rulestate.PROtherOpenKongState;
|
||
|
|
import extend.mj.player.rulestate.PROtherWinState;
|
||
|
|
import extend.mj.player.rulestate.PRPongKongState;
|
||
|
|
import extend.mj.player.rulestate.PRPongOpenKongState;
|
||
|
|
import extend.mj.player.rulestate.PRPongState;
|
||
|
|
import extend.mj.player.rulestate.PRSelfKongState;
|
||
|
|
import extend.mj.player.rulestate.PRSelfOpenKongState;
|
||
|
|
import extend.mj.player.rulestate.PRSelfWinState;
|
||
|
|
import extend.mj.player.state.EXPlayerDisCardTipState;
|
||
|
|
import extend.mj.player.state.EXPlayerDiscardState;
|
||
|
|
import extend.mj.player.state.EXPlayerDrawState;
|
||
|
|
import extend.mj.player.state.EXPlayerDrawTipState;
|
||
|
|
import extend.mj.player.state.EXPlayerHaidiTipState;
|
||
|
|
import extend.mj.player.state.EXPlayerKongWinState;
|
||
|
|
import extend.mj.player.state.EXPlayerOpenKongState;
|
||
|
|
import extend.mj.player.state.EXPlayerPiaoNiaoTipState;
|
||
|
|
import extend.mj.player.state.EXPlayerQSWinTipState;
|
||
|
|
import extend.mj.player.state.EXPlayerTianTingTipState;
|
||
|
|
import extend.mj.player.state.EXPlayerWaitKongWinState;
|
||
|
|
import extend.mj.player.state.EXPlayerWaitState;
|
||
|
|
import extend.mj.player.state.EXPlayerZTWinTipState;
|
||
|
|
import extend.mj.room.state.EXRoomDealState;
|
||
|
|
import extend.mj.room.state.EXRoomSetpState;
|
||
|
|
import extend.mj.room.state.EXRoomStartGameState;
|
||
|
|
|
||
|
|
/**
|
||
|
|
*
|
||
|
|
*
|
||
|
|
*/
|
||
|
|
public class EXMainServer extends MainServer{
|
||
|
|
|
||
|
|
|
||
|
|
public static PlayerRuleManager playerRuleMgr;
|
||
|
|
|
||
|
|
public static EXGameController gameCtr;
|
||
|
|
|
||
|
|
@Override
|
||
|
|
public void onStart() {
|
||
|
|
super.onStart();
|
||
|
|
gameCtr = (EXGameController)Global.gameCtr;
|
||
|
|
|
||
|
|
registerState();
|
||
|
|
|
||
|
|
playerRuleMgr = new PlayerRuleManager();
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
private final void registerState() {
|
||
|
|
Global.registerState(RoomStartGameState.class, new EXRoomStartGameState());
|
||
|
|
Global.registerState(EXRoomSetpState.class, new EXRoomSetpState());
|
||
|
|
Global.registerState(EXRoomDealState.class, new EXRoomDealState());
|
||
|
|
|
||
|
|
Global.registerState(PlayerWaitState.class, new EXPlayerWaitState());
|
||
|
|
Global.registerState(EXPlayerDrawState.class, new EXPlayerDrawState());
|
||
|
|
Global.registerState(EXPlayerDiscardState.class, new EXPlayerDiscardState());
|
||
|
|
Global.registerState(EXPlayerDisCardTipState.class, new EXPlayerDisCardTipState());
|
||
|
|
Global.registerState(EXPlayerDrawTipState.class, new EXPlayerDrawTipState());
|
||
|
|
Global.registerState(EXPlayerWaitKongWinState.class, new EXPlayerWaitKongWinState());
|
||
|
|
Global.registerState(EXPlayerKongWinState.class, new EXPlayerKongWinState());
|
||
|
|
Global.registerState(EXPlayerQSWinTipState.class, new EXPlayerQSWinTipState());
|
||
|
|
Global.registerState(EXPlayerOpenKongState.class, new EXPlayerOpenKongState());
|
||
|
|
Global.registerState(EXPlayerHaidiTipState.class, new EXPlayerHaidiTipState());
|
||
|
|
Global.registerState(EXPlayerZTWinTipState.class, new EXPlayerZTWinTipState());
|
||
|
|
Global.registerState(EXPlayerPiaoNiaoTipState.class, new EXPlayerPiaoNiaoTipState());
|
||
|
|
Global.registerState(EXPlayerTianTingTipState.class, new EXPlayerTianTingTipState());
|
||
|
|
|
||
|
|
Global.registerState(PRChowState.class, new PRChowState());
|
||
|
|
Global.registerState(PROtherKongState.class, new PROtherKongState());
|
||
|
|
Global.registerState(PROtherWinState.class, new PROtherWinState());
|
||
|
|
Global.registerState(PRPongKongState.class, new PRPongKongState());
|
||
|
|
Global.registerState(PRPongState.class, new PRPongState());
|
||
|
|
Global.registerState(PRSelfKongState.class, new PRSelfKongState());
|
||
|
|
Global.registerState(PRSelfWinState.class, new PRSelfWinState());
|
||
|
|
Global.registerState(PROtherOpenKongState.class, new PROtherOpenKongState());
|
||
|
|
Global.registerState(PRPongOpenKongState.class, new PRPongOpenKongState());
|
||
|
|
Global.registerState(PRSelfOpenKongState.class, new PRSelfOpenKongState());
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
@Override
|
||
|
|
public Room newRoom(String roomid, Map<String, String> redis_room_map) {
|
||
|
|
// TODO Auto-generated method stub
|
||
|
|
return new EXRoom(roomid, redis_room_map);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
@Override
|
||
|
|
public Player newPlayer(int playerid, Room room, String session_id) {
|
||
|
|
// TODO Auto-generated method stub
|
||
|
|
return new EXPlayer(playerid, room, session_id);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
@Override
|
||
|
|
protected GameController newController() {
|
||
|
|
// TODO Auto-generated method stub
|
||
|
|
return new EXGameController();
|
||
|
|
}
|
||
|
|
}
|