示例#1
1
    private void SwitchPanel(RectTransform panelFrom, RectTransform panelTo)
    {
        DOTween.Kill(panelFrom.transform, true);
        DOTween.Kill(panelTo.transform, true);

        var y = panelFrom.anchoredPosition.y;
        panelFrom.anchoredPosition = new Vector2(0, y);
        panelFrom.DOAnchorPos(new Vector2(-700, y), 0.25f)
                 .OnComplete(() => panelFrom.gameObject.SetActive(false));

        panelTo.gameObject.SetActive(true);
        panelTo.anchoredPosition = new Vector2(700, y);
        panelTo.DOAnchorPos(new Vector2(0, y), 0.25f);
    }
    static int DOAnchorPos(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 3)
            {
                UnityEngine.RectTransform obj  = (UnityEngine.RectTransform)ToLua.CheckObject(L, 1, typeof(UnityEngine.RectTransform));
                UnityEngine.Vector2       arg0 = ToLua.ToVector2(L, 2);
                float arg1            = (float)LuaDLL.luaL_checknumber(L, 3);
                DG.Tweening.Tweener o = obj.DOAnchorPos(arg0, arg1);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 4)
            {
                UnityEngine.RectTransform obj  = (UnityEngine.RectTransform)ToLua.CheckObject(L, 1, typeof(UnityEngine.RectTransform));
                UnityEngine.Vector2       arg0 = ToLua.ToVector2(L, 2);
                float arg1            = (float)LuaDLL.luaL_checknumber(L, 3);
                bool  arg2            = LuaDLL.luaL_checkboolean(L, 4);
                DG.Tweening.Tweener o = obj.DOAnchorPos(arg0, arg1, arg2);
                ToLua.PushObject(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.RectTransform.DOAnchorPos"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
示例#3
0
        protected override Tween DOPlay()
        {
            if (null == m_RectTransform)
            {
                return(null);
            }
            // end if
            switch (m_posType)
            {
            case PosTypeEnum.Pos:
                return(m_RectTransform.DOAnchorPos(m_toAnchorPos, m_duration, m_isSnapping));

            case PosTypeEnum.PosX:
                return(m_RectTransform.DOAnchorPosX(m_toAnchorPosX, m_duration, m_isSnapping));

            case PosTypeEnum.PosY:
                return(m_RectTransform.DOAnchorPosY(m_toAnchorPosY, m_duration, m_isSnapping));

            default: return(null);
            } // end switch
        }
示例#4
0
    /// <summary>
    /// Plays the outro for the menu.
    /// </summary>
    private void AnimateOutro( RectTransform sliding, CanvasGroup fading, MenuDestinations d )
    {
        //Disable input
        allowInput = false;

        //Start animation
        Sequence s = DOTween.Sequence ( )
            .Append ( fading.DOFade ( 0, FADE_TIME ) )
            .Append ( sliding.DOAnchorPos ( new Vector2 ( -sliding.rect.width, 0 ), SLIDE_TIME ) )
            .OnComplete ( () =>
            {
                //Enable input
                allowInput = true;

                //Check transistion
                switch ( d )
                {
                    case MenuDestinations.RulesToAbilites:
                        //Hide button
                        abilityButton.SetActive ( false );

                        //Hide menu panel
                        rulesPanel.gameObject.SetActive ( false );

                        //Display ability panel
                        abilitiesPanel.gameObject.SetActive ( true );

                        //Set scroll panel to the top
                        scroll.value = 1;

                        //Display first ability
                        OnAbilityClick ( abilityButtons [ 0 ], false );

                        //Play intro
                        AnimateIntro ( abilitiesPanel, fading );
                        break;
                    case MenuDestinations.AbilitiesToRules:
                        //Hide ability panel
                        abilitiesPanel.gameObject.SetActive ( false );

                        //Display menu panel
                        rulesPanel.gameObject.SetActive ( true );

                        //Display overview
                        OnMenuClick ( menuButtons [ 3 ], false );

                        //Play intro
                        AnimateIntro ( rulesPanel, fading );
                        break;
                    case MenuDestinations.Tutorial:
                        Application.LoadLevel ( "Game Board" );
                        break;
                    case MenuDestinations.None:
                        Application.LoadLevel ( "Main Menu" );
                        break;
                }
            } )
            .SetRecyclable ( )
            .Play ( );
    }
示例#5
0
    /// <summary>
    /// Plays the intro animation for the menu.
    /// </summary>
    private void AnimateIntro( RectTransform sliding, CanvasGroup fading )
    {
        //Disable input
        allowInput = false;

        //Set starting values
        sliding.anchoredPosition = new Vector2 ( -sliding.rect.width, 0 );
        fading.alpha = 0;

        //Start animation
        Sequence s = DOTween.Sequence ( )
            .Append ( sliding.DOAnchorPos ( Vector2.zero, SLIDE_TIME ) )
            .Append ( fading.DOFade ( 1, FADE_TIME ) )
            .OnComplete ( () =>
            {
                //Enable input
                allowInput = true;
            } )
            .SetRecyclable ( )
            .Play ( );
    }
示例#6
0
 void TweenOut(RectTransform rt)
 {
     float tweenDist = -rt.rect.height;
     rt.DOAnchorPos(new Vector2(0f,tweenDist),.2f);
 }
示例#7
0
 void TweenIn(RectTransform rt)
 {
     rt.DOAnchorPos(new Vector2(0f,0f),.2f);
 }