优化地图代码

back_recharge
jiahuiwen 2019-02-25 17:53:47 +08:00
parent 99ca55edba
commit 32bbca91cd
1 changed files with 48 additions and 42 deletions

View File

@ -366,48 +366,7 @@ public class MapLogic {
return; return;
} }
// 1 完成事件点即进度100% // 1 完成事件点即进度100%
switch (sOptionAddConditions.getType()) { nextPoint = getNextPoint(user, mapManager, jumpTypeValues, sOptionAddConditions);
case 1:{
int doneEvent = sOptionAddConditions.getValues()[0][0];
for (Cell cell1 : mapManager.getMapInfo().values()) {
if (cell1.getPointId() == doneEvent) {
if (cell1.getEventId() >= sOptionAddConditions.getValues()[0][1]) {
nextPoint = jumpTypeValues[0][0];
}
break;
}
}
break;
}
// 2 物品数量
case 2:{
break;
}
// 3 角色属性
case 3:{
break;
}
// 完成某个任务的第几步
case 4:{
Set<Integer> finishMissions = user.getMissionManager().getFinishMissions();
Set<Integer> takeRewardMissions = user.getMissionManager().getTakeRewardMissions();
if (finishMissions.contains(sOptionAddConditions.getValues()[0][0]) || takeRewardMissions.contains(sOptionAddConditions.getValues()[0][0])) {
nextPoint = jumpTypeValues[0][0];
}
if (nextPoint == 0) {
Map<Integer, Mission> doingMissions = user.getMissionManager().getDoingMissions();
Mission mission = doingMissions.get(sOptionAddConditions.getValues()[0][0]);
if (mission == null || mission.getMissionStep() < jumpTypeValues[0][1]) {
nextPoint = jumpTypeValues[0][1];
}
}
break;
}
default: {
nextPoint = jumpTypeValues[0][1];
break;
}
}
break; break;
} }
// 4 不跳转,关闭界面 // 4 不跳转,关闭界面
@ -455,6 +414,53 @@ public class MapLogic {
MessageUtil.sendMessage(session, 1, messageType.getNumber(), eventUpdateResponse.build(), true); MessageUtil.sendMessage(session, 1, messageType.getNumber(), eventUpdateResponse.build(), true);
} }
private int getNextPoint(User user, MapManager mapManager, int[][] jumpTypeValues, SOptionAddCondition sOptionAddConditions) {
int nextPoint = 0;
switch (sOptionAddConditions.getType()) {
case 1:{
int doneEvent = sOptionAddConditions.getValues()[0][0];
for (Cell cell1 : mapManager.getMapInfo().values()) {
if (cell1.getPointId() == doneEvent) {
if (cell1.getEventId() >= sOptionAddConditions.getValues()[0][1]) {
nextPoint = jumpTypeValues[0][0];
}
break;
}
}
break;
}
// 2 物品数量
case 2:{
break;
}
// 3 角色属性
case 3:{
break;
}
// 完成某个任务的第几步
case 4:{
Set<Integer> finishMissions = user.getMissionManager().getFinishMissions();
Set<Integer> takeRewardMissions = user.getMissionManager().getTakeRewardMissions();
if (finishMissions.contains(sOptionAddConditions.getValues()[0][0]) || takeRewardMissions.contains(sOptionAddConditions.getValues()[0][0])) {
nextPoint = jumpTypeValues[0][0];
}
if (nextPoint == 0) {
Map<Integer, Mission> doingMissions = user.getMissionManager().getDoingMissions();
Mission mission = doingMissions.get(sOptionAddConditions.getValues()[0][0]);
if (mission == null || mission.getMissionStep() < jumpTypeValues[0][1]) {
nextPoint = jumpTypeValues[0][1];
}
}
break;
}
default: {
nextPoint = jumpTypeValues[0][1];
break;
}
}
return nextPoint;
}
public CommonProto.Mission getMission(Mission mission) { public CommonProto.Mission getMission(Mission mission) {
CommonProto.Mission openMission; CommonProto.Mission openMission;
StringBuilder state = null; StringBuilder state = null;