internal static void RegisterAuxManagerCreator(CreateAuxCyclopsManager createEvent, string typeName) { if (AuxManagerCreators.ContainsKey(typeName)) { QuickLogger.Warning($"Block duplicate AuxManagerCreator '{typeName}'"); return; } QuickLogger.Info($"Received AuxManagerCreator '{typeName}'"); AuxManagerCreators.Add(typeName, createEvent); }
/// <summary> /// Registers a <see cref="CreateAuxCyclopsManager" /> method that creates returns a new <see cref="IAuxCyclopsManager" /> on demand.<para /> /// This method will be invoked only once for each Cyclops sub in the game world.<para /> /// Use this when you simply need to have a class that is attaches one instance per Cyclops. /// </summary> /// <typeparam name="T">Your class that implements <see cref="IAuxCyclopsManager" />.</typeparam> /// <param name="createEvent">The create event.</param> public void AuxCyclopsManager <T>(CreateAuxCyclopsManager createEvent) where T : IAuxCyclopsManager { if (CyclopsManager.TooLateToRegister) { QuickLogger.Error("AuxCyclopsManagerCreator have already been invoked. This method should only be called during patch time."); } else { CyclopsManager.RegisterAuxManagerCreator(createEvent, typeof(T).Name); } }