當前位置: 首頁>>代碼示例>>C#>>正文


C# RectTransform.DOAnchorPos方法代碼示例

本文整理匯總了C#中UnityEngine.RectTransform.DOAnchorPos方法的典型用法代碼示例。如果您正苦於以下問題:C# RectTransform.DOAnchorPos方法的具體用法?C# RectTransform.DOAnchorPos怎麽用?C# RectTransform.DOAnchorPos使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UnityEngine.RectTransform的用法示例。


在下文中一共展示了RectTransform.DOAnchorPos方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SwitchPanel

    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);
    }
開發者ID:SaladLab,項目名稱:TicTacToe,代碼行數:14,代碼來源:MainScene.cs

示例2: AnimateOutro

    /// <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 ( );
    }
開發者ID:ethancaraway,項目名稱:Evasion,代碼行數:63,代碼來源:RulesMenu.cs

示例3: TweenOut

 void TweenOut(RectTransform rt)
 {
     float tweenDist = -rt.rect.height;
     rt.DOAnchorPos(new Vector2(0f,tweenDist),.2f);
 }
開發者ID:Wuzseen,項目名稱:RollerGolf,代碼行數:5,代碼來源:ObjectPlacer.cs

示例4: AnimateIntro

    /// <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 ( );
    }
開發者ID:ethancaraway,項目名稱:Evasion,代碼行數:24,代碼來源:RulesMenu.cs

示例5: TweenIn

 void TweenIn(RectTransform rt)
 {
     rt.DOAnchorPos(new Vector2(0f,0f),.2f);
 }
開發者ID:Wuzseen,項目名稱:RollerGolf,代碼行數:4,代碼來源:ObjectPlacer.cs


注:本文中的UnityEngine.RectTransform.DOAnchorPos方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。