#pragma once #include "UIScene.h" #include "UIScene_FriendMenu.h" #include "UIScene_PendingRequestsMenu.h" #include "SocialOnlineService.h" class UIScene_SocialMenu : public UIScene { private: enum ETabs { eTab_Profile = 0, eTab_Friends, eTab_Count, }; enum EControls { eControl_Username = 0, eControl_OnlineProfile = 1, eControl_FriendsList = 2, eControl_AcceptRequests = 3, eControl_HideUUID = 4, eControl_LinkAccount = 5, }; enum EFriendsItems { eFriendsItem_AddFriend = 0, eFriendsItem_PendingRequests = 1, eFriendsItem_FriendBase = 100, }; UIControl_Label m_labelProfileTab; UIControl_Label m_labelFriendsTab; UIControl_Label m_labelSkinTitle; UIControl m_unusedTabOff; UIControl m_unusedTab; wstring m_shownMyStatus; UIControl m_descriptionPanel; UIControl_HTMLLabel m_description; UIControl_Label m_labelUsername; UIControl_TextInput m_editUsername; UIControl_CheckBox m_checkOnlineProfile; UIControl_CheckBox m_checkAcceptRequests; UIControl_CheckBox m_checkHideUUID; UIControl_Button m_buttonLinkAccount; UIControl m_friendsPanel; UIControl_MultiList m_friendsList; IggyName m_funcSetActiveTab; IggyName m_funcFocusList; UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene) UI_MAP_ELEMENT( m_descriptionPanel, "BackgroundPanel_Text") UI_MAP_ELEMENT( m_description, "Description") UI_MAP_ELEMENT( m_unusedTabOff, "TabOff_Biomes") UI_MAP_ELEMENT( m_unusedTab, "TabMiddle") UI_MAP_ELEMENT( m_labelUsername, "UsernameLabel") UI_MAP_ELEMENT( m_editUsername, "UsernameInput") UI_MAP_ELEMENT( m_checkOnlineProfile, "OnlineProfileCheckbox") UI_MAP_ELEMENT( m_checkAcceptRequests, "AcceptRequestsCheckbox") UI_MAP_ELEMENT( m_checkHideUUID, "HideUUIDCheckbox") UI_MAP_ELEMENT( m_buttonLinkAccount, "LinkAccountButton") UI_MAP_ELEMENT( m_friendsPanel, "PropertiesPanel") UI_BEGIN_MAP_CHILD_ELEMENTS(m_friendsPanel) UI_MAP_ELEMENT( m_friendsList, "PropertiesList") UI_END_MAP_CHILD_ELEMENTS() UI_MAP_ELEMENT( m_labelProfileTab, "LayersTabTitle") UI_MAP_ELEMENT( m_labelSkinTitle, "BiomesTabTitle") UI_MAP_ELEMENT( m_labelFriendsTab, "PropertiesTabTitle") UI_MAP_NAME( m_funcSetActiveTab, L"SetActiveTab") UI_MAP_NAME( m_funcFocusList, L"FocusList") UI_END_MAP_ELEMENTS_AND_NAMES() int m_activeTab; bool m_bInitialised; bool m_bNeedsFriendsRepopulate; bool m_bPendingAddFriend; bool m_bPendingUnlink; int m_linkSecondsShown; bool m_bWasConnecting; int m_renameLockShown; wstring m_statusLine; int m_statusScrollOffset; int m_statusScrollDirection; unsigned long long m_statusScrollNextMs; unsigned long long m_nextFriendsRefreshMs; bool m_bOnlineProfileOn; bool m_bAcceptRequestsOn; bool m_bHideUUIDOn; void tickStatusScroll(); wstring m_pendingFriendName; #ifdef _WINDOWS64 FriendMenuInitData m_friendMenuData; PendingRequestsInitData m_pendingRequestsData; #endif vector m_pendingRequests; bool m_bIgnoreInput; int m_focusId; wstring m_username; int m_friendsSelection; vector m_friendsSelectable; vector m_friendNames; void populateFriendsList(); static void FriendRemoved(void *param, int friendIndex); static void FriendBlocked(void *param, int friendIndex); static void FriendInvited(void *param, int friendIndex); bool isInWorld(); static void FriendRequestResponded(void *param, const wstring &name, bool accept); bool isOnlineActive(); void handleServiceEvent(const SocialOnlineService::Event &e); void showMessage(const wchar_t *title, const wstring &body); vector m_friends; vector m_incoming; void setActiveTab(int tab); void focusFriendsList(); void placeSkinTitle(); void updateDescription(); void applyUsername(const wstring &name); bool usingOnlineName(); void syncUsernameMode(); void updateUsernameLabel(); bool checkUsernameEditable(); static wstring FormatWait(int seconds); void openKeyboard(); static int UsernameKeyboardCallback(LPVOID lpParam, const bool bRes); static int AddFriendKeyboardCallback(LPVOID lpParam, const bool bRes); static int UnlinkConfirmCallback(LPVOID lpParam, int iPad, const C4JStorage::EMessageResult result); void updateLinkControls(); void pressLinkButton(); void openAddFriendKeyboard(); void sendFriendRequest(const wstring &name); public: UIScene_SocialMenu(int iPad, void *initData, UILayer *parentLayer); virtual EUIScene getSceneType() { return eUIScene_SocialMenu; } virtual void tick(); virtual void updateTooltips(); virtual void updateComponents(); virtual void customDraw(IggyCustomDrawCallbackRegion *region); virtual void handleGainFocus(bool navBack); virtual void handleReload(); protected: virtual wstring getMoviePath(); public: virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled); virtual void handlePress(F64 controlId, F64 childId); virtual UIControl* GetMainPanel(); virtual void handleFocusChange(F64 controlId, F64 childId); virtual void handleCheckboxToggled(F64 controlId, bool selected); #ifdef _WINDOWS64 virtual bool handleMouseClick(F32 x, F32 y); virtual void getDirectEditInputs(vector &inputs); virtual void onDirectEditFinished(UIControl_TextInput *input, UIControl_TextInput::EDirectEditResult result); #endif };