本文整理汇总了C#中UIPanel.IsVisible方法的典型用法代码示例。如果您正苦于以下问题:C# UIPanel.IsVisible方法的具体用法?C# UIPanel.IsVisible怎么用?C# UIPanel.IsVisible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIPanel
的用法示例。
在下文中一共展示了UIPanel.IsVisible方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateGeometry
/// <summary>
/// Update the widget and fill its geometry if necessary. Returns whether something was changed.
/// </summary>
public bool UpdateGeometry(UIPanel p, bool forceVisible)
{
if (material != null && p != null)
{
mPanel = p;
bool hasMatrix = false;
float final = finalAlpha;
bool visibleByAlpha = (final > 0.001f);
bool visibleByPanel = forceVisible || mVisibleByPanel;
// Has transform moved?
if (HasTransformChanged())
{
// Check to see if the widget has moved relative to the panel that manages it
#if UNITY_EDITOR
if (!mPanel.widgetsAreStatic || !Application.isPlaying)
#else
if (!mPanel.widgetsAreStatic)
#endif
{
mLocalToPanel = p.worldToLocal * cachedTransform.localToWorldMatrix;
hasMatrix = true;
Vector2 offset = pivotOffset;
float x0 = -offset.x * mWidth;
float y0 = -offset.y * mHeight;
float x1 = x0 + mWidth;
float y1 = y0 + mHeight;
Transform wt = cachedTransform;
Vector3 v0 = wt.TransformPoint(x0, y0, 0f);
Vector3 v1 = wt.TransformPoint(x1, y1, 0f);
v0 = p.worldToLocal.MultiplyPoint3x4(v0);
v1 = p.worldToLocal.MultiplyPoint3x4(v1);
if (Vector3.SqrMagnitude(mOldV0 - v0) > 0.000001f ||
Vector3.SqrMagnitude(mOldV1 - v1) > 0.000001f)
{
mChanged = true;
mOldV0 = v0;
mOldV1 = v1;
}
}
// Is the widget visible by the panel?
if (visibleByAlpha || mForceVisible != forceVisible)
{
mForceVisible = forceVisible;
visibleByPanel = forceVisible || mPanel.IsVisible(this);
}
}
else if (visibleByAlpha && mForceVisible != forceVisible)
{
mForceVisible = forceVisible;
visibleByPanel = mPanel.IsVisible(this);
}
// Is the visibility changing?
if (mVisibleByPanel != visibleByPanel)
{
mVisibleByPanel = visibleByPanel;
mChanged = true;
}
// Has the alpha changed?
if (mVisibleByPanel && mLastAlpha != final) mChanged = true;
mLastAlpha = final;
if (mChanged)
{
mChanged = false;
if (isVisible)
{
bool hadVertices = mGeom.hasVertices;
mGeom.Clear();
OnFill(mGeom.verts, mGeom.uvs, mGeom.cols);
if (mGeom.hasVertices)
{
// Want to see what's being filled? Uncomment this line.
//Debug.Log("Fill " + name + " (" + Time.time + ")");
if (!hasMatrix) mLocalToPanel = p.worldToLocal * cachedTransform.localToWorldMatrix;
mGeom.ApplyTransform(mLocalToPanel);
return true;
}
return hadVertices;
}
else if (mGeom.hasVertices)
{
mGeom.Clear();
return true;
}
//.........这里部分代码省略.........
示例2: UpdateGeometry
/// <summary>
/// Update the widget and fill its geometry if necessary. Returns whether something was changed.
/// </summary>
public bool UpdateGeometry (UIPanel p, bool forceVisible)
#endif
{
if (material != null && p != null)
{
mPanel = p;
bool hasMatrix = false;
#if !OLD_UNITY
float final = finalAlpha;
bool visibleByAlpha = (final > 0.001f);
bool visibleByPanel = forceVisible || mVisibleByPanel;
// Has transform moved?
if (cachedTransform.hasChanged)
{
mTrans.hasChanged = false;
// Check to see if the widget has moved relative to the panel that manages it
#if UNITY_EDITOR
if (!mPanel.widgetsAreStatic || !Application.isPlaying)
#else
if (!mPanel.widgetsAreStatic)
#endif
{
Vector2 size = relativeSize;
Vector2 offset = pivotOffset;
Vector4 padding = relativePadding;
float x0 = offset.x * size.x - padding.x;
float y0 = offset.y * size.y + padding.y;
float x1 = x0 + size.x + padding.x + padding.z;
float y1 = y0 - size.y - padding.y - padding.w;
mLocalToPanel = p.worldToLocal * cachedTransform.localToWorldMatrix;
hasMatrix = true;
Vector3 v0 = new Vector3(x0, y0, 0f);
Vector3 v1 = new Vector3(x1, y1, 0f);
v0 = mLocalToPanel.MultiplyPoint3x4(v0);
v1 = mLocalToPanel.MultiplyPoint3x4(v1);
if (Vector3.SqrMagnitude(mOldV0 - v0) > 0.000001f || Vector3.SqrMagnitude(mOldV1 - v1) > 0.000001f)
{
mChanged = true;
mOldV0 = v0;
mOldV1 = v1;
}
}
// Is the widget visible by the panel?
if (visibleByAlpha || mForceVisible != forceVisible)
{
mForceVisible = forceVisible;
visibleByPanel = forceVisible || mPanel.IsVisible(this);
}
}
else if (visibleByAlpha && mForceVisible != forceVisible)
{
mForceVisible = forceVisible;
visibleByPanel = mPanel.IsVisible(this);
}
// Is the visibility changing?
if (mVisibleByPanel != visibleByPanel)
{
mVisibleByPanel = visibleByPanel;
mChanged = true;
}
// Has the alpha changed?
if (mVisibleByPanel && mLastAlpha != final) mChanged = true;
mLastAlpha = final;
#endif
if (mChanged)
{
mChanged = false;
if (isVisible)
{
mGeom.Clear();
OnFill(mGeom.verts, mGeom.uvs, mGeom.cols);
// Want to see what's being filled? Uncomment this line.
//Debug.Log("Fill " + name + " (" + Time.time + ")");
if (mGeom.hasVertices)
{
Vector3 offset = pivotOffset;
Vector2 scale = relativeSize;
offset.x *= scale.x;
offset.y *= scale.y;
if (!hasMatrix) mLocalToPanel = p.worldToLocal * cachedTransform.localToWorldMatrix;
//.........这里部分代码省略.........