feat(battle-engine-port): M2 step 1 — SingleBattleMgr constructs headless
First green of the M2 go/no-go probe: `new SingleBattleMgr(StandardBattleMgr- ContentsCreator)` now builds the two-player pair fully headless against the shim, no Unity runtime. Verdict: headless construction is feasible; every blocker was a mechanical no-op shim fill or data seam, not a Unity/logic wall. Shim fills (authored): - GameMgr: lazy non-null DataMgr/PrefabMgr/InputMgr/SoundMgr/BattleControl. - GameObject: lazy cached component model so GetComponent<T>/AddComponent<T> return non-null no-op instances for Component-derived T (F1: unguarded view touches). - Resources.Load(string): cached non-null GameObject so the prefab->Instantiate-> GetComponent chain (UnityEventAgent) yields a real object. - ClassBattleCardViewBase: re-attach dropped IClassBattleCardView (no-op members); ClassBattleCardBase.Setup casts the created view to it. Engine copy (DP1/DP3 mis-cut fix): - CardIconControl.cs copied verbatim (manifested) + generated null-stub deleted. SplitAndCompleteIconStr is pure string logic on the resolution path that M1 had wrongly stubbed as "View" -> null deref in SkillCreator.CreateBuildInfo. Test harness (SVSim.BattleEngine.Tests, authored fixture): - HeadlessContentsCreator/HeadlessPhaseCreator: deterministic replica of the solo practice init (StandardBattleMgrContentsCreator + SingleBattlePhaseCreator) with no-op recovery/replay managers. - HeadlessCardMaster: reflects the loader cards.json dump into CardMaster. - HeadlessMasterData: minimal Data.Master (class-character list, empty collections) + Data.Load + player/enemy chara ids. - ConstructionProbeTests.SingleBattleMgr_constructs_headless — GREEN. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -3308,3 +3308,4 @@ WrapVariableContentsScrollBarSize.cs WrapVariableContentsScrollBarSize.cs 05c94e
|
||||
YuwanField.cs YuwanField.cs 1368d0b2755edbae36ce4dcabd69d8d2f6ce854765ea46621199ef20d407d13a 0
|
||||
iTween.cs iTween.cs 8da77cd885d8fb1e8727e91681ab5ac00a889d0fcc9b973a4162f15a0b642a54 0
|
||||
llField.cs llField.cs a0e0eaed3f22a8c4ce47f82fa80346e3b99e3ac0a6765e1ad4ade3a87c1b0189 0
|
||||
Wizard.Battle.View/CardIconControl.cs Wizard.Battle.View/CardIconControl.cs affd5a289a04bc9f446f3e892403dd9cd560ee557de1e5cd743dcb031dab280c 0
|
||||
|
||||
|
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
|
||||
namespace Wizard.Battle.View;
|
||||
|
||||
public class CardIconControl
|
||||
{
|
||||
public static string[] SplitAndCompleteIconStr(string iconStr, string[] skillTypeStr)
|
||||
{
|
||||
int skillCount = skillTypeStr[0].Split(',').Length;
|
||||
int num = 0;
|
||||
if (skillTypeStr.Length > 1)
|
||||
{
|
||||
num = skillTypeStr[1].Split(',').Length;
|
||||
}
|
||||
if (iconStr == null)
|
||||
{
|
||||
string[] array = new string[2]
|
||||
{
|
||||
CompleteIconDefaultParam(skillCount),
|
||||
null
|
||||
};
|
||||
if (num > 0)
|
||||
{
|
||||
array[1] = CompleteIconDefaultParam(num);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
iconStr = iconStr.Replace(" ", "");
|
||||
if (string.IsNullOrEmpty(iconStr))
|
||||
{
|
||||
string[] array2 = new string[2]
|
||||
{
|
||||
CompleteIconDefaultParam(skillCount),
|
||||
null
|
||||
};
|
||||
if (num > 0)
|
||||
{
|
||||
array2[1] = CompleteIconDefaultParam(num);
|
||||
}
|
||||
return array2;
|
||||
}
|
||||
return iconStr.Split(new string[1] { "//" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
}
|
||||
|
||||
public static string CompleteIconDefaultParam(int skillCount)
|
||||
{
|
||||
string text = string.Empty;
|
||||
for (int i = 0; i < skillCount; i++)
|
||||
{
|
||||
text = ((!string.IsNullOrEmpty(text)) ? (text + ",none") : "none");
|
||||
}
|
||||
return text;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
// AUTO-GENERATED no-op stubs (m1_stub_gen) from Shadowverse_Code_2026-05-23\Wizard.Battle.View\CardIconControl.cs
|
||||
using System;
|
||||
namespace Wizard.Battle.View
|
||||
{
|
||||
public partial class CardIconControl
|
||||
{
|
||||
public static string[] SplitAndCompleteIconStr(string iconStr, string[] skillTypeStr) => default!;
|
||||
public static string CompleteIconDefaultParam(int skillCount) => default!;
|
||||
}
|
||||
}
|
||||
@@ -110,12 +110,15 @@ public class GameMgr
|
||||
private NetworkUserInfoData _netUser;
|
||||
|
||||
public EffectMgr GetEffectMgr() => _effect ??= new EffectMgr();
|
||||
public SoundMgr GetSoundMgr() => _sound;
|
||||
public DataMgr GetDataMgr() => _data;
|
||||
public SoundMgr GetSoundMgr() => _sound ??= new SoundMgr();
|
||||
// Headless: hand back non-null no-op instances. The copied manager types are pure
|
||||
// data/dictionary/no-op holders (no Unity in their ctors); the resolution-path ctor
|
||||
// dereferences these immediately (CreateBackgroundId / CreateManager / UnityEventAgent wiring).
|
||||
public DataMgr GetDataMgr() => _data ??= new DataMgr();
|
||||
public GameObjMgr GetGameObjMgr() => _gameObj;
|
||||
public PrefabMgr GetPrefabMgr() => _prefab;
|
||||
public InputMgr GetInputMgr() => _input;
|
||||
public BattleControl GetBattleCtrl() => _battleCtrl;
|
||||
public PrefabMgr GetPrefabMgr() => _prefab ??= new PrefabMgr();
|
||||
public InputMgr GetInputMgr() => _input ??= new InputMgr();
|
||||
public BattleControl GetBattleCtrl() => _battleCtrl ??= new BattleControl();
|
||||
public NetworkUserInfoData GetNetworkUserInfoData() => _netUser;
|
||||
public void SetNetworkUserInfoData(NetworkUserInfoData infoData) => _netUser = infoData;
|
||||
public Wizard.MailTopTask GetMailTopTask() => null;
|
||||
|
||||
@@ -50,8 +50,19 @@ namespace UnityEngine
|
||||
{
|
||||
public static T Load<T>(string path) where T : Object => null;
|
||||
public static T Load<T>(string path, Type t) where T : Object => null;
|
||||
public static Object Load(string path) => null;
|
||||
public static Object Load(string path, Type t) => null;
|
||||
// Headless: the non-generic Load is used by the copied PrefabMgr to back a prefab
|
||||
// dictionary that the resolution-path ctor then Instantiate()s + GetComponent()s
|
||||
// (e.g. Prefab/Game/UnityEventAgent). Return a cached no-op GameObject per path so that
|
||||
// chain yields a non-null object. Typed asset loads go through the generic Load<T> (null).
|
||||
private static readonly System.Collections.Generic.Dictionary<string, GameObject> _loaded
|
||||
= new System.Collections.Generic.Dictionary<string, GameObject>();
|
||||
public static Object Load(string path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path)) return null;
|
||||
if (!_loaded.TryGetValue(path, out var go)) { go = new GameObject(path); _loaded[path] = go; }
|
||||
return go;
|
||||
}
|
||||
public static Object Load(string path, Type t) => Load(path);
|
||||
public static T[] LoadAll<T>(string path) where T : Object => new T[0];
|
||||
public static Object[] LoadAll(string path) => new Object[0];
|
||||
public static ResourceRequest LoadAsync<T>(string path) where T : Object => null;
|
||||
|
||||
@@ -185,8 +185,25 @@ namespace UnityEngine
|
||||
public int layer { get; set; }
|
||||
public string tag { get; set; }
|
||||
public void SetActive(bool value) { }
|
||||
public T GetComponent<T>() => default;
|
||||
public Component GetComponent(Type t) => null;
|
||||
|
||||
// Headless component model: the resolution-path ctor (and copied views) acquire components
|
||||
// off prefab GameObjects and use them unguarded (F1). Lazily create + cache a no-op instance
|
||||
// per concrete Component-derived type so those touches resolve harmlessly instead of NRE.
|
||||
// Non-Component T or abstract/uninstantiable T still returns default (null).
|
||||
private System.Collections.Generic.Dictionary<Type, object> _components;
|
||||
private object GetOrAddComponent(Type t)
|
||||
{
|
||||
if (t == null || t.IsAbstract || !typeof(Component).IsAssignableFrom(t)) return null;
|
||||
_components ??= new System.Collections.Generic.Dictionary<Type, object>();
|
||||
if (_components.TryGetValue(t, out var c)) return c;
|
||||
object inst;
|
||||
try { inst = Activator.CreateInstance(t); }
|
||||
catch { return null; }
|
||||
_components[t] = inst;
|
||||
return inst;
|
||||
}
|
||||
public T GetComponent<T>() => (T)(GetOrAddComponent(typeof(T)) ?? default(T));
|
||||
public Component GetComponent(Type t) => (Component)GetOrAddComponent(t);
|
||||
public Component GetComponent(string t) => null;
|
||||
public T GetComponentInChildren<T>() => default;
|
||||
public T GetComponentInChildren<T>(bool includeInactive) => default;
|
||||
@@ -196,8 +213,8 @@ namespace UnityEngine
|
||||
public T GetComponentInParent<T>(bool includeInactive) => default;
|
||||
public T[] GetComponents<T>() => new T[0];
|
||||
public Component[] GetComponents(Type t) => new Component[0];
|
||||
public T AddComponent<T>() where T : Component => default;
|
||||
public Component AddComponent(Type t) => null;
|
||||
public T AddComponent<T>() where T : Component => (T)(GetOrAddComponent(typeof(T)) ?? default(T));
|
||||
public Component AddComponent(Type t) => (Component)GetOrAddComponent(t);
|
||||
public void SendMessage(string method) { }
|
||||
public void SendMessage(string method, object value) { }
|
||||
public void SendMessage(string method, object value, SendMessageOptions options) { }
|
||||
|
||||
@@ -48,7 +48,18 @@ namespace Wizard.Battle.View
|
||||
{
|
||||
// Decomp bases (dropped by the hand stub): both derive from BattleCardView, which
|
||||
// carries the IBattleCardView impl — so they convert to IBattleCardView via it.
|
||||
public abstract class ClassBattleCardViewBase : BattleCardView { }
|
||||
// The decomp ClassBattleCardViewBase also implements IClassBattleCardView; the resolution
|
||||
// path casts the created view to it (ClassBattleCardBase.Setup), so re-attach the dropped
|
||||
// interface here with no-op members (the leaf PlayerClassBattleCardView inherits them).
|
||||
public abstract class ClassBattleCardViewBase : BattleCardView, IClassBattleCardView
|
||||
{
|
||||
public virtual Wizard.Battle.Player.ClassCharacter.IClassCharacter ClassCharacter => null;
|
||||
public virtual void StartOutFrame() { }
|
||||
public virtual void StartIntoFrame() { }
|
||||
public virtual float GetCurrentClipTime() => 0f;
|
||||
public virtual bool GetCurrentClipIsName(global::ClassCharaPrm.MotionType motionType) => false;
|
||||
public virtual void ClearSpineObject() { }
|
||||
}
|
||||
public class NullBattleCardView : BattleCardView { public NullBattleCardView() { } public NullBattleCardView(BuildInfo buildInfo) { } public static void ReleaseSharedDummy() { } }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user