3#include "HMUIUIUtils.hpp"
4#include "../../CP_SDK/Utils/Delegate.hpp"
5#include "../../CP_SDK/Utils/Il2cpp.hpp"
6#include "../../CP_SDK/Utils/MonoPtr.hpp"
8#include <custom-types/shared/coroutine.hpp>
10#include <HMUI/FlowCoordinator.hpp>
11#include <HMUI/ViewController.hpp>
16#define SDK_UI_FLOW_COORDINATOR_INSTANCE() public: static CP_SDK::Utils::MonoPtr<___TargetType>& Instance() { return _Instance<___TargetType>(); }
17#define SDK_UI_FLOW_COORDINATOR_DESTROY() public: static void Destroy() { _Destroy <___TargetType>(); }
23 using namespace UnityEngine;
40 static std::map<System::Type*, _v::MonoPtr<HMUIViewFlowCoordinator>> m_Instances;
43 template<
class t_Base>
requires(std::is_assignable_v<HMUIViewFlowCoordinator*&, t_Base*>)
46 auto l_Type =
reinterpret_cast<System::Type*
>(csTypeOf(t_Base*));
47 if (l_Type && m_Instances.contains(l_Type))
50 m_Instances[l_Type] = HMUIUIUtils::CreateFlowCoordinator<t_Base*>();
53 template<
class t_Base>
requires(std::is_assignable_v<HMUIViewFlowCoordinator*&, t_Base*>)
54 static void _Destroy()
56 auto l_Type =
reinterpret_cast<System::Type*
>(csTypeOf(t_Base*));
57 auto l_It = m_Instances.find(l_Type);
58 if (!l_Type || l_It == m_Instances.end())
61 if (m_Instances[l_Type])
62 _u::GameObject::Destroy(m_Instances[l_Type]->get_gameObject());
64 m_Instances.erase(l_It);
76 std::queue<t_Views> m_SwitchQueue;
77 bool m_IsDequeueEngaged;
97 void Present(
bool p_IgnoreBackuping =
false);
124 void ChangeView(HMUI::ViewController* p_NewView, HMUI::ViewController* p_Left =
nullptr, HMUI::ViewController* p_Right =
nullptr);
128 void DequeueViewController();
130 static custom_types::Helpers::Coroutine DequeueViewControllerWhileOldInTransition(
HMUIViewFlowCoordinator* p_Self);
135 template<
class t_ViewController>
requires(std::is_assignable_v<HMUI::ViewController*&, t_ViewController>)
138 return HMUIUIUtils::CreateViewController<t_ViewController>();
143 template<
class t_ViewController>
requires(std::is_assignable_v<HMUI::ViewController*&, t_ViewController*>)
146 if (*p_ViewController)
148 _u::GameObject::DestroyImmediate((*p_ViewController)->get_gameObject());
149 *p_ViewController =
nullptr;
View flow coordinator base class.
CP_SDK_IL2CPP_OVERRIDE_METHOD_EX(HMUI, FlowCoordinator, void, BackButtonWasPressed, HMUI::ViewController *p_TopViewController)
When the back button is pressed.
_v::Action< bool > Present_Override
Present this HMUIViewFlowCoordinator.
_v::Func< t_Views > GetInitialViewsController
Get initial views controller (Middle, Left, Right)
void Dismiss()
Dismiss this HMUIViewFlowCoordinator.
_v::Func< std::u16string_view > Title
Initial title.
t_ViewController CreateViewController()
Create a view controller.
CP_SDK_IL2CPP_OVERRIDE_METHOD_EX(HMUI, FlowCoordinator, void, DidActivate, bool p_FirstActivation, bool p_AddedToHierarchy, bool p_ScreenSystemEnabling)
On activation.
void HideLeftScreen()
Hide the left screen.
void Present(bool p_IgnoreBackuping=false)
Present this HMUIViewFlowCoordinator.
_v::Action Dismiss_Override
Dismiss this HMUIViewFlowCoordinator.
_v::Func< bool, HMUI::ViewController * > OnBackButtonPressed
On back button pressed.
void HideRightScreen()
Hide the right screen.
static void DestroyViewController(_v::MonoPtr< t_ViewController > *p_ViewController)
Destroy view controller.
void ChangeView(HMUI::ViewController *p_NewView, HMUI::ViewController *p_Left=nullptr, HMUI::ViewController *p_Right=nullptr)
Enqueue a main view controller change.
Various platform utils like Delegate/Action/Function/Event system.
BeatSaber specific UI compoenents and utilities.