e14b092aa7
This isn't 100% finished yet. I intend to add some better API for reading specific attributes, as well as write support (of course!)
32 lines
763 B
C#
32 lines
763 B
C#
namespace RobloxFiles.DataTypes
|
|
{
|
|
public class UDim
|
|
{
|
|
public readonly float Scale;
|
|
public readonly int Offset;
|
|
|
|
public override string ToString() => $"{Scale}, {Offset}";
|
|
|
|
public UDim(float scale = 0, int offset = 0)
|
|
{
|
|
Scale = scale;
|
|
Offset = offset;
|
|
}
|
|
|
|
internal UDim(Attribute attr)
|
|
{
|
|
Scale = attr.readFloat();
|
|
Offset = attr.readInt();
|
|
}
|
|
|
|
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);
|
|
}
|
|
}
|
|
} |