static public int CompareFunc (UIWidget left, UIWidget right)
{
int val = UIPanel.CompareFunc(left.mPanel, right.mPanel);
if (val == 0)
{
if (left.mDepth < right.mDepth) val = -1;
if (left.mDepth > right.mDepth) val = 1;
if (val == 0)
{
Material leftMat = left.material;
Material rightMat = right.material;
if (leftMat != rightMat)
{
if (leftMat != null && rightMat != null)
{
val = leftMat.GetInstanceID() < rightMat.GetInstanceID() ? -1 : 1;
}
else
{
val = leftMat == null ? -1 : 1;
}
}
}
}
return val;
}