Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Turbo.Plugins.Default;
- using System.Collections.Generic;
- namespace Turbo.Plugins.Miqui.CustomizableActorDecorators
- {
- public class CustomizableActorDecoratorsPlugin : BasePlugin, IInGameWorldPainter
- {
- private Dictionary<ActorSnoEnum, List<IActorDecorator>> ActorDecorators { get ; set ; }
- public CustomizableActorDecoratorsPlugin()
- {
- Enabled = true;
- }
- public override void Load(IController hud)
- {
- base.Load(hud);
- ActorDecorators = new Dictionary<ActorSnoEnum, List<IActorDecorator>>();
- }
- /// Allows you to add a decorator for the given Actor.
- public void AddDecorator(ActorSnoEnum actor, IActorDecorator decorator)
- {
- List<IActorDecorator> l;
- if (!ActorDecorators.TryGetValue(actor, out l))
- {
- l = new List<IActorDecorator>();
- }
- l.Add(decorator);
- ActorDecorators[actor] = l;
- }
- /// Allows you to set the decorators for the given Actor.
- public void SetDecorators(ActorSnoEnum actor, List<IActorDecorator> decorators)
- {
- ActorDecorators[actor] = decorators;
- }
- public void PaintWorld(WorldLayer layer)
- {
- Hud.Game.Actors.ForEach(actor =>
- {
- List<IActorDecorator> decorators;
- if (ActorDecorators.TryGetValue(actor.SnoActor.Sno, out decorators))
- {
- decorators.ForEach(decorator =>
- {
- var toPaint = decorator.getActorDecorator(Hud, actor);
- if (toPaint != null)
- toPaint.Paint(layer, actor, actor.FloorCoordinate, null);
- });
- }
- });
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement