0
mirror of https://github.com/sampletext32/ParkanPlayground.git synced 2025-06-20 00:18:02 +03:00

добавил tma в просмотр и отрефакторил код

This commit is contained in:
bird_egop
2024-11-26 04:05:25 +03:00
parent b336f44b72
commit e16b219854
28 changed files with 878 additions and 537 deletions

View File

@ -1,5 +1,6 @@
using System.Numerics;
using ImGuiNET;
using MissionTmaLib.Parsing;
using NativeFileDialogSharp;
using NResLib;
using NResUI.Abstractions;
@ -12,13 +13,15 @@ namespace NResUI.ImGuiUI
{
private readonly NResExplorerViewModel _nResExplorerViewModel;
private readonly TexmExplorerViewModel _texmExplorerViewModel;
private readonly MissionTmaViewModel _missionTmaViewModel;
private readonly MessageBoxModalPanel _messageBox;
public MainMenuBar(NResExplorerViewModel nResExplorerViewModel, TexmExplorerViewModel texmExplorerViewModel, MessageBoxModalPanel messageBox)
public MainMenuBar(NResExplorerViewModel nResExplorerViewModel, TexmExplorerViewModel texmExplorerViewModel, MessageBoxModalPanel messageBox, MissionTmaViewModel missionTmaViewModel)
{
_nResExplorerViewModel = nResExplorerViewModel;
_texmExplorerViewModel = texmExplorerViewModel;
_messageBox = messageBox;
_missionTmaViewModel = missionTmaViewModel;
}
public void OnImGuiRender()
@ -78,6 +81,19 @@ namespace NResUI.ImGuiUI
}
}
if (ImGui.MenuItem("Open Mission TMA"))
{
var result = Dialog.FileOpen("tma");
if (result.IsOk)
{
var path = result.Path;
var parseResult = MissionTmaParser.ReadFile(path);
_missionTmaViewModel.SetParseResult(parseResult, path);
}
}
if (_nResExplorerViewModel.HasFile)
{
if (ImGui.MenuItem("Экспортировать NRes"))
@ -102,32 +118,5 @@ namespace NResUI.ImGuiUI
}
}
// This is a direct port of imgui_demo.cpp HelpMarker function
// https://github.com/ocornut/imgui/blob/master/imgui_demo.cpp#L190
private void ShowHint(string message)
{
// ImGui.TextDisabled("(?)");
if (ImGui.IsItemHovered())
{
// Change background transparency
ImGui.PushStyleColor(
ImGuiCol.PopupBg,
new Vector4(
1,
1,
1,
0.8f
)
);
ImGui.BeginTooltip();
ImGui.PushTextWrapPos(ImGui.GetFontSize() * 35.0f);
ImGui.TextUnformatted(message);
ImGui.PopTextWrapPos();
ImGui.EndTooltip();
ImGui.PopStyleColor();
}
}
}
}