当前位置: 首页>>代码示例>>C#>>正文


C# UIButton.scaleFromTo方法代码示例

本文整理汇总了C#中UIButton.scaleFromTo方法的典型用法代码示例。如果您正苦于以下问题:C# UIButton.scaleFromTo方法的具体用法?C# UIButton.scaleFromTo怎么用?C# UIButton.scaleFromTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UIButton的用法示例。


在下文中一共展示了UIButton.scaleFromTo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: onTouchUpInsideScoresButton

 // Button callback
 public void onTouchUpInsideScoresButton( UIButton sender )
 {
     var ani = sender.scaleFromTo( 0.3f, new Vector3( 1, 1, 1 ), new Vector3( 1.3f, 1.3f, 1 ), Easing.Sinusoidal.easeOut );
     ani.autoreverse = true;
     ani.onComplete = () => Debug.Log( "done scaling button" ); // example of completion handler
 }
开发者ID:nsxdavid,项目名称:UIToolkit,代码行数:7,代码来源:KitchenSinkManager.cs

示例2: Start2

        public void Start2 () 
        {
            Debug.Log("Show main menu.");

            var atlas = GameObject.Find("main_menu_atlas").GetComponent<UIToolkit>();

            const float padding = 0.12f;
            const float bannerHeight = 0.1f;

            banner = UIButton.create(atlas, "banner.png", "banner.png", 0, 0);
            banner.positionFromCenter(0, 0);
            banner.positionFromTop(0, 0);
            banner.highlightedTouchOffsets = new UIEdgeOffsets(30);
            banner.scaleFromTo(1.0f, Vector3.zero, new Vector3(0.3f, 0.3f, 0), Easing.Quintic.easeOut);

            queue1vs1Btn = UIButton.create(atlas, "button.png", "button.png", 0, 0);
            queue1vs1Btn.highlightedTouchOffsets = new UIEdgeOffsets(30);
            queue1vs1Btn.positionFromCenter(0, 0);
            queue1vs1Btn.positionFromTop(bannerHeight+padding, 0);
            queue1vs1Btn.scaleFromTo(1.0f, Vector3.zero, new Vector3(0.3f, 0.3f, 0), Easing.Quintic.easeOut);
            queue1vs1Btn.onTouchUpInside += OnQueue1vs1Clicked;

            queue2vs2Btn = UIButton.create(atlas, "button.png", "button.png", 0, 0);
            queue2vs2Btn.highlightedTouchOffsets = new UIEdgeOffsets(30);
            queue2vs2Btn.positionFromCenter(0, 0);
            queue2vs2Btn.positionFromTop(bannerHeight + padding * 2, 0);
            queue2vs2Btn.scaleFromTo(1.0f, Vector3.zero, new Vector3(0.3f, 0.3f, 0), Easing.Quintic.easeOut);
            queue2vs2Btn.onTouchUpInside += OnQueue2vs2Clicked;

            customGameBtn = UIButton.create(atlas, "button.png", "button.png", 0, 0);
            customGameBtn.highlightedTouchOffsets = new UIEdgeOffsets(30);
            customGameBtn.positionFromCenter(0, 0);
            customGameBtn.positionFromTop(bannerHeight + padding * 3, 0);
            customGameBtn.scaleFromTo(1.0f, Vector3.zero, new Vector3(0.3f, 0.3f, 0), Easing.Quintic.easeOut);
            customGameBtn.onTouchUpInside += OnCustomGameClicked;

            settingsBtn = UIButton.create(atlas, "button.png", "button.png", 0, 0);
            settingsBtn.highlightedTouchOffsets = new UIEdgeOffsets(30);
            settingsBtn.positionFromCenter(0, 0);
            settingsBtn.positionFromTop(bannerHeight + padding * 4, 0);
            settingsBtn.scaleFromTo(1.0f, Vector3.zero, new Vector3(0.3f, 0.3f, 0), Easing.Quintic.easeOut);
            settingsBtn.onTouchUpInside += OnSettingsClicked;

            profileBtn = UIButton.create(atlas, "button.png", "button.png", 0, 0);
            profileBtn.highlightedTouchOffsets = new UIEdgeOffsets(30);
            profileBtn.positionFromCenter(0, 0);
            profileBtn.positionFromTop(bannerHeight + padding * 5, 0);
            profileBtn.scaleFromTo(1.0f, Vector3.zero, new Vector3(0.3f, 0.3f, 0), Easing.Quintic.easeOut);

            shopBtn = UIButton.create(atlas, "shop.png", "shop.png", 0, 0);
            shopBtn.highlightedTouchOffsets = new UIEdgeOffsets(30);
            shopBtn.positionFromCenter(0, 0);
            shopBtn.positionFromTop(bannerHeight + padding * 6, 0);
            shopBtn.scaleFromTo(1.0f, Vector3.zero, new Vector3(0.3f, 0.3f, 0), Easing.Quintic.easeOut);
            shopBtn.onTouchUpInside += OnShopClicked;
            
            /*var layout = new UIVerticalLayout(45);
            layout.beginUpdates();
            layout.verticalAlignMode = UIAbsoluteLayout.UIContainerVerticalAlignMode.Top;
            layout.addChild(queue1vs1Btn, queue2vs2Btn, customGameBtn, settings, shopBtn);
            layout.positionFromTop(0.2f, 0);
            layout.positionFromCenter(0, 0);
            layout.endUpdates();
            layout.matchSizeToContentSize();*/
        }
开发者ID:Foxzter,项目名称:net.kibotu.sandbox.unity.dragnslay,代码行数:65,代码来源:MainMenu.cs


注:本文中的UIButton.scaleFromTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。