2019-10-31 02:37:22 +11:00
|
|
|
using System;
|
2020-07-06 16:37:39 -05:00
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using JetBrains.Annotations;
|
2019-10-31 02:37:22 +11:00
|
|
|
using Robust.Shared.GameObjects;
|
2020-07-06 16:37:39 -05:00
|
|
|
using Robust.Shared.Prototypes;
|
2019-10-31 02:37:22 +11:00
|
|
|
using Robust.Shared.Serialization;
|
2020-07-06 16:37:39 -05:00
|
|
|
using Robust.Shared.Timers;
|
|
|
|
|
using Robust.Shared.ViewVariables;
|
|
|
|
|
using YamlDotNet.RepresentationModel;
|
|
|
|
|
using Component = Robust.Shared.GameObjects.Component;
|
2019-10-31 02:37:22 +11:00
|
|
|
|
|
|
|
|
namespace Content.Shared.GameObjects.Components.Mobs
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Full screen overlays; Blindness, death, flash, alcohol etc.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public abstract class SharedOverlayEffectsComponent : Component
|
|
|
|
|
{
|
|
|
|
|
public override string Name => "OverlayEffectsUI";
|
|
|
|
|
public sealed override uint? NetID => ContentNetIDs.OVERLAYEFFECTS;
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-06 16:37:39 -05:00
|
|
|
[Serializable, NetSerializable]
|
|
|
|
|
public class OverlayContainer
|
2019-10-31 02:37:22 +11:00
|
|
|
{
|
2020-07-06 16:37:39 -05:00
|
|
|
[ViewVariables(VVAccess.ReadOnly)]
|
|
|
|
|
public string ID { get; }
|
|
|
|
|
|
|
|
|
|
public OverlayContainer([NotNull] string id)
|
|
|
|
|
{
|
|
|
|
|
ID = id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public OverlayContainer(OverlayType type) : this(type.ToString())
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override bool Equals(object obj)
|
|
|
|
|
{
|
|
|
|
|
if (obj is OverlayContainer container)
|
|
|
|
|
{
|
|
|
|
|
return container.ID == ID;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj is string idString)
|
|
|
|
|
{
|
|
|
|
|
return idString == ID;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return base.Equals(obj);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override int GetHashCode()
|
|
|
|
|
{
|
|
|
|
|
return (ID != null ? ID.GetHashCode() : 0);
|
|
|
|
|
}
|
2019-10-31 02:37:22 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Serializable, NetSerializable]
|
|
|
|
|
public class OverlayEffectComponentState : ComponentState
|
|
|
|
|
{
|
2020-07-06 16:37:39 -05:00
|
|
|
public List<OverlayContainer> Overlays;
|
2019-10-31 02:37:22 +11:00
|
|
|
|
2020-07-06 16:37:39 -05:00
|
|
|
public OverlayEffectComponentState(List<OverlayContainer> overlays) : base(ContentNetIDs.OVERLAYEFFECTS)
|
2019-10-31 02:37:22 +11:00
|
|
|
{
|
2020-07-06 16:37:39 -05:00
|
|
|
Overlays = overlays;
|
2019-10-31 02:37:22 +11:00
|
|
|
}
|
|
|
|
|
}
|
2020-07-06 16:37:39 -05:00
|
|
|
|
|
|
|
|
[Serializable, NetSerializable]
|
|
|
|
|
public class TimedOverlayContainer : OverlayContainer
|
|
|
|
|
{
|
|
|
|
|
[ViewVariables(VVAccess.ReadOnly)]
|
|
|
|
|
public int Length { get; }
|
|
|
|
|
|
|
|
|
|
public TimedOverlayContainer(string id, int length) : base(id)
|
|
|
|
|
{
|
|
|
|
|
Length = length;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void StartTimer(Action finished) => Timer.Spawn(Length, finished);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum OverlayType
|
|
|
|
|
{
|
|
|
|
|
GradientCircleMaskOverlay,
|
|
|
|
|
CircleMaskOverlay,
|
|
|
|
|
FlashOverlay
|
|
|
|
|
}
|
2019-10-31 02:37:22 +11:00
|
|
|
}
|