public static void RegisterPurchasable(Type t, PurchasableCreatorDelegate creator) { if (!typeof(BaseUI).IsAssignableFrom(t)) { throw new Exception($"{t} does not extend BaseUI!"); } RegisterPurchasable((otherType, x) => t.IsAssignableFrom(otherType), creator); }
/// <summary> /// Register a <paramref name="creator"/> to all UI's pointed to by the <paramref name="pred"/> /// </summary> /// <param name="pred">The prediate for filtering the Purchasable UI</param> /// <param name="creator">The creator of the new purchasable</param> public static void RegisterPurchasable(PurchasableUIPredicate pred, PurchasableCreatorDelegate creator) { customPurchasables.Add(pred, creator); }