mirror of
https://github.com/sampletext32/ParkanPlayground.git
synced 2025-10-13 23:10:23 +03:00
improvements
This commit is contained in:
@@ -34,22 +34,60 @@ public class CpDatSchemeExplorer : IImGuiPanel
|
||||
|
||||
ImGui.Separator();
|
||||
|
||||
if (ImGui.BeginTable("content", 7, ImGuiTableFlags.Borders | ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.NoHostExtendX))
|
||||
if (ImGui.BeginTable("content", 8, ImGuiTableFlags.Borders | ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.NoHostExtendX | ImGuiTableFlags.Sortable))
|
||||
{
|
||||
ImGui.TableSetupColumn("Индекс");
|
||||
ImGui.TableSetupColumn("Уровень вложенности");
|
||||
ImGui.TableSetupColumn("Архив");
|
||||
ImGui.TableSetupColumn("Элемент");
|
||||
ImGui.TableSetupColumn("Magic1");
|
||||
ImGui.TableSetupColumn("Magic2");
|
||||
ImGui.TableSetupColumn("Описание");
|
||||
ImGui.TableSetupColumn("Magic3");
|
||||
ImGui.TableSetupColumn("Тип");
|
||||
|
||||
ImGui.TableHeadersRow();
|
||||
|
||||
// Handle sorting
|
||||
ImGuiTableSortSpecsPtr sortSpecs = ImGui.TableGetSortSpecs();
|
||||
if (sortSpecs.SpecsDirty)
|
||||
{
|
||||
// Only handle the first sort spec for simplicity
|
||||
var sortSpec = sortSpecs.Specs;
|
||||
|
||||
if (sortSpec.ColumnIndex == 0)
|
||||
{
|
||||
_viewModel.RebuildFlatList();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
_viewModel.FlatList.Sort((a, b) =>
|
||||
{
|
||||
int result = 0;
|
||||
switch (sortSpec.ColumnIndex)
|
||||
{
|
||||
case 1: result = a.Level.CompareTo(b.Level); break;
|
||||
case 2: result = string.Compare(a.Entry.ArchiveFile, b.Entry.ArchiveFile, StringComparison.Ordinal); break;
|
||||
case 3: result = string.Compare(a.Entry.ArchiveEntryName, b.Entry.ArchiveEntryName, StringComparison.Ordinal); break;
|
||||
case 4: result = a.Entry.Magic1.CompareTo(b.Entry.Magic1); break;
|
||||
case 5: result = a.Entry.Magic2.CompareTo(b.Entry.Magic2); break;
|
||||
case 6: result = string.Compare(a.Entry.Description, b.Entry.Description, StringComparison.Ordinal); break;
|
||||
case 7: result = a.Entry.Type.CompareTo(b.Entry.Type); break;
|
||||
}
|
||||
|
||||
return sortSpec.SortDirection == ImGuiSortDirection.Descending ? -result : result;
|
||||
});
|
||||
}
|
||||
|
||||
sortSpecs.SpecsDirty = false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < _viewModel.FlatList.Count; i++)
|
||||
{
|
||||
ImGui.TableNextRow();
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.Text(i.ToString());
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.Text(_viewModel.FlatList[i].Level.ToString());
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.Text(_viewModel.FlatList[i].Entry.ArchiveFile);
|
||||
@@ -62,7 +100,7 @@ public class CpDatSchemeExplorer : IImGuiPanel
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.Text(_viewModel.FlatList[i].Entry.Description);
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.Text(_viewModel.FlatList[i].Entry.Magic3.ToString());
|
||||
ImGui.Text(_viewModel.FlatList[i].Entry.Type.ToString("G"));
|
||||
}
|
||||
|
||||
ImGui.EndTable();
|
||||
@@ -80,9 +118,9 @@ public class CpDatSchemeExplorer : IImGuiPanel
|
||||
ImGui.SameLine();
|
||||
ImGui.Text(entry.Magic2.ToString());
|
||||
|
||||
ImGui.Text("Magic3: ");
|
||||
ImGui.Text("Тип: ");
|
||||
ImGui.SameLine();
|
||||
ImGui.Text(entry.Magic3.ToString());
|
||||
ImGui.Text(entry.Type.ToString());
|
||||
|
||||
ImGui.Text("Кол-во дочерних элементов: ");
|
||||
ImGui.SameLine();
|
||||
|
Reference in New Issue
Block a user