本文整理汇总了C#中UIWidget.MakePixelPerfect方法的典型用法代码示例。如果您正苦于以下问题:C# UIWidget.MakePixelPerfect方法的具体用法?C# UIWidget.MakePixelPerfect怎么用?C# UIWidget.MakePixelPerfect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIWidget
的用法示例。
在下文中一共展示了UIWidget.MakePixelPerfect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnSceneGUI
//.........这里部分代码省略.........
if (e.button < 2)
{
bool handled = false;
if (e.button == 1)
{
// Right-click: Select the widget below
SelectWidget(mWidget, e.mousePosition, false);
handled = true;
}
else if (mAction == Action.None)
{
if (mAllowSelection)
{
// Left-click: Select the widget above
SelectWidget(mWidget, e.mousePosition, true);
handled = true;
}
}
else
{
// Finished dragging something
mAction = Action.None;
mActionUnderMouse = Action.None;
Vector3 pos = t.localPosition;
Vector3 scale = t.localScale;
if (mWidget.pixelPerfectAfterResize)
{
t.localPosition = pos;
t.localScale = scale;
mWidget.MakePixelPerfect();
}
else
{
pos.x = Mathf.Round(pos.x);
pos.y = Mathf.Round(pos.y);
scale.x = Mathf.Round(scale.x);
scale.y = Mathf.Round(scale.y);
t.localPosition = pos;
t.localScale = scale;
}
handled = true;
}
if (handled)
{
mActionUnderMouse = Action.None;
mAction = Action.None;
e.Use();
}
}
}
else if (mAllowSelection)
{
BetterList<UIWidget> widgets = SceneViewRaycast(mWidget.panel, e.mousePosition);
if (widgets.size > 0) Selection.activeGameObject = widgets[0].gameObject;
}
mAllowSelection = true;
}
break;
case EventType.KeyDown: