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


C# UISprite.setSize方法代码示例

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


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

示例1: SandwichSlice

        public SandwichSlice(SandwichVisual sandwich, Ingredient ingredient, int price, int index)
        {
            m_sandwich = sandwich;
            m_ingredient = ingredient;
            m_price = price;
            m_index = index;

            m_ingredientSprite = m_sandwich.AcquireSprite();
            m_ingredientSprite.centerize();
            if (index == 0)
            {
                m_ingredientSprite.setSpriteImage(ingredient.IngredientBottomSpriteName);
            }
            else
            {
                m_ingredientSprite.setSpriteImage(ingredient.IngredientSpriteName);
            }

            var size = Screen.width * 0.15f;
            var bottom = Screen.width * 0.1f;
            var offset = Screen.width * 0.02f;

            if (m_sandwich.IsTop)
            {
                m_ingredientSprite.setSize(size, -size);
                m_ingredientSprite.position = new Vector3(Screen.width * 0.55f, Screen.height - (bottom + index * offset), -(5.1f + 0.1f * index));
            }
            else
            {
                m_ingredientSprite.setSize(size, size);
                m_ingredientSprite.position = new Vector3(Screen.width * 0.5f, bottom + index * offset, -(5.1f + 0.1f * index));
            }

            if (price != 0)
            {
                m_tagSprite = m_sandwich.AcquireSprite();
                m_tagSprite.centerize();
                m_tagSprite.setSpriteImage(dicPrices[price]);
                //m_tagSprite.eulerAngles = new Vector3(0f, 0f, 180f / 15f * (float)index);
                m_tagSprite.eulerAngles = new Vector3(0f, 0f, Random.Range(-15f,15f));

                if (m_sandwich.IsTop)
                {
                    m_tagSprite.setSize(-Screen.width * 0.2f, -Screen.width * 0.1f);
                    m_tagSprite.position = new Vector3(Screen.width * 0.85f, Screen.height - (bottom + index * offset), -(5.1f + 0.2f * index));
                }
                else
                {
                    m_tagSprite.setSize(Screen.width * 0.2f, Screen.width * 0.1f);
                    m_tagSprite.position = new Vector3(Screen.width * 0.15f, bottom + index * offset, -(5.1f + 0.2f * index));
                }
            }
        }
开发者ID:nicolas-repiquet,项目名称:FoodTruckSaga,代码行数:53,代码来源:SandwichSlice.cs

示例2: ShowHeadWaiting

    public void ShowHeadWaiting()
    {
        int xc = (int)(Repository.Instance.SizeHeadClient * Screen.width);
        int yc = Screen.height / 2 + (int)(Repository.Instance.SizeHeadClient * Screen.width / 2);

        spriteClientWaiting = m_ui.addSprite(ClientName + "_waiting.png", xc, yc, 0);
        spriteClientWaiting.eulerAngles = new Vector3(0f, 0f, -90f);
        spriteClientWaiting.position = new Vector3(xc, yc + Repository.Instance.SizeHeadClient * Screen.width / 2f, -4f);
        spriteClientWaiting.setSize(Screen.width * Repository.Instance.SizeHeadClient * 2f, Screen.width * Repository.Instance.SizeHeadClient);
    }
开发者ID:nicolas-repiquet,项目名称:FoodTruckSaga,代码行数:10,代码来源:Menu.cs

示例3: UIProgressBar

    public UIProgressBar( UIToolkit manager, Rect frame, int depth, UIUVRect uvFrame, UISprite bar )
        : base(frame, depth, uvFrame)
    {
        // Save the bar and make it a child of the container/border for organization purposes
        _bar = bar;
        _bar.parentUIObject = this;

        // Save the bars original size
        _barOriginalWidth = _bar.width;
        _barOriginalUVframe = _bar.uvFrame;

        // Update the bar size based on the value
        if (rightToLeft)
            _bar.setSize(_value * -_barOriginalWidth, _bar.height);
        else
            _bar.setSize(_value * _barOriginalWidth, _bar.height);

        manager.addSprite( this );
    }
开发者ID:githubbar,项目名称:UIToolkit,代码行数:19,代码来源:UIProgressBar.cs

示例4: 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


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