mirror of
https://github.com/GabsPuNs/Project-Zenith-Main.git
synced 2026-07-09 20:58:08 +00:00
211 lines
5.8 KiB
C++
211 lines
5.8 KiB
C++
#pragma once
|
|
|
|
#pragma push_macro("byte")
|
|
#pragma push_macro("GetNextSibling")
|
|
#pragma push_macro("GetFirstChild")
|
|
#undef byte
|
|
#undef GetNextSibling
|
|
#undef GetFirstChild
|
|
|
|
#include "UIScene.h"
|
|
#include <RmlUi/Core/EventListener.h>
|
|
#include <RmlUi/Core/ElementDocument.h>
|
|
|
|
// NOTE: pop_macro at end of file
|
|
|
|
class LevelGenerationOptions;
|
|
class C4JThread;
|
|
|
|
class UIScene_LoadCreateJoinMenu : public UIScene, public Rml::EventListener
|
|
{
|
|
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<FriendSessionInfo *> *m_currentSessions;
|
|
vector<LevelGenerationOptions *> m_generators;
|
|
vector<File *> *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();
|
|
virtual void updateComponents();
|
|
virtual UIControl* GetMainPanel();
|
|
|
|
virtual void handleDestroy();
|
|
virtual void handleLoseFocus();
|
|
virtual void handleGainFocus(bool navBack);
|
|
virtual void handleTimerComplete(int id);
|
|
// INPUT
|
|
virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled);
|
|
virtual void handleFocusChange(F64 controlId, F64 childId);
|
|
virtual void handleInitFocus(F64 controlId, F64 childId);
|
|
|
|
virtual EUIScene getSceneType() { return eUIScene_LoadCreateJoinMenu; }
|
|
|
|
static void UpdateGamesListCallback(LPVOID pParam);
|
|
|
|
virtual void tick();
|
|
|
|
// Override focus/movie lifecycle for RmlUi (no Iggy movie)
|
|
virtual void gainFocus() override;
|
|
virtual void reloadMovie(bool force) override;
|
|
virtual void render(S32 width, S32 height, C4JRender::eViewportType viewport) 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();
|
|
|
|
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();
|
|
|
|
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
|
|
|
|
// RmlUi document
|
|
private:
|
|
Rml::ElementDocument* m_document;
|
|
};
|
|
|
|
#pragma pop_macro("GetFirstChild")
|
|
#pragma pop_macro("GetNextSibling")
|
|
#pragma pop_macro("byte") |