feat(debug-panel): [Item 8 & Item 3] add outfit toggle UI endpoint and update enemy camp selection
This commit is contained in:
1 parent
3c3d9b141e
commit
97a371001b
2 files changed
+33
-5
No files matched your search
@@ -124,6 +124,8 @@ internal sealed class DebugApiServer(PrivateServerConfig config, GameSessionHub
|
|||||||
await WriteJsonAsync(ctx, await UnstuckBlackScreenAsync(token), token);
|
await WriteJsonAsync(ctx, await UnstuckBlackScreenAsync(token), token);
|
||||||
else if (method == "POST" && path == "/api/player/rollback-10s")
|
else if (method == "POST" && path == "/api/player/rollback-10s")
|
||||||
await WriteJsonAsync(ctx, await RollbackPositionAsync(token), token);
|
await WriteJsonAsync(ctx, await RollbackPositionAsync(token), token);
|
||||||
|
else if (method == "POST" && path == "/api/player/toggle-clothes")
|
||||||
|
await WriteJsonAsync(ctx, await ToggleClothesAsync(token), token);
|
||||||
else if (method == "POST" && path == "/api/enemy/spawn")
|
else if (method == "POST" && path == "/api/enemy/spawn")
|
||||||
await WriteJsonAsync(ctx, await SpawnEnemyAsync(await ReadBodyAsync(ctx.Request, token), token), token);
|
await WriteJsonAsync(ctx, await SpawnEnemyAsync(await ReadBodyAsync(ctx.Request, token), token), token);
|
||||||
else if (method == "POST" && path == "/api/cutscene/play")
|
else if (method == "POST" && path == "/api/cutscene/play")
|
||||||
@@ -1032,6 +1034,19 @@ internal sealed class DebugApiServer(PrivateServerConfig config, GameSessionHub
|
|||||||
return new { ok = true, timeline };
|
return new { ok = true, timeline };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task<object> ToggleClothesAsync(CancellationToken token)
|
||||||
|
{
|
||||||
|
var session = hub.Current;
|
||||||
|
if (session is null)
|
||||||
|
return new { ok = false, error = "no live game session (is the client in the world?)" };
|
||||||
|
|
||||||
|
var cmd = "CMD:TOGGLE_CLOTHES";
|
||||||
|
await session.NotifyAsync(MethodId.SyncNotice, UxSerializer.Serialize(cmd), token);
|
||||||
|
|
||||||
|
session.Log.Info("[DEBUG-API] toggle clothes dispatched");
|
||||||
|
return new { ok = true };
|
||||||
|
}
|
||||||
|
|
||||||
private static async Task<string> ReadBodyAsync(HttpListenerRequest request, CancellationToken token)
|
private static async Task<string> ReadBodyAsync(HttpListenerRequest request, CancellationToken token)
|
||||||
{
|
{
|
||||||
if (!request.HasEntityBody)
|
if (!request.HasEntityBody)
|
||||||
|
|||||||
@@ -117,6 +117,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="card" style="border-color:#ab47bc">
|
||||||
|
<h2 style="color:#ce93d8">👗 Outfit / Appearance (สลับชุด / ซ่อนเสื้อผ้า)</h2>
|
||||||
|
<div>
|
||||||
|
<button style="background:#8e24aa;color:white" onclick="toggleClothes()">Toggle Clothes / ซ่อน-แสดงชุด</button>
|
||||||
|
</div>
|
||||||
|
<div class="muted" style="margin-top:6px">สลับการแสดงผลเสื้อผ้า (SkinnedMeshRenderer) ของตัวละครที่กำลังเล่นอยู่ โดยยังคงแสดงโมเดลบอดี้เดิมไว้</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="card" style="border-color:#e53935">
|
<div class="card" style="border-color:#e53935">
|
||||||
<h2 style="color:#ff8a80">Emergency Unstuck & Black Screen Recovery</h2>
|
<h2 style="color:#ff8a80">Emergency Unstuck & Black Screen Recovery</h2>
|
||||||
<div>
|
<div>
|
||||||
@@ -146,9 +154,9 @@
|
|||||||
<div>
|
<div>
|
||||||
Camp:
|
Camp:
|
||||||
<select id="enemyCamp">
|
<select id="enemyCamp">
|
||||||
<option value="2">Enemy (Hostile)</option>
|
<option value="0">Enemy / Hostile (0)</option>
|
||||||
<option value="0">Neutral</option>
|
<option value="1">Ally / Friendly (1)</option>
|
||||||
<option value="1">Ally / Friendly</option>
|
<option value="2">Neutral (2)</option>
|
||||||
</select>
|
</select>
|
||||||
Count: <input id="enemyCount" type="number" style="width:70px" value="1" min="1" max="10">
|
Count: <input id="enemyCount" type="number" style="width:70px" value="1" min="1" max="10">
|
||||||
<button style="background:#e53935;margin-left:8px" onclick="spawnEnemy()">Spawn Opponent</button>
|
<button style="background:#e53935;margin-left:8px" onclick="spawnEnemy()">Spawn Opponent</button>
|
||||||
@@ -412,6 +420,11 @@ async function rollback10s() {
|
|||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function toggleClothes() {
|
||||||
|
const r = await api('/api/player/toggle-clothes', { method: 'POST' });
|
||||||
|
log('toggle clothes: ' + JSON.stringify(r));
|
||||||
|
}
|
||||||
|
|
||||||
function onEnemyPresetChange() {
|
function onEnemyPresetChange() {
|
||||||
const sel = document.getElementById('enemypreset').value;
|
const sel = document.getElementById('enemypreset').value;
|
||||||
if (sel !== 'custom') {
|
if (sel !== 'custom') {
|
||||||
@@ -421,8 +434,8 @@ function onEnemyPresetChange() {
|
|||||||
|
|
||||||
async function spawnEnemy() {
|
async function spawnEnemy() {
|
||||||
const body = {
|
const body = {
|
||||||
enemyId: parseInt(document.getElementById('enemyId').value || '100101', 10),
|
enemyId: parseInt(document.getElementById('enemyId').value || '40900579', 10),
|
||||||
camp: parseInt(document.getElementById('enemyCamp').value || '2', 10),
|
camp: parseInt(document.getElementById('enemyCamp').value || '0', 10),
|
||||||
count: parseInt(document.getElementById('enemyCount').value || '1', 10)
|
count: parseInt(document.getElementById('enemyCount').value || '1', 10)
|
||||||
};
|
};
|
||||||
const r = await api('/api/enemy/spawn', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) });
|
const r = await api('/api/enemy/spawn', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) });
|
||||||
|
|||||||
Reference in new issue
Block a user