#pragma once #pragma push_macro("byte") #pragma push_macro("GetNextSibling") #pragma push_macro("GetFirstChild") #undef byte #undef GetNextSibling #undef GetFirstChild #include "UIScene_RmlBase.h" class LevelGenerationOptions; class C4JThread; class UIScene_LoadCreateJoinMenu : public UIScene_RmlBase { private: enum EControls { eControl_SavesList, eControl_NewGamesList, eControl_GamesList, eControl_TabLoad, eControl_TabCreate, eControl_TabJoin, eControl_SpaceIndicator, }; enum ELoadCreateJoinTab { eTab_Load = 0, eTab_Create, eTab_Join, }; enum EState { e_SavesIdle, e_SavesRepopulate, e_SavesRepopulateAfterMashupHide, e_SavesRepopulateAfterDelete, e_SavesRepopulateAfterTransferDownload, }; enum eActions { eAction_None=0, eAction_ViewInvites, eAction_JoinGame, }; eActions m_eAction; static const int JOIN_LOAD_CREATE_BUTTON_INDEX = 0; SaveListDetails *m_saveDetails; int m_iSaveDetailsCount; protected: int m_iDefaultButtonsC; int m_iMashUpButtonsC; int m_iState; vector *m_currentSessions; vector m_generators; vector *m_saves; bool m_bIgnoreInput; bool m_bAllLoaded; bool m_bRetrievingSaveThumbnails; bool m_bSaveThumbnailReady; bool m_bShowingPartyGamesOnly; bool m_bInParty; JoinMenuInitData *m_initData; bool m_bMultiplayerAllowed; int m_iTexturePacksNotInstalled; int m_iRequestingThumbnailId; SAVE_DETAILS *m_pSaveDetails; bool m_bSavesDisplayed; bool m_bExitScene; bool m_bCopying; bool m_bCopyingCancelled; int m_iSaveInfoC; int m_iSaveListIndex; int m_iGameListIndex; #ifndef _XBOX_ONE bool m_bSaveTransferInProgress; bool m_bSaveTransferCancelled; #endif bool m_bUpdateSaveSize; bool m_bPendingSaveSizeBarRefresh; bool m_bPendingJoinTabAvailabilityRefresh; bool m_bPendingJoinVisualRefresh; bool m_bRebuildingJoinVisual; bool m_bHasNoGamesLabel; int m_iNewGameListIndex; #ifdef _WINDOWS64 int m_lastHoverMouseX; int m_lastHoverMouseY; bool m_mouseHoverTracked; int m_hoverBaseIndexLoad; int m_hoverBaseIndexCreate; int m_hoverBaseIndexJoin; #endif ELoadCreateJoinTab m_activeTab; public: UIScene_LoadCreateJoinMenu(int iPad, void *initData, UILayer *parentLayer); virtual ~UIScene_LoadCreateJoinMenu(); virtual void updateTooltips() override; virtual void updateComponents() override; virtual UIControl* GetMainPanel(); virtual void handleDestroy() override; virtual void handleGainFocus(bool navBack) override; virtual void handleTimerComplete(int id) override; virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled) override; virtual void handleFocusChange(F64 controlId, F64 childId) override; virtual void handleInitFocus(F64 controlId, F64 childId) override; virtual EUIScene getSceneType() override { return eUIScene_LoadCreateJoinMenu; } static void UpdateGamesListCallback(LPVOID pParam); void tick() override; // Rml::EventListener void ProcessEvent(Rml::Event& event) override; private: void Initialise(); void GetSaveInfo(); void UpdateGamesList(); void AddDefaultButtons(); bool DoesSavesListHaveFocus(); bool DoesMashUpWorldHaveFocus(); bool DoesGamesListHaveFocus(); bool DoesNewGamesListHaveFocus(); int GetMovieTabFromFocus(); void SyncMovieTab(); void SetMovieTab(int tab); void SetActiveTab(ELoadCreateJoinTab tab, bool setFocus); void ApplyTabVisibility(bool setFocus); void RebuildJoinGamesListVisual(bool syncFocus); void UpdateJoinTabAvailability(); void UpdateSaveSizeBarVisibility(); // RmlUi helper methods void ShowTabPanel(const char* panelId, bool show); void SetTabButtonState(int tabIndex); void ClearList(const char* listId); void AddListItem(const char* listId, const wstring& text, const wchar_t* textureName = nullptr); void SetListTexture(int itemIndex, const char* listId, const wchar_t* textureName); int GetListItemCount(const char* listId); protected: virtual wstring getMoviePath() override; public: static int LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes); static int LoadSaveCallback(LPVOID lpParam,bool bRes); static int DeleteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); static int SaveOptionsDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); static int TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); static int DeleteSaveDataReturned(LPVOID lpParam,bool bRes); static int RenameSaveDataReturned(LPVOID lpParam,bool bRes); static int KeyboardCompleteWorldNameCallback(LPVOID lpParam,bool bRes); protected: void handlePress(F64 controlId, F64 childId); void LoadLevelGen(LevelGenerationOptions *levelGen); void LoadSaveFromDisk(File *saveFile, ESavePlatform savePlatform = SAVE_FILE_PLATFORM_LOCAL); public: virtual void HandleDLCMountingComplete() override; private: void CheckAndJoinGame(int gameIndex); #ifdef _WINDOWS64 static const int ADD_SERVER_BUTTON_INDEX = 0; enum eAddServerPhase { eAddServer_Idle, eAddServer_IP, eAddServer_Port, eAddServer_Name }; eAddServerPhase m_addServerPhase; wstring m_addServerIP; wstring m_addServerPort; wstring m_addServerName; void BeginAddServer(); void AppendServerToFile(const wstring& ip, const wstring& port, const wstring& name); static int AddServerKeyboardCallback(LPVOID lpParam, bool bRes); #endif }; #pragma pop_macro("GetFirstChild") #pragma pop_macro("GetNextSibling") #pragma pop_macro("byte")