/// <summary> /// 从网络线程接受协议 /// </summary> /// <param name="session"></param> /// <param name="route_codec"></param> /// <param name="binary"></param> /// <param name="cb"></param> public void connect_OnReceivedBinaryImmediately(TypeCodec route_codec, BinaryMessage binary, OnRpcBinaryReturn cb = null) { last_heartbeat = DateTime.Now; if (client_battle_action_codec.MessageID == route_codec.MessageID) { SendToArea(route_codec, binary); } else { this.Provider.Execute(new Action(do_async_OnReceivedBinaryImmediately)); void do_async_OnReceivedBinaryImmediately() { SendToLogic(route_codec, binary, cb); } } }
/// <summary> /// 逻辑协议发往LogicService /// </summary> /// <param name="msg"></param> /// <param name="callback"></param> public virtual void SendToLogic(TypeCodec route_codec, BinaryMessage msg, OnRpcBinaryReturn callback = null) { var logic = remote_logic_service; if (logic != null) { if (callback != null) { logic.Call(msg, callback); } else { logic.Invoke(msg); } } else { log.Warn("SendToLogic Error : Logic Service Not Init : " + route_codec); if (callback != null) { callback(BinaryMessage.NULL); } } }