Files
Commonwealth-Online-Public/ui/views/CommonwealthOnline/server-browser.html
T
andrew fe620020be Add PrismaUI HTML server browser & integration
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.
2026-06-08 14:02:49 +12:00

248 lines
5.8 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Commonwealth Online</title>
<style>
:root {
--pip-green: #39ff14;
--pip-dim: #1a6610;
--pip-bg: rgba(0, 8, 0, 0.92);
--pip-border: #0f3d0a;
--pip-text-dim: #7adf66;
--pip-danger: #ff5a5a;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html, body {
width: 100vw;
height: 100vh;
overflow: hidden;
font-family: "Consolas", "Courier New", monospace;
color: var(--pip-green);
background: transparent;
}
.backdrop {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
background:
radial-gradient(circle at top, rgba(57, 255, 20, 0.08), transparent 45%),
rgba(0, 0, 0, 0.72);
}
.panel {
width: min(720px, 92vw);
border: 2px solid var(--pip-border);
background: var(--pip-bg);
box-shadow:
0 0 0 1px rgba(57, 255, 20, 0.15),
0 0 40px rgba(57, 255, 20, 0.08);
padding: 28px 32px 24px;
}
.scanlines {
position: relative;
}
.scanlines::after {
content: "";
pointer-events: none;
position: absolute;
inset: 0;
background: repeating-linear-gradient(
to bottom,
rgba(0, 0, 0, 0),
rgba(0, 0, 0, 0) 2px,
rgba(0, 0, 0, 0.08) 3px
);
}
h1 {
font-size: 28px;
letter-spacing: 0.18em;
text-transform: uppercase;
margin-bottom: 6px;
}
.subtitle {
color: var(--pip-text-dim);
font-size: 12px;
letter-spacing: 0.08em;
margin-bottom: 24px;
}
.status-row {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 18px;
font-size: 13px;
}
.status-dot {
width: 10px;
height: 10px;
border-radius: 50%;
background: var(--pip-danger);
box-shadow: 0 0 8px rgba(255, 90, 90, 0.8);
}
.status-dot.connected {
background: var(--pip-green);
box-shadow: 0 0 8px rgba(57, 255, 20, 0.8);
}
.card {
border: 1px solid var(--pip-border);
padding: 16px 18px;
margin-bottom: 18px;
background: rgba(0, 20, 0, 0.55);
}
.card h2 {
font-size: 14px;
letter-spacing: 0.12em;
margin-bottom: 8px;
}
.card p {
font-size: 12px;
color: var(--pip-text-dim);
line-height: 1.5;
}
.server-address {
margin-top: 10px;
font-size: 16px;
letter-spacing: 0.06em;
}
.actions {
display: flex;
gap: 12px;
flex-wrap: wrap;
}
button {
appearance: none;
border: 1px solid var(--pip-green);
background: rgba(57, 255, 20, 0.08);
color: var(--pip-green);
padding: 10px 18px;
font: inherit;
font-size: 12px;
letter-spacing: 0.08em;
text-transform: uppercase;
cursor: pointer;
}
button:hover {
background: rgba(57, 255, 20, 0.18);
}
button.secondary {
border-color: var(--pip-dim);
color: var(--pip-text-dim);
background: rgba(26, 102, 16, 0.15);
}
.hint {
margin-top: 18px;
font-size: 11px;
color: var(--pip-text-dim);
}
</style>
</head>
<body>
<div class="backdrop">
<div class="panel scanlines">
<h1>Commonwealth Online</h1>
<div class="subtitle">Relay server browser prototype</div>
<div class="status-row">
<div id="statusDot" class="status-dot"></div>
<div id="statusText">Checking connection...</div>
</div>
<div class="card">
<h2>Local Relay</h2>
<p>Connect to the Python relay used by this prototype. Start <code>server/server.py</code> before connecting.</p>
<div class="server-address">127.0.0.1:7777</div>
</div>
<div class="actions">
<button id="connectBtn" type="button">Connect</button>
<button id="disconnectBtn" type="button" class="secondary">Disconnect</button>
<button id="closeBtn" type="button" class="secondary">Close</button>
</div>
<div class="hint">Opened from Main Menu &gt; Multiplayer. Press F9 to toggle. JS console output goes to CommonwealthOnline.log.</div>
</div>
</div>
<script>
const statusDot = document.getElementById("statusDot");
const statusText = document.getElementById("statusText");
const connectBtn = document.getElementById("connectBtn");
const disconnectBtn = document.getElementById("disconnectBtn");
const closeBtn = document.getElementById("closeBtn");
function fire(eventName) {
const bridge = window[eventName];
if (typeof bridge === "function") {
bridge();
return;
}
console.warn("Prisma bridge unavailable for event:", eventName);
}
window.connectServer = window.connectServer || function() {
console.warn("connectServer bridge not ready yet");
};
window.disconnectServer = window.disconnectServer || function() {
console.warn("disconnectServer bridge not ready yet");
};
window.closeBrowser = window.closeBrowser || function() {
console.warn("closeBrowser bridge not ready yet");
};
window.setConnectionStatus = function(connected, logPrefix) {
statusDot.classList.toggle("connected", !!connected);
statusText.textContent = connected
? "Connected to relay (" + (logPrefix || "player unassigned") + ")"
: "Not connected to relay";
connectBtn.disabled = !!connected;
disconnectBtn.disabled = !connected;
};
window.onBrowserShown = function() {
console.log("Commonwealth Online server browser visible");
};
connectBtn.addEventListener("click", function() {
fire("connectServer");
});
disconnectBtn.addEventListener("click", function() {
fire("disconnectServer");
});
closeBtn.addEventListener("click", function() {
fire("closeBrowser");
});
console.log("Commonwealth Online server browser loaded");
</script>
</body>
</html>