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;
|
|
|
|
|
|
|
|
|
|
public byte unknown4;
|
|
|
|
|
|
|
|
|
|
public VisibilityFlags visibility;
|
2021-03-10 19:08:28 +00:00
|
|
|
|
|
|
|
|
|
public byte unknown6;
|
|
|
|
|
|
|
|
|
|
public byte opacity;
|
|
|
|
|
|
|
|
|
|
[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-10 19:08:28 +00:00
|
|
|
|
this.unknown4 = element.Unknown4;
|
|
|
|
|
this.visibility = element.Visibility;
|
|
|
|
|
this.unknown6 = element.Unknown6;
|
|
|
|
|
this.opacity = element.Opacity;
|
|
|
|
|
this.unknown8 = element.Unknown8;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class Element {
|
|
|
|
|
public ElementKind Id { get; set; }
|
|
|
|
|
|
|
|
|
|
public float X { get; set; }
|
|
|
|
|
|
|
|
|
|
public float Y { get; set; }
|
|
|
|
|
|
|
|
|
|
public float Scale { get; set; }
|
|
|
|
|
|
2021-03-11 19:14:34 +00:00
|
|
|
|
public byte[] Options { get; set; }
|
|
|
|
|
|
|
|
|
|
public ushort Width { get; set; }
|
2021-03-10 19:08:28 +00:00
|
|
|
|
|
2021-03-11 19:14:34 +00:00
|
|
|
|
public ushort Height { get; set; }
|
|
|
|
|
|
|
|
|
|
public byte Unknown4 { get; set; }
|
|
|
|
|
|
|
|
|
|
public VisibilityFlags Visibility { get; set; }
|
2021-03-10 19:08:28 +00:00
|
|
|
|
|
|
|
|
|
public byte Unknown6 { get; set; }
|
|
|
|
|
|
|
|
|
|
public byte Opacity { get; set; }
|
|
|
|
|
|
|
|
|
|
public byte[] Unknown8 { get; set; }
|
|
|
|
|
|
2021-03-11 19:14:34 +00:00
|
|
|
|
public bool this[VisibilityFlags flags] {
|
|
|
|
|
get => (this.Visibility & flags) > 0;
|
|
|
|
|
set {
|
|
|
|
|
if (value) {
|
|
|
|
|
this.Visibility |= flags;
|
|
|
|
|
} else {
|
|
|
|
|
this.Visibility &= ~flags;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-10 19:08:28 +00:00
|
|
|
|
public Element(RawElement raw) {
|
|
|
|
|
this.Id = raw.id;
|
|
|
|
|
this.X = raw.x;
|
|
|
|
|
this.Y = raw.y;
|
|
|
|
|
this.Scale = raw.scale;
|
2021-03-11 19:14:34 +00:00
|
|
|
|
this.Options = raw.options;
|
|
|
|
|
this.Width = raw.width;
|
|
|
|
|
this.Height = raw.height;
|
2021-03-10 19:08:28 +00:00
|
|
|
|
this.Unknown4 = raw.unknown4;
|
|
|
|
|
this.Visibility = raw.visibility;
|
|
|
|
|
this.Unknown6 = raw.unknown6;
|
|
|
|
|
this.Opacity = raw.opacity;
|
|
|
|
|
this.Unknown8 = raw.unknown8;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|