//通过hid发送对应的bytes给对应的监听者 private void ParseHeader(int hLen) { lock (locker){ int ind; ArrayList arrL = Proto.unpack("iH", m_recvBytes, out ind); if (arrL == null || arrL.Count != 2) { return; } //Debug.Log("hLen is " + hLen); int hid = (ushort)arrL[1]; byte[] tmpBytes = new byte[hLen]; ind = ind - (int)Proto.calsize("H"); Array.Copy(m_recvBytes, ind, tmpBytes, 0, hLen); int tot_len = hLen + (int)Proto.calsize("i"); m_recvcount -= tot_len; byte[] tmp = new byte[m_recvcount]; Array.Copy(m_recvBytes, tot_len, tmp, 0, m_recvcount); m_recvBytes = tmp; //发送数据 Debug.Log("pass hid is " + hid); NetDelegate.GetIns().DispatchEvent((ushort)hid, tmpBytes); } }
private void cancel_msg() { NetDelegate.GetIns().RemoveListener(HeaderConst.HEADER_LOGIN_MSG_ID, this.create_new_player); }
private void register_msg() { NetDelegate.GetIns().AddListener(HeaderConst.HEADER_LOGIN_MSG_ID, this.create_new_player); }
public void uinit() { NetDelegate.GetIns().RemoveListener(HeaderConst.HEADER_POS_MSG_ID); }
public void init() { NetDelegate.GetIns().AddListener(HeaderConst.HEADER_POS_MSG_ID, this.update_pos); }