コード例 #1
0
 static int _Hide(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 4);
         Wnd       obj  = (Wnd)ToLua.CheckObject(L, 1, typeof(Wnd));
         float     arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
         WShowType arg1 = (WShowType)ToLua.CheckObject(L, 3, typeof(WShowType));
         int       arg2 = (int)LuaDLL.luaL_checknumber(L, 4);
         obj._Hide(arg0, arg1, arg2);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
コード例 #2
0
    static int get_needVisible(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            wndShowHideInfo obj = (wndShowHideInfo)o;
            WShowType       ret = obj.needVisible;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index needVisible on a nil value" : e.Message));
        }
    }
コード例 #3
0
    static int set_needVisible(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            wndShowHideInfo obj  = (wndShowHideInfo)o;
            WShowType       arg0 = (WShowType)ToLua.CheckObject(L, 2, typeof(WShowType));
            obj.needVisible = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index needVisible on a nil value" : e.Message));
        }
    }
コード例 #4
0
 void _DoHide(WShowType wt, int depth)
 {
     if (m_panelObj == null)
     {
         return;
     }
     if (wt == WShowType.hide)
     {
         m_panelObj.SetActive(false); //关闭一切逻辑,并隐藏
         UIPanel[] panels = m_panelObj.transform.GetComponentsInChildren <UIPanel>(true);
         for (int i = 0; i < panels.Length; i++)
         {
             panels[i].depth -= depth;
         }
         m_Visible = false;
         WndManage.Single._OnWndHide(m_wInfo.name);//通知界面隐藏
     }
     else
     {
         WndManage.Single.DestroyWnd(WndManage.Single._GetWnd(m_wInfo.name));
         OnDestroyFinishEnd.Call(this);
     }
 }
コード例 #5
0
 public void _Hide(float duration, WShowType wt, int depth)
 {
     _ShowHide(false, duration, wt, depth);
 }
コード例 #6
0
    void _ShowHide(bool isShow, float duration, WShowType wt, int depth = 0)
    {
        //移除所有现有的显示效果
        StopAllTweener();

        if (isShow && !m_panelObj.activeSelf)
        {
            m_panelObj.SetActive(true);
        }

        if (isShow)
        {
            m_Visible = true;
        }

        if (duration > 0)//需要做动画
        {
            //显示挡板
            m_baffleObj.GetComponent <UIWidget>().depth = 99999;

            UIWidget widget = m_wndObj.GetComponent <UIWidget>();
            if (widget)
            {
                widget.SetAnchor((GameObject)null);  //解除锚点

                m_TweenStartScale = m_wndObj.transform.localScale;
                m_TweenStartPos   = m_wndObj.transform.localPosition;
                m_TweenStartAlpha = m_wndObj.GetComponent <UIWidget>().alpha;
                var t = 0f;
                m_Tween = DOTween.To(() => t, (v) =>
                {
                    t = v;
                    tweenShowHide(isShow, v);
                }, 1, duration).SetAutoKill(true).SetEase(Ease.Linear)
                          .OnComplete(() =>
                {
                    m_baffleObj.GetComponent <UIWidget>().depth = -99;

                    if (isShow)
                    {
                        OnShowFinishEnd.Call(this);
                    }
                    else
                    {
                        _DoHide(wt, depth);
                    }
                }
                                      );
                m_Tween.SetUpdate(true);
            }
            else
            {
                if (isShow)
                {
                    OnShowFinishEnd.Call(this);
                }
                else
                {
                    _DoHide(wt, depth);
                }
            }
        }
        else//瞬间完成
        {
            if (isShow)
            {
                m_wndObj.GetComponent <UIWidget>().alpha = 1;
                m_wndObj.transform.localScale            = Vector3.one;
                OnShowFinishEnd.Call(this);
            }
            else
            {
                _DoHide(wt, depth);
            }
        }
    }