Befund aus dem Spieltest des U3-Nachtrags: Nichts legte LuneNetPlay in die Szene. Das Spiel begann direkt in einer Partie, der Startbildschirm aus U4 war unerreichbar, und der Verlassen-Dialog beendete das Spiel statt zum Hauptmenü zu führen. - LuneWorldBuilder legt LuneNetPlay auf das Match-Objekt; Szene neu gebaut. - Das Menü bekommt ein eigenes UIDocument über dem HUD. Vorher hing es an keinem Panel, und das HUD hätte es beim ersten Partiestart geleert. - Rückkehr über „Menü“ → „Zum Menü“: HUD und Aufstellungsflächen weg, Sitzung beendet, leere Karte. Die Kamera ruht hinter dem Menü und beginnt jede Partie ungedreht. Die Bund-Wahl ist markiert, die Knopfreihe passt in die Tafel. - Tests und Benchmark ohne Startbildschirm (LuneMatchDriver.DirectStart, -luneBenchmark); Bot-Partien und Fingerabdrücke unverändert. - Neu: LuneSmoke (-luneSmoke <Ordner>), Selbsttest eines Players nach lune_smoke.gd. StartScreenTests führt ihn im Editor aus. - Tests: EditMode 29/29, PlayMode 14/14 (StartScreenTests 26/26), Verify 718/0, Fingerabdrücke DCE95C96556F3A1A und 7B8E43AEFC0D60C5 unverändert. macOS-Player: Selbsttest 26/26, Bilder in docs/port/screenshots/u4/startbildschirm/. Ein zusammenhängender PlayMode-Lauf auf dem Endstand und ein Player-Benchmark stehen aus, weil der Mac zugeklappt schlief (siehe U4-NETWORK.md). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
91 lines
3.8 KiB
C#
91 lines
3.8 KiB
C#
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using System.IO;
|
||
using Luneraria.Core;
|
||
using Luneraria.View;
|
||
using NUnit.Framework;
|
||
using UnityEngine;
|
||
using UnityEngine.SceneManagement;
|
||
using UnityEngine.TestTools;
|
||
|
||
namespace Luneraria.UI.Tests
|
||
{
|
||
/// <summary>
|
||
/// U3B: the HUD on a real match in the G1 scene, rendered over the camera image at 1920×1080
|
||
/// (tools/out/hud-*.png). First look at layout, fonts, plates and portraits against the G3
|
||
/// screenshots.
|
||
/// </summary>
|
||
public sealed class HudCaptureTests
|
||
{
|
||
public static string Root { get { return Path.GetDirectoryName(Application.dataPath); } }
|
||
|
||
public static LuneUiAssets Assets()
|
||
{
|
||
#if UNITY_EDITOR
|
||
return UnityEditor.AssetDatabase.LoadAssetAtPath<LuneUiAssets>("Assets/Luneraria/Settings/LuneUi.asset");
|
||
#else
|
||
return null;
|
||
#endif
|
||
}
|
||
|
||
/// <summary>The G1 scene with its match running at once, without the start screen.</summary>
|
||
public static IEnumerator LoadScene()
|
||
{
|
||
LuneMatchDriver.DirectStart = true;
|
||
AsyncOperation loading = SceneManager.LoadSceneAsync("G1_Map", LoadSceneMode.Single);
|
||
while (!loading.isDone)
|
||
yield return null;
|
||
yield return null;
|
||
}
|
||
|
||
/// <summary>Composes the camera image and the HUD texture and writes a PNG.</summary>
|
||
public static void Capture(LuneHud hud, RenderTexture target, string file)
|
||
{
|
||
LunePortraits.Shared?.Flush();
|
||
Texture2D scene = LuneHudCapture.RenderScene(Camera.main, target.width, target.height);
|
||
Texture2D overlay = LuneHudCapture.Read(target);
|
||
Texture2D image = LuneHudCapture.Compose(scene, overlay);
|
||
LuneHudCapture.Save(image, file);
|
||
Object.Destroy(scene);
|
||
Object.Destroy(overlay);
|
||
Object.Destroy(image);
|
||
}
|
||
|
||
[UnityTest]
|
||
[Timeout(600000)]
|
||
public IEnumerator PlanningHudOverTheScene()
|
||
{
|
||
LunePreferences.ResetSession();
|
||
yield return LoadScene();
|
||
var driver = Object.FindAnyObjectByType<LuneMatchDriver>();
|
||
var view = Object.FindAnyObjectByType<LuneMatchView>();
|
||
var rig = Object.FindAnyObjectByType<LuneCameraRig>();
|
||
driver.HumanSlot = 1;
|
||
driver.Seed = 4;
|
||
driver.Restart();
|
||
LuneMatch match = driver.Runner.Match;
|
||
Player me = match.Players[1];
|
||
List<string> ids = match.BaseIds(me.Bund);
|
||
foreach (int index in new[] { 1, 0, 2 })
|
||
Assert.IsTrue(match.Submit(1, Command.Buy(ids[index])).Ok);
|
||
var target = new RenderTexture(1920, 1080, 0, RenderTextureFormat.ARGB32);
|
||
var hud = new GameObject("Hud").AddComponent<LuneHud>();
|
||
hud.Init(match, 1, view.Library, Assets(), target);
|
||
Vec2 point = match.Map.LanePoint(me.Team, me.Lane, match.Map.LanePaths[me.Lane].Length * .2);
|
||
rig.LookAt(point, LuneCameraMath.DefaultZoom, true);
|
||
for (int frame = 0; frame < 30; frame++)
|
||
{
|
||
if (frame == 10)
|
||
LunePortraits.Shared.Flush();
|
||
yield return null;
|
||
}
|
||
Capture(hud, target, Path.Combine(Root, "tools/out/hud-planung-1920.png"));
|
||
Debug.Log("LUNE_HUD syncs " + hud.Syncs + " sync ms " + hud.SyncMs.ToString("0.000") + " portraits " + LunePortraits.Shared.Rendered + " scale " + hud.UiScale + " size " + hud.LogicalSize);
|
||
foreach (KeyValuePair<string, Rect> region in hud.Regions())
|
||
Debug.Log("LUNE_HUD region " + region.Key + " " + region.Value);
|
||
Assert.Greater(hud.Syncs, 0);
|
||
Object.Destroy(hud.gameObject);
|
||
target.Release();
|
||
}
|
||
}
|
||
}
|