private string _GetTargetModule(NativeModule module) { switch (Application.platform) { case RuntimePlatform.IPhonePlayer: return(string.IsNullOrEmpty(module.IOS) ? module.Default : module.IOS); case RuntimePlatform.Android: return(string.IsNullOrEmpty(module.Android) ? module.Default : module.Android); default: return(string.IsNullOrEmpty(module.Default) ? string.Empty : module.Default); } }
public INativeProxy Connect <T>(NativeModule module, T proxy) where T : class { var token = this.nativeProxies.Count; var nativeProxy = new NativeProxy(this, proxy, token); this.nativeProxies.Add(nativeProxy); var protocol = new ConnnectProtocol() { Token = token, Module = _GetTargetModule(module), }; //var message = SimpleJson.SimpleJson.SerializeObject(protocol); // NativeBridge.Connect(message); return(nativeProxy); }
public void Call(NativeModule module, string method, params object[] args) { using (var proxy = Connect(module, new InnerManagedProxy())) { proxy.Call(method, args); } }