Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
bupt1987 committed Aug 27, 2014
1 parent 96d7a5a commit ac6df39
Show file tree
Hide file tree
Showing 54 changed files with 1,015 additions and 1,226 deletions.
27 changes: 0 additions & 27 deletions .classpath

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
/target
.svn
.myeclipse/

.idea/
JgWeb.iml
52 changes: 0 additions & 52 deletions .project

This file was deleted.

13 changes: 0 additions & 13 deletions .settings/.jsdtscope

This file was deleted.

3 changes: 0 additions & 3 deletions .settings/com.genuitec.eclipse.core.prefs

This file was deleted.

2 changes: 0 additions & 2 deletions .settings/com.genuitec.eclipse.migration.prefs

This file was deleted.

3 changes: 0 additions & 3 deletions .settings/com.genuitec.jboss.ide.eclipse.xdoclet.run.prefs

This file was deleted.

2 changes: 0 additions & 2 deletions .settings/org.eclipse.core.resources.prefs

This file was deleted.

12 changes: 0 additions & 12 deletions .settings/org.eclipse.jdt.core.prefs

This file was deleted.

4 changes: 0 additions & 4 deletions .settings/org.eclipse.m2e.core.prefs

This file was deleted.

13 changes: 0 additions & 13 deletions .settings/org.eclipse.wst.common.component

This file was deleted.

7 changes: 0 additions & 7 deletions .settings/org.eclipse.wst.common.project.facet.core.prefs.xml

This file was deleted.

9 changes: 0 additions & 9 deletions .settings/org.eclipse.wst.common.project.facet.core.xml

This file was deleted.

48 changes: 0 additions & 48 deletions .settings/org.eclipse.wst.jsdt.core.prefs

This file was deleted.

2 changes: 0 additions & 2 deletions .settings/org.eclipse.wst.jsdt.ui.prefs

This file was deleted.

1 change: 0 additions & 1 deletion .settings/org.eclipse.wst.jsdt.ui.superType.container

This file was deleted.

1 change: 0 additions & 1 deletion .settings/org.eclipse.wst.jsdt.ui.superType.name

This file was deleted.

8 changes: 0 additions & 8 deletions .settings/org.eclipse.wst.validation.prefs

This file was deleted.

40 changes: 20 additions & 20 deletions src/main/java/com/zhaidaosi/game/server/BootStart.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@
import com.zhaidaosi.game.server.model.player.PlayerFactory;

@SuppressWarnings("serial")
public class BootStart extends HttpServlet {
public class BootStart extends HttpServlet {

private static void start() {
//设置action所在包路径,不设置不扫描
Boot.setActionPackage("com.zhaidaosi.game.server.model.action");
//设置area所在包路径,不设置不扫描
Boot.setAreaPackage("com.zhaidaosi.game.server.model.area");
//设置player工厂,默认为BasePlayerFactory
Boot.setPlayerFactory(new PlayerFactory());
Boot.start();
}

@Override
public void init() {
start();
}

public static void main(String[] args) {
start();
}

private static void start(){
//设置action所在包路径,不设置不扫描
Boot.setActionPackage("com.zhaidaosi.game.server.model.action");
//设置area所在包路径,不设置不扫描
Boot.setAreaPackage("com.zhaidaosi.game.server.model.area");
//设置player工厂,默认为BasePlayerFactory
Boot.setPlayerFactory(new PlayerFactory());
Boot.start();
}

@Override
public void init() {
start();
}

public static void main(String[] args) {
start();
}

}
40 changes: 20 additions & 20 deletions src/main/java/com/zhaidaosi/game/server/handler/DuelHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@

public class DuelHandler extends BaseHandler {

@Override
public IBaseMessage run(InMessage im, Channel ch) {
Player me = (Player) ch.getAttachment();
Integer targetId = 0;
if(im.getMember("uid") != null){
targetId = Integer.valueOf((String)im.getMember("uid"));
}
if(targetId < 1){
return OutMessage.showError("目标用户id为空");
}
Player target = (Player) SessionManager.getPlayerByUserId(targetId);
if(target == null){
return OutMessage.showError("目标用户已下线");
}
//new 一个打架场地
DuelZone zone = new DuelZone();
Player winer = Duel.doDuel(me, target, zone, this.getHandlerName());
winer.addExperience(5);
return OutMessage.showSucc(me);
}
@Override
public IBaseMessage run(InMessage im, Channel ch) {
Player me = (Player) ch.getAttachment();
Integer targetId = 0;
if (im.getMember("uid") != null) {
targetId = Integer.valueOf((String) im.getMember("uid"));
}
if (targetId < 1) {
return OutMessage.showError("目标用户id为空");
}
Player target = (Player) SessionManager.getPlayerByUserId(targetId);
if (target == null) {
return OutMessage.showError("目标用户已下线");
}
//new 一个打架场地
DuelZone zone = new DuelZone();
Player winer = Duel.doDuel(me, target, zone, this.getHandlerName());
winer.addExperience(5);
return OutMessage.showSucc(me);
}

}
36 changes: 18 additions & 18 deletions src/main/java/com/zhaidaosi/game/server/handler/InitHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@
import com.zhaidaosi.game.server.sdm.service.UserInfoService;

public class InitHandler extends BaseHandler {
UserInfoService userInfoService = (UserInfoService) ServiceManager.getService(UserInfoService.BEANID);
@Override
public IBaseMessage run(InMessage im, Channel ch){
Player player = (Player)ch.getAttachment();
UserInfo userInfo = (UserInfo) userInfoService.findByUid(player.getId());
if(userInfo == null){
OutMessage.showError("初始化失败", 50001);
}
player.init(userInfo);
return OutMessage.showSucc(player);
}

UserInfoService userInfoService = (UserInfoService) ServiceManager.getService(UserInfoService.BEANID);

@Override
public IBaseMessage run(InMessage im, Channel ch) {

Player player = (Player) ch.getAttachment();

UserInfo userInfo = (UserInfo) userInfoService.findByUid(player.getId());

if (userInfo == null) {
OutMessage.showError("初始化失败", 50001);
}

player.init(userInfo);

return OutMessage.showSucc(player);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

public class OnlineUserHandler extends BaseHandler {

@Override
public IBaseMessage run(InMessage im, Channel ch) {
Area area = (Area) AreaManager.getArea(Area.ID);
return OutMessage.showSucc(area.getPlayers());
}
@Override
public IBaseMessage run(InMessage im, Channel ch) {
Area area = (Area) AreaManager.getArea(Area.ID);
return OutMessage.showSucc(area.getPlayers());
}

}
Loading

0 comments on commit ac6df39

Please sign in to comment.