EventBus Refactor (#490)

* API changes for the new EventBus.

* Update Engine Module.
This commit is contained in:
Acruid
2019-12-08 19:52:29 -08:00
committed by GitHub
parent 7f188b0f44
commit 9c9984a40a
5 changed files with 12 additions and 12 deletions

View File

@@ -81,7 +81,7 @@ namespace Content.Client.GameObjects.Components.IconSmoothing
base.Startup();
SnapGrid.OnPositionChanged += SnapGridOnPositionChanged;
Owner.EntityManager.RaiseEvent(Owner, new IconSmoothDirtyEvent(null, SnapGrid.Offset, Mode));
Owner.EntityManager.EventBus.RaiseEvent(Owner, new IconSmoothDirtyEvent(null, SnapGrid.Offset, Mode));
if (Mode == IconSmoothingMode.Corners)
{
var state0 = $"{StateBase}0";
@@ -203,12 +203,12 @@ namespace Content.Client.GameObjects.Components.IconSmoothing
base.Shutdown();
SnapGrid.OnPositionChanged -= SnapGridOnPositionChanged;
Owner.EntityManager.RaiseEvent(Owner, new IconSmoothDirtyEvent(_lastPosition, SnapGrid.Offset, Mode));
Owner.EntityManager.EventBus.RaiseEvent(Owner, new IconSmoothDirtyEvent(_lastPosition, SnapGrid.Offset, Mode));
}
private void SnapGridOnPositionChanged()
{
Owner.EntityManager.RaiseEvent(Owner, new IconSmoothDirtyEvent(_lastPosition, SnapGrid.Offset, Mode));
Owner.EntityManager.EventBus.RaiseEvent(Owner, new IconSmoothDirtyEvent(_lastPosition, SnapGrid.Offset, Mode));
_lastPosition = (Owner.Transform.GridID, SnapGrid.Position);
}

View File

@@ -32,7 +32,7 @@ namespace Content.Client.GameObjects.Components
base.Startup();
_snapGridComponent.OnPositionChanged += SnapGridOnPositionChanged;
Owner.EntityManager.RaiseEvent(Owner, new SubFloorHideDirtyEvent());
Owner.EntityManager.EventBus.RaiseEvent(Owner, new SubFloorHideDirtyEvent());
}
/// <inheritdoc />
@@ -41,12 +41,12 @@ namespace Content.Client.GameObjects.Components
base.Shutdown();
_snapGridComponent.OnPositionChanged -= SnapGridOnPositionChanged;
Owner.EntityManager.RaiseEvent(Owner, new SubFloorHideDirtyEvent());
Owner.EntityManager.EventBus.RaiseEvent(Owner, new SubFloorHideDirtyEvent());
}
private void SnapGridOnPositionChanged()
{
Owner.EntityManager.RaiseEvent(Owner, new SubFloorHideDirtyEvent());
Owner.EntityManager.EventBus.RaiseEvent(Owner, new SubFloorHideDirtyEvent());
}
}

View File

@@ -31,7 +31,7 @@ namespace Content.Client.GameObjects.Components
base.Startup();
_snapGrid.OnPositionChanged += SnapGridOnPositionChanged;
Owner.EntityManager.RaiseEvent(Owner, new WindowSmoothDirtyEvent());
Owner.EntityManager.EventBus.RaiseEvent(Owner, new WindowSmoothDirtyEvent());
var state0 = $"{_stateBase}0";
_sprite.LayerMapSet(CornerLayers.SE, _sprite.AddLayerState(state0));
@@ -54,7 +54,7 @@ namespace Content.Client.GameObjects.Components
private void SnapGridOnPositionChanged()
{
Owner.EntityManager.RaiseEvent(Owner, new WindowSmoothDirtyEvent());
Owner.EntityManager.EventBus.RaiseEvent(Owner, new WindowSmoothDirtyEvent());
}
public void UpdateSprite()

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Threading;
using Content.Server.GameObjects;
using Content.Server.Interfaces.Chat;
@@ -34,7 +34,7 @@ namespace Content.Server.GameTicking.GameRules
{
_chatManager.DispatchServerAnnouncement("The game is now a death match. Kill everybody else to win!");
_entityManager.SubscribeEvent<MobDamageStateChangedMessage>(_onMobDamageStateChanged, this);
_entityManager.EventBus.SubscribeEvent<MobDamageStateChangedMessage>(_onMobDamageStateChanged, this);
_playerManager.PlayerStatusChanged += PlayerManagerOnPlayerStatusChanged;
}
@@ -42,7 +42,7 @@ namespace Content.Server.GameTicking.GameRules
{
base.Removed();
_entityManager.UnsubscribeEvent<MobDamageStateChangedMessage>(this);
_entityManager.EventBus.UnsubscribeEvent<MobDamageStateChangedMessage>(this);
_playerManager.PlayerStatusChanged -= PlayerManagerOnPlayerStatusChanged;
}