public static void Prefix(ushort eventID, ref EventData data, Color32 newColor, EventAI __instance) { if (IgnoreHelper.IsIgnored()) { return; } Type type = __instance.GetType(); if (type != typeof(RocketLaunchAI) && type != typeof(ConcertAI) && type != typeof(SportMatchAI)) { return; } if (newColor.r == data.m_color.r && newColor.g == data.m_color.g && newColor.b == data.m_color.b) { return; } Command.SendToAll(new EventColorChangedCommand() { Event = eventID, Color = newColor }); }
/// <summary>Customizes the vanilla events in the game by changing their time behavior.</summary> /// <returns>An instance of the <see cref="VanillaEvents"/> class that can be used for reverting the events /// to the original state.</returns> public static VanillaEvents Customize() { var result = new VanillaEvents(); for (uint i = 0; i < PrefabCollection <EventInfo> .PrefabCount(); ++i) { EventInfo eventInfo = PrefabCollection <EventInfo> .GetPrefab(i); if (eventInfo?.m_eventAI?.m_info == null) { continue; } EventAI eventAI = eventInfo.m_eventAI; var originalData = new EventAIData(eventAI.m_eventDuration, eventAI.m_prepareDuration, eventAI.m_disorganizeDuration); result.eventData[eventAI] = originalData; Customize(eventAI); Log.Debug(LogCategory.Events, $"Customized event {eventAI.GetType().Name}"); } return(result); }