public sealed override Action <BridgeRequest, BridgeResponse> PullListener(CallUnityMethod key) { Action <BridgeRequest, BridgeResponse> method; if (!staticUnityMethods.TryGetValue(key, out method)) { return(null); } return(method); }
protected void AsyncInvokePlatform(CallPlatformMethod invokeMethod, CallUnityMethod callbackMethod, Action <BridgeResponse> method, params JsonData[] args) { var request = BridgeRequest.Create(invokeMethod.ToString(), callbackMethod.ToString(), args); var requestJson = request.ToJson(); try { DebugUtility.Log(LoggerTags.Module, "异步调用 -> arg:{0};", requestJson); PushListener(request.callbackMethod, method); InvokePlatform(requestJson); } catch (Exception ex) { DebugUtility.LogError(LoggerTags.Module, "异步调用 -> arg:{0}; 异常 -> Exception:{1}", requestJson, ex); } }
protected sealed override void PushListener(CallUnityMethod key, Action <BridgeRequest, BridgeResponse> method) { staticUnityMethods[key] = method; }
public abstract Action <BridgeRequest, BridgeResponse> PullListener(CallUnityMethod key);
protected abstract void PushListener(CallUnityMethod key, Action <BridgeRequest, BridgeResponse> method);