本文整理汇总了C#中UIButton.positionFromTop方法的典型用法代码示例。如果您正苦于以下问题:C# UIButton.positionFromTop方法的具体用法?C# UIButton.positionFromTop怎么用?C# UIButton.positionFromTop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIButton
的用法示例。
在下文中一共展示了UIButton.positionFromTop方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
public void Start()
{
var textureAtlas = GameObject.Find("ui_menu").GetComponent<UIToolkit>();
Banner = UIButton.create(textureAtlas, "banner.png", "banner.png", 0, 0);
Banner.positionFromTop(0.04f, 0);
Banner.scale = new Vector3(0.7f, 0.7f, 1);
var scale = new Vector3(0.3f, 0.3f, 1);
var topMargin = 0.7f;
//var textAtlas = new UIText(GameObject.Find("ui_text").GetComponent<UIToolkit>(),"prototype", "prototype.png");
TrainingButton = UIButton.create(textureAtlas, "button.png", "button.png", 0, 0);
TrainingButton.positionFromTop(topMargin, -0.3f);
TrainingButton.scale = scale;
TrainingButton.onTouchUp += button => Application.LoadLevel(Registry.Levels.TrainingsLevel);
MultiplayerButton = UIButton.create(textureAtlas, "button.png", "button.png", 0, 0);
MultiplayerButton.positionFromTop(topMargin, -0.1f);
MultiplayerButton.scale = scale;
MultiplayerButton.onTouchUp += button => Application.LoadLevel(Registry.Levels.MultiplayerLevel);
ProfileButton = UIButton.create(textureAtlas, "button.png", "button.png", 0, 0);
ProfileButton.positionFromTop(topMargin, 0.1f);
ProfileButton.scale = scale;
ShopButton = UIButton.create(textureAtlas, "button.png", "button.png", 0, 0);
ShopButton.positionFromTop(topMargin, 0.3f);
ShopButton.scale = scale;
}
示例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();*/
}