Das G3-HUD steht im Spiel; die Abnahme (U3D) folgt. - U3B: alle Bereiche und Komponenten aus Godot übertragen (LuneHud, Lanes, Bossgrotte, nächste Welle, Kaufkarten, Armee, Held mit Items und Talenten, Angriffschampions, Team, Ereignisse, Minimap, Tooltip, Optionen, Partieende). Porträts aus den echten Modellen, einmal gerendert. - Offene G3-Punkte umgesetzt: „1 WELLE“ als Band am Porträtrand, Schadens- und Rüstungssymbole auf den Karten, Armeewert, Heldenporträts auf der Minimap. Befehlsplatz für die Ultimates der geplanten Helden reserviert (verborgen). - U3C: LuneGame verdrahtet Befehle (gleiche Schnittstelle wie die Bots), Bereit mit 1-s-Sperre nach dem Kampf, Tempo und Pause, Tasten wie in G3, Kamera-Ziele, Auswahl im Feld, Planungsvorschau und Aufstellungsflächen. Ersetzt die U2-Debug-Anzeige. Bot-Partien und Benchmark unverändert. - Szenen- und Bibliotheksbauer idempotent: Animator-Controller und Post-Processing-Profil werden an Ort und Stelle aktualisiert. Die Szene bekommt bei jedem Bau neue Objekt-IDs, der Inhalt ist gleich. - Prüfung (Port von verify_g3, Teile A–H): 699 Prüfungen ohne Fehler. EditMode 23/23, PlayMode 12/12, Fingerabdrücke der Bot-Partien unverändert (DCE95C96556F3A1A, 7B8E43AEFC0D60C5). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
89 lines
3.6 KiB
C#
89 lines
3.6 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
|
||
}
|
||
|
||
public static IEnumerator LoadScene()
|
||
{
|
||
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();
|
||
}
|
||
}
|
||
}
|