2019-02-01 17:19:20 +00:00
|
|
|
|
namespace RobloxFiles.DataTypes
|
2019-01-26 00:39:37 +00:00
|
|
|
|
{
|
2019-02-01 18:40:39 +00:00
|
|
|
|
public class UDim
|
2019-01-26 00:39:37 +00:00
|
|
|
|
{
|
|
|
|
|
public readonly float Scale;
|
|
|
|
|
public readonly int Offset;
|
|
|
|
|
|
2019-11-01 02:40:31 +00:00
|
|
|
|
public override string ToString() => $"{Scale}, {Offset}";
|
|
|
|
|
|
2019-01-26 00:39:37 +00:00
|
|
|
|
public UDim(float scale = 0, int offset = 0)
|
|
|
|
|
{
|
|
|
|
|
Scale = scale;
|
|
|
|
|
Offset = offset;
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-01 02:40:31 +00:00
|
|
|
|
internal UDim(Attribute attr)
|
|
|
|
|
{
|
|
|
|
|
Scale = attr.readFloat();
|
|
|
|
|
Offset = attr.readInt();
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-26 00:39:37 +00:00
|
|
|
|
public static UDim operator+(UDim a, UDim b)
|
|
|
|
|
{
|
|
|
|
|
return new UDim(a.Scale + b.Scale, a.Offset + b.Offset);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static UDim operator-(UDim a, UDim b)
|
|
|
|
|
{
|
|
|
|
|
return new UDim(a.Scale - b.Scale, a.Offset - b.Offset);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|