internal static void RegisterStatusIconCreator(CyclopsStatusIconCreator creatorEvent, string name) { if (StatusIconCreators.Find(s => s.Creator == creatorEvent || s.StatusIconName == name) != null) { QuickLogger.Warning($"Duplicate CyclopsStatusIconCreator '{name}' was blocked"); return; } QuickLogger.Info($"Received CyclopsStatusIconCreator '{name}'"); StatusIconCreators.Add(new StatusIconCreator(creatorEvent, name)); }
/// <summary> /// Registers a <see cref="CyclopsStatusIconCreator"/> method that creates a new <see cref="StatusIcons.CyclopsStatusIcon"/> on demand.<para/> /// This method will be invoked only once for each Cyclops sub in the game world. /// </summary> /// <typeparam name="T">Your class that implements <see cref="StatusIcons.CyclopsStatusIcon"/>.</typeparam> /// <param name="createEvent">A method that takes a <see cref="SubRoot"/> parameter a returns a new instance of <see langword="abstract"/><see cref="StatusIcons.CyclopsStatusIcon"/>.</param> public void CyclopsStatusIcon <T>(CyclopsStatusIconCreator createEvent) where T : CyclopsStatusIcon { if (CyclopsHUDManager.TooLateToRegister) { QuickLogger.Error("CyclopsStatusIconCreator have already been invoked. This method should only be called during patch time."); } else { CyclopsHUDManager.RegisterStatusIconCreator(createEvent, typeof(T).Name); } }
public StatusIconCreator(CyclopsStatusIconCreator creator, string stutusIconName) { Creator = creator; StatusIconName = stutusIconName; }