mirror of
https://github.com/sampletext32/ParkanPlayground.git
synced 2025-06-18 15:49:47 +03:00
add export
This commit is contained in:
@ -8,6 +8,8 @@ public abstract class ImGuiModalPanel : IImGuiPanel
|
||||
{
|
||||
protected abstract string ImGuiId { get; }
|
||||
|
||||
protected Vector2 WindowSize { get; set; } = new Vector2(600, 400);
|
||||
|
||||
private bool _shouldOpen = false;
|
||||
|
||||
public virtual void Open()
|
||||
@ -27,7 +29,7 @@ public abstract class ImGuiModalPanel : IImGuiPanel
|
||||
_shouldOpen = false;
|
||||
}
|
||||
|
||||
ImGui.SetNextWindowSize(new Vector2(600, 400));
|
||||
ImGui.SetNextWindowSize(WindowSize);
|
||||
|
||||
if (ImGui.BeginPopup(ImGuiId, ImGuiWindowFlags.NoResize))
|
||||
{
|
||||
|
@ -11,9 +11,11 @@ namespace NResUI.ImGuiUI
|
||||
{
|
||||
private readonly ExplorerViewModel _explorerViewModel;
|
||||
|
||||
public MainMenuBar(ExplorerViewModel explorerViewModel)
|
||||
private readonly MessageBoxModalPanel _messageBox;
|
||||
public MainMenuBar(ExplorerViewModel explorerViewModel, MessageBoxModalPanel messageBox)
|
||||
{
|
||||
_explorerViewModel = explorerViewModel;
|
||||
_messageBox = messageBox;
|
||||
}
|
||||
|
||||
public void OnImGuiRender()
|
||||
@ -45,8 +47,10 @@ namespace NResUI.ImGuiUI
|
||||
if (result.IsOk)
|
||||
{
|
||||
var path = result.Path;
|
||||
|
||||
Console.WriteLine(path);
|
||||
|
||||
NResExporter.Export(_explorerViewModel.Archive!, path, _explorerViewModel.Path!);
|
||||
|
||||
_messageBox.Show("Успешно экспортировано");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
33
NResUI/ImGuiUI/MessageBoxModalPanel.cs
Normal file
33
NResUI/ImGuiUI/MessageBoxModalPanel.cs
Normal file
@ -0,0 +1,33 @@
|
||||
using System.Numerics;
|
||||
using ImGuiNET;
|
||||
using NResUI.Abstractions;
|
||||
|
||||
namespace NResUI.ImGuiUI;
|
||||
|
||||
public class MessageBoxModalPanel : ImGuiModalPanel
|
||||
{
|
||||
private string? _text;
|
||||
protected override string ImGuiId { get; } = "#message-box";
|
||||
|
||||
public MessageBoxModalPanel()
|
||||
{
|
||||
WindowSize = new Vector2(300, 150);
|
||||
}
|
||||
|
||||
public void Show(string? text)
|
||||
{
|
||||
_text = text;
|
||||
base.Open();
|
||||
}
|
||||
|
||||
protected override void OnImGuiRenderContent()
|
||||
{
|
||||
ImGui.Text(_text);
|
||||
ImGui.Spacing();
|
||||
|
||||
if (ImGui.Button("Ок"))
|
||||
{
|
||||
ImGui.CloseCurrentPopup();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user