private void ProccesingPanelItems(IList <Item> items, Type valueType, params GUILayoutOption[] options) { var isItemsValid = true; var index = 0; ItemToolsResult itemToolsResult; ValidatorResult validatorResult; DrawOptionsResult drawOptionsResult; Item itemResult; foreach (var item in items) { validatorResult = ItemValidator.GetResult(items, item, index); drawOptionsResult = ItemDrawOptions.GetResult(validatorResult); //Draw item GUILayout.BeginHorizontal(options); itemResult = DrawItem(item, valueType, index, drawOptionsResult); itemToolsResult = DrawItemTools(items, index, _buttonWidthOption, _buttonHeightOption); GUILayout.EndHorizontal(); //Collect validate if ( item.key != itemResult.key || item.value != itemResult.value ) { SetChanged(); item.Set(itemResult); if (isItemsValid) //[OPTIMIZE] if false, all isItemsValid = false for any results from forward in the list { isItemsValid = ItemValidator.GetResult(items, itemResult, index).isItemValid; } } else if (isItemsValid) //[OPTIMIZE] if false, all isItemsValid = false for any results from forward in the list { isItemsValid = validatorResult.isItemValid; } //process result from tools switch (itemToolsResult) { case ItemToolsResult.RemoveItem: DeleteItem(items, index); SetChanged(); return; case ItemToolsResult.DublicateItem: DublicateItemAtIndex(items, index); SetChanged(); return; case ItemToolsResult.ViewItem: throw new NotImplementedException(); //return; } ++index; } IsItemsValid = isItemsValid; }