3#include "mc/_HeaderOutputPredefine.h"
6#include "mc/client/gui/screens/models/LegacyWorldConversionManager.h"
7#include "mc/client/gui/screens/models/MainMenuScreenModel.h"
8#include "mc/client/gui/screens/models/MinecraftScreenModel.h"
9#include "mc/client/gui/screens/models/WorldType.h"
10#include "mc/client/gui/screens/models/interface/IWorldsProvider.h"
11#include "mc/client/legacy/ImportStatus.h"
12#include "mc/client/network/realms/GenericStatus.h"
13#include "mc/client/network/realms/RealmId.h"
14#include "mc/client/world/NetworkWorldType.h"
15#include "mc/deps/core/file/PathBuffer.h"
16#include "mc/deps/core/resource/PackType.h"
17#include "mc/deps/core/threading/Async.h"
18#include "mc/deps/core/utility/pub_sub/Subscription.h"
19#include "mc/platform/Result.h"
20#include "mc/util/CallbackToken.h"
21#include "mc/util/UploadState.h"
22#include "mc/world/level/LevelListCacheObserver.h"
40namespace Core {
class Path; }
41namespace Core {
class Result; }
45namespace MSGraph::Models {
struct GraphError; }
46namespace Realms {
struct World; }
63 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::Social::MultiplayerGameInfo>> server;
64 ::ll::TypedStorage<1, 1, bool> found;
65 ::ll::TypedStorage<8, 8, double> lastFoundTime;
66 ::ll::TypedStorage<1, 1, bool> dead;
74 ::ll::TypedStorage<8, 8, ::PlayScreenModel&> mModel;
79 PlayScreenLevelListCacheObserver& operator=(PlayScreenLevelListCacheObserver
const&);
80 PlayScreenLevelListCacheObserver(PlayScreenLevelListCacheObserver
const&);
81 PlayScreenLevelListCacheObserver();
86 virtual void onLevelAdded(::std::string
const& levelId) ;
88 virtual void onLevelUpdated(::std::string
const& levelId) ;
90 virtual void onLevelDeleted(::std::string
const& levelId) ;
92 virtual void onStorageChanged() ;
94 virtual ~PlayScreenLevelListCacheObserver() ;
106 MCFOLD
void $onLevelAdded(::std::string
const& levelId);
108 MCFOLD
void $onLevelUpdated(::std::string
const& levelId);
110 MCFOLD
void $onLevelDeleted(::std::string
const& levelId);
112 MCFOLD
void $onStorageChanged();
122 using PlayerCountMap = ::std::map<::Realms::RealmId, int>;
124 using RealmFullMap = ::std::map<::Realms::RealmId, bool>;
126 using RealmsWorldList = ::std::vector<::Realms::World>;
128 using StashedNetworkSelection = ::std::pair<::NetworkWorldInfo const, ::NetworkWorldType>;
133 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::std::pair<::NetworkWorldInfo const, ::NetworkWorldType>>>
134 mLastNetworkSelection;
135 ::ll::TypedStorage<1, 1, bool> mIsDirty;
136 ::ll::TypedStorage<8, 24, ::std::vector<::LocalWorldInfo>> mLocalWorldList;
137 ::ll::TypedStorage<8, 24, ::std::vector<::LocalWorldInfo>> mBetaRetailLocalWorldList;
138 ::ll::TypedStorage<8, 24, ::std::vector<::WorldTemplateInfo>> mWorldTemplates;
139 ::ll::TypedStorage<8, 24, ::std::vector<::NetworkWorldInfo>> mFriendsNetworkWorldList;
140 ::ll::TypedStorage<8, 24, ::std::vector<::NetworkWorldInfo>> mCrossPlatformFriendsNetworkWorldList;
141 ::ll::TypedStorage<8, 24, ::std::vector<::NetworkWorldInfo>> mLANNetworkWorldList;
142 ::ll::TypedStorage<8, 24, ::std::vector<::NetworkWorldInfo>> mServerNetworkWorldList;
143 ::ll::TypedStorage<8, 24, ::std::vector<::RealmsWorldInfo>> mRealmWorldList;
144 ::ll::TypedStorage<8, 24, ::std::vector<::RealmsWorldInfo>> mUnpairedParentRealmWorldList;
145 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::NetworkWorldInfo>>> mThirdPartyServerWorldList;
146 ::ll::TypedStorage<8, 24, ::std::vector<::LegacyWorldInfo>> mLegacyWorldList;
147 ::ll::TypedStorage<8, 24, ::std::vector<::LegacyWorldInfo>> mBetaRetailLegacyWorldList;
148 ::ll::TypedStorage<8, 64, ::std::unordered_map<::std::string, ::ResourceLocation>> mNetworkedFriendsGamerpicMap;
149 ::ll::TypedStorage<8, 72, ::std::chrono::steady_clock::time_point[9]> mUpdateTimes;
150 ::ll::TypedStorage<8, 24, ::std::vector<::Realms::World>> mWorlds;
151 ::ll::TypedStorage<1, 1, bool> mWorldsFetched;
152 ::ll::TypedStorage<8, 24, ::std::vector<::Realms::World>> mUnpairedParentWorlds;
153 ::ll::TypedStorage<1, 1, bool> mUnpairedWorldsFetched;
154 ::ll::TypedStorage<8, 16, ::std::map<::Realms::RealmId, int>> mUnreadCounts;
155 ::ll::TypedStorage<4, 4, int> mRealmWorldPartitionIndex;
156 ::ll::TypedStorage<4, 20, ::std::array<int, 5>> mSeenUnreadPosts;
157 ::ll::TypedStorage<1, 1, bool> mLocalWorldsPopulated;
158 ::ll::TypedStorage<1, 1, bool> mHasPendingInvites;
159 ::ll::TypedStorage<4, 4, int> mPendingInviteCount;
160 ::ll::TypedStorage<1, 1, bool> mFetchingInvites;
161 ::ll::TypedStorage<1, 1, bool> mFetchingLegacyWorldsInProgress;
162 ::ll::TypedStorage<1, 1, bool> mLegacyWorldsFetched;
163 ::ll::TypedStorage<1, 1, bool> mFoundLegacyWorlds;
164 ::ll::TypedStorage<8, 48, ::LegacyWorldConversionManager> mLegacyWorldConversionManager;
165 ::ll::TypedStorage<8, 24, ::std::vector<::LocalWorldInfo>> mEduCloudWorlds;
166 ::ll::TypedStorage<1, 1, bool> mFetchingEduCloudWorldsInProgress;
167 ::ll::TypedStorage<1, 1, bool> mEduCloudWorldsFetched;
168 ::ll::TypedStorage<1, 1, bool> mEduCloudWorldsPopulated;
169 ::ll::TypedStorage<1, 1, bool> mEduCloudFetchFailed;
170 ::ll::TypedStorage<4, 4, int> mEduCloudWorldsFetchRetriesRemaining;
171 ::ll::TypedStorage<8, 32, ::std::string> mEduCloudWorldsFetchNextLinkUrl;
177 mEduCloudWorldsHandle;
178 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mFetchStartTimestamp;
179 ::ll::TypedStorage<8, 32, ::std::string> mFetchCorrelationId;
180 ::ll::TypedStorage<1, 1, bool> mFetchingPlayerCounts;
181 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mLastRealmsUpdate;
182 ::ll::TypedStorage<1, 1, bool> mJoiningRealm;
183 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mLastTryJoin;
184 ::ll::TypedStorage<8, 8, ::std::chrono::seconds> mRetryJoinInterval;
185 ::ll::TypedStorage<4, 4, int> mRetryTime;
186 ::ll::TypedStorage<8, 16, ::Bedrock::PubSub::Subscription> mPendingInviteCountSubscriber;
187 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::Legacy::WorldImporter>> mLegacyWorldImporter;
188 ::ll::TypedStorage<8, 16, ::CallbackToken> mRetrieveCallbackToken;
189 ::ll::TypedStorage<8, 16, ::CallbackToken> mImportCallbackToken;
190 ::ll::TypedStorage<1, 1, bool> mFirstRealmsFetchComplete;
191 ::ll::TypedStorage<1, 1, bool> mFirstUnpairedParentRealmsFetchComplete;
192 ::ll::TypedStorage<4, 4, ::Realms::GenericStatus> mRealmsStatus;
193 ::ll::TypedStorage<4, 4, ::Realms::GenericStatus> mUnpairedParentRealmsStatus;
194 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mLastPlayerCountUpdate;
195 ::ll::TypedStorage<8, 24, ::PlayScreenModel::PlayScreenLevelListCacheObserver> mLevelListCacheObserver;
196 ::ll::TypedStorage<8, 16, ::Bedrock::PubSub::Subscription> mTrialModeUpdateSubscription;
197 ::ll::TypedStorage<1, 1, bool> mAreTrialWorldsHidden;
198 ::ll::TypedStorage<1, 1, bool> mIsEditScreenLoading;
199 ::ll::TypedStorage<1, 1, bool> mIsLoadingAdditionalRealmInfo;
200 ::ll::TypedStorage<4, 4, int> mNumRealmsWorldsToQuery;
201 ::ll::TypedStorage<8, 16, ::std::set<::Realms::RealmId>> mWorldsWithDetailedInfo;
202 ::ll::TypedStorage<1, 1, bool> initRequestPendingInvites;
212 virtual ~PlayScreenModel() ;
214 virtual int getWorldCount(::WorldType worldType, ::NetworkWorldType networkType)
const ;
216 virtual ::LocalWorldInfo
const* getLocalWorldAtIndex(
int const index)
const ;
218 virtual ::LocalWorldInfo
const* getLocalWorldById(::std::string
const&
id)
const ;
220 virtual bool refresh(::WorldType tabType) ;
224 virtual bool isDirty() const ;
232 MCAPI explicit PlayScreenModel(::MinecraftScreenModel::
Context context);
234 MCAPI
void _fetchAdditionalRealmsWorldsInfo();
236 MCAPI
void _fetchTrialAvailability();
238 MCAPI
bool _isCrossPlatformGame(::Social::MultiplayerGameInfo const& gameInfo) const;
240 MCAPI
void _navigateToEditWorldScreen(::
LocalWorldInfo const& info);
242 MCAPI
void _populateAdditionalRealmsWorldsInfo();
244 MCAPI
void _populateEduCloudWorlds(::
std::vector<::
LocalWorldInfo>& localWorlds);
246 MCFOLD
void _populateLocalWorlds();
248 MCAPI
void _populateLocalWorldsFromStorageSource(
256 MCAPI
void _populateNetworkWorlds();
258 MCAPI
void _populateRealmsWorldsInternal(
bool ofUnpairedParentRealms);
260 MCAPI
void _postRealmEvents();
262 MCAPI
void _processLegacyWorld(::
std::shared_ptr<::Legacy::WorldProcessRequest> processRequest);
264 MCAPI
void _remove3PServersMismatchingEditorMode();
266 MCAPI
void _requestPendingInviteCount();
268 MCAPI
void _sendBulkUnreadCountRequest();
270 MCAPI
void _sortRealmsWorlds(::
std::
string currentUserXUID, ::
std::vector<::Realms::World>& worlds);
280 MCAPI
void _updateOwnerInfo();
286 MCAPI
void convertLegacyWorld(
288 ::
std::
string const& newWorldDir,
289 ::
std::function<
void(::Legacy::ImportStatus,
float, ::
std::shared_ptr<::
ImportResult>)> callback
292 MCAPI ::Core::PathBuffer<::
std::
string> const createUniquePathForWorld() const;
294 MCAPI
void deleteLegacyWorld(uint legacyWorldIndex);
296 MCAPI
void fetchEduCloudWorlds();
298 MCAPI
void fetchRealmsPlayerCounts();
300 MCAPI
void fetchRealmsWorldsForPlayScreen();
302 MCAPI
void fetchThirdPartyServerWorlds(
bool forceFetch);
306 MCAPI
bool getFetchingThirdPartyWorldsInProgress() const;
310 MCAPI
void handleLegacyWorldConversionComplete(::
ImportResult const& result);
312 MCAPI
bool hasLocalWorldWithId(::
std::
string const& levelId);
314 MCAPI
void initializeRealmsWorlds();
316 MCAPI
bool isEditorPlaytestRoundtrip() const;
320 MCAPI
void navigateToAddEditExternalScreen(
int id);
322 MCAPI
void navigateToEditWorldScreen(
int index, ::
std::function<
void(::Core::
Path const&)> onErrorCallback);
325 navigateToEditWorldScreen(::
LocalWorldInfo* info, ::
std::function<
void(::Core::
Path const&)> onErrorCallback);
327 MCAPI
void navigateToWorldSyncModalScreen(
328 ::
std::
string const& levelId,
329 ::
std::function<
void(::Core::Result)> onCompleteCallback
334 MCFOLD
void repopulateLocalWorlds();
336 MCAPI
void startNetworkWorld(::
NetworkWorldInfo worldInfo, ::NetworkWorldType worldType);
338 MCAPI ::Bedrock::PubSub::Subscription subscribeToBuildGameList();
340 MCAPI
bool supportsEduCloudWorlds() const;
342 MCAPI
void triggerMultiplayerGameRefresh(
bool tryToReconnect);
344 MCAPI
void uploadLocalWorldFileAtIndex(
345 ::
std::
string const& realmID,
348 ::
std::function<
void(::UploadState, ::Realms::World)> callbackAfterUpload
367 MCAPI
int $getWorldCount(::WorldType worldType, ::NetworkWorldType networkType) const;
369 MCAPI ::
LocalWorldInfo const* $getLocalWorldAtIndex(
int const index) const;
373 MCAPI
bool $refresh(::WorldType tabType);
377 MCAPI
bool $isDirty() const;
Definition FilePickerSettings.h:5
Definition ILevelListCache.h:27
Definition IMinecraftEventing.h:134
Definition IWorldsProvider.h:5
Definition WorldImporter.h:7
Definition WorldProcessRequest.h:7
Definition LevelSettings.h:39
Definition MainMenuScreenModel.h:5
Definition PlayScreenModel.h:16
static MCAPI void ** $vftable()
Definition PlayScreenModel.h:5
static MCAPI void ** $vftableForIWorldsProvider()
static MCAPI void ** $vftableForIDlcBatcher()
static MCAPI void ** $vftableForMainMenuScreenModel()
static MCAPI void ** $vftableForIMinecraftScreenModel()
Definition ResourceLocation.h:15
Definition MultiplayerGameInfo.h:7
Definition ExperienceConnectionData.h:5
Definition ExternalServer.h:5
Definition ImportResult.h:5
Definition LegacyWorldInfo.h:5
Definition LocalWorldInfo.h:5
Definition DriveItemCollection.h:7
Definition GraphError.h:7
Definition MinecraftScreenModel.h:15
Definition NetworkWorldInfo.h:5
Definition PingedCompatibleServer.h:5
Definition PlayScreenModel.h:14
Definition RealmsWorldInfo.h:5
Definition WorldTemplateInfo.h:12