feat: create creature interface
This commit is contained in:
@@ -9,18 +9,18 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Client.Domain.Service
|
||||
{
|
||||
public class PlayerHandler : EntityHandler<Player>
|
||||
public class DropHandler : EntityHandler<Drop>
|
||||
{
|
||||
public override void OnCreate(Player entity)
|
||||
public override void OnCreate(Drop entity)
|
||||
{
|
||||
mainViewModel.AddPlayer(entity);
|
||||
mainViewModel.AddDrop(entity);
|
||||
}
|
||||
public override void OnDelete(Player entity)
|
||||
public override void OnDelete(Drop entity)
|
||||
{
|
||||
mainViewModel.RemovePlayer(entity);
|
||||
mainViewModel.RemoveDrop(entity);
|
||||
}
|
||||
|
||||
public PlayerHandler(EntityFactoryInterface<Player> factory, MainViewModelInterface mainViewModel) : base(factory)
|
||||
public DropHandler(EntityFactoryInterface<Drop> factory, MainViewModelInterface mainViewModel) : base(factory)
|
||||
{
|
||||
this.mainViewModel = mainViewModel;
|
||||
}
|
||||
|
@@ -17,11 +17,11 @@ namespace Client.Domain.Service
|
||||
{
|
||||
entity.Level = npcInfoHelper.GetLevel(entity.NpcId);
|
||||
entity.AggroRadius = npcInfoHelper.GetAggroRadius(entity.NpcId);
|
||||
eventBus.Publish(new NpcCreatedEvent(entity));
|
||||
eventBus.Publish(new CreatureCreatedEvent(entity));
|
||||
}
|
||||
public override void OnDelete(NPC entity)
|
||||
{
|
||||
eventBus.Publish(new NpcDeletedEvent(entity.Id));
|
||||
eventBus.Publish(new CreatureDeletedEvent(entity.Id));
|
||||
}
|
||||
|
||||
public NpcHandler(EntityFactoryInterface<NPC> factory, EventBusInterface eventBus, NpcInfoHelperInterface npcInfoHelper) : base(factory)
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using Client.Domain.Entities;
|
||||
using Client.Domain.Events;
|
||||
using Client.Domain.Factories;
|
||||
using Client.Domain.ViewModels;
|
||||
using System;
|
||||
@@ -9,22 +10,22 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Client.Domain.Service
|
||||
{
|
||||
public class DropHandler : EntityHandler<Drop>
|
||||
public class PlayerHandler : EntityHandler<Player>
|
||||
{
|
||||
public override void OnCreate(Drop entity)
|
||||
public override void OnCreate(Player entity)
|
||||
{
|
||||
mainViewModel.AddDrop(entity);
|
||||
eventBus.Publish(new CreatureCreatedEvent(entity));
|
||||
}
|
||||
public override void OnDelete(Drop entity)
|
||||
public override void OnDelete(Player entity)
|
||||
{
|
||||
mainViewModel.RemoveDrop(entity);
|
||||
eventBus.Publish(new CreatureDeletedEvent(entity.Id));
|
||||
}
|
||||
|
||||
public DropHandler(EntityFactoryInterface<Drop> factory, MainViewModelInterface mainViewModel) : base(factory)
|
||||
public PlayerHandler(EntityFactoryInterface<Player> factory, EventBusInterface eventBus) : base(factory)
|
||||
{
|
||||
this.mainViewModel = mainViewModel;
|
||||
this.eventBus = eventBus;
|
||||
}
|
||||
|
||||
private readonly MainViewModelInterface mainViewModel;
|
||||
private readonly EventBusInterface eventBus;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user