Merge branch 'master' of http://60.1.1.230/backend/jieling_server
Conflicts: serverlogic/src/main/java/com/ljsd/jieling/handler/GetAllItemHandler.javaback_recharge
commit
8b26c4a73f
|
|
@ -54,4 +54,4 @@ int int int int int int float float float float float mut,int#int,2 mut,int#int,
|
|||
52 2052 0 0 4 10 1834 140 0 220 176 10100#10|10101#20 null
|
||||
53 2053 0 0 4 10 1943 135 219 0 176 10100#10|10101#20 null
|
||||
54 2054 0 0 4 10 1630 169 0 176 163 10100#10|10101#20 null
|
||||
55 2055 0 0 4 10 1508 205 163 0 194 10100#10|10101#20 null
|
||||
55 2055 0 0 4 10 1508 205 163 0 194 10100#10|10101#20 null
|
||||
|
|
|
|||
|
|
@ -0,0 +1,74 @@
|
|||
package com.ljsd.jieling.config;
|
||||
|
||||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name = "HeroRankupConfig")
|
||||
public class SCHeroRankUpConfig implements BaseConfig{
|
||||
public static Map<Integer,SCHeroRankUpConfig> scHeroRankUpConfigMap;
|
||||
|
||||
private int id;
|
||||
|
||||
private int type;
|
||||
|
||||
private float rankupPara;
|
||||
|
||||
private int limitLevel;
|
||||
|
||||
private int openLevel;
|
||||
|
||||
private int limitStar;
|
||||
|
||||
private int openStar;
|
||||
|
||||
private int consumeMaterial[];
|
||||
|
||||
private int[] consumeCard[];
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
scHeroRankUpConfigMap = STableManager.getConfig(SCHeroRankUpConfig.class);
|
||||
}
|
||||
|
||||
public static Map<Integer, SCHeroRankUpConfig> getScHeroRankUpConfigMap() {
|
||||
return scHeroRankUpConfigMap;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public float getRankupPara() {
|
||||
return rankupPara;
|
||||
}
|
||||
|
||||
public int getLimitLevel() {
|
||||
return limitLevel;
|
||||
}
|
||||
|
||||
public int getOpenLevel() {
|
||||
return openLevel;
|
||||
}
|
||||
|
||||
public int getLimitStar() {
|
||||
return limitStar;
|
||||
}
|
||||
|
||||
public int getOpenStar() {
|
||||
return openStar;
|
||||
}
|
||||
|
||||
public int[] getConsumeMaterial() {
|
||||
return consumeMaterial;
|
||||
}
|
||||
|
||||
public int[][] getConsumeCard() {
|
||||
return consumeCard;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package com.ljsd.jieling.config;
|
||||
|
||||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name = "HeroLevelConfig")
|
||||
public class SHeroLevlConfig implements BaseConfig{
|
||||
|
||||
public static Map<Integer, SHeroLevlConfig> sHeroLevlConfigMap;
|
||||
|
||||
private int id;
|
||||
|
||||
private int level;
|
||||
|
||||
private float characterLevelPara;
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
sHeroLevlConfigMap = STableManager.getConfig(SHeroLevlConfig.class);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static Map<Integer, SHeroLevlConfig> getsCHero() {
|
||||
return sHeroLevlConfigMap;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public static Map<Integer, SHeroLevlConfig> getsHeroLevlConfigMap() {
|
||||
return sHeroLevlConfigMap;
|
||||
}
|
||||
|
||||
public float getCharacterLevelPara() {
|
||||
return characterLevelPara;
|
||||
}
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@ public class RedisKey {
|
|||
|
||||
|
||||
|
||||
private <K, T> String getKey(String type, K key, boolean withServerId) {
|
||||
public static String getKey(String type, String key, boolean withServerId) {
|
||||
if (withServerId) {
|
||||
return areaId + Delimiter_colon + type + Delimiter_colon + String.valueOf(key);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -198,12 +198,12 @@ public class RedisUtil {
|
|||
*
|
||||
* @param key
|
||||
* 键 不能为null
|
||||
* @param item
|
||||
* @param mapKey
|
||||
* 项 不能为null
|
||||
* @return 值
|
||||
*/
|
||||
public Object hget(String key, String item) {
|
||||
return redisTemplate.opsForHash().get(key, item);
|
||||
public Object hget(String key, String mapKey) {
|
||||
return redisTemplate.opsForHash().get(key, mapKey);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -265,18 +265,18 @@ public class RedisUtil {
|
|||
*
|
||||
* @param key
|
||||
* 键
|
||||
* @param item
|
||||
* @param mapKey
|
||||
* 项
|
||||
* @param value
|
||||
* 值
|
||||
* @return true 成功 false失败
|
||||
*/
|
||||
public boolean hset(String key, String item, Object value) {
|
||||
public boolean hset(String key, String mapKey, Object value) {
|
||||
try {
|
||||
if (!(value instanceof String)){
|
||||
value = gson.toJson(value);
|
||||
}
|
||||
redisTemplate.opsForHash().put(key, item, value);
|
||||
redisTemplate.opsForHash().put(key, mapKey, value);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
|
@ -289,7 +289,7 @@ public class RedisUtil {
|
|||
*
|
||||
* @param key
|
||||
* 键
|
||||
* @param item
|
||||
* @param mapKey
|
||||
* 项
|
||||
* @param value
|
||||
* 值
|
||||
|
|
@ -297,9 +297,12 @@ public class RedisUtil {
|
|||
* 时间(秒) 注意:如果已存在的hash表有时间,这里将会替换原有的时间
|
||||
* @return true 成功 false失败
|
||||
*/
|
||||
public boolean hset(String key, String item, Object value, long time) {
|
||||
public boolean hset(String key, String mapKey, Object value, long time) {
|
||||
try {
|
||||
redisTemplate.opsForHash().put(key, item, value);
|
||||
if (!(value instanceof String)){
|
||||
value = gson.toJson(value);
|
||||
}
|
||||
redisTemplate.opsForHash().put(key, mapKey, value);
|
||||
if (time > 0) {
|
||||
expire(key, time);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,54 @@
|
|||
package com.ljsd.jieling.handler;
|
||||
|
||||
import com.ljsd.jieling.config.SCHero;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import com.ljsd.jieling.protocols.HeroInfoProto;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class GetAllHeroHandler extends BaseHandler {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(GetAllHeroHandler.class);
|
||||
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.GET_HEROINFO_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
byte[] packetData = netData.parseClientProtoNetData();
|
||||
int uid = iSession.getUid();
|
||||
List<CommonProto.Hero> heroList = new ArrayList<>();
|
||||
// SCHero scHero = SCHero.getsCHero().get(1);
|
||||
CommonProto.Hero hero = CommonProto.Hero.newBuilder()
|
||||
.setHeroId(1)
|
||||
.setAttack(2)
|
||||
.setStar(2)
|
||||
.setHeroType(1)
|
||||
.setLevel(1)
|
||||
.setHp(1000)
|
||||
.setMDefence(2000)
|
||||
.setPDefence(3000)
|
||||
.setSpeed(4000)
|
||||
.addAllEquipList(new ArrayList<>())
|
||||
.addAllSkillList(new ArrayList<>())
|
||||
.build();
|
||||
|
||||
|
||||
heroList.add(hero);
|
||||
HeroInfoProto.GetHeroInfoResponse build = HeroInfoProto.GetHeroInfoResponse.newBuilder().addAllHeroList(heroList).build();
|
||||
//HeroInfoProto.HeroInfo.GetHeroInfoResponse build = HeroInfoProto.HeroInfo.GetHeroInfoResponse.newBuilder().setHeroList(hero).build();
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_HEROINFO_RESPONSE_VALUE, build, true);
|
||||
LOGGER.info("back to client!");
|
||||
}
|
||||
}
|
||||
|
|
@ -40,6 +40,7 @@ public class GetAllItemHandler extends BaseHandler {
|
|||
= PlayerInfoProto.PlayerInfo.GetItemInfoRequest.parseFrom(netData.parseClientProtoNetData());
|
||||
LOGGER.info("processMessage->uid={},token={},msgId={},msgIndex={},messageNum={},messageStr={}",
|
||||
userId, token,msgId,msgIndex,getItemInfoRequest.getNum(),getItemInfoRequest.getStr());
|
||||
|
||||
User user = UserManager.getUserForLogin(userId);
|
||||
List<CommonProto.Common.Item> itemList = ItemUtil.getAllItem(user);
|
||||
PlayerInfoProto.PlayerInfo.GetItemInfoResponse getItemInfoResponse = PlayerInfoProto.PlayerInfo.GetItemInfoResponse.newBuilder()
|
||||
|
|
|
|||
|
|
@ -31,18 +31,18 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
int token = netData.getToken();
|
||||
int msgId = netData.getMsgId();
|
||||
int msgIndex = netData.getIndex();
|
||||
PlayerInfoProto.PlayerInfo.GetPlayerInfoRequest getPlayerInfoRequest
|
||||
= PlayerInfoProto.PlayerInfo.GetPlayerInfoRequest.parseFrom(netData.parseClientProtoNetData());
|
||||
PlayerInfoProto.GetPlayerInfoRequest getPlayerInfoRequest
|
||||
= PlayerInfoProto.GetPlayerInfoRequest.parseFrom(netData.parseClientProtoNetData());
|
||||
|
||||
LOGGER.info("processMessage->uid={},token={},msgId={},msgIndex={},messageNum={},messageStr={}",
|
||||
userId, token,msgId,msgIndex,getPlayerInfoRequest.getNum(),getPlayerInfoRequest.getStr());
|
||||
|
||||
User user = UserManager.getUserForLogin(userId);
|
||||
|
||||
CommonProto.Common.Player player = CBean2Proto.getPlayer(userId, user.getPlayerInfoManager());
|
||||
CommonProto.Player player = CBean2Proto.getPlayer(userId, user.getPlayerInfoManager());
|
||||
|
||||
PlayerInfoProto.PlayerInfo.GetPlayerInfoResponse getPlayerInfoResponse
|
||||
= PlayerInfoProto.PlayerInfo.GetPlayerInfoResponse.newBuilder()
|
||||
PlayerInfoProto.GetPlayerInfoResponse getPlayerInfoResponse
|
||||
= PlayerInfoProto.GetPlayerInfoResponse.newBuilder()
|
||||
.setPlayer(player)
|
||||
.build();
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
package com.ljsd.jieling.handler;
|
||||
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.logic.dao.User;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.UserServerInfo;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
|
|
@ -32,24 +29,35 @@ public class LoginRequestHandler extends BaseHandler {
|
|||
int msgId = netData.getMsgId();
|
||||
int msgIndex = netData.getIndex();
|
||||
byte[] message = netData.parseClientProtoNetData();
|
||||
PlayerInfoProto.PlayerInfo.LoginRequest loginRequest
|
||||
= PlayerInfoProto.PlayerInfo.LoginRequest.parseFrom(message);
|
||||
PlayerInfoProto.LoginRequest loginRequest
|
||||
= PlayerInfoProto.LoginRequest.parseFrom(message);
|
||||
LOGGER.info("processMessage->uid={},token={},msgId={},msgIndex={},messageNum={},messageStr={}",
|
||||
userId, token,msgId,msgIndex,loginRequest.getNum(),loginRequest.getStr());
|
||||
|
||||
//登陆注册入内存
|
||||
User user = UserManager.userLogin(userId);
|
||||
user.getPlayerInfoManager().setOpenId(loginRequest.getOpenId());
|
||||
UserServerInfo userServerInfo = new UserServerInfo(user.getPlayerInfoManager());
|
||||
RedisUtil.getInstence().hset(RedisKey.USER_SERVER_INFO,loginRequest.getOpenId(), userServerInfo);
|
||||
|
||||
// UserServerInfo userServerInfo = new UserServerInfo(user.getPlayerInfoManager());
|
||||
// String key = RedisKey.getKey(RedisKey.USER_SERVER_INFO,loginRequest.getOpenId(),false);
|
||||
// RedisUtil.getInstence().hset(key,10086+"", userServerInfo);
|
||||
//
|
||||
// UserServerInfo userServerInfo1 = new UserServerInfo(user.getPlayerInfoManager());
|
||||
// RedisUtil.getInstence().hset(key,10087+"", userServerInfo1);
|
||||
//
|
||||
// UserServerInfo userServerInfo2 = new UserServerInfo(user.getPlayerInfoManager());
|
||||
// RedisUtil.getInstence().hset(key,10088+"", userServerInfo2);
|
||||
|
||||
// Map<String, UserServerInfo> userServerInfoMap = RedisUtil.getInstence().hget(RedisKey.USER_SERVER_INFO, loginRequest.getOpenId(), UserServerInfo.class, -1, false);
|
||||
|
||||
String newToken = UserManager.getNewToken(userId);
|
||||
|
||||
PlayerInfoProto.PlayerInfo.LoginResponse loginResponse
|
||||
= PlayerInfoProto.PlayerInfo.LoginResponse.newBuilder()
|
||||
PlayerInfoProto.LoginResponse loginResponse
|
||||
= PlayerInfoProto.LoginResponse.newBuilder()
|
||||
.setResultCode(0)
|
||||
.setNewToken(newToken)
|
||||
.build();
|
||||
|
||||
try {
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.LOGIN_RESPONSE_VALUE, loginResponse, true);
|
||||
LOGGER.info("back to client!");
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ public class MapEnterRequestHandler extends BaseHandler{
|
|||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
byte[] message = netData.parseClientProtoNetData();
|
||||
MapInfoProto.MapInfo.MapEnterRequest mapEnterRequest = MapInfoProto.MapInfo.MapEnterRequest.parseFrom(message);
|
||||
MapInfoProto.MapEnterRequest mapEnterRequest = MapInfoProto.MapEnterRequest.parseFrom(message);
|
||||
MapLogic.getInstance().enterMap(iSession, mapEnterRequest.getMapId(), MessageTypeProto.MessageType.MAP_ENTER_RESPONSE);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ public class MapGetInfoRequestHandler extends BaseHandler {
|
|||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
int uid = iSession.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
MapInfoProto.MapInfo.MapGetInfoResponse mapGetInfoResponse = MapInfoProto.MapInfo.MapGetInfoResponse
|
||||
MapInfoProto.MapGetInfoResponse mapGetInfoResponse = MapInfoProto.MapGetInfoResponse
|
||||
.newBuilder()
|
||||
.setMapId(user.getMapManager().getCurMapId())
|
||||
.build();
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public class MapLogic {
|
|||
mapManager = initMap( 1);
|
||||
user.setMapManager(mapManager);
|
||||
}
|
||||
MapInfoProto.MapInfo.MapEnterResponse mapEnterResponse = MapInfoProto.MapInfo.MapEnterResponse
|
||||
MapInfoProto.MapEnterResponse mapEnterResponse = MapInfoProto.MapEnterResponse
|
||||
.newBuilder()
|
||||
.build();
|
||||
MessageUtil.sendMessage(iSession, 1, messageType.getNumber(), mapEnterResponse, true);
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ import java.util.List;
|
|||
public class CBean2Proto {
|
||||
|
||||
|
||||
public static CommonProto.Common.Player getPlayer(int uid, PlayerManager playerManager) {
|
||||
CommonProto.Common.Player player = CommonProto.Common.Player
|
||||
public static CommonProto.Player getPlayer(int uid, PlayerManager playerManager) {
|
||||
CommonProto.Player player = CommonProto.Player
|
||||
.newBuilder()
|
||||
.setUid(uid)
|
||||
.setNickName(playerManager.getNickName())
|
||||
|
|
@ -25,8 +25,8 @@ public class CBean2Proto {
|
|||
return player;
|
||||
}
|
||||
|
||||
public static CommonProto.Common.Item getItem(Item item){
|
||||
CommonProto.Common.Item itemProto = CommonProto.Common.Item
|
||||
public static CommonProto.Item getItem(Item item){
|
||||
CommonProto.Item itemProto = CommonProto.Item
|
||||
.newBuilder()
|
||||
.setItemId(item.getItemId())
|
||||
.setItemNum(item.getItemNum())
|
||||
|
|
@ -35,8 +35,8 @@ public class CBean2Proto {
|
|||
return itemProto;
|
||||
}
|
||||
|
||||
public static CommonProto.Common.Hero getHero(Hero hero){
|
||||
CommonProto.Common.Hero heroProto = CommonProto.Common.Hero
|
||||
public static CommonProto.Hero getHero(Hero hero){
|
||||
CommonProto.Hero heroProto = CommonProto.Hero
|
||||
.newBuilder()
|
||||
.setId(hero.getId())
|
||||
.setHeroId(hero.getTemplateId())
|
||||
|
|
@ -55,11 +55,11 @@ public class CBean2Proto {
|
|||
return heroProto;
|
||||
}
|
||||
|
||||
private static List<CommonProto.Common.Skill> getHeroSkill(List<Skill> skillList) {
|
||||
private static List<CommonProto.Skill> getHeroSkill(List<Skill> skillList) {
|
||||
|
||||
List<CommonProto.Common.Skill> skills = new ArrayList<>();
|
||||
List<CommonProto.Skill> skills = new ArrayList<>();
|
||||
for(Skill skill : skillList){
|
||||
CommonProto.Common.Skill skill1 = CommonProto.Common.Skill
|
||||
CommonProto.Skill skill1 = CommonProto.Skill
|
||||
.newBuilder()
|
||||
.setSkillId(skill.getSkillId())
|
||||
.setSkillType(skill.getSkillType())
|
||||
|
|
@ -72,8 +72,8 @@ public class CBean2Proto {
|
|||
return skills;
|
||||
}
|
||||
|
||||
private static List<CommonProto.Common.Equip> getHeroEquip(List<Equip> equipList) {
|
||||
List<CommonProto.Common.Equip> equips = new ArrayList<>();
|
||||
private static List<CommonProto.Equip> getHeroEquip(List<Equip> equipList) {
|
||||
List<CommonProto.Equip> equips = new ArrayList<>();
|
||||
return equips;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package network.client;
|
|||
import com.google.protobuf.*;
|
||||
import com.ljsd.jieling.netty.cocdex.Tea;
|
||||
import com.ljsd.jieling.protocols.GMCommandProto;
|
||||
import com.ljsd.jieling.protocols.HeroInfoProto;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
||||
import io.netty.bootstrap.Bootstrap;
|
||||
|
|
@ -36,15 +37,19 @@ public class NettyClient {
|
|||
NettyTCPClientHandler handler = ch.pipeline().get(NettyTCPClientHandler.class);
|
||||
//------------------------------------------测试类型-------------------------------------------------------
|
||||
// GameProto.GameMessage gameMessage = new NettyClient().sendLoginMessageTest();//登陆请求
|
||||
PlayerInfoProto.PlayerInfo.GetPlayerInfoRequest gameMessage = new NettyClient().sendRegisterMessageTest();//注册请求
|
||||
PlayerInfoProto.GetPlayerInfoRequest gameMessage = new NettyClient().sendRegisterMessageTest();//注册请求
|
||||
LOGGER.info(gameMessage.toString());
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
|
||||
handler.sendRequest_jieling(makeFinalMessage(gameMessage, MessageTypeProto.MessageType.LOGIN_REQUEST_VALUE));
|
||||
handler.sendRequest_jieling(makeFinalMessage(gmRequest(), MessageTypeProto.MessageType.GM_COMMAND_VALUE));
|
||||
handler.sendRequest_jieling(makeFinalMessage(getHero(), MessageTypeProto.MessageType.GET_HEROINFO_REQUEST_VALUE));
|
||||
|
||||
}
|
||||
|
||||
public static HeroInfoProto.GetHeroInfoRequest getHero(){
|
||||
return HeroInfoProto.GetHeroInfoRequest.newBuilder().setNum(1).setStr("111").build();
|
||||
}
|
||||
|
||||
private static byte[] makeFinalMessage(MessageLite request, int msgNum) {
|
||||
byte[] messageData = request.toByteArray();
|
||||
byte[] packetData = new byte[messageData.length + 16];
|
||||
|
|
@ -64,9 +69,9 @@ public class NettyClient {
|
|||
}
|
||||
|
||||
|
||||
private PlayerInfoProto.PlayerInfo.GetPlayerInfoRequest sendRegisterMessageTest(){
|
||||
private PlayerInfoProto.GetPlayerInfoRequest sendRegisterMessageTest(){
|
||||
LOGGER.info("register");
|
||||
PlayerInfoProto.PlayerInfo.GetPlayerInfoRequest registerRequest = PlayerInfoProto.PlayerInfo.GetPlayerInfoRequest
|
||||
PlayerInfoProto.GetPlayerInfoRequest registerRequest = PlayerInfoProto.GetPlayerInfoRequest
|
||||
.newBuilder()
|
||||
// .setNum(888)
|
||||
// .setStr("666")
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package network.client;
|
|||
import com.google.protobuf.MessageLite;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.netty.cocdex.Tea;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import com.ljsd.jieling.protocols.HeroInfoProto;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.SimpleChannelInboundHandler;
|
||||
|
|
@ -16,6 +18,8 @@ import java.util.concurrent.BlockingDeque;
|
|||
import java.util.concurrent.LinkedBlockingDeque;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import static com.ljsd.jieling.protocols.MessageTypeProto.MessageType.GET_HEROINFO_RESPONSE_VALUE;
|
||||
|
||||
/**
|
||||
* Created by justin on 14-8-12.
|
||||
*/
|
||||
|
|
@ -105,9 +109,15 @@ public class NettyTCPClientHandler extends SimpleChannelInboundHandler<Object> {
|
|||
int userId = packetNetData.getUserId();
|
||||
int token = packetNetData.getToken();
|
||||
int msgId = packetNetData.getMsgId();
|
||||
byte[] packetData = packetNetData.getPacketData();
|
||||
|
||||
byte[] packetData = packetNetData.parseServerProtoNetData();
|
||||
|
||||
if(msgId == GET_HEROINFO_RESPONSE_VALUE){
|
||||
HeroInfoProto.GetHeroInfoResponse getHeroInfoResponse = HeroInfoProto.GetHeroInfoResponse.parseFrom(packetData);
|
||||
int heroListCount = getHeroInfoResponse.getHeroListCount();
|
||||
//int heroListCount = getHeroInfoResponse.getHeroListCount();
|
||||
System.out.println("--->>>>" + heroListCount);
|
||||
}
|
||||
|
||||
System.out.println("back hartbeat id : "+msgId);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue