Archived
forked from RDTKEditor/RDTKEditor
添加对 Core 的直接引用
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
namespace RhythmBase.Settings
|
||||
{
|
||||
/// <summary>
|
||||
/// Actions performed on inactive items at read or write times.
|
||||
/// </summary>
|
||||
public enum InactiveEventsHandling
|
||||
{
|
||||
/// <summary>
|
||||
/// Retaining inactivated events to the level on reads.
|
||||
/// Write inactivated events on writes.
|
||||
/// </summary>
|
||||
Retain,
|
||||
/// <summary>
|
||||
/// Dumps inactivated events to <see cref="P:RhythmBase.Settings.LevelReadOrWriteSettings.InactiveEvents" /> on reads and writes.
|
||||
/// </summary>
|
||||
Store,
|
||||
/// <summary>
|
||||
/// Ignore inactivation events on reads and writes.
|
||||
/// </summary>
|
||||
Ignore
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace RhythmBase.Settings
|
||||
{
|
||||
/// <summary>
|
||||
/// Actions performed on items with exceptions during reads.
|
||||
/// </summary>
|
||||
public enum UnreadableEventHandling
|
||||
{
|
||||
/// <summary>
|
||||
/// Stores unreadable events in <see cref="P:RhythmBase.Settings.LevelReadOrWriteSettings.UnreadableEvents" /> for restoration.
|
||||
/// </summary>
|
||||
Store,
|
||||
/// <summary>
|
||||
/// An exception will be thrown.
|
||||
/// </summary>
|
||||
ThrowException
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user