Cleanup: Added sensible defaults. Removed all initialization errors.
--HG-- branch : develop_5.3release
parent
9cf482d6ed
commit
b8bd371232
|
@ -31,7 +31,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
protected float[] columnWidths = new float[0];
|
protected float[] columnWidths = new float[1] { 96f };
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The widths of all the columns in the table
|
/// The widths of all the columns in the table
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -122,6 +122,9 @@ namespace UnityEngine.UI.Extensions
|
||||||
|
|
||||||
public override void CalculateLayoutInputVertical()
|
public override void CalculateLayoutInputVertical()
|
||||||
{
|
{
|
||||||
|
if (columnWidths.Length == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
int rowCount = Mathf.CeilToInt(rectChildren.Count / (float)columnWidths.Length);
|
int rowCount = Mathf.CeilToInt(rectChildren.Count / (float)columnWidths.Length);
|
||||||
|
|
||||||
maxPreferredHeightInRows = new float[rowCount];
|
maxPreferredHeightInRows = new float[rowCount];
|
||||||
|
@ -182,6 +185,9 @@ namespace UnityEngine.UI.Extensions
|
||||||
{
|
{
|
||||||
int columnCount = columnWidths.Length;
|
int columnCount = columnWidths.Length;
|
||||||
|
|
||||||
|
if (columnCount == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
for (int i = 0; i < rectChildren.Count; i++)
|
for (int i = 0; i < rectChildren.Count; i++)
|
||||||
{
|
{
|
||||||
RectTransform child = rectChildren[i];
|
RectTransform child = rectChildren[i];
|
||||||
|
@ -199,11 +205,14 @@ namespace UnityEngine.UI.Extensions
|
||||||
|
|
||||||
public override void SetLayoutVertical()
|
public override void SetLayoutVertical()
|
||||||
{
|
{
|
||||||
float tableLayoutHeight = rectTransform.rect.height;
|
|
||||||
|
|
||||||
int columnCount = columnWidths.Length;
|
int columnCount = columnWidths.Length;
|
||||||
|
if (columnCount == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
int rowCount = Mathf.CeilToInt(rectChildren.Count / (float)columnCount);
|
int rowCount = Mathf.CeilToInt(rectChildren.Count / (float)columnCount);
|
||||||
|
|
||||||
|
float tableLayoutHeight = rectTransform.rect.height;
|
||||||
|
|
||||||
int cornerX = (int)startCorner % 2;
|
int cornerX = (int)startCorner % 2;
|
||||||
int cornerY = (int)startCorner / 2;
|
int cornerY = (int)startCorner / 2;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue