本文整理汇总了C#中MenuButton.SetPosition方法的典型用法代码示例。如果您正苦于以下问题:C# MenuButton.SetPosition方法的具体用法?C# MenuButton.SetPosition怎么用?C# MenuButton.SetPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MenuButton
的用法示例。
在下文中一共展示了MenuButton.SetPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InstanceOpenMenu
private void InstanceOpenMenu(ArrayList availableActions)
{
finished = false;
selectedAction = null;
menuButtons = new ArrayList();
if(PlayerPrefs.GetInt("mouseMove") == 1) {
guiPosition = GUIGlobals.ScreenCoordToGUICoord(new Vector3(Screen.width/2, Input.mousePosition.y, Input.mousePosition.z));
} else {
guiPosition = GUIGlobals.ScreenCoordToGUICoord(Input.mousePosition);
}
MouseHandler.ReleaseCursorXPosition();
MenuButton closeButton = new MenuButton(closeMenuIcon, null);
menuPos = new Vector2(guiPosition.x, guiPosition.y);
// Making sure that menu stays in the screen.
if(menuPos.x - menuMinDistanceFromBorders.left < 0) {
menuPos.x = menuMinDistanceFromBorders.left;
}
else if(menuPos.x + menuMinDistanceFromBorders.right > GUIGlobals.screenWidth) {
menuPos.x = GUIGlobals.screenWidth - menuMinDistanceFromBorders.right;
}
if(menuPos.y - menuMinDistanceFromBorders.top < 0) {
menuPos.y = menuMinDistanceFromBorders.top;
}
else if(menuPos.y + menuMinDistanceFromBorders.bottom > GUIGlobals.screenHeight) {
menuPos.y = GUIGlobals.screenHeight - menuMinDistanceFromBorders.bottom;
}
closeButton.SetPosition(menuPos.x, menuPos.y, menuItemDiameter);
menuButtons.Add(closeButton);
// Building the menu
foreach (SelectableAction availableAction in availableActions){
menuButtons.Add(new MenuButton(availableAction.GetIconSet(this), availableAction));
}
int nPositive = 1;
int nNegative = 1;
for (int i = 1; i < menuButtons.Count; i++){
if(i%2==0) {
float x=menuPos.x-(float)nNegative*(float)menuItemDiameter;
float y=menuPos.y;
nNegative++;
((MenuButton)menuButtons[i]).SetPosition(x, y, menuItemDiameter);
}
else {
float x=menuPos.x+(float)nPositive*(float)menuItemDiameter;
float y=menuPos.y;
nPositive++;
((MenuButton)menuButtons[i]).SetPosition(x, y, menuItemDiameter);
}
}
FModManager.StartEvent(FModLies.EVENTID_LIES_POPUPMENU_MENUOPEN);
}