本文整理汇总了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));
}
}
}
示例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);
}
示例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 );
}
示例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++;
}
}