Пример #1
0
    /// <summary>
    /// Sets the web view invisible from screen.
    /// </summary>
    /// <param name="fade">Whether hide with a fade in animation. Default is `false`.</param>
    /// <param name="edge">The edge from which the web view hiding. It simulates a modal effect when hiding a web view. Default is `UniWebViewTransitionEdge.None`.</param>
    /// <param name="duration">Duration of hiding animation. Default is `0.4f`.</param>
    /// <param name="completionHandler">Completion handler which will be called when hiding finishes. Default is `null`.</param>
    /// <returns>A bool value indicates whether the hiding operation started.</returns>
    public bool Hide(bool fade      = false, UniWebViewTransitionEdge edge = UniWebViewTransitionEdge.None,
                     float duration = 0.4f, Action completionHandler       = null)
    {
        var identifier  = Guid.NewGuid().ToString();
        var hideStarted = UniWebViewInterface.Hide(listener.Name, fade, (int)edge, duration, identifier);

        if (hideStarted && completionHandler != null)
        {
            var hasAnimation = (fade || edge != UniWebViewTransitionEdge.None);
            if (hasAnimation)
            {
                actions.Add(identifier, completionHandler);
            }
            else
            {
                completionHandler();
            }
        }
        if (hideStarted && useToolbar)
        {
            var top = (toolbarPosition == UniWebViewToolbarPosition.Top);
            SetShowToolbar(false, false, top, fullScreen);
        }
        return(hideStarted);
    }
Пример #2
0
 /// <summary>
 /// Hide this UniWebView.
 /// </summary>
 /// <description>
 /// Calling this method on a UniWebView will hide it.
 /// </description>
 public void Hide(bool fade = false, UniWebViewTransitionEdge direction = UniWebViewTransitionEdge.None, float duration = 0.4f, Action finishAction = null)
 {
     #if UNITY_EDITOR
     _hidden = true;
     #endif
     UniWebViewPlugin.Hide(gameObject.name, fade, (int)direction, duration);
     _hideTransitionAction = finishAction;
 }
Пример #3
0
    static int IntToEnum(IntPtr L)
    {
        int arg0 = (int)LuaDLL.lua_tonumber(L, 1);
        UniWebViewTransitionEdge o = (UniWebViewTransitionEdge)arg0;

        ToLua.Push(L, o);
        return(1);
    }
Пример #4
0
 public void Show(bool fade = false, UniWebViewTransitionEdge direction = UniWebViewTransitionEdge.None, float duration = 0.4f, Action finishAction = null)
 {
     this._lastScreenHeight = UniWebViewHelper.screenHeight;
     this.ResizeInternal();
     UniWebViewPlugin.Show(base.gameObject.name, fade, (int)direction, duration);
     this._showTransitionAction = finishAction;
     if (this.toolBarShow)
     {
         this.ShowToolBar(true);
     }
 }
Пример #5
0
 public void Show(bool fade = false, UniWebViewTransitionEdge direction = UniWebViewTransitionEdge.None, float duration = 0.4f, Action finishAction = null)
 {
     this._lastScreenHeight = UniWebViewHelper.screenHeight;
     this.ResizeInternal();
     UniWebViewPlugin.Show(((Object)((Component)this).get_gameObject()).get_name(), fade, (int)direction, duration);
     this._showTransitionAction = finishAction;
     if (!this.toolBarShow)
     {
         return;
     }
     this.ShowToolBar(true);
 }
Пример #6
0
    /// <summary>
    /// Sets the web view invisible from screen.
    /// </summary>
    /// <param name="fade">Whether hide with a fade in animation. Default is `false`.</param>
    /// <param name="edge">The edge from which the web view hiding. It simulates a modal effect when hiding a web view. Default is `UniWebViewTransitionEdge.None`.</param>
    /// <param name="duration">Duration of hiding animation. Default is `0.4f`.</param>
    /// <param name="completionHandler">Completion handler which will be called when hiding finishes. Default is `null`.</param>
    /// <returns>A bool value indicates whether the hiding operation started.</returns>
    public bool Hide(bool fade      = false, UniWebViewTransitionEdge edge = UniWebViewTransitionEdge.None,
                     float duration = 0.4f, Action completionHandler       = null)
    {
        var identifier  = Guid.NewGuid().ToString();
        var hideStarted = UniWebViewInterface.Hide(listener.Name, fade, (int)edge, duration, identifier);

        if (hideStarted && completionHandler != null)
        {
            actions.Add(identifier, completionHandler);
        }
        return(hideStarted);
    }
        public static void ShowWebView(UniWebViewTransitionEdge InTransitionEdge = UniWebViewTransitionEdge.None)
        {
            Log.Info($"[WebViewBridge] show web view : {InTransitionEdge}");

            isWebViewShowing = true;

            if (InTransitionEdge == UniWebViewTransitionEdge.None)
            {
                _webView.Show();
                SetGameSceneCameraActive(false);
            }
            else
            {
                _webView.Show(false, InTransitionEdge, .4f, () => { SetGameSceneCameraActive(false); });
            }
            _webView.SetBackButtonEnabled(true);
        }
Пример #8
0
    /// <summary>
    /// Show this UniWebView on screen.
    /// </summary>
    /// <description>
    /// Usually, it should be called when you get the LoadCompleteDelegate raised with a success flag true.
    /// The webview will not be visible until this method is called.
    /// </description>
    public void Show(bool fade = false, UniWebViewTransitionEdge direction = UniWebViewTransitionEdge.None, float duration = 0.4f, Action finishAction = null)
    {
        _lastScreenHeight = UniWebViewHelper.screenHeight;
        ResizeInternal();

        UniWebViewPlugin.Show(gameObject.name, fade, (int)direction, duration);
        _showTransitionAction = finishAction;

        if (toolBarShow)
        {
            ShowToolBar(true);
        }

        #if UNITY_EDITOR
        _webViewId = UniWebViewPlugin.GetId(gameObject.name);
        _hidden    = false;
        #endif
    }
        public static void HideWebView(UniWebViewTransitionEdge InTransitionEdge = UniWebViewTransitionEdge.None)
        {
            Log.Info($"[WebViewBridge] hide web view : {InTransitionEdge}");

            SetGameSceneCameraActive(true);

            if (InTransitionEdge == UniWebViewTransitionEdge.None)
            {
                TimerTools.Instance.RegisterTrigger(.4f, () => { _webView.Hide(); }, _webView);
            }
            else
            {
                _webView.Hide(false, InTransitionEdge, .4f, () => { Log.Info($"[WebViewBridge] hide web view finished.", ColorName.Olive); });
            }

            Szn.Framework.Audio.AudioManager.Instance.FadeTurnSound(false);
            isWebViewShowing = false;
        }
Пример #10
0
    /// <summary>
    /// Sets the web view visible on screen.
    /// </summary>
    /// <param name="fade">Whether show with a fade in animation. Default is `false`.</param>
    /// <param name="edge">The edge from which the web view showing. It simulates a modal effect when showing a web view. Default is `UniWebViewTransitionEdge.None`.</param>
    /// <param name="duration">Duration of showing animation. Default is `0.4f`.</param>
    /// <param name="completionHandler">Completion handler which will be called when showing finishes. Default is `null`.</param>
    /// <returns>A bool value indicates whether the showing operation started.</returns>
    public bool Show(bool fade      = false, UniWebViewTransitionEdge edge = UniWebViewTransitionEdge.None,
                     float duration = 0.4f, Action completionHandler       = null)
    {
        var identifier  = Guid.NewGuid().ToString();
        var showStarted = UniWebViewInterface.Show(listener.Name, fade, (int)edge, duration, identifier);

        if (showStarted && completionHandler != null)
        {
            var hasAnimation = (fade || edge != UniWebViewTransitionEdge.None);
            if (hasAnimation)
            {
                actions.Add(identifier, completionHandler);
            }
            else
            {
                completionHandler();
            }
        }
        return(showStarted);
    }
Пример #11
0
        /// <summary>
        /// 显示页面
        /// </summary>
        /// <param name="fade"></param>
        /// <param name="direction"></param>
        /// <param name="duration"></param>
        /// <param name="finishAction"></param>
        public void Show(bool fade = false, UniWebViewTransitionEdge direction = UniWebViewTransitionEdge.None, float duration = 0.4f, Action finishAction = null)
        {
            _lastScreenHeight = UniWebViewHelper.screenHeight;
            YxDebug.Log(string.Format("_lastScreenHeight:{0}", _lastScreenHeight));
            ResizeInternal();

            UniWebViewPlugin.Show(gameObject.name, fade, (int)direction, duration);
            _showTransitionAction = finishAction;

            if (ToolBarShow)
            {
                ShowToolBar(true);
            }
        #if UNITY_ANDROID && !UNITY_EDITOR
            UniWebViewPlugin.SetZoomEnable(gameObject.name, _zoomEnable);
        #endif

#if UNITY_EDITOR
            _webViewId = UniWebViewPlugin.GetId(gameObject.name);
            _hidden    = false;
#endif
        }
Пример #12
0
 public void Hide(bool fade = false, UniWebViewTransitionEdge direction = UniWebViewTransitionEdge.None, float duration = 0.4f, Action finishAction = null)
 {
     UniWebViewPlugin.Hide(((Object)((Component)this).get_gameObject()).get_name(), fade, (int)direction, duration);
     this._hideTransitionAction = finishAction;
 }
Пример #13
0
 public void Hide(bool fade = false, UniWebViewTransitionEdge direction = UniWebViewTransitionEdge.None, float duration = 0.4f, Action finishAction = null)
 {
     UniWebViewPlugin.Hide(base.gameObject.name, fade, (int)direction, duration);
     this._hideTransitionAction = finishAction;
 }