BREAKING CHANGE: renamed original Behaviour class to BehaviourInternal, and replaced it with BehaviourBase
Original Behaviour was using old methods for detecting entering/exiting universe, they are now all under the same hood and the original is kept for UniverseEntranceManager because it needs to enter the universe without itself. The internal behaviour kept under a subnamespace of "Core.Internal" for the purpose that it might come in handy for other use cases.
This commit is contained in:
@@ -4,7 +4,7 @@ using Engine.Core;
|
||||
|
||||
namespace Engine.Integration.MonoGame;
|
||||
|
||||
public class LoadContentManager : Behaviour, IFirstFrameUpdate
|
||||
public class LoadContentManager : Behaviour, IEnterUniverse, IExitUniverse, IFirstFrameUpdate
|
||||
{
|
||||
// We use Ascending order because we are using reverse for loop to call them
|
||||
private static Comparer<int> SortByAscendingPriority() => Comparer<int>.Create((x, y) => x.CompareTo(y));
|
||||
@@ -20,14 +20,14 @@ public class LoadContentManager : Behaviour, IFirstFrameUpdate
|
||||
monoGameWindowContainer = Universe.FindRequiredBehaviour<MonoGameWindowContainer>();
|
||||
}
|
||||
|
||||
protected override void OnEnteredUniverse(IUniverse universe)
|
||||
public void EnterUniverse(IUniverse universe)
|
||||
{
|
||||
loadContents.Assign(universe);
|
||||
|
||||
universe.OnPreUpdate.AddListener(OnPreUpdate);
|
||||
}
|
||||
|
||||
protected override void OnExitedUniverse(IUniverse universe)
|
||||
public void ExitUniverse(IUniverse universe)
|
||||
{
|
||||
loadContents.Unassign();
|
||||
|
||||
|
@@ -5,7 +5,7 @@ using Engine.Core;
|
||||
|
||||
namespace Engine.Integration.MonoGame;
|
||||
|
||||
public class MonoGameCamera2D : BehaviourBase, ICamera2D, IFirstFrameUpdate, IPreDraw
|
||||
public class MonoGameCamera2D : Behaviour, ICamera2D, IFirstFrameUpdate, IPreDraw
|
||||
{
|
||||
public Event<MonoGameCamera2D> OnMatrixTransformChanged { get; } = new();
|
||||
public Event<MonoGameCamera2D> OnViewportChanged { get; } = new();
|
||||
|
@@ -5,7 +5,7 @@ using Engine.Core;
|
||||
|
||||
namespace Engine.Integration.MonoGame;
|
||||
|
||||
public class MonoGameCamera3D : BehaviourBase, ICamera3D, IFirstFrameUpdate, IPreDraw
|
||||
public class MonoGameCamera3D : Behaviour, ICamera3D, IFirstFrameUpdate, IPreDraw
|
||||
{
|
||||
public Event<MonoGameCamera3D, ViewChangedArguments> OnViewChanged { get; } = new();
|
||||
public Event<MonoGameCamera3D, ProjectionChangedArguments> OnProjectionChanged { get; } = new();
|
||||
|
@@ -4,7 +4,7 @@ using Engine.Core;
|
||||
|
||||
namespace Engine.Integration.MonoGame;
|
||||
|
||||
public class SpriteBatcher : BehaviourBase, IFirstFrameUpdate, IDraw
|
||||
public class SpriteBatcher : Behaviour, IFirstFrameUpdate, IDraw
|
||||
{
|
||||
private static Comparer<int> SortByPriority() => Comparer<int>.Create((x, y) => y.CompareTo(x));
|
||||
private static System.Func<IBehaviour, int> GetPriority() => (b) => b.Priority;
|
||||
|
@@ -6,7 +6,7 @@ using Engine.Core;
|
||||
|
||||
namespace Engine.Integration.MonoGame;
|
||||
|
||||
public class TriangleBatcher : BehaviourBase, ITriangleBatch, IFirstFrameUpdate, IDraw
|
||||
public class TriangleBatcher : Behaviour, ITriangleBatch, IFirstFrameUpdate, IDraw
|
||||
{
|
||||
private static Comparer<int> SortByAscendingPriority() => Comparer<int>.Create((x, y) => x.CompareTo(y));
|
||||
private static System.Func<IBehaviour, int> GetPriority() => (b) => b.Priority;
|
||||
|
@@ -4,7 +4,7 @@ using Engine.Core.Serialization;
|
||||
namespace Engine.Integration.MonoGame;
|
||||
|
||||
[IgnoreSerialization]
|
||||
public class MonoGameWindowContainer(MonoGameWindow GameWindow) : BehaviourBase
|
||||
public class MonoGameWindowContainer(MonoGameWindow GameWindow) : Behaviour
|
||||
{
|
||||
public MonoGameWindow Window { get; } = GameWindow;
|
||||
}
|
||||
|
Reference in New Issue
Block a user