Engine, adapter and tools without game data

This commit is contained in:
CRTkafa 2026-10-11 08:53:04 +08:00
commit e2ede736f3
3500 changed files with 1640229 additions and 0 deletions

40
engine/ui/market_ui.h Normal file
View file

@ -0,0 +1,40 @@
#pragma once
#include <filesystem>
#include <string>
#include "ui/ui_runtime.h"
namespace choco {
class MarketUi {
public:
MarketUi(const Vfs& assets,const StringTable& strings):runtime_(assets,strings) {}
~MarketUi();
bool open(GameSim& sim,const std::filesystem::path& luaRoot,
const std::string& marketName,std::string& error);
void close();
void mouseMove(float x,float y) {runtime_.menu().mouseMove(x,y);}
void mouseDown(float x,float y) {runtime_.menu().mouseDown(x,y);}
void mouseUp(float x,float y);
void textInput(const std::string& text) {runtime_.menu().textInput(text);}
void backspace() {runtime_.menu().backspace();}
Menu& menu() {return runtime_.menu();}
const Menu& menu() const {return runtime_.menu();}
bool active() const {return active_;}
const std::string& lastHaggleResult() const {return lastHaggleResult_;}
std::string takeResult();
private:
enum class View {Market,Register,Haggle};
UiRuntime runtime_;
GameSim* sim_=nullptr;
std::string marketName_;
std::string result_;
std::string lastHaggleResult_;
bool active_=false,bought_=false;
View view_=View::Market;
bool showMarket(std::string& error,const std::string& response={});
bool processPending(std::string& error);
bool finishHaggle(const std::string& response,std::string& error);
};
}