75 lines
2.3 KiB
C++
75 lines
2.3 KiB
C++
#include "EventListener.h"
|
|
|
|
auto EventListener::GetSingleton() -> EventListener*
|
|
{
|
|
static EventListener singleton{};
|
|
return std::addressof(singleton);
|
|
}
|
|
|
|
// Unused
|
|
void EventListener::Install()
|
|
{
|
|
//RE::ScriptEventSourceHolder::GetSingleton()->AddEventSink<RE::TESContainerChangedEvent>(EventListener::GetSingleton());
|
|
RE::UI::GetSingleton()->AddEventSink<RE::MenuOpenCloseEvent>(EventListener::GetSingleton());
|
|
SKSE::GetModCallbackEventSource()->AddEventSink(EventListener::GetSingleton());
|
|
}
|
|
|
|
auto EventListener::ProcessEvent(
|
|
const SKSE::ModCallbackEvent* a_event,
|
|
RE::BSTEventSource<SKSE::ModCallbackEvent>* a_eventSource)
|
|
-> RE::BSEventNotifyControl
|
|
{
|
|
if (a_event->eventName == "Enderal_OpenHelpURL") {
|
|
ShowWindow(GetForegroundWindow(), SW_MINIMIZE);
|
|
ShellExecuteA(NULL, "open", "https://go.eddoursul.win/enderal-se-support", NULL, NULL, SW_SHOWNORMAL);
|
|
|
|
//} else if (a_event->eventName == "Enderal_OpenQuestJournal") {
|
|
// RE::UIMessageQueue::GetSingleton()->AddMessage(RE::InterfaceStrings::GetSingleton()->journalMenu, RE::UI_MESSAGE_TYPE::kShow, 0i64);
|
|
}
|
|
|
|
return RE::BSEventNotifyControl::kContinue;
|
|
}
|
|
|
|
auto EventListener::ProcessEvent(
|
|
const RE::TESContainerChangedEvent* a_event,
|
|
RE::BSTEventSource<RE::TESContainerChangedEvent>* a_eventSource)
|
|
-> RE::BSEventNotifyControl
|
|
{
|
|
//
|
|
|
|
return RE::BSEventNotifyControl::kContinue;
|
|
}
|
|
|
|
auto EventListener::ProcessEvent(
|
|
const RE::MenuOpenCloseEvent* a_event,
|
|
RE::BSTEventSource<RE::MenuOpenCloseEvent>* a_eventSource)
|
|
-> RE::BSEventNotifyControl
|
|
{
|
|
if (a_event->opening) {
|
|
if (a_event->menuName == RE::DialogueMenu::MENU_NAME) {
|
|
// Make sure Tab is not blocked. If it should be, a Papyrus script will block it a few frames later.
|
|
DialogueMenuPatch::BlockTab(false);
|
|
} else if (a_event->menuName == "CustomMenu" && RE::UI::GetSingleton()->IsMenuOpen(RE::TweenMenu::MENU_NAME)) {
|
|
CloseTweenMenu();
|
|
}
|
|
} else {
|
|
if (a_event->menuName == RE::DialogueMenu::MENU_NAME) {
|
|
DialogueMenuPatch::BlockTab(false);
|
|
} else if (a_event->menuName == RE::MainMenu::MENU_NAME) {
|
|
CheckScriptVersions();
|
|
}
|
|
}
|
|
|
|
return RE::BSEventNotifyControl::kContinue;
|
|
}
|
|
|
|
auto EventListener::ProcessEvent(
|
|
const RE::TESActivateEvent* a_event,
|
|
RE::BSTEventSource<RE::TESActivateEvent>* a_eventSource)
|
|
-> RE::BSEventNotifyControl
|
|
{
|
|
//
|
|
|
|
return RE::BSEventNotifyControl::kContinue;
|
|
}
|