Live: rebind the stage's own scripts; fix mirror ball colour; map what is recoverable

The big finding is structural, and it corrects something I asserted two commits ago.

Stage prefabs reference 11 script classes and UmaViewer implemented one of them, leaving
892 MonoBehaviour instances with a null script. I claimed those serialized fields were
unreachable at runtime and that reimplementing the scripts would need name heuristics or a
baked parameter table. That was wrong, and the diagnostic I wrote to confirm it disproved it
instead: among the 7 surviving components were AssetHolder (bundle namespace Gallop) and
StageController (Gallop.Live). Unity resolves MonoScript by class name + namespace +
assembly, and Assets/Scripts/umamusume.asmdef is named "umamusume", exactly matching every
MonoScript in the bundles. The project was organised for this from the start — it is the same
mechanism LiveTimelineWorkSheet relies on to read cutt data.

So the 892 are simply unwritten. Declaring a class with the matching signature makes Unity
deserialize the real fields.

BillboardController (Gallop.Live, 164 instances) is the first one rebuilt, and it confirms
the mechanism: missing-script count drops 892 -> 728, exactly -164. _rotationType is now read
per object rather than guessed. Type 0 (106 objects) faces the camera; type 2 (58, all
glow_ramp) is logged and left alone — the enum's meaning is not recoverable, see below.

BlinkLight palette slots — the mirror ball was solid pink
  * color0Array/powerArray are a 10-slot palette and every renderer was taking slot 0.
    The slot is the object's own or nearest ancestor's `lightNNN_` / `alphaNNN_` name prefix.
    Confirmed across all groups on live10149: the number of distinct prefixes equals the
    number of distinct colours in slots 0..N-1, with slots N..9 uniform white filler, in
    every group without exception. mirrorball 3 (pink/blue/yellow), wash_truss 4, glow_object
    2, audience_light 9.
  * Renderers with no prefix are not palette lights and are now skipped when the group has
    any. The mirror ball body uses Gallop/3D/Bg/BgMirrorBall, whose _MulColor0 belongs to
    BgColor1 — which drives it to white, the silver ball seen in the reference footage.
    BlinkLight runs after BgColor1 and was overwriting it with palette pink.

Stage animation is now driven by the timeline, not Unity's clock. Using Animation.Play() plus
a default clip with playAutomatically meant the stage kept moving while the live was paused
and ignored scrubbing. AnimationState.time is now set from currentLiveTime and sampled.

CLAUDE.md gains a ground-truth map: what the bundles yield, the rebinding trick above with
its signature table, and what is permanently blocked. global-metadata.dat is neither on disk
nor inside GameAssembly.dll (magic 0xFAB11BAF absent, identifier strings absent) — the game's
anti-tamper keeps it encrypted until runtime. Every enum's meaning, the original method
bodies, and any tuning constants are therefore unrecoverable; rebuilding a signature yields
data, never behaviour. The mirror ball's 2.0s-per-revolution is authored in the clip and
reproduced faithfully; if the reference looks slower, the factor lives in code we cannot read.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
ritenseki
2026-08-05 14:25:37 +08:00
parent b2c607b7d8
commit 4d7a7c3373
6 changed files with 367 additions and 29 deletions
@@ -0,0 +1,71 @@
using UnityEngine;
namespace Gallop.Live
{
/// <summary>
/// 舞台面片朝向摄像机。对应轨道 Billboard (75),live10149 上 164 个实例。
///
/// 这是第一个「按原签名重建」的舞台脚本。bundle 里的 MonoScript 记着
/// ClassName=BillboardController、Namespace=Gallop.Live、AssemblyName=umamusume,
/// 而 <c>Assets/Scripts/umamusume.asmdef</c> 的程序集名正是 umamusume,
/// 所以只要类名 + namespace 对上,Unity 就会把下面三个字段从 bundle 反序列化进来 ——
/// 不需要按名字猜,也不需要把 dump 的参数表打包进项目。
///
/// 字段名必须和 bundle 的 TypeTree 逐字一致(大小写敏感),实测为:
/// _targetCameraTransform / _rotationType / _isInversedForward
///
/// live10149 的实测取值:`_targetCameraTransform` 164/164 全为空 → 回落主摄像机;
/// `_isInversedForward` 全 0;`_rotationType` 只有 0(106 个,wash/glow 类)
/// 和 2(58 个,全是 glow_ramp)两种。
///
/// ⚠ `_rotationType` 的枚举语义仍未知。0 是枚举零值、类名又是 BillboardController,
/// 按「整体朝向摄像机」处理是合理的;**2 代表什么没有依据,故不处理**,
/// 只打一次日志。等拿到证据再补,不猜。
/// </summary>
public class BillboardController : MonoBehaviour
{
// ↓ 这三个名字来自 bundle TypeTree,改名就收不到数据
[SerializeField] private Transform _targetCameraTransform;
[SerializeField] private int _rotationType;
[SerializeField] private bool _isInversedForward;
private Transform _cachedTarget;
private static bool _loggedUnknownType;
private Transform ResolveTarget()
{
if (_targetCameraTransform != null) return _targetCameraTransform;
// 舞台数据里这个字段全是空的,回落到当前生效的直播摄像机。
if (Director.instance != null && Director.instance.MainCameraTransform != null)
return Director.instance.MainCameraTransform;
var cam = Camera.main;
return cam != null ? cam.transform : null;
}
private void LateUpdate()
{
// 放 LateUpdate:必须在 Director 当帧摆好摄像机之后再朝向它,否则永远差一帧。
if (_rotationType != 0)
{
if (!_loggedUnknownType)
{
_loggedUnknownType = true;
Debug.Log($"[Billboard] _rotationType={_rotationType}(如 '{name}')语义未知,未处理。" +
"live10149 上这一类共 58 个,全是 glow_ramp。");
}
return;
}
if (_cachedTarget == null) _cachedTarget = ResolveTarget();
if (_cachedTarget == null) return;
Vector3 forward = transform.position - _cachedTarget.position;
if (_isInversedForward) forward = -forward;
if (forward.sqrMagnitude < 1e-8f) return;
transform.rotation = Quaternion.LookRotation(forward.normalized, _cachedTarget.up);
}
}
}