Clip meta changes.

This commit is contained in:
Ottermandias 2024-08-28 18:29:47 +02:00
parent 4970e57131
commit 6d408ba695
8 changed files with 31 additions and 7 deletions

View file

@ -66,6 +66,9 @@ public sealed class EqdpMetaDrawer(ModMetaEditor editor, MetaFileManager metaFil
.ThenBy(kvp => kvp.Key.Slot)
.Select(kvp => (kvp.Key, kvp.Value));
protected override int Count
=> Editor.Eqdp.Count;
private static bool DrawIdentifierInput(ref EqdpIdentifier identifier)
{
ImGui.TableNextColumn();

View file

@ -64,6 +64,9 @@ public sealed class EqpMetaDrawer(ModMetaEditor editor, MetaFileManager metaFile
.ThenBy(kvp => kvp.Key.Slot)
.Select(kvp => (kvp.Key, kvp.Value));
protected override int Count
=> Editor.Eqp.Count;
private static bool DrawIdentifierInput(ref EqpIdentifier identifier)
{
ImGui.TableNextColumn();

View file

@ -64,6 +64,9 @@ public sealed class EstMetaDrawer(ModMetaEditor editor, MetaFileManager metaFile
.ThenBy(kvp => kvp.Key.Slot)
.Select(kvp => (kvp.Key, kvp.Value));
protected override int Count
=> Editor.Est.Count;
private static bool DrawIdentifierInput(ref EstIdentifier identifier)
{
ImGui.TableNextColumn();

View file

@ -52,6 +52,9 @@ public sealed class GlobalEqpMetaDrawer(ModMetaEditor editor, MetaFileManager me
.ThenBy(identifier => identifier.Condition.Id)
.Select(identifier => (identifier, (byte)0));
protected override int Count
=> Editor.GlobalEqp.Count;
private static void DrawIdentifierInput(ref GlobalEqpManipulation identifier)
{
ImGui.TableNextColumn();

View file

@ -59,7 +59,10 @@ public sealed class GmpMetaDrawer(ModMetaEditor editor, MetaFileManager metaFile
protected override IEnumerable<(GmpIdentifier, GmpEntry)> Enumerate()
=> Editor.Gmp
.OrderBy(kvp => kvp.Key.SetId.Id)
.Select(kvp => (kvp.Key, kvp.Value));
.Select(kvp => (kvp.Key, kvp.Value));
protected override int Count
=> Editor.Gmp.Count;
private static bool DrawIdentifierInput(ref GmpIdentifier identifier)
{

View file

@ -149,6 +149,9 @@ public sealed class ImcMetaDrawer(ModMetaEditor editor, MetaFileManager metaFile
.ThenBy(kvp => kvp.Key.Variant.Id)
.Select(kvp => (kvp.Key, kvp.Value));
protected override int Count
=> Editor.Imc.Count;
public static bool DrawObjectType(ref ImcIdentifier identifier, float width = 110)
{
var ret = Combos.ImcType("##imcType", identifier.ObjectType, out var type, width);

View file

@ -41,12 +41,14 @@ public abstract class MetaDrawer<TIdentifier, TEntry>(ModMetaEditor editor, Meta
using var id = ImUtf8.PushId((int)Identifier.Type);
DrawNew();
foreach (var ((identifier, entry), idx) in Enumerate().WithIndex())
{
id.Push(idx);
DrawEntry(identifier, entry);
id.Pop();
}
var height = ImUtf8.FrameHeightSpacing;
var skips = ImGuiClip.GetNecessarySkipsAtPos(height, ImGui.GetCursorPosY());
var remainder = ImGuiClip.ClippedTableDraw(Enumerate(), skips, DrawLine, Count);
ImGuiClip.DrawEndDummy(remainder, height);
void DrawLine((TIdentifier Identifier, TEntry Value) pair)
=> DrawEntry(pair.Identifier, pair.Value);
}
public abstract ReadOnlySpan<byte> Label { get; }
@ -57,6 +59,7 @@ public abstract class MetaDrawer<TIdentifier, TEntry>(ModMetaEditor editor, Meta
protected abstract void DrawEntry(TIdentifier identifier, TEntry entry);
protected abstract IEnumerable<(TIdentifier, TEntry)> Enumerate();
protected abstract int Count { get; }
/// <summary>

View file

@ -63,6 +63,9 @@ public sealed class RspMetaDrawer(ModMetaEditor editor, MetaFileManager metaFile
.ThenBy(kvp => kvp.Key.Attribute)
.Select(kvp => (kvp.Key, kvp.Value));
protected override int Count
=> Editor.Rsp.Count;
private static bool DrawIdentifierInput(ref RspIdentifier identifier)
{
ImGui.TableNextColumn();