添加对 Core 的直接引用

This commit is contained in:
OLDREDSTONE
2025-03-25 15:49:57 +08:00
parent 24907abedb
commit 06c19bf10a
296 changed files with 24961 additions and 2 deletions
@@ -0,0 +1,82 @@
using Newtonsoft.Json.Linq;
using RhythmBase.Events;
namespace RhythmBase.Settings
{
/// <summary>
/// Level import settings.
/// </summary>
public class LevelReadOrWriteSettings
{
/// <summary>
/// Event triggered before reading.
/// </summary>
public event EventHandler BeforeReading;
/// <summary>
/// Event triggered after reading.
/// </summary>
public event EventHandler AfterReading;
/// <summary>
/// Event triggered before writing.
/// </summary>
public event EventHandler BeforeWriting;
/// <summary>
/// Event triggered after writing.
/// </summary>
public event EventHandler AfterWriting;
/// <summary>
/// Initialize.
/// </summary>
public LevelReadOrWriteSettings()
{
BeforeReading = delegate { };
AfterReading = delegate { };
BeforeWriting = delegate { };
AfterWriting = delegate { };
}
/// <summary>
/// Enable resource preloading. This may grow read times.
/// Defaults to <see langword="false" />.
/// </summary>
public bool PreloadAssets { get; set; } = false;
/// <summary>
/// Action on inactive items on reads or writes.
/// Defaults to <see cref="F:RhythmBase.Settings.InactiveEventsHandling.Retain" />.
/// </summary>
public InactiveEventsHandling InactiveEventsHandling { get; set; } = InactiveEventsHandling.Retain;
/// <summary>
/// Stores unreadable event data when the <see cref="P:RhythmBase.Settings.LevelReadOrWriteSettings.InactiveEventsHandling" /> is <see cref="F:RhythmBase.Settings.InactiveEventsHandling.Store" />.
/// </summary>
public List<BaseEvent> InactiveEvents { get; set; } = [];
/// <summary>
/// Action on unreadable events.
/// Defaults to <see cref="F:RhythmBase.Settings.UnreadableEventHandling.ThrowException" />.
/// </summary>
public UnreadableEventHandling UnreadableEventsHandling { get; set; } = UnreadableEventHandling.ThrowException;
/// <summary>
/// Stores unreadable event data when the <see cref="P:RhythmBase.Settings.LevelReadOrWriteSettings.UnreadableEventsHandling" /> is <see cref="F:RhythmBase.Settings.UnreadableEventHandling.Store" />.
/// </summary>
/// <returns></returns>
public List<(JObject item, string reason)> UnreadableEvents { get; set; } = [];
/// <summary>
/// Use indentation.
/// Defaults to <see langword="true" />.
/// </summary>
public bool Indented { get; set; } = true;
internal void OnBeforeReading()
{
BeforeReading?.Invoke(this, EventArgs.Empty);
}
internal void OnAfterReading()
{
AfterReading?.Invoke(this, EventArgs.Empty);
}
internal void OnBeforeWriting()
{
BeforeWriting?.Invoke(this, EventArgs.Empty);
}
internal void OnAfterWriting()
{
AfterWriting?.Invoke(this, EventArgs.Empty);
}
}
}