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


C# UIButton.positionFromTopLeft方法代码示例

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


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

示例1: CreateGUI

    private void CreateGUI()
    {
        UIToolkit ui = GameObject.Find("UIToolkit").GetComponent<UIToolkit>();

        UIButton uiBackground = UIButton.create(ui, "Marge.png", "Marge.png", 0, 0);
        uiBackground.color = new Color(0f, 0f, 0f, 0f);
        uiBackground.setSize(Screen.width, Screen.height);
        uiBackground.onTouchUpInside += uiBackground_onTouchUpInside;
        uiBackground.zIndex = 10;

        float buttonSize = Screen.width * 0.06f;

        btnMargeArrow = UIButton.create(ui, "MargeArrow.png", "MargeArrow.png", 0, 0);
        btnMargeArrow.setSize(buttonSize, buttonSize);
        btnMargeArrow.positionFromTopLeft(0f, 0.01f);
        btnMargeArrow.onTouchUpInside += btnMargeArrow_onTouchUpInside;
        btnMargeArrow.zIndex = -1;

        spriteMarge = ui.addSprite("Marge.png", 0, 0, -1);
        spriteMarge.setSize(0.01f * Screen.width, 1 * Screen.height);
        spriteMarge.positionFromTopLeft(0f, 0f);
        spriteMarge.zIndex = -1;

        //--- Conteneur
        //var scrollable = new UIScrollableVerticalLayout(10);

        //scrollable.alignMode = UIAbstractContainer.UIContainerAlignMode.Center;
        //scrollable.position = new Vector3(Screen.width * 0.05f, -Screen.height * 0.1f, 0);
        //var width = UI.scaleFactor * 150;
        //scrollable.setSize(width, Screen.height * 0.8f);
        //---

        //UIGridLayout grid = new UIGridLayout(4, map.Layers.Count, 0);
        //grid.edgeInsets = new UIEdgeInsets(0);
        //grid.alignMode = UIAbstractContainer.UIContainerAlignMode.Left;
        //grid.layoutType = UIAbstractContainer.UILayoutType.AbsoluteLayout
        int i = 0;
        foreach (Layer layer in map.Layers)
        {
            UIHorizontalLayout hLayout = new UIHorizontalLayout(0);
            hLayout.zIndex = -2f;

            listHLayout.Add(hLayout);

            //int posY = 10 + i * 20;
            //int margeX = 10;
            //int deltaX = 10;
            //int spaceX = 5;

            //UIText text = new UIText(textManager, "prototype", "prototype.png");

            UIButton btnBrowse = UIButton.create(ui, "Browse.png", "Browse.png", 0, 0);
            UIButton btnMute = UIButton.create(ui, "Mute.png", "Mute.png", 0, 0);
            UIButton btnSolo = UIButton.create(ui, "Solo.png", "Solo.png", 0, 0);
            UIButton btnQuarter = UIButton.create(ui, "Quarter.png", "Quarter.png", 0, 0);
            UIButton btnHalf = UIButton.create(ui, "Half.png", "Half.png", 0, 0);
            UIButton btnNormal = UIButton.create(ui, "Normal.png", "Double.png", 0, 0);
            UIButton btnDouble = UIButton.create(ui, "Double.png", "Double.png", 0, 0);
            UIButton btnFourth = UIButton.create(ui, "Fourth.png", "Fourth.png", 0, 0);

            btnBrowse.setSize(buttonSize, buttonSize);
            btnMute.setSize(buttonSize, buttonSize);
            btnSolo.setSize(buttonSize, buttonSize);
            btnQuarter.setSize(buttonSize, buttonSize);
            btnHalf.setSize(buttonSize, buttonSize);
            btnNormal.setSize(buttonSize, buttonSize);
            btnDouble.setSize(buttonSize, buttonSize);
            btnFourth.setSize(buttonSize, buttonSize);

            float layerButton = -3f;

            btnBrowse.zIndex = layerButton;
            btnMute.zIndex = layerButton;
            btnSolo.zIndex = layerButton;
            btnQuarter.zIndex = layerButton;
            btnHalf.zIndex = layerButton;
            btnNormal.zIndex = layerButton;
            btnDouble.zIndex = layerButton;
            btnFourth.zIndex = layerButton;

            hLayout.addChild(btnBrowse, btnMute, btnSolo, btnQuarter, btnHalf, btnNormal, btnDouble, btnFourth);

            hLayout.positionFromTopLeft(i * 0.1f, -0.5f);

            i++;
        }
    }
开发者ID:HaKDMoDz,项目名称:geff,代码行数:87,代码来源:Cubeat.cs


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