mirror of
https://github.com/sampletext32/ParkanPlayground.git
synced 2025-06-18 23:59:46 +03:00
add varset view
This commit is contained in:
@ -55,6 +55,7 @@ public class App
|
||||
serviceCollection.AddSingleton(new MissionTmaViewModel());
|
||||
serviceCollection.AddSingleton(new BinaryExplorerViewModel());
|
||||
serviceCollection.AddSingleton(new ScrViewModel());
|
||||
serviceCollection.AddSingleton(new VarsetViewModel());
|
||||
|
||||
var serviceProvider = serviceCollection.BuildServiceProvider();
|
||||
|
||||
|
@ -8,6 +8,7 @@ using NResUI.Abstractions;
|
||||
using NResUI.Models;
|
||||
using ScrLib;
|
||||
using TexmLib;
|
||||
using VarsetLib;
|
||||
|
||||
namespace NResUI.ImGuiUI
|
||||
{
|
||||
@ -16,6 +17,7 @@ namespace NResUI.ImGuiUI
|
||||
TexmExplorerViewModel texmExplorerViewModel,
|
||||
ScrViewModel scrViewModel,
|
||||
MissionTmaViewModel missionTmaViewModel,
|
||||
VarsetViewModel varsetViewModel,
|
||||
MessageBoxModalPanel messageBox)
|
||||
: IImGuiPanel
|
||||
{
|
||||
@ -104,6 +106,21 @@ namespace NResUI.ImGuiUI
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGui.MenuItem("Open Varset File"))
|
||||
{
|
||||
var result = Dialog.FileOpen("var");
|
||||
|
||||
if (result.IsOk)
|
||||
{
|
||||
var path = result.Path;
|
||||
var parseResult = VarsetParser.Parse(path);
|
||||
|
||||
varsetViewModel.Items = parseResult;
|
||||
|
||||
Console.WriteLine("Read VARSET");
|
||||
}
|
||||
}
|
||||
|
||||
if (nResExplorerViewModel.HasFile)
|
||||
{
|
||||
if (ImGui.MenuItem("Экспортировать NRes"))
|
||||
|
57
NResUI/ImGuiUI/VarsetExplorerPanel.cs
Normal file
57
NResUI/ImGuiUI/VarsetExplorerPanel.cs
Normal file
@ -0,0 +1,57 @@
|
||||
using ImGuiNET;
|
||||
using NResUI.Abstractions;
|
||||
using NResUI.Models;
|
||||
|
||||
namespace NResUI.ImGuiUI;
|
||||
|
||||
public class VarsetExplorerPanel : IImGuiPanel
|
||||
{
|
||||
private readonly VarsetViewModel _viewModel;
|
||||
|
||||
public VarsetExplorerPanel(VarsetViewModel viewModel)
|
||||
{
|
||||
_viewModel = viewModel;
|
||||
}
|
||||
|
||||
public void OnImGuiRender()
|
||||
{
|
||||
if (ImGui.Begin("VARSET Explorer"))
|
||||
{
|
||||
if (_viewModel.Items.Count == 0)
|
||||
{
|
||||
ImGui.Text("VARSET не загружен");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ImGui.BeginTable($"varset", 4, ImGuiTableFlags.Borders | ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.NoHostExtendX))
|
||||
{
|
||||
ImGui.TableSetupColumn("Индекс");
|
||||
ImGui.TableSetupColumn("Тип");
|
||||
ImGui.TableSetupColumn("Имя");
|
||||
ImGui.TableSetupColumn("Значение");
|
||||
ImGui.TableHeadersRow();
|
||||
|
||||
for (int j = 0; j < _viewModel.Items.Count; j++)
|
||||
{
|
||||
var item = _viewModel.Items[j];
|
||||
ImGui.TableNextRow();
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.Text(j.ToString());
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.Text(item.Type);
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.Text(item.Name);
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.Text(item.Value);
|
||||
}
|
||||
|
||||
ImGui.EndTable();
|
||||
}
|
||||
|
||||
ImGui.TreePop();
|
||||
}
|
||||
|
||||
ImGui.End();
|
||||
}
|
||||
}
|
||||
}
|
8
NResUI/Models/VarsetViewModel.cs
Normal file
8
NResUI/Models/VarsetViewModel.cs
Normal file
@ -0,0 +1,8 @@
|
||||
using VarsetLib;
|
||||
|
||||
namespace NResUI.Models;
|
||||
|
||||
public class VarsetViewModel
|
||||
{
|
||||
public List<VarsetItem> Items { get; set; } = [];
|
||||
}
|
@ -23,6 +23,7 @@
|
||||
<ProjectReference Include="..\NResLib\NResLib.csproj" />
|
||||
<ProjectReference Include="..\ScrLib\ScrLib.csproj" />
|
||||
<ProjectReference Include="..\TexmLib\TexmLib.csproj" />
|
||||
<ProjectReference Include="..\VarsetLib\VarsetLib.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
Reference in New Issue
Block a user