public override bool AfterInit() { NFCNetLogic.Instance().AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_LOGIN, OnLoginProcess); NFCNetLogic.Instance().AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_WORLD_LIST, OnWorldList); NFCNetLogic.Instance().AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_CONNECT_WORLD, OnConnectWorld); NFCNetLogic.Instance().AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_CONNECT_KEY, OnConnectKey); NFCNetLogic.Instance().AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_SELECT_SERVER, OnSelectServer); return(true); }
public override bool AfterInit() { NFCNetLogic.Instance().AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_PROPERTY_INT, OnPropertyInt); NFCNetLogic.Instance().AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_PROPERTY_FLOAT, OnPropertyFloat); NFCNetLogic.Instance().AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_PROPERTY_STRING, OnPropertyString); NFCNetLogic.Instance().AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_PROPERTY_OBJECT, OnPropertyObject); NFCNetLogic.Instance().AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_OBJECT_PROPERTY_ENTRY, OnObjectPropertyEntry); return(true); }
public override bool AfterInit() { NFCNetLogic.Instance().AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_ROLE_LIST, OnRoleList); NFCNetLogic.Instance().AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_OBJECT_ENTRY, OnObjectEntry); NFCNetLogic.Instance().AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_OBJECT_LEAVE, OnObjectLeave); NFCNetLogic.Instance().AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_MOVE, OnObjectMove); NFCNetLogic.Instance().AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_MOVE_IMMUNE, OnObjectJump); return(true); }
public void RequireConnectWorld(int nWorldID) { NFMsg.ReqConnectWorld xData = new NFMsg.ReqConnectWorld(); xData.world_id = nWorldID; MemoryStream stream = new MemoryStream(); Serializer.Serialize <NFMsg.ReqConnectWorld>(stream, xData); NFCNetLogic.Instance().SendToServerByPB(NFMsg.EGameMsgID.EGMI_REQ_CONNECT_WORLD, stream); }
public void RequireWorldList() { NFMsg.ReqServerList xData = new NFMsg.ReqServerList(); xData.type = NFMsg.ReqServerListType.RSLT_WORLD_SERVER; MemoryStream stream = new MemoryStream(); Serializer.Serialize <NFMsg.ReqServerList>(stream, xData); NFCNetLogic.Instance().SendToServerByPB(NFMsg.EGameMsgID.EGMI_REQ_WORLD_LIST, stream); }
public void RequireSelectServer(int nServerID) { NFMsg.ReqSelectServer xData = new NFMsg.ReqSelectServer(); xData.world_id = nServerID; mServerID = nServerID; MemoryStream stream = new MemoryStream(); Serializer.Serialize <NFMsg.ReqSelectServer>(stream, xData); NFCNetLogic.Instance().SendToServerByPB(NFMsg.EGameMsgID.EGMI_REQ_SELECT_SERVER, stream); }
public override bool AfterInit() { NFCNetLogic.Instance().AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_RECORD_INT, OnRecordInt); NFCNetLogic.Instance().AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_RECORD_FLOAT, OnRecordFloat); NFCNetLogic.Instance().AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_RECORD_STRING, OnRecordString); NFCNetLogic.Instance().AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_RECORD_OBJECT, OnRecordObject); NFCNetLogic.Instance().AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_SWAP_ROW, OnSwapRow); NFCNetLogic.Instance().AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_ADD_ROW, OnAddRow); NFCNetLogic.Instance().AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_REMOVE_ROW, OnRemoveRow); NFCNetLogic.Instance().AddReceiveCallBack(NFMsg.EGameMsgID.EGMI_ACK_OBJECT_RECORD_ENTRY, OnObjectRecordEntry); return(true); }
// 请求消息 public void RequireRoleList() { NFMsg.ReqRoleList xData = new NFMsg.ReqRoleList(); xData.game_id = NFCLoginLogic.Instance().mServerID; xData.account = UnicodeEncoding.Default.GetBytes(NFCLoginLogic.Instance().mAccount); MemoryStream stream = new MemoryStream(); Serializer.Serialize <NFMsg.ReqRoleList>(stream, xData); NFCNetLogic.Instance().SendToServerByPB(NFMsg.EGameMsgID.EGMI_REQ_ROLE_LIST, stream); Debug.Log("RequireRoleList"); }
private void OnConnectWorld(UInt16 id, MemoryStream stream) { NFMsg.MsgBase xMsg = new NFMsg.MsgBase(); xMsg = Serializer.Deserialize <NFMsg.MsgBase>(stream); NFMsg.AckConnectWorldResult xData = new NFMsg.AckConnectWorldResult(); xData = Serializer.Deserialize <NFMsg.AckConnectWorldResult>(new MemoryStream(xMsg.msg_data)); NFCNetLogic.Instance().Shut(); NFCNetLogic.Instance().ConnectServer(System.Text.Encoding.Default.GetString(xData.world_ip), (ushort)xData.world_port); mKey = System.Text.Encoding.Default.GetString(xData.world_key); RequireVerifyWorldKey(mAccount, mKey); }
public void RequireMove(UnityEngine.Vector3 pos) { NFMsg.ReqAckPlayerMove xData = new NFMsg.ReqAckPlayerMove(); xData.mover = NFToPB(mRoleID); xData.moveType = 0; NFMsg.Position xTargetPos = new NFMsg.Position(); xTargetPos.x = pos.x; xTargetPos.y = pos.z; xTargetPos.z = pos.y; xData.target_pos.Add(xTargetPos); MemoryStream stream = new MemoryStream(); Serializer.Serialize <NFMsg.ReqAckPlayerMove>(stream, xData); NFCNetLogic.Instance().SendToServerByPB(NFMsg.EGameMsgID.EGMI_REQ_MOVE, stream); }
public void RequireEnterGameServer(int nRoleIndex) { m_nRoleIndex = nRoleIndex; Debug.Log("RequireEnterGameServer:" + nRoleIndex); NFMsg.RoleLiteInfo info = (NFMsg.RoleLiteInfo)mRoleList[nRoleIndex]; NFMsg.ReqEnterGameServer xData = new NFMsg.ReqEnterGameServer(); xData.name = info.noob_name; xData.account = UnicodeEncoding.Default.GetBytes(NFCLoginLogic.Instance().mAccount); xData.game_id = NFCLoginLogic.Instance().mServerID; xData.id = info.id; MemoryStream stream = new MemoryStream(); Serializer.Serialize <NFMsg.ReqEnterGameServer>(stream, xData); mRoleID = PBToNF(info.id); NFCNetLogic.Instance().mOwnerID = mRoleID; NFCNetLogic.Instance().SendToServerByPB(NFMsg.EGameMsgID.EGMI_REQ_ENTER_GAME, stream); }
public void RequireVerifyWorldKey(string strAccount, string strKey) { NFMsg.ReqAccountLogin xData = new NFMsg.ReqAccountLogin(); xData.account = System.Text.Encoding.Default.GetBytes(strAccount); xData.password = System.Text.Encoding.Default.GetBytes(""); xData.security_code = System.Text.Encoding.Default.GetBytes(strKey); xData.signBuff = System.Text.Encoding.Default.GetBytes(""); xData.clientVersion = 1; xData.loginMode = 0; xData.clientIP = 0; xData.clientMAC = 0; xData.device_info = System.Text.Encoding.Default.GetBytes(""); xData.extra_info = System.Text.Encoding.Default.GetBytes(""); MemoryStream stream = new MemoryStream(); Serializer.Serialize <NFMsg.ReqAccountLogin>(stream, xData); NFCNetLogic.Instance().SendToServerByPB(NFMsg.EGameMsgID.EGMI_REQ_CONNECT_KEY, stream); }
public void RequireCreateRole(string strRoleName, int byCareer, int bySex) { if (strRoleName.Length >= 20 || strRoleName.Length < 1) { return; } NFMsg.ReqCreateRole xData = new NFMsg.ReqCreateRole(); xData.career = byCareer; xData.sex = bySex; xData.noob_name = UnicodeEncoding.Default.GetBytes(strRoleName); xData.account = UnicodeEncoding.Default.GetBytes(NFCLoginLogic.Instance().mAccount); xData.race = 0; xData.game_id = NFCLoginLogic.Instance().mServerID; MemoryStream stream = new MemoryStream(); Serializer.Serialize <NFMsg.ReqCreateRole>(stream, xData); NFCNetLogic.Instance().SendToServerByPB(NFMsg.EGameMsgID.EGMI_REQ_CREATE_ROLE, stream); }
// 请求消息 public void LoginPB(string strAccount, string strPwd, string strKey) { Debug.Log("LoginPB:" + strAccount); NFMsg.ReqAccountLogin xData = new NFMsg.ReqAccountLogin(); xData.account = System.Text.Encoding.Default.GetBytes(strAccount); xData.password = System.Text.Encoding.Default.GetBytes(strPwd); xData.security_code = System.Text.Encoding.Default.GetBytes(strKey); xData.signBuff = System.Text.Encoding.Default.GetBytes(""); xData.clientVersion = 1; xData.loginMode = 0; xData.clientIP = 0; xData.clientMAC = 0; xData.device_info = System.Text.Encoding.Default.GetBytes(""); xData.extra_info = System.Text.Encoding.Default.GetBytes(""); mAccount = strAccount; MemoryStream stream = new MemoryStream(); Serializer.Serialize <NFMsg.ReqAccountLogin>(stream, xData); NFCNetLogic.Instance().SendToServerByPB(NFMsg.EGameMsgID.EGMI_REQ_LOGIN, stream); }