3#include "mc/_HeaderOutputPredefine.h"
6#include "mc/client/gui/oreui/routing/RouteHistoryAction.h"
7#include "mc/client/gui/oreui/routing/RouterAction.h"
8#include "mc/client/gui/oreui/routing/RouterHistory.h"
9#include "mc/client/gui/oreui/routing/RouterLocation.h"
10#include "mc/deps/core/utility/NonOwnerPointer.h"
11#include "mc/deps/core/utility/pub_sub/Publisher.h"
18namespace Bedrock::PubSub::ThreadModel {
struct MultiThreaded; }
35 enum class RouterPushMode :
int {
44 ::ll::TypedStorage<8, 160, ::std::optional<::OreUI::RouterLocation>> mOldLocation;
45 ::ll::TypedStorage<8, 160, ::std::optional<::OreUI::RouterLocation>> mCurrentLocation;
51 MCAPI ~DeferredChangeNotification();
61 using OnRouteChangedCallback = void(
62 ::std::optional<::OreUI::RouterLocation>
const&,
63 ::std::optional<::OreUI::RouterLocation>
const&,
70 ::ll::TypedStorage<8, 128, ::OreUI::RouterHistory> mHistory;
71 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::OreUI::IRouteMatcher const>> mRouteMatcher;
72 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::ISceneStack>> mSceneStack;
76 ::Bedrock::PubSub::Publisher<
78 ::std::optional<::OreUI::RouterLocation>
const&,
79 ::std::optional<::OreUI::RouterLocation>
const&,
82 ::Bedrock::PubSub::ThreadModel::MultiThreaded,
84 mOnRouteChangedPublisher;
85 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::OreUI::IRoutePrerequisiteHandler>> mPrerequisiteHandler;
86 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::OreUI::RouterEventing>> mEventing;
87 ::ll::TypedStorage<1, 1, bool> mIsNotifyingListeners;
88 ::ll::TypedStorage<8, 24, ::std::vector<::OreUI::Router::DeferredChangeNotification>> mDeferredChangeNotifications;
99 ::std::unique_ptr<::OreUI::IRouteMatcher const> routeMatcher,
100 ::std::unique_ptr<::OreUI::IRoutePrerequisiteHandler> prerequisiteHandler,
101 ::std::unique_ptr<::OreUI::RouterEventing> routerEventing,
102 ::Bedrock::NotNullNonOwnerPtr<::ISceneStack>
const& sceneStack
105 MCAPI
void _handleSceneStackPop(
106 ::std::shared_ptr<::AbstractScene>
const& newTopScreen,
108 ::std::optional<::OreUI::RouteAction>
const&
111 MCAPI
void _handleSceneStackPush(
112 ::std::shared_ptr<::AbstractScene>
const& newScreen,
113 ::std::optional<::OreUI::RouteAction>
const& routeAction
116 MCAPI
void _onChange(
117 ::std::optional<::OreUI::RouterLocation>
const& oldLocation,
118 ::std::optional<::OreUI::RouterLocation>
const& currentLocation
121 MCAPI
bool _pushRoute(::std::string
const& route, ::OreUI::Router::RouterPushMode mode);
123 MCAPI
void _replaceCurrentRouteInHistory(::std::string
const& newRoute, ::OreUI::RouteHistoryAction action);
125 MCAPI
bool _shouldGoBackAndReplaceInsteadOfPush(::std::string
const& newRoute)
const;
127 MCAPI
bool _shouldPopCurrentScreenOnReplacingWithIncompatibleRoute()
const;
129 MCAPI ::Bedrock::PubSub::Subscription addObserver(
130 ::std::function<
void(
131 ::std::optional<::OreUI::RouterLocation>
const&,
132 ::std::optional<::OreUI::RouterLocation>
const&,
133 ::OreUI::RouterAction
137 MCAPI
bool areRoutesCompatible(::std::string
const& routeA, ::std::string
const& routeB)
const;
139 MCAPI ::std::optional<::OreUI::RouterLocation> getCurrentLocation()
const;
141 MCAPI ::std::vector<::std::string> getFullHistory()
const;
143 MCFOLD ::std::vector<::OreUI::RouterLocation>
const& getFullRouterLocationHistory()
const;
145 MCFOLD uint64 getHistoryLength()
const;
149 MCAPI
bool isCurrentRoute(::std::string_view route)
const;
151 MCAPI
bool pushRoute(::std::string
const& route);
153 MCAPI
bool pushRouteWithFlux(::std::string
const& route);
155 MCAPI
bool replaceRoute(::std::string
const& route);
157 MCAPI
void replaceRouteMatcher(::std::unique_ptr<::OreUI::IRouteMatcher> newRouteMatcher);
165 MCAPI static ::std::add_lvalue_reference_t<char const[]> BEDROCK_PREFIX();
172 ::std::unique_ptr<::OreUI::IRouteMatcher const> routeMatcher,
173 ::std::unique_ptr<::OreUI::IRoutePrerequisiteHandler> prerequisiteHandler,
174 ::std::unique_ptr<::OreUI::RouterEventing> routerEventing,
175 ::Bedrock::NotNullNonOwnerPtr<::ISceneStack>
const& sceneStack
Definition AbstractScene.h:5
Definition Subscription.h:10
Definition ISceneStack.h:5
Definition IRouteMatcher.h:7
Definition IRoutePrerequisiteHandler.h:7
Definition RouterEventing.h:7
Definition MultiThreaded.h:7
Definition RouteAction.h:7