3#include "mc/_HeaderOutputPredefine.h"
6#include "mc/client/gui/DirtyFlag.h"
7#include "mc/client/gui/screens/controllers/ModalScreenButtonId.h"
8#include "mc/client/gui/screens/controllers/ModalScreenButtonMode.h"
9#include "mc/client/gui/screens/controllers/ModalScreenData.h"
10#include "mc/client/gui/screens/controllers/MultiplayerLockState.h"
11#include "mc/client/gui/screens/controllers/SettingsScreenControllerBase.h"
12#include "mc/client/network/realms/ConfigInfo.h"
13#include "mc/client/network/realms/SubscriptionInfo.h"
14#include "mc/client/network/realms/World.h"
15#include "mc/client/network/realms/WorldBackupList.h"
16#include "mc/client/services/clubs/ClubModel.h"
17#include "mc/world/level/storage/GameRules.h"
32namespace Realms {
struct Content; }
48 enum class PurchaseIntent :
int {
50 ManageSubscription = 1,
51 RenewSubscription = 2,
56 enum class SaveType :
int {
62 enum class RealmsSaveAction :
int {
74 ::ll::TypedStorage<1, 1, bool> mRealmsSaveInProgress;
75 ::ll::TypedStorage<1, 1, bool> mClubsSaveInProgress;
76 ::ll::TypedStorage<1, 1, bool> mRealmsSaveSuccess;
83 using Version = ::Realms::ConfigInfo::Version;
88 ::ll::TypedStorage<4, 4, int> mPageIndex;
89 ::ll::TypedStorage<1, 1, bool> mAwaitingResponse;
90 ::ll::TypedStorage<8, 32, ::std::string> mPendingRef;
91 ::ll::TypedStorage<8, 32, ::std::string> mLastFilter;
92 ::ll::TypedStorage<8, 56, ::Realms::ConfigInfo> mConfigInfo;
93 ::ll::TypedStorage<8, 24, ::std::vector<::Realms::ConfigInfo::Version>> mFilteredVersions;
94 ::ll::TypedStorage<8, 104, ::Realms::ConfigInfo::Version> mMatchingVersion;
102 ::ll::TypedStorage<8, 368, ::ModalScreenData> screenData;
103 ::ll::TypedStorage<8, 64, ::std::function<void(::ModalScreenButtonId)>> callback;
107 using PackContentItemPtr = ::std::shared_ptr<::PackContentItem>;
109 using ConstPackContentItemPtr = ::std::shared_ptr<::PackContentItem const>;
114 ::ll::TypedStorage<8, 80, ::std::mutex> mClubModelMutex;
115 ::ll::TypedStorage<8, 128, ::Clubs::ClubModel> mClubModel;
116 ::ll::TypedStorage<8, 128, ::Clubs::ClubModel> mUpdatedClubModel;
117 ::ll::TypedStorage<8, 720, ::Realms::World> mWorld;
118 ::ll::TypedStorage<8, 720, ::Realms::World> mUpdatedWorld;
119 ::ll::TypedStorage<8, 112, ::Realms::SubscriptionInfo> mSubscription;
120 ::ll::TypedStorage<1, 1, bool> mIsInitialWorldLoadComplete;
121 ::ll::TypedStorage<1, 1, bool> mRefreshWorldAndSubscriptionInfoOnOpen;
122 ::ll::TypedStorage<4, 4, ::RealmsSettingsScreenController::PurchaseIntent> mPurchaseIntent;
123 ::ll::TypedStorage<8, 32, ::std::string> mSelectedSectionTitle;
124 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::RealmsAllowListScreenController>> mRealmsAllowListScreenController;
125 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::ResourcePacksScreenController>> mBehaviorPacksScreenController;
126 ::ll::TypedStorage<4, 4, int> mActiveTabIndex;
127 ::ll::TypedStorage<1, 1, bool> mIsSlotsScreen;
128 ::ll::TypedStorage<1, 1, bool> mHasSubscriptionInfoBeenReceived;
129 ::ll::TypedStorage<1, 1, bool> mRefreshScreen;
130 ::ll::TypedStorage<1, 1, bool> mIsUploadingPacks;
131 ::ll::TypedStorage<1, 1, bool> mRealmsSelectedContentInitialized;
132 ::ll::TypedStorage<1, 1, bool> mDidReplaceWorld;
133 ::ll::TypedStorage<1, 1, bool> mRefreshingWorldInfo;
134 ::ll::TypedStorage<1, 1, bool> mScreenHasRefreshed;
135 ::ll::TypedStorage<1, 1, bool> mRealmDescriptionEdited;
136 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::PlatformMultiplayerRestrictions>> mPlatformMultiplayerRestrictions;
137 ::ll::TypedStorage<8, 8, ::IContentManager&> mContentManager;
138 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::DlcUIWrapper>> mDlcUIWrapper;
139 ::ll::TypedStorage<8, 8, ::Realms::ContentService&> mContentService;
140 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::IContentManagerContext>> mContentManagerContext;
141 ::ll::TypedStorage<8, 8, ::MultiplayerLockState> mMultiplayerState;
142 ::ll::TypedStorage<8, 8, ::PackManagerContentSource*> mRealmContentSource;
143 ::ll::TypedStorage<8, 32, ::std::string> mInitialPackId;
144 ::ll::TypedStorage<8, 8, uint64> mLoadedItemsCount;
145 ::ll::TypedStorage<1, 3, ::RealmsSettingsScreenController::SaveStatusTracker> mSaveStatusTracker;
146 ::ll::TypedStorage<8, 32, ::std::string> mNewSlotWorldName;
147 ::ll::TypedStorage<8, 64, ::Realms::WorldBackupList> mWorldBackupList;
148 ::ll::TypedStorage<1, 1, bool> mDidWorldBackupListReceiveNetworkError;
149 ::ll::TypedStorage<1, 1, bool> mHasLoadedWorldBackupList;
150 ::ll::TypedStorage<1, 1, bool> mHasLoadedActiveWorldSize;
151 ::ll::TypedStorage<1, 1, bool> mDidFetchActiveWorldSizeReceiveError;
152 ::ll::TypedStorage<4, 4, float> mStorageTotal;
153 ::ll::TypedStorage<4, 4, float> mStorageUsed;
154 ::ll::TypedStorage<8, 8, int64> mActiveWorldSizeBytes;
155 ::ll::TypedStorage<8, 32, ::std::vector<bool>> mManualSavesToggleStates;
156 ::ll::TypedStorage<8, 24, ::std::vector<::std::string>> mBackupIdsToOverwrite;
157 ::ll::TypedStorage<4, 4, int> mActiveSavesTabIndex;
158 ::ll::TypedStorage<4, 4, int> mSelectedSaveIndex;
159 ::ll::TypedStorage<8, 32, ::std::string> mSelectedBackupId;
160 ::ll::TypedStorage<4, 4, ::RealmsSettingsScreenController::RealmsSaveAction> mLastSaveAction;
161 ::ll::TypedStorage<4, 8, ::std::optional<::RealmsSettingsScreenController::RealmsSaveAction>> mSaveAction;
162 ::ll::TypedStorage<8, 24, ::std::vector<::std::string>> mBackupsToReplace;
163 ::ll::TypedStorage<8, 32, ::std::string> mLastFocusIdBeforeModalOpen;
164 ::ll::TypedStorage<1, 1, bool> mIsFetchingInviteLinkInfo;
165 ::ll::TypedStorage<1, 1, bool> mHasInviteLinkInfoErrored;
166 ::ll::TypedStorage<1, 1, bool> mIsPostingInviteLink;
167 ::ll::TypedStorage<8, 24, ::std::vector<::Realms::InviteLink>> mInviteLinks;
168 ::ll::TypedStorage<1, 1, bool> mRefetchInviteLinksOnOpen;
169 ::ll::TypedStorage<1, 1, bool> mActiveDropdown;
170 ::ll::TypedStorage<4, 4, int> mRegionSelectedIndex;
171 ::ll::TypedStorage<8, 24, ::std::vector<::Realms::ServerRegion>> mRegionData;
172 ::ll::TypedStorage<1, 1, bool> mIsFetchingPreferredRegions;
173 ::ll::TypedStorage<1, 1, bool> mHasPreferredRegionsErrored;
174 ::ll::TypedStorage<8, 256, ::RealmsSettingsScreenController::RealmsVersionState> mRealmsVersionState;
175 ::ll::TypedStorage<8, 24, ::std::vector<::RealmsSettingsScreenController::DelayedStandardModalScreenData>>
176 mDelayedStandardModalPopups;
177 ::ll::TypedStorage<4, 4, int> mPlayerSleepPercentInt;
178 ::ll::TypedStorage<8, 32, ::std::string> mRespawnRadiusString;
179 ::ll::TypedStorage<8, 32, ::std::string> mRandomTickSpeedString;
180 ::ll::TypedStorage<8, 192, ::GameRules> mGameRules;
185 RealmsSettingsScreenController& operator=(RealmsSettingsScreenController
const&);
186 RealmsSettingsScreenController(RealmsSettingsScreenController
const&);
187 RealmsSettingsScreenController();
192 virtual ~RealmsSettingsScreenController() =
default;
194 virtual void onOpen() ;
196 virtual void onCreation() ;
198 virtual ::ui::DirtyFlag tick() ;
200 virtual ::std::string getAdditionalScreenInfo() const ;
202 virtual
void addEventProperties(::std::unordered_map<::std::
string, ::std::
string>& eventProperties) const
209 MCAPI RealmsSettingsScreenController(
210 ::std::shared_ptr<::MainMenuScreenModel> model,
211 ::Realms::World const& world,
212 ::std::
string const& initialPackId
215 MCAPI
void _addContentToBeAppliedAndUploadIfNeeded(
216 ::std::vector<::std::shared_ptr<::PackContentItem>> contentToUpload,
217 ::std::shared_ptr<::std::vector<::Realms::Content>> contentToApply,
219 ::std::function<
void(::std::vector<::Realms::Content>)> completeUploadCallback,
220 ::std::function<
void(::std::vector<::std::shared_ptr<::PackContentItem>>,
int)> failedUploadCallback
223 MCAPI
void _applyPacks(::std::function<
void()> packsApplyCallback);
225 MCAPI
bool _canChangeCheatGameRules() const;
227 MCAPI
void _displayFreeUpSpacePopup();
229 MCAPI
void _displayModalPopup(
230 ::std::
string const& title,
231 ::std::
string const& message,
232 ::std::function<
void(::ModalScreenButtonId)> callback,
233 ::std::
string const& leftButtonLabel,
234 ::std::
string const& middleButtonLabel,
235 ::std::
string const& rightButtonLabel,
236 ::ModalScreenButtonMode buttonNumber,
237 ::std::
string const& telemetryOverride
240 MCAPI
void _downloadMostRecentBackup();
242 MCAPI
void _downloadRealmsWorld(
243 uint64 estimatedSize,
244 ::std::
string const& backupId,
245 ::std::
string const& time,
246 bool shouldCheckForSettingsChanged
249 MCAPI
void _fetchActiveWorldSize();
251 MCAPI
void _fetchAppliedContent();
253 MCAPI
void _fetchInviteLinks();
255 MCAPI
void _fetchWorldBackupList();
257 MCAPI
bool _hasGameRulesChanged();
259 MCAPI
bool _hasSingleGameRuleChanged(::GameRuleId const& rule);
261 MCAPI
bool _hasSlotInfoChanged();
263 MCAPI
bool _hasWorldInfoChanged();
265 MCAPI
bool _isStoreMismatch() const;
267 MCAPI
void _openCloseRealm(
bool isRequestToOpen);
269 MCAPI
void _querySubscriptionInfo();
271 MCAPI
void _refreshWorldInfo(
bool refreshSubscriptionInfo);
273 MCAPI
void _registerEventHandlers();
275 MCAPI
void _renewRealmHandler();
277 MCAPI
void _saveAutoRealmWorldBackup();
279 MCAPI
void _saveRealmWorldBackup();
281 MCAPI
void _saveSettings(
bool showRealmsLoadingLevelProgressHandler, ::std::function<
void(
bool)> actionAfterSave);
283 MCAPI
void _setUpCallbacksBooleanGameRuleSettings(
284 ::std::vector<::std::pair<::std::
string, ::GameRuleId>> const& rules,
285 ::std::function<
bool()> enabledFunction
288 MCAPI
void _showErrorPopup(::std::
string titleId, ::std::
string contentId, ::std::function<
void(
bool)> action);
290 MCAPI
void _showErrorPopupAndExitScreenAfterDismissed(::std::
string titleId, ::std::
string contentId);
292 MCAPI
void _showSuccessPopup();
294 MCAPI
void _updateRealmBranchConfig(::std::
string const& ref);
296 MCAPI
void _updateVersionsModel(::std::
string const& filter,
bool forceUpdate);
298 MCAPI
void activateInitialPack();
304 MCAPI static ::std::
string
305 _getDateAsFormattedStringForBackupByIndex(::std::vector<::Realms::WorldBackup> const& backups,
int index);
307 MCAPI static ::std::
string
308 _getGameServerVersionForBackupByIndex(::std::vector<::Realms::WorldBackup> const& backups,
int index);
310 MCAPI static ::std::
string
311 _getPacksListTextForBackupByIndex(::std::vector<::Realms::WorldBackup> const& backups,
int index);
313 MCAPI static ::std::
string
314 _getTimeAsFormattedStringForBackupByIndex(::std::vector<::Realms::WorldBackup> const& backups,
int index);
316 MCAPI static ::std::
string
317 _getWorldNameForBackupByIndex(::std::vector<::Realms::WorldBackup> const& backups,
int index);
323 MCAPI static ::std::
string const& DEFAULT_SAVES_TAB_FOCUS();
325 MCAPI static ::std::
string const& SAVES_BUTTON_FOCUS_CONTROL();
332 ::std::shared_ptr<::MainMenuScreenModel> model,
333 ::Realms::World const& world,
334 ::std::
string const& initialPackId
341 MCAPI
void $onOpen();
343 MCAPI
void $onCreation();
345 MCAPI ::ui::DirtyFlag $tick();
347 MCAPI ::std::
string $getAdditionalScreenInfo() const;
349 MCAPI
void $addEventProperties(::std::unordered_map<::std::
string, ::std::
string>& eventProperties) const;
Definition DlcUIWrapper.h:5
Definition IContentManagerContext.h:5
Definition IContentManager.h:5
Definition MainMenuScreenModel.h:5
Definition RealmsAllowListScreenController.h:5
Definition RealmsSettingsScreenController.h:5
Definition ContentService.h:7
Definition ResourcePacksScreenController.h:5
Definition SettingsScreenControllerBase.h:5
Definition GameRuleId.h:8
Definition PackContentItem.h:5
Definition PackManagerContentSource.h:5
Definition RealmsSettingsScreenController.h:25
Definition RealmsSettingsScreenController.h:23
Definition RealmsSettingsScreenController.h:21
Definition InviteLink.h:7
Definition ServerRegion.h:7
Definition WorldBackup.h:7