Integrate a PrismaUI_F4-based HTML server browser and related tooling. Adds a ThirdParty submodule (framework-F4-Conversion), UI views (CommonwealthOnline browser HTML/JS/CSS), and multiple plugin headers/sources to bridge PrismaUI/Scaleform, handle menu input, and manage server browser data and actions (mock server list, join/connect flow). Key changes: - New build/deploy scripts: build-prismaui.bat, build-all.bat, deploy-all.bat, deploy-ui.bat and a PowerShell helper for linking the Ultralight SDK (ULTRALIGHT_SDK_PATH, default F:\\UltralightSDK). - Plugin additions: F4TPrismaUI, F4TScaleformUI, F4TServerBrowserBridge, F4TServerBrowserData, F4TMenuInput, F4TDebugOverlay and implementations to create/show/hide the HTML view, forward controller input, register Scaleform functions (openManager/closeManager), and push UI events. - Networking: add ConnectToServer(host,port) and keep ConnectToLocalServer() as wrapper; update connection logs and error handling. - Main menu SWF/AS updates: updated MainMenu.swf and MainMenu.as to call closeManager() when leaving multiplayer and to integrate open/close hooks. - Documentation: plugin/setup.md updated with PrismaUI build/deploy instructions. - Removed Main_ModManager.swf (deleted). Primary intent: provide an in-game HTML server browser (toggleable with F9 or Scaleform calls), wire up controller input, and add build/deploy workflow for PrismaUI/Ultralight so developers can build and deploy the UI and plugin together. Mock server data is used for now; network join/connect plumbing is provided for local/dev servers.
72 lines
2.0 KiB
C++
72 lines
2.0 KiB
C++
#pragma once
|
|
|
|
#include <nlohmann/json.hpp>
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace F4T::ServerBrowser
|
|
{
|
|
struct ServerEntry
|
|
{
|
|
std::string id;
|
|
std::string name;
|
|
std::string region;
|
|
std::string worldspace;
|
|
std::string mode;
|
|
std::string status;
|
|
std::string description;
|
|
std::string host;
|
|
int port{ 0 };
|
|
int players{ 0 };
|
|
int maxPlayers{ 0 };
|
|
int ping{ 0 };
|
|
bool modded{ false };
|
|
bool passworded{ false };
|
|
bool favorite{ false };
|
|
|
|
nlohmann::json ToJson() const;
|
|
static ServerEntry FromJson(const nlohmann::json& a_json);
|
|
};
|
|
|
|
struct BrowserFilters
|
|
{
|
|
std::string search;
|
|
std::string region{ "Any Region" };
|
|
std::string mode{ "Any Mode" };
|
|
std::string worldspace{ "Any Worldspace" };
|
|
std::string ping{ "Any" };
|
|
bool showFull{ false };
|
|
bool hasPassword{ false };
|
|
bool modded{ false };
|
|
};
|
|
|
|
class ServerBrowserData
|
|
{
|
|
public:
|
|
void SetFilters(const BrowserFilters& a_filters);
|
|
void ResetFilters();
|
|
void ApplyFilters();
|
|
void SetAllServers(std::vector<ServerEntry> a_servers);
|
|
void ToggleFavorite(const std::string& a_serverId);
|
|
const ServerEntry* FindServer(const std::string& a_serverId) const;
|
|
const std::vector<ServerEntry>& GetFilteredServers() const { return m_filteredServers; }
|
|
const BrowserFilters& GetFilters() const { return m_filters; }
|
|
std::string GetConnectionStatus() const { return m_connectionStatus; }
|
|
void SetConnectionStatus(std::string a_status) { m_connectionStatus = std::move(a_status); }
|
|
bool IsRefreshing() const { return m_isRefreshing; }
|
|
void SetRefreshing(bool a_refreshing) { m_isRefreshing = a_refreshing; }
|
|
nlohmann::json ToServerListJson() const;
|
|
static std::vector<ServerEntry> CreateMockServers();
|
|
|
|
private:
|
|
bool PassesFilters(const ServerEntry& a_entry) const;
|
|
|
|
std::vector<ServerEntry> m_allServers;
|
|
std::vector<ServerEntry> m_filteredServers;
|
|
BrowserFilters m_filters;
|
|
std::string m_connectionStatus{ "Online" };
|
|
bool m_isRefreshing{ false };
|
|
};
|
|
}
|