1
0
mirror of synced 2025-01-18 00:56:49 +01:00

impr: Close tutorial view when a tutorial is started

This commit is contained in:
WerWolv 2023-12-20 15:26:45 +01:00
parent e2ae567b9f
commit e3e117a14e
2 changed files with 19 additions and 17 deletions

View File

@ -22,26 +22,27 @@ namespace hex::plugin::builtin {
{
auto &step = tutorial.addStep();
static EventManager::EventList::iterator eventHandle;
step.setMessage(
"hex.builtin.tutorial.introduction.step2.title",
"hex.builtin.tutorial.introduction.step2.description",
Bottom | Right
)
.addHighlight("hex.builtin.tutorial.introduction.step2.highlight",
{
"Welcome Screen/Start##SubWindow_69AA6996",
Lang("hex.builtin.welcome.start.create_file")
})
.onAppear([&step] {
EventProviderOpened::subscribe(&step, [&step](prv::Provider *provider) {
if (dynamic_cast<MemoryFileProvider*>(provider))
step.complete();
});
})
.onComplete([&step] {
EventProviderOpened::unsubscribe(&step);
"hex.builtin.tutorial.introduction.step2.title",
"hex.builtin.tutorial.introduction.step2.description",
Bottom | Right
)
.addHighlight("hex.builtin.tutorial.introduction.step2.highlight",
{
"Welcome Screen/Start##SubWindow_69AA6996",
Lang("hex.builtin.welcome.start.create_file")
})
.onAppear([&step] {
eventHandle = EventProviderOpened::subscribe([&step](prv::Provider *provider) {
if (dynamic_cast<MemoryFileProvider*>(provider))
step.complete();
});
})
.onComplete([] {
EventProviderOpened::unsubscribe(eventHandle);
});
}
{

View File

@ -53,6 +53,7 @@ namespace hex::plugin::builtin {
ImGui::BeginDisabled(currTutorial != tutorials.end());
if (ImGuiExt::DimmedButton("hex.builtin.view.tutorials.start"_lang, ImVec2(ImGui::GetContentRegionAvail().x, 0))) {
TutorialManager::startTutorial(m_selectedTutorial->getUnlocalizedName());
this->getWindowOpenState() = false;
}
ImGui::EndDisabled();
}