1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
#pragma once
#include "ScrollableMenuSection.h"
namespace Jazz2::UI::Menu
{
#ifndef DOXYGEN_GENERATING_OUTPUT
enum class UserProfileOptionsItemType {
#if (defined(DEATH_TARGET_WINDOWS) && !defined(DEATH_TARGET_WINDOWS_RT)) || defined(DEATH_TARGET_UNIX)
EnableDiscordIntegration,
#endif
PlayerName,
#if defined(WITH_MULTIPLAYER)
UniquePlayerID
#endif
};
struct UserProfileOptionsItem {
UserProfileOptionsItemType Type;
StringView DisplayName;
bool HasBooleanValue;
bool IsReadOnly;
};
#endif
class UserProfileOptionsSection : public ScrollableMenuSection<UserProfileOptionsItem>
{
public:
UserProfileOptionsSection();
~UserProfileOptionsSection();
void OnShow(IMenuContainer* root) override;
void OnUpdate(float timeMult) override;
void OnDraw(Canvas* canvas) override;
void OnDrawOverlay(Canvas* canvas) override;
void OnKeyPressed(const nCine::KeyboardEvent& event) override;
void OnTextInput(const nCine::TextInputEvent& event) override;
NavigationFlags GetNavigationFlags() const override;
protected:
void OnHandleInput() override;
void OnTouchEvent(const nCine::TouchEvent& event, Vector2i viewSize) override;
void OnTouchUp(std::int32_t newIndex, Vector2i viewSize, Vector2i touchPos) override;
void OnLayoutItem(Canvas* canvas, ListViewItem& item) override;
void OnDrawItem(Canvas* canvas, ListViewItem& item, std::int32_t& charOffset, bool isSelected) override;
void OnExecuteSelected() override;
void OnBackPressed() override;
private:
constexpr static std::uint32_t MaxPlayerNameLength = 24;
bool _isDirty;
bool _waitForInput;
std::size_t _textCursor;
float _carretAnim;
String _localPlayerName;
String _prevPlayerName;
#if defined(DEATH_TARGET_ANDROID)
String _deviceId;
Vector2i _initialVisibleSize;
Recti _currentVisibleBounds;
float _recalcVisibleBoundsTimeLeft;
#endif
void RecalcLayoutForScreenKeyboard();
};
}
|