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
|
#pragma once
#include <CommonBase.h>
#if (defined(SHAREWARE_DEMO_ONLY) && defined(DEATH_TARGET_EMSCRIPTEN)) || defined(DOXYGEN_GENERATING_OUTPUT)
#include "MenuSection.h"
#include "../../../nCine/Base/HashMap.h"
#include <IO/EmscriptenFileStream.h>
using namespace Death::IO;
namespace Jazz2::UI::Menu
{
/** @brief Import Episodes menu section (Emscripten only) */
class ImportSection : public MenuSection
{
public:
ImportSection();
void OnShow(IMenuContainer* root) override;
void OnUpdate(float timeMult) override;
void OnDraw(Canvas* canvas) override;
void OnTouchEvent(const nCine::TouchEvent& event, Vector2i viewSize) override;
private:
enum class State {
Waiting,
Loading,
NothingSelected,
NothingImported,
Success
};
static constexpr std::int32_t TopLine = 31;
static constexpr std::int32_t BottomLine = 42;
float _animation;
State _state;
std::int32_t _fileCount;
float _timeout;
HashMap<String, bool> _foundLevels;
EmscriptenFilePicker _picker;
void OnFilesReceived(ArrayView<EmscriptenFileStream> files);
void ShowPicker();
void CheckFoundLevels();
bool HasAllLevels(ArrayView<const StringView> levelNames);
};
}
#endif
|