back_recharge
wangyuan 2019-09-23 17:56:22 +08:00
parent eb6cf6f62b
commit 388b2e5495
3 changed files with 13 additions and 35 deletions

View File

@ -94,12 +94,15 @@ public class BeanToProto {
Integer value = item.getValue();
builder.addPosMineral(CommonProto.PosMineral.newBuilder().setPos(key).setNums(value).build());
}
long endTime = SBloodyBattleSetting.sBloodyBattleSetting.getBattleTime();
long startTime = scene.getStartTime();
if(startTime==0){
startTime = System.currentTimeMillis();
}
long endTime = SBloodyBattleSetting.sBloodyBattleSetting.getBattleTime()*1000+startTime;
if(scene.getQuickEnd()!=-1){
long startTime = scene.getStartTime();
endTime = startTime + scene.getQuickEnd()*50;
}
int remainTime = SBloodyBattleSetting.sBloodyBattleSetting.getBattleTime() - (int)((System.currentTimeMillis() - scene.getStartTime()) / 1000);
int remainTime =(int)((endTime - System.currentTimeMillis() - scene.getStartTime()) / 1000);
builder.setRemainTime(remainTime);
builder.addAllBarrierPoint(SceneManager.bloodyMap.getBarrierPoints());
return builder.build();

View File

@ -56,7 +56,7 @@ public class SceneManager {
Map.Entry<Integer, Long> next = iterator.next();
Integer roomId = next.getKey();
Long time = next.getValue();
if(time - now > sBloodyBattleSetting.getReloadTime() * 1000){
if(now-time > sBloodyBattleSetting.getReloadTime() * 1000){
iterator.remove();
Scene scene = sceneMap.get(roomId);
if(scene!=null){
@ -66,7 +66,7 @@ public class SceneManager {
}
}
}
Thread.sleep(1000);
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
@ -123,7 +123,6 @@ public class SceneManager {
scene.setRoomId(room.getId());
SBloodyBattleSetting sBloodyBattleSetting = SBloodyBattleSetting.sBloodyBattleSetting;
for(Integer uid : room.fightPlayer){
//todo 设置用户在战斗房间中 取消用户匹配信息 获取用户快照信息
String key = RedisUtil.getInstence().getKey(RedisKey.BLOODY_TEAM, Integer.toString(uid));
UserBloodySnpInfo userBloodySnpInfo =RedisUtil.getInstence().getObject(key,UserBloodySnpInfo.class);
BattleManager.putUserFightInfo(userBloodySnpInfo);
@ -145,6 +144,7 @@ public class SceneManager {
createMonster(scene,-1);
sceneMap.put(room.getId(),scene);
readyRunTaskMap.put(room.getId(),System.currentTimeMillis());
}
@ -384,11 +384,6 @@ public class SceneManager {
MessageUtil.sendErrorResponse(iSession, 0, responseMsgId, "没有在房间中");
return;
}
/* if(sceneMap.containsKey(scene.getRoomId())){
//房间已经销毁,如果走到这一步,说明其他地方有错了
MessageUtil.sendErrorResponse(iSession, 0, responseMsgId, "房间已经销毁");
return;
}*/
MessageUtil.sendRoomStartGameReadyResponse(iSession, responseMsgId, 1);
@ -457,24 +452,4 @@ public class SceneManager {
scene.getSceneActorMap().get(uid).setGameState(StateType.UNREADY_STATE);
}
}
static class ReadySceneTask{
private Scene scene;
private long startTime;
public ReadySceneTask(Scene scene, long startTime) {
this.scene = scene;
this.startTime = startTime;
}
public Scene getScene() {
return scene;
}
public long getStartTime() {
return startTime;
}
}
}

View File

@ -4,7 +4,7 @@ public class ParamEnvironmentSimpleBean extends ParamEnvironmentBean{
private String idfa_s; // ios设备唯一标识必须添加该字段
private String imei_s;// 安卓设备唯一标识,必须添加该字段
private String app_device_id_s;
private String device_id_s;
private String brand_s;
private String dpi_s;
private String operator_s;
@ -20,7 +20,7 @@ public class ParamEnvironmentSimpleBean extends ParamEnvironmentBean{
}
public String getApp_device_id_s() {
return app_device_id_s;
return device_id_s;
}
public String getBrand_s() {
@ -52,7 +52,7 @@ public class ParamEnvironmentSimpleBean extends ParamEnvironmentBean{
}
public void setApp_device_id_s(String app_device_id_s) {
this.app_device_id_s = app_device_id_s;
this.device_id_s = app_device_id_s;
}
public void setBrand_s(String brand_s) {
@ -78,7 +78,7 @@ public class ParamEnvironmentSimpleBean extends ParamEnvironmentBean{
public ParamEnvironmentSimpleBean(String idfa_s, String imei_s, String app_device_id_s, String brand_s, String dpi_s, String operator_s, String os_version_s, boolean wifi_b) {
this.idfa_s = idfa_s;
this.imei_s = imei_s;
this.app_device_id_s = app_device_id_s;
this.device_id_s = app_device_id_s;
this.brand_s = brand_s;
this.dpi_s = dpi_s;
this.operator_s = operator_s;