public void LuaCallSendApi(int iFuncId, object[] args) { try { if (iFuncId > HandlerSendType.Length) { Debug.LogError("LuaCallSendApi iFuncId err:" + iFuncId + " " + HandlerSendType.Length); return; } Type callBackType = HandlerSendType[iFuncId]; if (callBackType.GetFields().Length != args.Length) { Debug.LogError("LuaCallSendApi Length err:" + iFuncId + "," + callBackType.GetFields().Length + "," + args.Length); return; } //WQ_TODO CsRpcWrap.To_Bytes_Handler pByHandler = CsRpcWrap.to_bytes_pHander[iFuncId]; Debug.Assert(null != pByHandler, "CsRpcWrap.To_Bytes_Handler Err:" + iFuncId); Byte[] data = pByHandler(ref args, 0); RpcSendHander.SendLogicCPrt(ref data, data.Length); } catch (Exception e) { Debug.LogError("LuaCallSendApi Exception:iFuncId" + iFuncId + ",args:" + args.ToString() + ",\n" + e.ToString()); } }
public static void OnConnected(IAsyncResult connected) { C2CS_GameUserLogin lg = GenerateStLogin(); RpcSendHander.Send_GameUserLogin(lg); if (m_timer == null) { m_timer = new Timer(OnTick, null, 0, 20000); } OnRecvStateMsg(EMsgState.eOnConnected, string.Format("OnConnected->{0}:{1}", m_sIp, m_nPort)); }
public static void CltCallCns(int iFuncId, object[] args) { int packLen = 0; Array.Clear(m_bufSendData, 0, 256); Dispatcher.Cns2CltRpc.PackProtocol(iFuncId, args, ref m_bufSendData, ref packLen); if (packLen > 0) { bool ret = RpcSendHander.CLuaSendHeadlerClt2Cns_SendRpcData(ref m_bufSendData, packLen); if (!ret) { Debug.LogWarning("CLuaSendHeadlerClt2Cns_SendRpcData: " + iFuncId); } } }
public static void GacCallGas(int iFuncId, object[] args) { int packLen = 0; Array.Clear(m_bufSendData, 0, 256); Dispatcher.LogicRpc.PackProtocol(iFuncId, args, ref m_bufSendData, ref packLen); if (packLen > 0) { bool ret = RpcSendHander.Send_GameLogicLua_WithBytes(ref m_bufSendData, packLen); if (!ret) { Debug.LogWarning("Send_GameLogicLua_WithBytes: " + iFuncId); } } }
private static void OnTick(object obj) { RpcSendHander.Send_Ping(); }