本文整理汇总了C#中UIButton.positionCenter方法的典型用法代码示例。如果您正苦于以下问题:C# UIButton.positionCenter方法的具体用法?C# UIButton.positionCenter怎么用?C# UIButton.positionCenter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIButton
的用法示例。
在下文中一共展示了UIButton.positionCenter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
void Start()
{
// create a vertical layout to house our buttons
var vBox = new UIVerticalLayout( 10 );
vBox.edgeInsets = new UIEdgeInsets( 10, 5, 10, 0 );
// create some buttons to control the positioning. we will add text to them se create the UIText we will use as well
var text = new UIText( textToolkit, "prototype", "prototype.png" );
var positions = new string[] { "top", "top-left", "top-right", "bottom", "bottom-left", "bottom-right" };
foreach( var pos in positions )
{
// create the button
var touchable = UIButton.create( "emptyUp.png", "emptyDown.png", 0, 0 );
touchable.userData = pos;
touchable.onTouchUpInside += onButtonTouched;
// add the text
var helloText = text.addTextInstance( pos, 0, 0, 0.5f, -1, Color.white, UITextAlignMode.Center, UITextVerticalAlignMode.Middle );
helloText.parentUIObject = touchable;
helloText.positionCenter();
vBox.addChild( touchable );
}
// Scores button. we will use this to demo positioning
_scoresButton = UIContinuousButton.create( buttonToolkit, "scoresUp.png", "scoresDown.png", 0, 0 );
_scoresButton.positionCenter();
}
示例2: Start
public void Start()
{
var atlas = GameObject.Find("profile_atlas").GetComponent<UIToolkit>();
sprite = UIButton.create(atlas, "profile.png", "profile.png", 0, 0);
sprite.positionCenter();
sprite.onTouchUpInside += OnUpgradesPressed;
//sprite.scale = new Vector3(0.52083f, 0.520833f, 0);
}