Skip to content

Commit

Permalink
Fixed error IEventArgs implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Tornado-Technology committed Jul 12, 2024
1 parent 294d38d commit 50ea7ae
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 20 deletions.
3 changes: 2 additions & 1 deletion Hypercube.Client/Graphics/Event/MainWindowClosedEvent.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using Hypercube.Client.Graphics.Windows;
using Hypercube.Shared.EventBus.Events;

namespace Hypercube.Client.Graphics.Event;

public readonly struct MainWindowClosedEvent(WindowRegistration registration)
public readonly struct MainWindowClosedEvent(WindowRegistration registration) : IEventArgs
{
public readonly WindowRegistration Registration = registration;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ namespace Hypercube.Shared.Entities.Realisation.EventBus;

public sealed class EntitiesEventBus : IEntitiesEventBus
{
public void Unsubscribe<T>(IEventSubscriber subscriber)
public void Unsubscribe<T>(IEventSubscriber subscriber) where T : IEventArgs
{
throw new NotImplementedException();
}

public void Subscribe<T>(IEventSubscriber subscriber, EventRefHandler<T> refHandler) where T : notnull
public void Subscribe<T>(IEventSubscriber subscriber, EventRefHandler<T> refHandler) where T : IEventArgs
{
throw new NotImplementedException();
}
Expand All @@ -19,12 +19,12 @@ public void Raise(object receiver)
throw new NotImplementedException();
}

public void Raise<T>(ref T receiver) where T : notnull
public void Raise<T>(ref T receiver) where T : IEventArgs
{
throw new NotImplementedException();
}

public void Raise<T>(T receiver) where T : notnull
public void Raise<T>(T receiver) where T : IEventArgs
{
throw new NotImplementedException();
}
Expand Down
6 changes: 4 additions & 2 deletions Hypercube.Shared/Runtimes/Event/RuntimeInitializationEvent.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
namespace Hypercube.Shared.Runtimes.Event;
using Hypercube.Shared.EventBus.Events;

public readonly record struct RuntimeInitializationEvent;
namespace Hypercube.Shared.Runtimes.Event;

public readonly record struct RuntimeInitializationEvent : IEventArgs;
6 changes: 4 additions & 2 deletions Hypercube.Shared/Runtimes/Event/RuntimeShutdownEvent.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
namespace Hypercube.Shared.Runtimes.Event;
using Hypercube.Shared.EventBus.Events;

public readonly record struct RuntimeShutdownEvent(string Reason);
namespace Hypercube.Shared.Runtimes.Event;

public readonly record struct RuntimeShutdownEvent(string Reason) : IEventArgs;
6 changes: 4 additions & 2 deletions Hypercube.Shared/Runtimes/Event/RuntimeStartupEvent.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
namespace Hypercube.Shared.Runtimes.Event;
using Hypercube.Shared.EventBus.Events;

public readonly record struct RuntimeStartupEvent;
namespace Hypercube.Shared.Runtimes.Event;

public readonly record struct RuntimeStartupEvent : IEventArgs;
6 changes: 4 additions & 2 deletions Hypercube.Shared/Runtimes/Loop/Event/RenderFrameEvent.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
namespace Hypercube.Shared.Runtimes.Loop.Event;
using Hypercube.Shared.EventBus.Events;

public readonly struct RenderFrameEvent(float deltaSeconds)
namespace Hypercube.Shared.Runtimes.Loop.Event;

public readonly struct RenderFrameEvent(float deltaSeconds) : IEventArgs
{
public readonly float DeltaSeconds = deltaSeconds;
}
6 changes: 4 additions & 2 deletions Hypercube.Shared/Runtimes/Loop/Event/UpdateFrameEvent.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
namespace Hypercube.Shared.Runtimes.Loop.Event;
using Hypercube.Shared.EventBus.Events;

public readonly struct UpdateFrameEvent(float deltaSeconds)
namespace Hypercube.Shared.Runtimes.Loop.Event;

public readonly struct UpdateFrameEvent(float deltaSeconds) : IEventArgs
{
public readonly float DeltaSeconds = deltaSeconds;
}
4 changes: 2 additions & 2 deletions Hypercube.UnitTests/EventBus/EventBusRaiseTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void AssertPassed()
}
}

private readonly record struct TestSubEventStruct;
private readonly record struct TestSubEventStruct : IEventArgs;

private sealed class TestSubEventClass;
private sealed class TestSubEventClass : IEventArgs;
}
2 changes: 1 addition & 1 deletion Hypercube.UnitTests/EventBus/EventBusRefStructTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ private void RefMethod(ref TestEventStruct args)
}
}

private record struct TestEventStruct(int Counter = 0);
private record struct TestEventStruct(int Counter = 0) : IEventArgs;
}
4 changes: 2 additions & 2 deletions Hypercube.UnitTests/EventBus/EventBusUnsubscribeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void AssertPassed()
}
}

private record struct TestUnsubEventStruct;
private record struct TestUnsubEventStruct : IEventArgs;

private sealed class TestUnsubEventClass;
private sealed class TestUnsubEventClass : IEventArgs;
}

0 comments on commit 50ea7ae

Please sign in to comment.