EventSystem allows you to easily add and manage events in your game. To create a new event, simply place the event source code in the EventSystem/EventSourceCode folder. All the necessary DLL files for creating events can be found in EventSystem/DLL.
using EventSystem.Events;
using EventSystem.Utils;
using NLog;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace EventSystem.Event
{
public class SpecialTwoEvent : EventsBase
{
public static readonly Logger Log = LogManager.GetLogger("EventSystem/SpecialTwoEvent");
private readonly EventSystemConfig _config;
private SpecialTwoEventSettings settings;
public SpecialTwoEvent(EventSystemConfig config)
{
_config = config;
EventName = "SpecialTwoEvent";
}
public override string EventDescription => "EventDescriptio";
//Pre-loading of the event by the system
public override Task SystemStartEvent()
{
LoggerHelper.DebugLog(Log, EventSystemMain.Instance.Config, "System Start SpecialTwoEvent.");
return Task.CompletedTask;
}
// Optional triggering of an event, such as when certain requirements are met
public override async Task StartEvent()
{
LoggerHelper.DebugLog(Log, EventSystemMain.Instance.Config, "Start SpecialTwoEvent.");
}
// Ending the event through the system
public override Task SystemEndEvent()
{
LoggerHelper.DebugLog(Log, EventSystemMain.Instance.Config, "Ending SpecialTwoEvent.");
return Task.CompletedTask;
}
public override void LoadEventSpecificSettings()
{
// Initialize settings with new values
settings = new SpecialTwoEventSettings
{
IsEnabled = false,
ActiveDaysOfMonth = new List<int> { 1, 15, 20 },
StartTime = "00:00:00",
EndTime = "23:59:59",
};
IsEnabled = settings.IsEnabled;
ActiveDaysOfMonth = settings.ActiveDaysOfMonth;
StartTime = TimeSpan.Parse(settings.StartTime);
EndTime = TimeSpan.Parse(settings.EndTime);
string activeDaysText = ActiveDaysOfMonth.Count > 0 ? string.Join(", ", ActiveDaysOfMonth) : "Every day";
LoggerHelper.DebugLog(Log, _config, $"Loaded {EventName} settings: IsEnabled={IsEnabled}, Active Days of Month={activeDaysText}, StartTime={StartTime}, EndTime={EndTime}");
}
public class SpecialTwoEventSettings
{
public bool IsEnabled { get; set; }
public List<int> ActiveDaysOfMonth { get; set; }
public string StartTime { get; set; }
public string EndTime { get; set; }
}
}
}
Required settings:
Adding custom settings to LoadEventSpecificSettings allows you to customize your event to meet specific requirements, such as participant limits, special prizes or unique event end conditions.