Skip to content
LeviMC
English
AutoLightDark
LeviLamina
Loading...
Searching...
No Matches
PlayScreenModel.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
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/interface/IWorldsProvider.h"
9#include "mc/client/gui/screens/models/interface/WorldType.h"
10#include "mc/client/legacy/ImportStatus.h"
11#include "mc/client/network/realms/GenericStatus.h"
12#include "mc/client/network/realms/RealmId.h"
13#include "mc/client/world/NetworkWorldType.h"
14#include "mc/deps/core/file/PathBuffer.h"
15#include "mc/deps/core/resource/PackType.h"
16#include "mc/deps/core/threading/Async.h"
17#include "mc/deps/core/utility/pub_sub/Subscription.h"
18#include "mc/events/IMinecraftEventing.h"
19#include "mc/platform/ErrorInfo.h"
20#include "mc/platform/Result.h"
21#include "mc/util/CallbackToken.h"
22#include "mc/util/UploadState.h"
23#include "mc/world/level/LevelListCacheObserver.h"
24
25// auto generated forward declare list
26// clang-format off
28class ILevelListCache;
30class LevelSettings;
32struct ExternalServer;
33struct ImportResult;
34struct LegacyWorldInfo;
35struct LocalWorldInfo;
37struct NetworkWorldInfo;
39struct RealmsWorldInfo;
41namespace Core { class Path; }
42namespace Legacy { class WorldImporter; }
43namespace MSGraph::Models { struct DriveItemCollection; }
44namespace MSGraph::Models { struct GraphError; }
45namespace Realms { struct World; }
46namespace Social { class MultiplayerGameInfo; }
47// clang-format on
48
50public:
51 // PlayScreenModel inner types declare
52 // clang-format off
53 struct LiveServer;
55 // clang-format on
56
57 // PlayScreenModel inner types define
58 struct LiveServer {
59 public:
60 // member variables
61 // NOLINTBEGIN
62 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::Social::MultiplayerGameInfo>> server;
63 ::ll::TypedStorage<1, 1, bool> found;
64 ::ll::TypedStorage<8, 8, double> lastFoundTime;
65 ::ll::TypedStorage<1, 1, bool> dead;
66 // NOLINTEND
67 };
68
69 class PlayScreenLevelListCacheObserver : public ::LevelListCacheObserver {
70 public:
71 // member variables
72 // NOLINTBEGIN
73 ::ll::TypedStorage<8, 8, ::PlayScreenModel&> mModel;
74 // NOLINTEND
75
76 public:
77 // prevent constructor by default
78 PlayScreenLevelListCacheObserver& operator=(PlayScreenLevelListCacheObserver const&);
79 PlayScreenLevelListCacheObserver(PlayScreenLevelListCacheObserver const&);
80 PlayScreenLevelListCacheObserver();
81
82 public:
83 // virtual functions
84 // NOLINTBEGIN
85 virtual void
86 onLevelAdded(::std::string const& levelId, ::LevelListCacheObserver::LevelAddedType type) /*override*/;
87
88 virtual void onLevelUpdated(::std::string const& levelId) /*override*/;
89
90 virtual void onLevelDeleted(::std::string const& levelId) /*override*/;
91
92 virtual void onStorageChanged() /*override*/;
93 // NOLINTEND
94
95 public:
96 // virtual function thunks
97 // NOLINTBEGIN
98 MCNAPI void $onLevelAdded(::std::string const& levelId, ::LevelListCacheObserver::LevelAddedType type);
99
100 MCNAPI void $onLevelUpdated(::std::string const& levelId);
101
102 MCNAPI void $onLevelDeleted(::std::string const& levelId);
103
104 MCNAPI void $onStorageChanged();
105 // NOLINTEND
106 };
107
108 using PlayerCountMap = ::std::map<::Realms::RealmId, int>;
109
110 using RealmFullMap = ::std::map<::Realms::RealmId, bool>;
111
112 using RealmsWorldList = ::std::vector<::Realms::World>;
113
114 using StashedNetworkSelection = ::std::pair<::NetworkWorldInfo const, ::NetworkWorldType>;
115
116public:
117 // member variables
118 // NOLINTBEGIN
119 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::std::pair<::NetworkWorldInfo const, ::NetworkWorldType>>>
120 mLastNetworkSelection;
121 ::ll::TypedStorage<1, 1, bool> mIsDirty;
122 ::ll::TypedStorage<1, 1, bool> mServerDetailsRequested;
123 ::ll::TypedStorage<8, 16, ::Bedrock::PubSub::Subscription> mHttpProbePermission;
124 ::ll::TypedStorage<8, 24, ::std::vector<::LocalWorldInfo>> mLocalWorldList;
125 ::ll::TypedStorage<8, 24, ::std::vector<::LocalWorldInfo>> mBetaRetailLocalWorldList;
126 ::ll::TypedStorage<8, 24, ::std::vector<::WorldTemplateInfo>> mWorldTemplates;
127 ::ll::TypedStorage<8, 24, ::std::vector<::NetworkWorldInfo>> mFriendsNetworkWorldList;
128 ::ll::TypedStorage<8, 24, ::std::vector<::NetworkWorldInfo>> mCrossPlatformFriendsNetworkWorldList;
129 ::ll::TypedStorage<8, 24, ::std::vector<::NetworkWorldInfo>> mLANNetworkWorldList;
130 ::ll::TypedStorage<8, 24, ::std::vector<::NetworkWorldInfo>> mServerNetworkWorldList;
131 ::ll::TypedStorage<8, 24, ::std::vector<::RealmsWorldInfo>> mRealmWorldList;
132 ::ll::TypedStorage<8, 24, ::std::vector<::RealmsWorldInfo>> mUnpairedParentRealmWorldList;
133 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::NetworkWorldInfo>>> mThirdPartyServerWorldList;
134 ::ll::TypedStorage<8, 24, ::std::vector<::LegacyWorldInfo>> mLegacyWorldList;
135 ::ll::TypedStorage<8, 24, ::std::vector<::LegacyWorldInfo>> mBetaRetailLegacyWorldList;
136 ::ll::TypedStorage<8, 64, ::std::unordered_map<::std::string, ::ResourceLocation>> mNetworkedFriendsGamerpicMap;
137 ::ll::TypedStorage<8, 72, ::std::chrono::steady_clock::time_point[9]> mUpdateTimes;
138 ::ll::TypedStorage<8, 24, ::std::vector<::Realms::World>> mWorlds;
139 ::ll::TypedStorage<1, 1, bool> mWorldsFetched;
140 ::ll::TypedStorage<8, 24, ::std::vector<::Realms::World>> mUnpairedParentWorlds;
141 ::ll::TypedStorage<1, 1, bool> mUnpairedWorldsFetched;
142 ::ll::TypedStorage<8, 16, ::std::map<::Realms::RealmId, int>> mUnreadCounts;
143 ::ll::TypedStorage<4, 4, int> mRealmWorldPartitionIndex;
144 ::ll::TypedStorage<4, 24, ::std::array<int, 6>> mSeenUnreadPosts;
145 ::ll::TypedStorage<1, 1, bool> mLocalWorldsPopulated;
146 ::ll::TypedStorage<1, 1, bool> mHasPendingInvites;
147 ::ll::TypedStorage<4, 4, int> mPendingInviteCount;
148 ::ll::TypedStorage<1, 1, bool> mFetchingInvites;
149 ::ll::TypedStorage<1, 1, bool> mFetchingLegacyWorldsInProgress;
150 ::ll::TypedStorage<1, 1, bool> mLegacyWorldsFetched;
151 ::ll::TypedStorage<1, 1, bool> mFoundLegacyWorlds;
152 ::ll::TypedStorage<8, 128, ::LegacyWorldConversionManager> mLegacyWorldConversionManager;
153 ::ll::TypedStorage<8, 24, ::std::vector<::LocalWorldInfo>> mEduCloudWorlds;
154 ::ll::TypedStorage<1, 1, bool> mFetchingEduCloudWorldsInProgress;
155 ::ll::TypedStorage<1, 1, bool> mEduCloudWorldsFetched;
156 ::ll::TypedStorage<1, 1, bool> mEduCloudWorldsPopulated;
157 ::ll::TypedStorage<1, 1, bool> mEduCloudFetchFailed;
158 ::ll::TypedStorage<4, 4, int> mEduCloudWorldsFetchRetriesRemaining;
159 ::ll::TypedStorage<8, 32, ::std::string> mEduCloudWorldsFetchNextLinkUrl;
160 ::ll::TypedStorage<
161 8,
162 16,
165 mEduCloudWorldsHandle;
166 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mFetchStartTimestamp;
167 ::ll::TypedStorage<8, 32, ::std::string> mFetchCorrelationId;
168 ::ll::TypedStorage<1, 1, bool> mFetchingPlayerCounts;
169 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mLastRealmsUpdate;
170 ::ll::TypedStorage<1, 1, bool> mJoiningRealm;
171 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mLastTryJoin;
172 ::ll::TypedStorage<8, 8, ::std::chrono::seconds> mRetryJoinInterval;
173 ::ll::TypedStorage<4, 4, int> mRetryTime;
174 ::ll::TypedStorage<8, 16, ::Bedrock::PubSub::Subscription> mPendingInviteCountSubscriber;
175 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::Legacy::WorldImporter>> mLegacyWorldImporter;
176 ::ll::TypedStorage<8, 16, ::CallbackToken> mRetrieveCallbackToken;
177 ::ll::TypedStorage<8, 16, ::CallbackToken> mImportCallbackToken;
178 ::ll::TypedStorage<1, 1, bool> mFirstRealmsFetchComplete;
179 ::ll::TypedStorage<1, 1, bool> mFirstUnpairedParentRealmsFetchComplete;
180 ::ll::TypedStorage<4, 4, ::Realms::GenericStatus> mRealmsStatus;
181 ::ll::TypedStorage<4, 4, ::Realms::GenericStatus> mUnpairedParentRealmsStatus;
182 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mLastPlayerCountUpdate;
183 ::ll::TypedStorage<8, 24, ::PlayScreenModel::PlayScreenLevelListCacheObserver> mLevelListCacheObserver;
184 ::ll::TypedStorage<8, 16, ::Bedrock::PubSub::Subscription> mTrialModeUpdateSubscription;
185 ::ll::TypedStorage<1, 1, bool> mAreTrialWorldsHidden;
186 ::ll::TypedStorage<1, 1, bool> mIsEditScreenLoading;
187 ::ll::TypedStorage<1, 1, bool> mIsLoadingAdditionalRealmInfo;
188 ::ll::TypedStorage<4, 4, int> mNumRealmsWorldsToQuery;
189 ::ll::TypedStorage<8, 16, ::std::set<::Realms::RealmId>> mWorldsWithDetailedInfo;
190 ::ll::TypedStorage<1, 1, bool> initRequestPendingInvites;
191 // NOLINTEND
192
193public:
194 // prevent constructor by default
195 PlayScreenModel();
196
197public:
198 // virtual functions
199 // NOLINTBEGIN
200 virtual ~PlayScreenModel() /*override*/ = default;
201
202 virtual int getWorldCount(::WorldType worldType, ::NetworkWorldType networkType) const /*override*/;
203
204 virtual ::LocalWorldInfo const* getLocalWorldAtIndex(int const index) const /*override*/;
205
206 virtual ::LocalWorldInfo const* getLocalWorldById(::std::string const& id) const /*override*/;
207
208 virtual bool refresh(::WorldType tabType) /*override*/;
209
210 virtual void startLocalWorld(::LocalWorldInfo worldInfo, ::LevelSettings const* settings) /*override*/;
211
212 virtual bool isDirty() const /*override*/;
213
214 virtual ::IMinecraftEventing& getMinecraftEventing() const /*override*/;
215 // NOLINTEND
216
217public:
218 // member functions
219 // NOLINTBEGIN
220 MCNAPI explicit PlayScreenModel(::MinecraftScreenModelContext context);
221
222 MCNAPI void _navigateToEditWorldScreen(::LocalWorldInfo const& info);
223
225
227 ::ILevelListCache& levelListCache,
228 ::std::vector<::LocalWorldInfo>& localWorlds,
229 ::std::vector<::LocalWorldInfo>& betaRetailWorlds,
230 bool restrictTrial,
231 bool fireTelemetry
232 );
233
235
236 MCNAPI void _populateRealmsWorldsInternal(bool ofUnpairedParentRealms);
237
239
240 MCNAPI void _sortRealmsWorlds(::std::string const currentUserXUID, ::std::vector<::Realms::World>& worlds);
241
243
244 MCNAPI void _startFriendNetworkWorld(::NetworkWorldInfo const& world);
245
246 MCNAPI void _startRemoteNetworkWorld(::NetworkWorldInfo const& world);
247
248 MCNAPI bool areExternalAndRemoteServerSame(::ExternalServer& externalServer, ::PingedCompatibleServer remoteServer);
249
251 ::LegacyWorldInfo worldInfo,
252 ::std::string const& newWorldDir,
253 ::std::function<void(::Legacy::ImportStatus, float, ::std::shared_ptr<::ImportResult>)> callback
254 );
255
256 MCNAPI ::Core::PathBuffer<::std::string> const createUniquePathForWorld() const;
257
258 MCNAPI void deleteLegacyWorld(uint legacyWorldIndex);
259
260 MCNAPI void fetchEduCloudWorlds();
261
263
265
266 MCNAPI void fetchThirdPartyServerWorlds(bool forceFetch);
267
269 ::IMinecraftEventing::IgnoredNotificationsType notificationType,
270 int notificationCount,
271 ::std::set<::IMinecraftEventing::IgnoredNotificationSource> notificationSources
272 );
273
275
277
278 MCNAPI ::std::vector<::ResourceLocation> getLoadingPacks(::PackType type) const;
279
281
282 MCNAPI int getRealmWorldCount() const;
283
285
286 MCNAPI bool hasLocalWorldWithId(::std::string const& levelId);
287
289
290 MCNAPI bool isEditorPlaytestRoundtrip() const;
291
292 MCNAPI bool isLocalWorldRealmsPlus(::LocalWorldInfo const& world);
293
295
296 MCNAPI void navigateToEditWorldScreen(int index, ::std::function<void(::Core::Path const&)> onErrorCallback);
297
298 MCNAPI void
299 navigateToEditWorldScreen(::LocalWorldInfo* info, ::std::function<void(::Core::Path const&)> onErrorCallback);
300
301 MCNAPI void
302 navigateToEditWorldScreen(::std::string const& levelId, ::std::function<void(::Core::Path const&)> onErrorCallback);
303
305 ::std::string const& levelId,
306 ::std::function<void(::nonstd::expected<void, ::Bedrock::ErrorInfo<::std::error_code>>)> onCompleteCallback
307 );
308
310
312
313 MCNAPI void setServerDetailsRequested(bool requested);
314
315 MCNAPI void startNetworkWorld(::NetworkWorldInfo worldInfo, ::NetworkWorldType worldType);
316
317 MCNAPI ::Bedrock::PubSub::Subscription subscribeToBuildGameList();
318
319 MCNAPI bool supportsEduCloudWorlds() const;
320
321 MCNAPI void triggerMultiplayerGameRefresh(bool tryToReconnect);
322
323 MCNAPI void updateWorldTimestamp(::NetworkWorldInfo const& worldInfo);
324
326 ::std::string const& realmID,
327 int slotIndex,
328 int index,
329 ::std::function<void(::UploadState, ::Realms::World)> callbackAfterUpload
330 );
331 // NOLINTEND
332
333public:
334 // constructor thunks
335 // NOLINTBEGIN
337 // NOLINTEND
338
339public:
340 // virtual function thunks
341 // NOLINTBEGIN
342 MCNAPI int $getWorldCount(::WorldType worldType, ::NetworkWorldType networkType) const;
343
344 MCNAPI ::LocalWorldInfo const* $getLocalWorldAtIndex(int const index) const;
345
346 MCNAPI ::LocalWorldInfo const* $getLocalWorldById(::std::string const& id) const;
347
348 MCNAPI bool $refresh(::WorldType tabType);
349
350 MCNAPI void $startLocalWorld(::LocalWorldInfo worldInfo, ::LevelSettings const* settings);
351
352 MCNAPI bool $isDirty() const;
353
355 // NOLINTEND
356};
Definition Result.h:9
The game spells this as an AsyncImplBase<T> base subobject holding the handle; a member at the same o...
Definition Async.h:13
Definition Path.h:10
Definition FilePickerSettings.h:5
Definition ILevelListCache.h:27
Definition IMinecraftEventing.h:152
Definition IWorldsProvider.h:5
Definition WorldImporter.h:7
Definition LevelSettings.h:39
Definition MainMenuScreenModel.h:5
Definition Path.h:16
MCAPI void $onLevelDeleted(::std::string const &levelId)
MCAPI void $onLevelAdded(::std::string const &levelId, ::LevelListCacheObserver::LevelAddedType type)
MCAPI void $onLevelUpdated(::std::string const &levelId)
Definition PlayScreenModel.h:5
MCAPI void fetchThirdPartyServerWorlds(bool forceFetch)
MCAPI bool supportsEduCloudWorlds() const
MCAPI bool $refresh(::WorldType tabType)
MCAPI void triggerMultiplayerGameRefresh(bool tryToReconnect)
MCAPI void repopulateLocalWorlds()
MCAPI int getRealmWorldCount() const
MCAPI void fetchEduCloudWorlds()
MCAPI void _navigateToEditWorldScreen(::LocalWorldInfo const &info)
MCAPI void navigateToWorldSyncModalScreen(::std::string const &levelId, ::std::function< void(::nonstd::expected< void, ::Bedrock::ErrorInfo<::std::error_code > >)> onCompleteCallback)
MCAPI void fireIgnoredNotificationsEvent(::IMinecraftEventing::IgnoredNotificationsType notificationType, int notificationCount, ::std::set<::IMinecraftEventing::IgnoredNotificationSource > notificationSources)
MCAPI void _sortRealmsWorlds(::std::string const currentUserXUID, ::std::vector<::Realms::World > &worlds)
MCAPI void _startFriendNetworkWorld(::NetworkWorldInfo const &world)
MCAPI void setServerDetailsRequested(bool requested)
MCAPI void uploadLocalWorldFileAtIndex(::std::string const &realmID, int slotIndex, int index, ::std::function< void(::UploadState, ::Realms::World)> callbackAfterUpload)
MCAPI ::std::shared_ptr<::FilePickerSettings > generateFilePickerSettingsForImport()
MCAPI::LocalWorldInfo const * $getLocalWorldById(::std::string const &id) const
MCAPI void _remove3PServersMismatchingEditorMode()
MCAPI bool hasLocalWorldWithId(::std::string const &levelId)
MCAPI void fetchRealmsPlayerCounts()
MCAPI int $getWorldCount(::WorldType worldType, ::NetworkWorldType networkType) const
MCAPI bool areExternalAndRemoteServerSame(::ExternalServer &externalServer, ::PingedCompatibleServer remoteServer)
MCAPI void fetchRealmsWorldsForPlayScreen()
MCAPI void navigateToEditWorldScreen(int index, ::std::function< void(::Core::Path const &)> onErrorCallback)
MCAPI void _populateAdditionalRealmsWorldsInfo()
MCAPI bool $isDirty() const
MCAPI bool getFetchingThirdPartyWorldsInProgress() const
MCAPI void * $ctor(::MinecraftScreenModelContext context)
MCAPI::Bedrock::PubSub::Subscription subscribeToBuildGameList()
MCAPI void _start3PNetworkWorld(::NetworkWorldInfo &world)
MCAPI bool isLocalWorldRealmsPlus(::LocalWorldInfo const &world)
MCAPI void $startLocalWorld(::LocalWorldInfo worldInfo, ::LevelSettings const *settings)
MCAPI void convertLegacyWorld(::LegacyWorldInfo worldInfo, ::std::string const &newWorldDir, ::std::function< void(::Legacy::ImportStatus, float, ::std::shared_ptr<::ImportResult >)> callback)
MCAPI ::Core::PathBuffer<::std::string > const createUniquePathForWorld() const
MCAPI void _populateNetworkWorlds()
MCAPI ::std::vector<::ResourceLocation > getLoadingPacks(::PackType type) const
MCAPI void startNetworkWorld(::NetworkWorldInfo worldInfo, ::NetworkWorldType worldType)
MCAPI::LocalWorldInfo const * $getLocalWorldAtIndex(int const index) const
MCAPI bool isEditorPlaytestRoundtrip() const
MCAPI void _populateRealmsWorldsInternal(bool ofUnpairedParentRealms)
MCAPI void _startRemoteNetworkWorld(::NetworkWorldInfo const &world)
MCAPI void initializeRealmsWorlds()
MCAPI void handleLegacyWorldConversionComplete(::ImportResult const &result)
MCAPI int getOwnedActiveUnpairedParentRealmWorldCount() const
MCAPI::IMinecraftEventing & $getMinecraftEventing() const
MCAPI void _populateLocalWorldsFromStorageSource(::ILevelListCache &levelListCache, ::std::vector<::LocalWorldInfo > &localWorlds, ::std::vector<::LocalWorldInfo > &betaRetailWorlds, bool restrictTrial, bool fireTelemetry)
MCAPI void navigateToAddEditExternalScreen(int id)
MCAPI void updateWorldTimestamp(::NetworkWorldInfo const &worldInfo)
MCAPI::LocalWorldInfo refreshLocalWorldInfo(::LocalWorldInfo const &worldInfo)
MCAPI void deleteLegacyWorld(uint legacyWorldIndex)
Definition ResourceLocation.h:15
Definition MultiplayerGameInfo.h:7
STL namespace.
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 MinecraftScreenModelContext.h:5
Definition NetworkWorldInfo.h:5
Definition PingedCompatibleServer.h:5
Definition PlayScreenModel.h:14
Definition RealmsWorldInfo.h:5
Definition World.h:7
Definition WorldTemplateInfo.h:12
Definition context.h:5