2019-12-12 02:13:28 -08:00
|
|
|
#pragma once
|
|
|
|
|
2020-08-13 00:55:18 -07:00
|
|
|
#include "lua/LuaParser.h"
|
2019-12-12 02:13:28 -08:00
|
|
|
|
2021-09-06 18:33:01 -07:00
|
|
|
#include "lua/Mod.h"
|
2021-08-20 22:48:38 -07:00
|
|
|
#include "client/gui/Root.h"
|
|
|
|
#include "client/gui/Element.h"
|
2021-09-30 15:50:45 -07:00
|
|
|
#include "game/atlas/asset/AtlasTexture.h"
|
2020-07-06 18:34:59 -07:00
|
|
|
|
2020-11-03 23:29:30 -08:00
|
|
|
class Client;
|
2020-07-06 18:34:59 -07:00
|
|
|
class Subgame;
|
2020-07-25 20:19:18 -07:00
|
|
|
class SubgameDef;
|
2020-07-06 18:34:59 -07:00
|
|
|
class GuiContainer;
|
2019-12-12 02:13:28 -08:00
|
|
|
|
|
|
|
class MenuSandbox : LuaParser {
|
2021-08-20 22:48:38 -07:00
|
|
|
public:
|
|
|
|
MenuSandbox(Client& client, Gui::Root& root, sptr<Gui::Element> sandboxRoot);
|
2020-11-08 22:57:34 -08:00
|
|
|
|
|
|
|
void load(const SubgameDef& subgame);
|
|
|
|
|
|
|
|
void update(double delta) override;
|
|
|
|
|
|
|
|
using LuaParser::update;
|
2021-08-20 22:48:38 -07:00
|
|
|
|
|
|
|
private:
|
2020-11-08 22:57:34 -08:00
|
|
|
void reset();
|
|
|
|
|
|
|
|
void loadApi();
|
|
|
|
|
2021-09-06 18:33:01 -07:00
|
|
|
void loadMod(const std::filesystem::path& path);
|
2020-11-08 22:57:34 -08:00
|
|
|
|
2021-08-20 22:48:38 -07:00
|
|
|
void showError(const string& err);
|
2020-11-08 22:57:34 -08:00
|
|
|
|
2021-09-06 18:33:01 -07:00
|
|
|
/** Exposed to Lua, can provide a relative path, uses environment variables to resolve. */
|
|
|
|
sol::protected_function_result require(sol::this_environment thisEnv, const string& path);
|
2020-11-08 22:57:34 -08:00
|
|
|
|
2021-09-06 18:33:01 -07:00
|
|
|
/** Loads a file with the right enviroment, needs a canonical path. */
|
|
|
|
sol::protected_function_result loadFile(const string& path);
|
|
|
|
|
|
|
|
Mod mod {};
|
2021-08-20 22:48:38 -07:00
|
|
|
string subgameName;
|
2020-11-08 22:57:34 -08:00
|
|
|
|
2021-08-20 22:48:38 -07:00
|
|
|
Client& client;
|
2021-08-19 13:33:08 -07:00
|
|
|
|
2021-08-20 22:48:38 -07:00
|
|
|
Gui::Root& root;
|
|
|
|
sptr<Gui::Element> sandboxRoot;
|
2021-09-30 15:50:45 -07:00
|
|
|
vec<AtlasTexture> menuAssets {};
|
2020-11-08 22:57:34 -08:00
|
|
|
|
2021-08-22 11:58:52 -07:00
|
|
|
double accumulatedDelta = 0;
|
|
|
|
|
2019-12-12 02:13:28 -08:00
|
|
|
};
|