Files
tbd-station-14/Content.Shared/GameObjects/Components/SharedGasAnalyzerComponent.cs
DrSmugleaf 4a8ed41e3a Fix namespaces and optimize imports (#1651)
* Fix namespaces and optimize imports

* Cleanup fixes

* Merge conflict fixes

* Merge conflict fixes

* Merge conflict fixes
2020-08-13 14:40:27 +02:00

83 lines
2.3 KiB
C#

using System;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components.UserInterface;
using Robust.Shared.Localization;
using Robust.Shared.Serialization;
namespace Content.Shared.GameObjects.Components
{
public class SharedGasAnalyzerComponent : Component
{
public override string Name => "GasAnalyzer";
public override uint? NetID => ContentNetIDs.GAS_ANALYZER;
[Serializable, NetSerializable]
public enum GasAnalyzerUiKey
{
Key,
}
[Serializable, NetSerializable]
public class GasAnalyzerBoundUserInterfaceState : BoundUserInterfaceState
{
public float Pressure;
public float Temperature;
public GasEntry[] Gases;
public string Error;
public GasAnalyzerBoundUserInterfaceState(float pressure, float temperature, GasEntry[] gases, string error = null)
{
Pressure = pressure;
Temperature = temperature;
Gases = gases;
Error = error;
}
}
[Serializable, NetSerializable]
public struct GasEntry
{
public readonly string Name;
public readonly float Amount;
public readonly string Color;
public GasEntry(string name, float amount, string color)
{
Name = name;
Amount = amount;
Color = color;
}
public override string ToString()
{
return Loc.GetString("{0}: {1:0.##} mol", Name, Amount);
}
}
[Serializable, NetSerializable]
public class GasAnalyzerRefreshMessage : BoundUserInterfaceMessage
{
public GasAnalyzerRefreshMessage() {}
}
[Serializable, NetSerializable]
public enum GasAnalyzerDanger
{
Nominal,
Warning,
Hazard
}
[Serializable, NetSerializable]
public class GasAnalyzerComponentState : ComponentState
{
public GasAnalyzerDanger Danger;
public GasAnalyzerComponentState(GasAnalyzerDanger danger) : base(ContentNetIDs.GAS_ANALYZER)
{
Danger = danger;
}
}
}
}