2021-03-08 15:03:11 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
|
|
|
|
namespace HUD_Manager.Structs {
|
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
|
public struct Layout {
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 81)]
|
2021-03-10 19:08:28 +00:00
|
|
|
|
public RawElement[] elements;
|
2021-03-08 15:03:11 +00:00
|
|
|
|
|
|
|
|
|
public Dictionary<ElementKind, Element> ToDictionary() {
|
|
|
|
|
// NOTE: not using ToDictionary here because duplicate keys are possible with old broken layouts
|
|
|
|
|
var dict = new Dictionary<ElementKind, Element>();
|
|
|
|
|
foreach (var elem in this.elements) {
|
|
|
|
|
if (elem.id == 0) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-10 19:08:28 +00:00
|
|
|
|
dict[elem.id] = new Element(elem);
|
2021-03-08 15:03:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return dict;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|