Merge branch 'master' of http://60.1.1.230/backend/jieling_server
commit
266808f042
|
@ -403,6 +403,7 @@ public class Scene implements Runnable{
|
|||
}
|
||||
}
|
||||
SceneManager.clearScene(roomId);
|
||||
RedisUtil.getInstence().del( "MATCH_ROOM_KEY:" + roomId);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -158,6 +158,7 @@ public class RedisKey {
|
|||
|
||||
//掉线缓存indication
|
||||
public static final String INDICATION_OFFLINE = "INDICATION_OFFLINE";
|
||||
public static final String INDICATION_OFFLINE_INDEX = "INDICATION_OFFLINE_INDEX";
|
||||
public static final String INDICATION_OFFLINE_BLOODY = "INDICATION_OFFLINE_BLOODY";
|
||||
|
||||
public static final String RESPONSE_OFFLINE = "RESPONSE_OFFLINE";
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -228,7 +228,8 @@ public class FriendLogic {
|
|||
continue;
|
||||
}
|
||||
if (friends1.size() >= maxFriends){
|
||||
continue;
|
||||
MessageUtil.sendErrorResponse(iSession,Global.SHOW_TIPS_ERROR,msgId,"对方好友已达上限");
|
||||
return;
|
||||
}
|
||||
if (applyFriends.size()>= maxApplyFriends){
|
||||
applyFriends.remove(0);
|
||||
|
|
|
@ -129,7 +129,7 @@ public class StoreLogic {
|
|||
while(it.hasNext()){
|
||||
StoreInfo storeInfo = it.next().getValue();
|
||||
SStoreTypeConfig sStoreTypeConfig = SStoreTypeConfig.getsStoreTypeConfigMap().get(storeInfo.getId());
|
||||
if (sStoreTypeConfig.getStoreOpenRule() ==2){
|
||||
if (sStoreTypeConfig.getStoreOpenRule() ==2 || sStoreTypeConfig.getStoreOpenRule() ==5){
|
||||
if (nowTime > storeInfo.getEndTime()){
|
||||
removeStoreIds.add(storeInfo.getId());
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ import com.ljsd.jieling.logic.dao.UserManager;
|
|||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.family.GuildLogic;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.netty.cocdex.Tea;
|
||||
import com.ljsd.jieling.netty.handler.GameMessageHandler;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocol.ProtocolsAbstract;
|
||||
|
@ -27,6 +28,7 @@ import com.ljsd.jieling.protocols.MessageTypeProto;
|
|||
import com.ljsd.jieling.session.GameSession;
|
||||
import com.ljsd.jieling.util.MathUtils;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import com.ljsd.jieling.util.StringUtil;
|
||||
import com.ljsd.jieling.util.TimeUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -233,14 +235,23 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
|||
Map<Integer, ISession.IndicationMsg> map= gson.fromJson(indicationInRedis.toString(),type);
|
||||
for(Map.Entry<Integer,ISession.IndicationMsg> info : map.entrySet()){
|
||||
session.writeAndFlush(info.getValue().getMsg());
|
||||
session.putBackIndicationToMap(maxMsgId++,info.getValue().getMsg());
|
||||
session.putBackIndicationToMap(info.getKey(),info.getValue().getMsg());
|
||||
if(info.getKey()>maxMsgId){
|
||||
maxMsgId = info.getKey();
|
||||
}
|
||||
}
|
||||
RedisUtil.getInstence().del(key);
|
||||
RedisUtil.getInstence().del(key);
|
||||
}
|
||||
key = RedisUtil.getInstence().getKey(RedisKey.RESPONSE_OFFLINE, Integer.toString(session.getUid()));
|
||||
type = new TypeToken<Map<Integer, byte[]>>(){}.getType();
|
||||
Object responsInRedis = RedisUtil.getInstence().get(key);
|
||||
session.setFiveReady(1);
|
||||
String indicationIndexInRedisKey = RedisUtil.getInstence().getKey(RedisKey.INDICATION_OFFLINE_INDEX, Integer.toString(session.getUid()));
|
||||
String indicationIndexInRedis =(String) RedisUtil.getInstence().get(indicationIndexInRedisKey);
|
||||
if(!StringUtil.isEmpty(indicationIndexInRedis)){
|
||||
maxMsgId= Integer.parseInt(indicationIndexInRedis);
|
||||
}
|
||||
|
||||
session.updateIndicationIndex(maxMsgId);
|
||||
if(responsInRedis!=null){
|
||||
Map<Integer, byte[]> response = gson.fromJson(responsInRedis.toString(), type);
|
||||
|
@ -391,12 +402,15 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
|||
|
||||
private void backUpMsgToRedis(ISession session){
|
||||
ConcurrentHashMap<Integer, ISession.IndicationMsg> indexToIndication = session.getIndexToIndication();
|
||||
LOGGER.info("the uid={} offline.the indication size={}",session.getUid(),indexToIndication.size());
|
||||
if(!indexToIndication.isEmpty() ){
|
||||
String key = RedisUtil.getInstence().getKey(RedisKey.INDICATION_OFFLINE, Integer.toString(session.getUid()));
|
||||
RedisUtil.getInstence().set(key,gson.toJson(indexToIndication));
|
||||
}
|
||||
String key = RedisUtil.getInstence().getKey(RedisKey.INDICATION_OFFLINE_INDEX, Integer.toString(session.getUid()));
|
||||
RedisUtil.getInstence().set(key,String.valueOf(session.getIndicationIndex()));
|
||||
|
||||
String key = RedisUtil.getInstence().getKey(RedisKey.RESPONSE_OFFLINE, Integer.toString(session.getUid()));
|
||||
key = RedisUtil.getInstence().getKey(RedisKey.RESPONSE_OFFLINE, Integer.toString(session.getUid()));
|
||||
RedisUtil.getInstence().set(key,gson.toJson(session.getIndexToMessage()));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue