public override void ShowWebView(string url, GamebaseRequest.Webview.GamebaseWebViewConfiguration configuration = null, int closeCallbackHandle = -1, List <string> schemeList = null, int schemeEventHandle = -1)
        {
            GamebaseCallback.ErrorDelegate closeCallback = null;
            if (-1 != closeCallbackHandle)
            {
                closeCallback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.ErrorDelegate>(closeCallbackHandle);
                GamebaseCallbackHandler.UnregisterCallback(closeCallbackHandle);
            }

            GamebaseCallback.GamebaseDelegate <string> schemeEvent = null;
            if (-1 != schemeEventHandle)
            {
                schemeEvent = GamebaseCallbackHandler.GetCallback <GamebaseCallback.GamebaseDelegate <string> >(schemeEventHandle);
                GamebaseCallbackHandler.UnregisterCallback(schemeEventHandle);
            }

            bool hasAdapter = WebviewAdapterManager.Instance.CreateWebviewAdapter("standalonewebviewadapter");

            if (false == hasAdapter)
            {
                GamebaseLog.Warn(GamebaseStrings.WEBVIEW_ADAPTER_NOT_FOUND, this);
                if (null != closeCallback)
                {
                    closeCallback(new GamebaseError(GamebaseErrorCode.WEBVIEW_UNKNOWN_ERROR, message: GamebaseStrings.WEBVIEW_ADAPTER_NOT_FOUND));
                }

                return;
            }

            WebviewAdapterManager.Instance.ShowWebView(url, configuration, closeCallback, schemeList, schemeEvent);
        }
Пример #2
0
        virtual public void ShowWebView(string url, GamebaseRequest.Webview.GamebaseWebViewConfiguration configuration = null, int closeCallback = -1, List <string> schemeList = null, int schemeEvent = -1)
        {
            NativeRequest.Webview.WebviewConfiguration webviewConfiguration = new NativeRequest.Webview.WebviewConfiguration();
            webviewConfiguration.url           = url;
            webviewConfiguration.configuration = configuration;

            string extraData = JsonMapper.ToJson(new GamebaseRequest.Webview.SchemeConfiguration(schemeList, schemeEvent));
            string jsonData  = JsonMapper.ToJson(new UnityMessage(GamebaseWebview.WEBVIEW_API_SHOW_WEBVIEW, handle: closeCallback, jsonData: JsonMapper.ToJson(webviewConfiguration), extraData: extraData, gameObjectName: GamebaseUnitySDK.ObjectName, requestMethodName: "OnAsyncEvent"));

            messageSender.GetAsync(jsonData);
        }
Пример #3
0
        public void ShowWebView(string url, GamebaseRequest.Webview.GamebaseWebViewConfiguration configuration = null, GamebaseCallback.ErrorDelegate closeCallback = null, List <string> schemeList = null, GamebaseCallback.GamebaseDelegate <string> schemeEvent = null)
        {
            if (adapter == null)
            {
                if (null != closeCallback)
                {
                    closeCallback(new GamebaseError(GamebaseErrorCode.WEBVIEW_UNKNOWN_ERROR, message: GamebaseStrings.WEBVIEW_ADAPTER_NOT_FOUND));
                }
                return;
            }

            adapter.ShowWebView(url, configuration, closeCallback, schemeList, schemeEvent);
        }
Пример #4
0
        virtual public void ShowWebView(GamebaseRequest.Webview.GamebaseWebViewConfiguration configuration)
        {
            string jsonString = "";

            if (null != configuration)
            {
                jsonString = JsonMapper.ToJson(configuration);
            }

            string jsonData = JsonMapper.ToJson(new UnityMessage(GamebaseWebview.WEBVIEW_API_SHOW_WEBVIEW_DEPRECATED, jsonData: jsonString, gameObjectName: GamebaseUnitySDK.ObjectName, requestMethodName: "OnAsyncEvent"));

            messageSender.GetAsync(jsonData);
        }
        public void ShowWebView(string url, GamebaseRequest.Webview.GamebaseWebViewConfiguration configuration = null, GamebaseCallback.ErrorDelegate closeCallback = null, List <string> schemeList = null, GamebaseCallback.GamebaseDelegate <string> schemeEvent = null)
        {
            int closeCallbackHandle = -1;
            int schemeEventHandle   = -1;

            if (null != closeCallback)
            {
                closeCallbackHandle = GamebaseCallbackHandler.RegisterCallback(closeCallback);
            }

            if (null != schemeEvent)
            {
                schemeEventHandle = GamebaseCallbackHandler.RegisterCallback(schemeEvent);
            }

            webview.ShowWebView(url, configuration, closeCallbackHandle, schemeList, schemeEventHandle);
        }
 public virtual void ShowWebView(string url, GamebaseRequest.Webview.GamebaseWebViewConfiguration configuration = null, int closeCallback = -1, List <string> schemeList = null, int schemeEvent = -1)
 {
     GamebaseErrorNotifier.FireNotSupportedAPI(this, "ShowWebView");
 }
 public virtual void ShowWebView(GamebaseRequest.Webview.GamebaseWebViewConfiguration configuration)
 {
     GamebaseErrorNotifier.FireNotSupportedAPI(this, "ShowWebView");
 }