protected override void GuiParameters() { toComp = (ToCompare)EditorGUILayout.EnumPopup("To Compare: ", toComp); toCompName = toComp.ToString(); ToScore = EditorGUILayout.ObjectField("To Score: ", ToScore, typeof(Character), false) as Character; base.GuiParameters(); }
/// <summary>Sorts jagged integer array using method for particular criterion in particular order.</summary> /// <param name="array"> An array to be sorted.</param> /// <param name="comparer"> Method setting the logic of particular kind of sorting.</param> /// public static void Sort(int[][] array, ToCompare comparer) { if (comparer == null) { throw new ArgumentException(nameof(comparer)); } else { DelegateToIComparerAdapter adapter = new DelegateToIComparerAdapter(comparer); Sort(array, adapter); } }
/// <summary>Sorts jagged integer array using method for particular criterion in particular order.</summary> /// <param name="array"> An array to be sorted.</param> /// <param name="comparer"> Interface setting the logic of particular kind of sorting.</param> public static void Sort(int[][] array, IComparer <int[], int[]> comparer) { ToCompare compare = comparer.CompareTo; if (comparer == null) { throw new ArgumentException(nameof(comparer)); } else { Sort(array, compare); } }
/// <summary>Sorts jagged integer array using method for particular criterion in particular order.</summary> /// <param name="array"> An array to be sorted.</param> /// <param name="comparer"> Method setting the logic of particular kind of sorting.</param> public static void Sort(int[][] array, ToCompare comparer) { int i = 0; bool flag = true; while (flag) { flag = false; for (int j = 0; j < array.Length - i - 1; j++) { if (comparer(array[j], array[j + 1])) { Swap(ref array[j], ref array[j + 1]); flag = true; } } i++; } }
public DelegateToIComparerAdapter(ToCompare c) { comparer = c; }