3#include "mc/_HeaderOutputPredefine.h"
6#include "mc/client/gui/GameEventNotification.h"
7#include "mc/client/gui/SceneType.h"
8#include "mc/client/gui/oreui/routing/RouteAction.h"
9#include "mc/client/gui/screens/interfaces/ISceneStack.h"
10#include "mc/deps/core/utility/NonOwnerPointer.h"
11#include "mc/deps/core/utility/pub_sub/Publisher.h"
12#include "mc/deps/core/utility/pub_sub/Subscription.h"
13#include "mc/platform/brstd/function_ref.h"
25namespace Bedrock::PubSub::ThreadModel {
struct MultiThreaded; }
45 enum class EventType :
int {
57 ::ll::TypedStorage<4, 4, ::SceneStack::SceneStackEvent::EventType> mType;
63 virtual ~SceneStackEvent() =
default;
71 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::AbstractScene>> mScene;
72 ::ll::TypedStorage<8, 48, ::std::optional<::OreUI::RouteAction>> mRouteAction;
78 virtual ~PushScreenEvent() =
default;
86 ::ll::TypedStorage<4, 4, int> mPopCount;
87 ::ll::TypedStorage<8, 48, ::std::optional<::OreUI::RouteAction>> mRouteAction;
88 ::ll::TypedStorage<8, 24, ::std::vector<::std::string>> mExpectedScreenNames;
94 virtual ~PopScreenEvent() =
default;
102 ::ll::TypedStorage<4, 4, ::ui::SceneType> mSceneType;
103 ::ll::TypedStorage<4, 4, ::ui::SceneType> mSceneTypeExclusions;
104 ::ll::TypedStorage<4, 4, int> mPopCount;
110 virtual ~PopRangeOfTypeScreenEvent() =
default;
118 ::ll::TypedStorage<1, 1, bool> mIgnoreNotFlushableFlag;
119 ::ll::TypedStorage<1, 1, bool> mIgnoreTransitions;
120 ::ll::TypedStorage<8, 64, ::std::function<void()>> mPostFlushCallback;
126 virtual ~FlushScreenEvent() =
default;
134 virtual ~ReloadScreenEvent() =
default;
142 ::ll::TypedStorage<8, 40, ::OreUI::RouteAction> mRouteAction;
148 virtual ~RouteActionEvent() =
default;
155 ::ll::TypedStorage<8, 24, ::std::vector<::ISceneStack::SceneElement>> mScreenStack;
156 ::ll::TypedStorage<8, 8, ::CachedScenes&> mCachedScreens;
157 ::ll::TypedStorage<8, 24, ::std::vector<::std::unique_ptr<::SceneStack::SceneStackEvent>>> mStackEvents;
158 ::ll::TypedStorage<8, 24, ::std::vector<::std::unique_ptr<::SceneStack::SceneStackEvent>>> mQueuedStackEvents;
159 ::ll::TypedStorage<8, 24, ::std::vector<::ScreenThreshold>> mScreenThresholds;
160 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::TaskGroup>> mDestroyScreenTaskGroup;
161 ::ll::TypedStorage<4, 4, int> mActiveStackSize;
162 ::ll::TypedStorage<4, 4, int> mScheduledScreenPushCount;
163 ::ll::TypedStorage<4, 4, int> mScheduledScreenPopCount;
164 ::ll::TypedStorage<1, 1, bool> mScreenNeedsEntrance;
165 ::ll::TypedStorage<8, 32, ::std::string> mLastPoppedScreenName;
166 ::ll::TypedStorage<1, 1, bool> mChangedThisFrame;
167 ::ll::TypedStorage<1, 1, bool> mScreenIsTicking;
168 ::ll::TypedStorage<1, 1, bool> mReloadScenesOnNextPop;
169 ::ll::TypedStorage<1, 1, bool> mDeferUpdatesUntilNextTick;
170 ::ll::TypedStorage<1, 1, bool> mBufferTextCharEvents;
171 ::ll::TypedStorage<8, 24, ::std::vector<::TextCharEventData>> mBufferedTextCharEventData;
172 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::OptionRegistry>> mOptions;
173 ::ll::TypedStorage<8, 16, ::Bedrock::PubSub::Subscription> mAsyncLoadOptionSubscription;
174 ::ll::TypedStorage<8, 16, ::Bedrock::PubSub::Subscription> mScreenAnimationsSubscription;
175 ::ll::TypedStorage<8, 128, ::Bedrock::PubSub::Publisher<void(), ::Bedrock::PubSub::ThreadModel::MultiThreaded, 0>>
176 mSceneStackDestroyedPublisher;
177 ::ll::TypedStorage<8, 24, ::std::vector<::std::pair<
void*, ::std::function<void(::AbstractScene&)>>>>
178 mSceneChangeCallbacks;
179 ::ll::TypedStorage<8, 24, ::std::vector<::std::pair<
void*, ::std::function<void(::AbstractScene&)>>>>
180 mPrePushSceneCallbacks;
184 ::std::vector<::std::pair<
186 ::std::function<void(::std::shared_ptr<::AbstractScene>, ::std::optional<::OreUI::RouteAction>)>>>>
188 ::ll::TypedStorage<8, 24, ::std::vector<::std::pair<
void*, ::std::function<void(::AbstractScene*)>>>>
189 mPrePopSceneCallbacks;
193 ::std::vector<::std::pair<
195 ::std::function<void(::std::shared_ptr<::AbstractScene>,
bool, ::std::optional<::OreUI::RouteAction>)>>>>
201 ::std::pair<
void*, ::std::function<void(::std::vector<::std::shared_ptr<::AbstractScene>>
const&)>>>>
202 mPopRangeSceneCallbacks;
203 ::ll::TypedStorage<8, 24, ::std::vector<::std::pair<
void*, ::std::function<void(::OreUI::RouteAction
const&)>>>>
204 mRouteActionCallbacks;
205 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::SceneStackProxy>> mProxy;
206 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::UIEventCoordinator>> mUIEventCoordinator;
207 ::ll::TypedStorage<8, 64, ::std::function<bool()>> mGetSuspended;
212 SceneStack& operator=(SceneStack
const&);
213 SceneStack(SceneStack
const&);
219 virtual ~SceneStack() ;
221 virtual void reload() ;
223 virtual void setOptions(::std::weak_ptr<::OptionRegistry> options) ;
226 registerSceneChangeCallback(
void* token, ::std::function<
void(::AbstractScene&)> sceneChangeCallback) ;
228 virtual void unregisterSceneChangeCallback(
void* token) ;
230 virtual void registerPrePushSceneCallback(
232 ::std::function<
void(::AbstractScene&)> prePushSceneCallback
235 virtual void unregisterPrePushSceneCallback(
void* token) ;
237 virtual void registerPushSceneCallback(
239 ::std::function<
void(::std::shared_ptr<::AbstractScene>, ::std::optional<::OreUI::RouteAction>)>
243 virtual void unregisterPushSceneCallback(
void* token) ;
246 registerPrePopSceneCallback(
void* token, ::std::function<
void(::AbstractScene*)> prePopSceneCallback) ;
248 virtual void unregisterPrePopSceneCallback(
void* token) ;
250 virtual void registerPopSceneCallback(
252 ::std::function<
void(::std::shared_ptr<::AbstractScene>,
bool, ::std::optional<::OreUI::RouteAction>)>
256 virtual void unregisterPopSceneCallback(
void* token) ;
258 virtual void registerPopRangeSceneCallback(
260 ::std::function<
void(::std::vector<::std::shared_ptr<::AbstractScene>>
const&)> popRangeSceneCallback
263 virtual void unregisterPopRangeSceneCallback(
void* token) ;
265 virtual void registerRouteActionCallback(
267 ::std::function<
void(::OreUI::RouteAction
const&)> routeActionCallback
270 virtual void unregisterRouteActionCallback(
void* token) ;
272 virtual void forEachVisibleScreen(
273 ::brstd::function_ref<
void(::AbstractScene&)> callback,
274 bool tickedLastFrame,
275 bool splitscreenRenderBypassThisFrame
278 virtual void forEachScreen(::brstd::function_ref<
bool(::AbstractScene&)> callback,
bool topDown) ;
280 virtual void forEachScreenConst(::brstd::function_ref<
bool(::AbstractScene
const&)> callback,
bool topDown)
const
283 virtual void forEachAlwaysAcceptInputScreen(
284 ::brstd::function_ref<
void(::AbstractScene&)> callback,
285 ::AbstractScene
const* ignoreScreen
289 forEachAlwaysAcceptInputScreenWithTop(::brstd::function_ref<
void(::AbstractScene&)> callback) ;
291 virtual void pushScreenWithRouteAction(
292 ::std::shared_ptr<::AbstractScene> newScreen,
293 ::OreUI::RouteAction
const& routeAction
296 virtual void popScreenWithRouteAction(::OreUI::RouteAction
const& routeAction) ;
298 virtual void scheduleRouteAction(::OreUI::RouteAction
const& routeAction) ;
300 virtual void pushScreen(::std::shared_ptr<::AbstractScene> newScreen,
bool flush) ;
302 virtual void schedulePopScreen(
int totalPopNumber) ;
305 schedulePopScreenWithExpectedNames(::std::vector<::std::string>
const& expectedScreenNames) ;
307 virtual void flushStack(::ISceneStack::FlushMode mode, ::std::function<
void()> postFlushCallback) ;
309 virtual void deferUpdatesUntilNextTick() ;
311 virtual ::std::optional<uint64> getFirstSceneIndexOfSceneType(::ui::SceneType sceneType)
const ;
313 virtual bool popScreensBackTo(::ui::SceneType
const sceneType) ;
315 virtual bool popScreensBackToFirstInstanceOf(::ui::SceneType
const sceneType) ;
317 virtual bool popTopScreensOfType(::ui::SceneType
const sceneType) ;
319 virtual bool update() ;
321 virtual void resetScreenChangeDirtyFlag() ;
323 virtual bool hasChangedThisFrame() const ;
325 virtual
bool isEmpty() const ;
327 virtual uint64 getSize() const ;
329 virtual
void setScreenTickingFlag(
bool screenIsTicking) ;
331 virtual
bool getScreenTickingFlag() const ;
333 virtual ::ui::SceneType getNonTerminatingSceneType() const ;
335 virtual ::std::vector<::std::
string> getScreenNames() const ;
337 virtual ::std::vector<::std::
string> getScreenTelemetryNames() const ;
339 virtual ::std::
string getScreenName() const ;
341 virtual ::std::
string getScreenTelemetry() const ;
343 virtual ::std::
string const& getLastPoppedScreenName() const ;
345 virtual
void handleLicenseChanged() ;
347 virtual
void onGameEventNotification(::ui::GameEventNotification notification) ;
349 virtual ::AbstractScene* getTopScene() ;
351 virtual ::AbstractScene const* getTopScene() const ;
353 virtual ::std::shared_ptr<::AbstractScene> getTopSceneShared() const ;
355 virtual ::AbstractScene* getActiveScene() ;
357 virtual ::AbstractScene const* getActiveScene() const ;
359 virtual ::std::shared_ptr<::AbstractScene> getSharedNonTerminatingActiveScene() ;
361 virtual ::std::shared_ptr<::AbstractScene const> const getSharedNonTerminatingActiveScene() const ;
363 virtual ::gsl::span<::ISceneStack::
SceneElement const> getScreenStackView() const ;
367 virtual
int getScheduledPopCount() const ;
369 virtual
bool isScreenReplaceable() const ;
371 virtual
void handleTextChar(::std::
string const& inputUtf8) ;
373 virtual
void setBufferTextCharEvents(
bool pushTextCharEvents) ;
375 virtual
bool isBufferingTextCharEvents() const ;
377 virtual
bool isOnSceneStack(::ui::SceneType sceneType) const ;
379 virtual
bool isOnSceneStack(::std::
string const& screenName) const ;
381 virtual ::SceneStackProxy* getProxy() ;
383 virtual
bool hasScheduledScreens() const ;
385 virtual
bool hasScheduledEvents() const ;
387 virtual
void setScreenThreshold(::ScreenThreshold const& screenThreshold) ;
389 virtual ::Bedrock::PubSub::Subscription
390 registerSceneStackDestroyedListener(::std::function<
void()> callback) ;
397 ::CachedScenes& cachedScenes,
398 ::Bedrock::NotNullNonOwnerPtr<::UIEventCoordinator> const& uiEventCoordinator,
399 ::std::function<
bool()> const& getSuspended,
400 ::std::function<::std::unique_ptr<::TaskGroup>(::std::
string)> const& taskGroupProvider
403 MCAPI
bool _animationsEnabled() const;
405 MCAPI
bool _popScreens(
407 bool ignoreTransitions,
408 ::std::optional<::OreUI::RouteAction> routeAction,
409 ::std::vector<::std::
string> const& expectedScreenNames
412 MCAPI
void _schedulePopScreen(
414 ::std::optional<::OreUI::RouteAction> routeAction,
415 ::std::vector<::std::
string> const& expectedScreenNames
418 MCAPI
void _schedulePushScreen(
419 ::std::shared_ptr<::AbstractScene> newScreen,
421 ::std::optional<::OreUI::RouteAction> routeAction
428 MCAPI static
void _forEachVisibleScreen(
429 ::brstd::function_ref<
void(::AbstractScene&)> callback,
430 ::std::function<::AbstractScene*(
int)> getScreen,
432 bool splitscreenRenderBypassThisFrame,
433 uint64 topStackIndex,
436 bool renderDrawLastScreens
439 MCAPI static
void forEachVisibleScreen(
440 ::brstd::function_ref<
void(::AbstractScene&)> callback,
441 ::std::function<::AbstractScene*(
int)> getScreen,
442 bool tickedLastFrame,
443 bool splitscreenRenderBypassThisFrame,
452 ::CachedScenes& cachedScenes,
453 ::Bedrock::NotNullNonOwnerPtr<::UIEventCoordinator> const& uiEventCoordinator,
454 ::std::function<
bool()> const& getSuspended,
455 ::std::function<::std::unique_ptr<::TaskGroup>(::std::
string)> const& taskGroupProvider
468 MCAPI
void $reload();
470 MCAPI
void $setOptions(::std::weak_ptr<::OptionRegistry> options);
472 MCAPI
void $registerSceneChangeCallback(
void* token, ::std::function<
void(::AbstractScene&)> sceneChangeCallback);
474 MCAPI
void $unregisterSceneChangeCallback(
void* token);
476 MCAPI
void $registerPrePushSceneCallback(
void* token, ::std::function<
void(::AbstractScene&)> prePushSceneCallback);
478 MCAPI
void $unregisterPrePushSceneCallback(
void* token);
480 MCAPI
void $registerPushSceneCallback(
482 ::std::function<
void(::std::shared_ptr<::AbstractScene>, ::std::optional<::OreUI::RouteAction>)>
486 MCAPI
void $unregisterPushSceneCallback(
void* token);
488 MCAPI
void $registerPrePopSceneCallback(
void* token, ::std::function<
void(::AbstractScene*)> prePopSceneCallback);
490 MCAPI
void $unregisterPrePopSceneCallback(
void* token);
492 MCAPI
void $registerPopSceneCallback(
494 ::std::function<
void(::std::shared_ptr<::AbstractScene>,
bool, ::std::optional<::OreUI::RouteAction>)>
498 MCAPI
void $unregisterPopSceneCallback(
void* token);
500 MCAPI
void $registerPopRangeSceneCallback(
502 ::std::function<
void(::std::vector<::std::shared_ptr<::AbstractScene>> const&)> popRangeSceneCallback
505 MCAPI
void $unregisterPopRangeSceneCallback(
void* token);
508 $registerRouteActionCallback(
void* token, ::std::function<
void(::OreUI::RouteAction const&)> routeActionCallback);
510 MCAPI
void $unregisterRouteActionCallback(
void* token);
512 MCAPI
void $forEachVisibleScreen(
513 ::brstd::function_ref<
void(::AbstractScene&)> callback,
514 bool tickedLastFrame,
515 bool splitscreenRenderBypassThisFrame
518 MCAPI
void $forEachScreen(::brstd::function_ref<
bool(::AbstractScene&)> callback,
bool topDown);
520 MCAPI
void $forEachScreenConst(::brstd::function_ref<
bool(::AbstractScene const&)> callback,
bool topDown) const;
522 MCAPI
void $forEachAlwaysAcceptInputScreen(
523 ::brstd::function_ref<
void(::AbstractScene&)> callback,
524 ::AbstractScene const* ignoreScreen
527 MCAPI
void $forEachAlwaysAcceptInputScreenWithTop(::brstd::function_ref<
void(::AbstractScene&)> callback);
530 $pushScreenWithRouteAction(::std::shared_ptr<::AbstractScene> newScreen, ::OreUI::RouteAction const& routeAction);
532 MCAPI
void $popScreenWithRouteAction(::OreUI::RouteAction const& routeAction);
534 MCAPI
void $scheduleRouteAction(::OreUI::RouteAction const& routeAction);
536 MCAPI
void $pushScreen(::std::shared_ptr<::AbstractScene> newScreen,
bool flush);
538 MCAPI
void $schedulePopScreen(
int totalPopNumber);
540 MCAPI
void $schedulePopScreenWithExpectedNames(::std::vector<::std::
string> const& expectedScreenNames);
542 MCAPI
void $flushStack(::ISceneStack::FlushMode mode, ::std::function<
void()> postFlushCallback);
544 MCAPI
void $deferUpdatesUntilNextTick();
546 MCAPI ::std::optional<uint64> $getFirstSceneIndexOfSceneType(::ui::SceneType sceneType) const;
548 MCAPI
bool $popScreensBackTo(::ui::SceneType const sceneType);
550 MCAPI
bool $popScreensBackToFirstInstanceOf(::ui::SceneType const sceneType);
552 MCAPI
bool $popTopScreensOfType(::ui::SceneType const sceneType);
554 MCAPI
bool $update();
556 MCAPI
void $resetScreenChangeDirtyFlag();
558 MCFOLD
bool $hasChangedThisFrame() const;
560 MCAPI
bool $isEmpty() const;
562 MCAPI uint64 $getSize() const;
564 MCAPI
void $setScreenTickingFlag(
bool screenIsTicking);
566 MCAPI
bool $getScreenTickingFlag() const;
568 MCAPI ::ui::SceneType $getNonTerminatingSceneType() const;
570 MCAPI ::std::vector<::std::
string> $getScreenNames() const;
572 MCAPI ::std::vector<::std::
string> $getScreenTelemetryNames() const;
574 MCAPI ::std::
string $getScreenName() const;
576 MCAPI ::std::
string $getScreenTelemetry() const;
578 MCAPI ::std::
string const& $getLastPoppedScreenName() const;
580 MCAPI
void $handleLicenseChanged();
582 MCAPI
void $onGameEventNotification(::ui::GameEventNotification notification);
584 MCAPI ::AbstractScene* $getTopScene();
586 MCAPI ::AbstractScene const* $getTopScene() const;
588 MCAPI ::std::shared_ptr<::AbstractScene> $getTopSceneShared() const;
590 MCAPI ::AbstractScene* $getActiveScene();
592 MCAPI ::AbstractScene const* $getActiveScene() const;
594 MCAPI ::std::shared_ptr<::AbstractScene> $getSharedNonTerminatingActiveScene();
596 MCAPI ::std::shared_ptr<::AbstractScene const> const $getSharedNonTerminatingActiveScene() const;
598 MCAPI ::gsl::span<::ISceneStack::
SceneElement const> $getScreenStackView() const;
602 MCFOLD
int $getScheduledPopCount() const;
604 MCAPI
bool $isScreenReplaceable() const;
606 MCAPI
void $handleTextChar(::std::
string const& inputUtf8);
608 MCAPI
void $setBufferTextCharEvents(
bool pushTextCharEvents);
610 MCAPI
bool $isBufferingTextCharEvents() const;
612 MCAPI
bool $isOnSceneStack(::ui::SceneType sceneType) const;
614 MCAPI
bool $isOnSceneStack(::std::
string const& screenName) const;
616 MCAPI ::SceneStackProxy* $getProxy();
618 MCAPI
bool $hasScheduledScreens() const;
620 MCAPI
bool $hasScheduledEvents() const;
622 MCAPI
void $setScreenThreshold(::ScreenThreshold const& screenThreshold);
624 MCAPI ::Bedrock::PubSub::Subscription $registerSceneStackDestroyedListener(::std::function<
void()> callback);
Definition AbstractScene.h:5
Definition CachedScenes.h:5
Definition ISceneStack.h:5
Definition OptionRegistry.h:5
Definition SceneStackProxy.h:5
Definition SceneStack.h:31
Definition SceneStack.h:29
Definition SceneStack.h:27
Definition SceneStack.h:25
Definition SceneStack.h:33
Definition SceneStack.h:35
Definition SceneStack.h:19
Definition SceneStack.h:5
Definition TaskGroup.h:86
Definition UIEventCoordinator.h:5
Definition MultiThreaded.h:7
Definition ISceneStack.h:18
Definition ISceneStack.h:16
Definition ScreenThreshold.h:5
Definition TextCharEventData.h:5