本文整理汇总了C#中Menu.SetCentre方法的典型用法代码示例。如果您正苦于以下问题:C# Menu.SetCentre方法的具体用法?C# Menu.SetCentre怎么用?C# Menu.SetCentre使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Menu
的用法示例。
在下文中一共展示了Menu.SetCentre方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateMenuPosition
public void UpdateMenuPosition (Menu menu, Vector2 invertedMouse)
{
if (invertedMouse == Vector2.zero)
{
invertedMouse = playerInput.GetInvertedMouse ();
}
if (menu.positionType == AC_PositionType.FollowCursor)
{
menu.SetCentre (new Vector2 ((invertedMouse.x / Screen.width) + (menu.manualPosition.x / 100f) - 0.5f,
(invertedMouse.y / Screen.height) + (menu.manualPosition.y / 100f) - 0.5f));
}
else if (menu.positionType == AC_PositionType.OnHotspot)
{
if (activeInventoryBoxCentre != Vector2.zero)
{
Vector2 screenPosition = new Vector2 (activeInventoryBoxCentre.x / Screen.width, activeInventoryBoxCentre.y / Screen.height);
menu.SetCentre (new Vector2 (screenPosition.x + (menu.manualPosition.x / 100f) - 0.5f,
screenPosition.y + (menu.manualPosition.y / 100f) - 0.5f));
}
else if (playerInteraction.GetActiveHotspot ())
{
Vector2 screenPosition = playerInteraction.GetHotspotScreenCentre ();
menu.SetCentre (new Vector2 (screenPosition.x + (menu.manualPosition.x / 100f) - 0.5f,
screenPosition.y + (menu.manualPosition.y / 100f) - 0.5f));
}
}
else if (menu.positionType == AC_PositionType.AboveSpeakingCharacter)
{
if (dialog.GetSpeakingCharacter () != null && dialog.isMessageAlive)
{
Vector2 screenPosition = dialog.GetSpeakingCharacter ().GetScreenCentre ();
menu.SetCentre (new Vector2 (screenPosition.x + (menu.manualPosition.x / 100f) - 0.5f,
screenPosition.y + (menu.manualPosition.y / 100f) - 0.5f));
}
}
else if (menu.positionType == AC_PositionType.AbovePlayer)
{
if (KickStarter.player)
{
Vector2 screenPosition = KickStarter.player.GetScreenCentre ();
menu.SetCentre (new Vector2 (screenPosition.x + (menu.manualPosition.x / 100f) - 0.5f,
screenPosition.y + (menu.manualPosition.y / 100f) - 0.5f));
}
}
}