2021-03-10 19:08:28 +00:00
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
|
|
|
|
namespace HUD_Manager.Structs {
|
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
|
public struct RawElement {
|
|
|
|
|
public ElementKind id;
|
|
|
|
|
|
|
|
|
|
public float x;
|
|
|
|
|
|
|
|
|
|
public float y;
|
|
|
|
|
|
|
|
|
|
public float scale;
|
|
|
|
|
|
2021-03-11 19:14:34 +00:00
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
|
|
|
|
|
public byte[] options;
|
2021-03-10 19:08:28 +00:00
|
|
|
|
|
2021-03-11 19:14:34 +00:00
|
|
|
|
public ushort width;
|
|
|
|
|
|
|
|
|
|
public ushort height;
|
|
|
|
|
|
2021-03-13 21:10:23 +00:00
|
|
|
|
public MeasuredFrom measuredFrom;
|
2021-03-11 19:14:34 +00:00
|
|
|
|
|
|
|
|
|
public VisibilityFlags visibility;
|
2021-03-10 19:08:28 +00:00
|
|
|
|
|
|
|
|
|
public byte unknown6;
|
|
|
|
|
|
|
|
|
|
public byte opacity;
|
|
|
|
|
|
2021-03-13 21:10:23 +00:00
|
|
|
|
// last two bytes are padding
|
2021-03-10 19:08:28 +00:00
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
|
|
|
|
|
public byte[] unknown8;
|
|
|
|
|
|
|
|
|
|
public RawElement(Element element) {
|
|
|
|
|
this.id = element.Id;
|
|
|
|
|
this.x = element.X;
|
|
|
|
|
this.y = element.Y;
|
|
|
|
|
this.scale = element.Scale;
|
2021-03-11 19:14:34 +00:00
|
|
|
|
this.options = element.Options;
|
|
|
|
|
this.width = element.Width;
|
|
|
|
|
this.height = element.Height;
|
2021-03-13 21:10:23 +00:00
|
|
|
|
this.measuredFrom = element.MeasuredFrom;
|
2021-03-10 19:08:28 +00:00
|
|
|
|
this.visibility = element.Visibility;
|
|
|
|
|
this.unknown6 = element.Unknown6;
|
|
|
|
|
this.opacity = element.Opacity;
|
|
|
|
|
this.unknown8 = element.Unknown8;
|
|
|
|
|
}
|
2021-03-11 19:14:34 +00:00
|
|
|
|
|
2021-03-13 21:10:23 +00:00
|
|
|
|
public void UpdateEnabled(Element element) {
|
|
|
|
|
if (element[ElementComponent.X]) {
|
|
|
|
|
this.x = element.X;
|
|
|
|
|
}
|
2021-03-10 19:08:28 +00:00
|
|
|
|
|
2021-03-13 21:10:23 +00:00
|
|
|
|
if (element[ElementComponent.Y]) {
|
|
|
|
|
this.y = element.Y;
|
|
|
|
|
}
|
2021-03-10 19:08:28 +00:00
|
|
|
|
|
2021-03-13 21:10:23 +00:00
|
|
|
|
if (element[ElementComponent.Scale]) {
|
|
|
|
|
this.scale = element.Scale;
|
|
|
|
|
}
|
2021-03-10 19:08:28 +00:00
|
|
|
|
|
2021-03-13 21:10:23 +00:00
|
|
|
|
if (element[ElementComponent.Visibility]) {
|
|
|
|
|
this.visibility = element.Visibility;
|
|
|
|
|
}
|
2021-03-10 19:08:28 +00:00
|
|
|
|
|
2021-03-13 21:10:23 +00:00
|
|
|
|
if (element[ElementComponent.Opacity]) {
|
|
|
|
|
this.opacity = element.Opacity;
|
2021-03-11 19:14:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-03-13 21:10:23 +00:00
|
|
|
|
if (element[ElementComponent.Options]) {
|
|
|
|
|
this.options = element.Options;
|
|
|
|
|
}
|
2021-03-10 19:08:28 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|