예제 #1
0
    /// <summary>
    /// Validates the elements and returns the height of all elements.
    /// </summary>
    /// <param name="rowElements">The row elements.</param>
    /// <returns></returns>
    private int ValidateElements(ElementIndexer[] rowElements) {
        int height = Constants.Zero;
        var indexesFound = new List<int>(rowElements.Length);
        rowElements.ForAll(e => {

            int index = e.index;
            D.AssertNotEqual(Constants.MinusOne, index, e.gameObject.name);
            if (indexesFound.Contains(index)) {
                D.Warn("Duplicate {0} index {1} found. Order will not be deterministic.", typeof(ElementIndexer).Name, index);
            }
            indexesFound.Add(index);

            if (height == Constants.Zero) {
                height = e.GetComponent<UIWidget>().height;
            }
            else {
                D.AssertEqual(height, e.gameObject.GetComponent<UIWidget>().height);
            }
        });
        return height;
    }
 /// <summary>
 /// Validates the elements.
 /// </summary>
 /// <param name="rowElements">The row elements.</param>
 /// <returns></returns>
 private void ValidateElements(ElementIndexer[] rowElements) {
     var indexesFound = new List<int>(rowElements.Length);
     rowElements.ForAll(e => {
         int index = e.index;
         D.AssertNotEqual(Constants.MinusOne, index, "{0}.{1} not set.".Inject(e.gameObject.name, typeof(ElementIndexer).Name));
         if (indexesFound.Contains(index)) {
             D.Warn("Duplicate {0} index {1} found. Order will not be deterministic.", typeof(ElementIndexer).Name, index);
         }
         indexesFound.Add(index);
     });
 }