//Register... public static void SendUserRegister() { protoSources.GameProto.GameAccountRegisterReq data = new protoSources.GameProto.GameAccountRegisterReq(); data.name = "Test20160815_1"; data.passwd = "Test20160815_1"; //mistake, this is user password... SingleDkReqProto.sendMsgSever((short)GameCmdCode.CMD_CODE_REGISTER_REQ, data); }
//Login... public static void SendUserLogin() { protoSources.GameProto.GameAccountLoginReq data = new protoSources.GameProto.GameAccountLoginReq(); data.name = "Test20160815_1"; data.passwd = "Test20160815_1"; //mistake, this is user password... SingleDkReqProto.sendMsgSever((short)(GameCmdCode.CMD_CODE_LOGIN_REQ), data); }
/// <summary> /// Sends the message to sever. /// TODO:设置bReliable为true,超时后可以重传该请求. /// </summary> /// <param name="shMsgID">Sh message I.</param> /// <param name="data">Data.</param> /// <param name="bReliable">If set to <c>true</c> b reliable.</param> public static void sendMsgSever(int shMsgID, ProtoBuf.IExtensible data) { SingleDkReqProto drp = new SingleDkReqProto(); drp.head = new proto_header(); drp.head.shMsgID = shMsgID; drp.req = data; Log.info("SingleDkReqProto", "[SingleDkReqProto][sendMsgSever] Send Message. ID " + (GameCmdCode)shMsgID); drp.request(); }
/// <summary> /// Sends the message to sever.P2P Message. /// NetWork retransmit. /// </summary> /// <param name="shMsgID">Sh message I.</param> /// <param name="data">Data.</param> /// <param name="bReliable">If set to <c>true</c> b reliable.</param> public static void sendMsgUdp(int shMsgID, ProtoBuf.IExtensible data) { //Must set self-playerid. SingleDkReqProto drp = new SingleDkReqProto(); drp.head = new proto_header(); drp.head.shMsgID = shMsgID; drp.req = data; drp.isP2P = true; Log.info("SingleDkReqProto", "[SingleDkReqProto][sendMsgUdp] Send Message. ID " + (GameCmdCode)shMsgID); drp.request(); }