mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-26 10:16:14 +00:00
保存
This commit is contained in:
@@ -34,8 +34,8 @@ public class GRefereeAction {
|
||||
|
||||
//headless位置
|
||||
// public static String Headless = "D:\\myproject\\JisolGame\\headless";
|
||||
public static String Headless = "D:\\Jisol\\JisolGame\\headless";
|
||||
// public static String Headless = "D:\\wwwroot\\pet.jisol.cn\\headless";
|
||||
// public static String Headless = "D:\\Jisol\\JisolGame\\headless";
|
||||
public static String Headless = "D:\\wwwroot\\pet.jisol.cn\\headless";
|
||||
|
||||
//获取一个空闲的裁决员
|
||||
public static GRefereeClient getFreeReferee(){
|
||||
|
@@ -11,6 +11,7 @@ import cn.jisol.game.entity.game.Player;
|
||||
import cn.jisol.game.entity.game.PlayerPet;
|
||||
import cn.jisol.game.entity.game.Resource;
|
||||
import cn.jisol.game.entity.mode.ModeOnHook;
|
||||
import cn.jisol.game.entity.mode.ModeOnHookInfo;
|
||||
import cn.jisol.game.proto.GOnHookMessage;
|
||||
import cn.jisol.game.service.ModeOnHookService;
|
||||
import cn.jisol.game.service.PlayerPetService;
|
||||
@@ -99,6 +100,10 @@ public class GOnHookController {
|
||||
@PostMapping("/nextLevel")
|
||||
public NewsContext<ModeOnHook> nextLevel(@CurrentPlayer Player player){
|
||||
ModeOnHook data = this.getInfo(player).data;
|
||||
|
||||
//判断是否战胜当前关卡
|
||||
if (!data.isWinLevel()) return NewsContext.onFail("请战胜当前关卡",data);
|
||||
|
||||
//获取当前关卡Id
|
||||
Integer levelId = data.getLevelId();
|
||||
|
||||
@@ -106,11 +111,30 @@ public class GOnHookController {
|
||||
GTbGOnHookLevels.GTbGOnHookLevel nextLevel = data.getGTbGOnHookLevels().get(levelId + 1);
|
||||
data.getHookInfo().getMaps().put(data.getOnHookMap(),nextLevel.getId());
|
||||
|
||||
//并且重置当前关卡状态
|
||||
data.getHookInfo().getMapStates().put(data.getOnHookMap(),ModeOnHookInfo.MapState.Fight);
|
||||
|
||||
//保存地图
|
||||
modeOnHookService.saveOrUpdate(data);
|
||||
//下一关 清理历史野怪
|
||||
CREEPS.put(player.getPlayerId(),new HashMap<>());
|
||||
return NewsContext.onSuccess("下一关");
|
||||
return NewsContext.onSuccess("下一关",data);
|
||||
}
|
||||
|
||||
//战胜当前关卡
|
||||
@ApiImplicitParams({})
|
||||
@ApiOperation(value = "战胜当前关卡")
|
||||
@PostMapping("/winLevel")
|
||||
public NewsContext<ModeOnHook> winLevel(@CurrentPlayer Player player){
|
||||
ModeOnHook data = this.getInfo(player).data;
|
||||
|
||||
data.getHookInfo().getMapStates().put(data.getOnHookMap(), ModeOnHookInfo.MapState.Win);
|
||||
|
||||
//保存地图
|
||||
modeOnHookService.saveOrUpdate(data);
|
||||
|
||||
return NewsContext.onSuccess("战胜当前关卡",data);
|
||||
|
||||
}
|
||||
|
||||
//生成野怪
|
||||
|
@@ -68,4 +68,9 @@ public class ModeOnHook {
|
||||
return levelId;
|
||||
}
|
||||
|
||||
//是否战胜当前关卡
|
||||
public boolean isWinLevel(){
|
||||
return ModeOnHookInfo.MapState.Win.equals(getHookInfo().getMapStates().get(getOnHookMap()));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -13,8 +13,17 @@ public class ModeOnHookInfo {
|
||||
//地图关卡信息 {地图Id: 地图关卡Id}
|
||||
private Map<Integer,Integer> maps;
|
||||
|
||||
//地图关卡状态 {地图Id: 状态(0:战斗中, 1:胜利)}
|
||||
private Map<Integer,Integer> mapStates;
|
||||
|
||||
public ModeOnHookInfo(){
|
||||
maps = new HashMap<>();
|
||||
mapStates = new HashMap<>();
|
||||
}
|
||||
|
||||
public interface MapState{
|
||||
Integer Fight = 0;
|
||||
Integer Win = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -4,8 +4,8 @@ spring:
|
||||
datasource:
|
||||
username: pet_jisol_cn
|
||||
password: sThsBwjfDcaw2wJR
|
||||
url: jdbc:mysql://kyu.jisol.cn:3306/pet_jisol_cn?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8
|
||||
# url: jdbc:mysql://localhost:3306/pet_jisol_cn?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8
|
||||
# url: jdbc:mysql://kyu.jisol.cn:3306/pet_jisol_cn?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8
|
||||
url: jdbc:mysql://localhost:3306/pet_jisol_cn?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
jackson:
|
||||
serialization:
|
||||
|
Reference in New Issue
Block a user