Files
SVSimServer/SVSim.BattleEngine/Shim/GodObjects/GodObjects.cs
gamer147 2b506574e7 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>
2026-06-06 01:36:22 -04:00

170 lines
13 KiB
C#

// AUTHORED SHIM (not copied). The god-object singletons the engine reaches for
// presentation/scene/effects/sound/data. These are the M0 "stop the bleed" types:
// copying them re-explodes the closure into the whole app (audio, scene, UI, net),
// so we shim a minimal surface. Manager GETTERS return the (copied) manager types as
// null fields -- the engine only dereferences them inside never-run VFX (IsForecast
// suppresses VFX) or non-battle code paths, so a null is harmless headless and avoids
// constructing copied types with heavy ctors. Member signatures mirror the decomp
// exactly (extracted, not guessed) so call sites compile unchanged.
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EffectMgr
{
public enum EffectType
{
NONE, CMN_INPUT_TOUCH_1, CMN_INPUT_TOUCH_2, CMN_INPUT_DRAG_1, CMN_CARD_MOVE_1, CMN_CARD_MOVE_2, CMN_CARD_DRAW_2, CMN_CARD_DRAW_4, CMN_CARD_RETURN_1, CMN_CARD_SET_1, CMN_CARD_SET_2, CMN_CARD_SET_3, CMN_CARD_SET_4, CMN_CARD_ACCELERATE_1, CMN_CARD_CRYSTALLIZE_1, CMN_CARD_RARE_1, CMN_CARD_ATTACK_1, CMN_CARD_LANDING_1, CMN_CARD_TARGET_1, CMN_CARD_TARGET_2, CMN_CARD_TARGET_3, CMN_CARD_TARGET_4, CMN_CARD_SELECT_3, CMN_CARD_DAMAGE_1, CMN_CARD_DAMAGE_3, CMN_CARD_EVO_4, CMN_CLASS_APPEAR_1, CMN_CLASS_DESTROY_1, CMN_CLASS_DECKOUT_1, CMN_UI_COST_1, CMN_UI_COST_2, CMN_UI_COST_3, CMN_UI_COST_4, CMN_UI_EP_2, CMN_UI_EP_3, CMN_UI_EP_4, CMN_UI_EP_5, CMN_UI_EP_6, CMN_UI_TURN_1, CMN_UI_TURN_4, CMN_UI_TURN_5, CMN_UI_TURN_6, CMN_UI_YOURTURN_3, CMN_UI_TARGET_3, CMN_START_VS_1, CMN_START_VS_ST2, CMN_START_CARD_1, CMN_FRAME_BTN_1, CMN_FRAME_BTN_2, CMN_UI_HEROSKILL_1, CMN_UI_HEROSKILL_2, CMN_RESULT_TITLE_1, CMN_RESULT_TITLE_2, CMN_RESULT_TITLE_3, CMN_RESULT_LVUP_1, CMN_RESULT_RANKUP_1, CMN_RESULT_RANKDOWN_1, CMN_RESULT_TIERUP_1, CMN_RESULT_MATCH_1, CMN_RESULT_FAILED_1, CMN_RESULT_ORB_1, CMN_RESULT_ORB_2, CMN_RESULT_GAUGE_1, CMN_RESULT_GAUGE_2, CMN_RESULT_BACK_1, CMN_RESULT_BACK_2, CMN_RESULT_BACK_3, CMN_FIELD_SET_1, CMN_FIELD_SET_2, CMN_FIELD_SET_3, CMN_FIELD_SET_4, CMN_FIELD_SET_5, CMN_FIELD_SET_6, CMN_FIELD_SET_7, CMN_FIELD_SET_8, CMN_FIELD_SET_9, CMN_FIELD_SET_10, CMN_FIELD_SET_20, CMN_FIELD_SET_21, CMN_FIELD_SET_22, CMN_FIELD_SET_23, CMN_FIELD_SET_30, CMN_FIELD_SET_31, CMN_FIELD_SET_32, CMN_FIELD_SET_33, CMN_FIELD_SET_34, CMN_FIELD_SET_41, CMN_FIELD_SET_42, CMN_FIELD_SET_43, CMN_FIELD_SET_51, CMN_FIELD_SET_52, CMN_FIELD_SET_61, CMN_FIELD_SET_62, CMN_FIELD_SET_71, CMN_FIELD_SET_72, CMN_FIELD_SET_74, CMN_FIELD_SET_76, CMN_FIELD_SET_1001, CMN_FIELD_SET_1002, CMN_FIELD_SET_1003, CMN_FIELD_SET_1004, CMN_FIELD_SET_1005, CMN_FIELD_SET_1006, CMN_FIELD_SET_1007, CMN_FIELD_SET_1008, CMN_FIELD_SET_1009, CMN_FIELD_SET_1010, CMN_FIELD_SET_1011, CMN_FIELD_SET_1012, CMN_FIELD_TAP_1_1, CMN_FIELD_TAP_1_2, CMN_FIELD_TAP_2_1, CMN_FIELD_TAP_3_1, CMN_FIELD_TAP_3_2, CMN_FIELD_TAP_4_1, CMN_FIELD_TAP_4_2, CMN_FIELD_TAP_5_1, CMN_FIELD_TAP_6_1, CMN_FIELD_TAP_6_2, CMN_FIELD_TAP_7_1, CMN_FIELD_TAP_8_1, CMN_FIELD_TAP_9_1, CMN_FIELD_TAP_10_1, CMN_FIELD_TAP_10_2, CMN_FIELD_TAP_20_1, CMN_FIELD_TAP_20_2, CMN_FIELD_TAP_21_1, CMN_FIELD_TAP_21_2, CMN_FIELD_TAP_22_1, CMN_FIELD_TAP_23_1, CMN_FIELD_TAP_23_2, CMN_FIELD_TAP_30_1, CMN_FIELD_TAP_31_1, CMN_FIELD_TAP_31_2, CMN_FIELD_TAP_32_1, CMN_FIELD_TAP_33_1, CMN_FIELD_TAP_33_2, CMN_FIELD_TAP_34_1, CMN_FIELD_TAP_41_1, CMN_FIELD_TAP_42_1, CMN_FIELD_TAP_43_1, CMN_FIELD_TAP_51_1, CMN_FIELD_TAP_52_1, CMN_FIELD_TAP_61_1, CMN_FIELD_TAP_61_2, CMN_FIELD_TAP_62_1, CMN_FIELD_TAP_71_1, CMN_FIELD_TAP_72_1, CMN_FIELD_TAP_74_1, CMN_FIELD_TAP_76_1, CMN_FIELD_TAP_1001_1, CMN_FIELD_TAP_1002_1, CMN_FIELD_TAP_1003_1, CMN_FIELD_TAP_1004_1, CMN_FIELD_TAP_1005_1, CMN_FIELD_TAP_1006_1, CMN_FIELD_TAP_1007_1, CMN_FIELD_TAP_1007_2, CMN_FIELD_TAP_1008_1, CMN_FIELD_TAP_1009_1, CMN_FIELD_TAP_1010_1, CMN_FIELD_TAP_1011_1, CMN_FIELD_TAP_1012_1, CMN_MYPAGE_EVO_1, CMN_GACHA_CURSOR_1, CMN_GACHA_OPEN_2, CMN_GACHA_OPEN_3, CMN_GACHA_OPEN_4, CMN_TUTORIAL_DRAG_1, CMN_TUTORIAL_DRAG_2, CMN_TUTORIAL_TAP_1, CMN_TUTORIAL_TAP_2, CMN_TUTORIAL_NICE_1, CMN_CRAFT_CARD_1, CMN_CRAFT_CARD_2, CMN_CRAFT_ICON_1, CMN_CRAFT_TRACK_1, CMN_CRAFT_SPLASH_1, CMN_CRAFT_SPLASH_2, CMN_CRAFT_SPLASH_3, CMN_CRAFT_SPLASH_4, CMN_ENDING_IN_1, CMN_ENDING_LOGO_1, CMN_ENDING_LOGO_2, CMN_ENDING_TEXT_1, CMN_PROLOGUE_NAME_1, CMN_ARENA_ARCANE_1, CMN_ARENA_ARCANE_2, CMN_ARENA_FRAME_1, CMN_ARENA_FRAME_2, CMN_ARENA_FRAME_3, CMN_ARENA_CLASS_1, CMN_ARENA_CLASS_2, CMN_ARENA_DECIDE_1, CMN_ARENA_DECIDE_2, CMN_ARENA_DECIDE_3, CMN_ARENA_DECK_1, CMN_MAP_CHAPTER_1, CMN_MAP_MAPICON_CLEARED, CMN_MAP_MAPICON_NOTCLEARED, CMN_MAP_PLAYERICON, CMN_EMBLEM_GET_1, CMN_FRAME_CHOICE_1, CMN_FRAME_CHOICE_2, CMN_FRAME_CHOICE_3, CMN_FRAME_FUSION, CMN_FRAME_HEROSKILL_1, STT_ACT_PLAY_1, STT_ACT_GUARD_1, STT_ACT_FLAG_1, STT_ACT_REFLECTION_1, STT_LOOP_GUARD_1, STT_LOOP_UP_1, STT_LOOP_DOWN_1, STT_LOOP_SNEAK_1, STT_LOOP_REDUCTION_1, STT_LOOP_PROTECTION_1, STT_LOOP_PROTECTION_2, STT_LOOP_SKILL_INVINCIBLE_1, STT_LOOP_HOLD_4, STT_LOOP_BUFFER_1, STT_LOOP_SPELLCHARGE_1, STT_LOOP_UNATTACKED_1, STT_LOOP_UNSELECTED_1, STT_LOOP_HEAVENLYAEGIS_1, MAX,
}
public static System.Collections.IEnumerator LoadAndInstantiate2dEffectCoroutine(string effectName, System.Action<UnityEngine.GameObject, System.Collections.Generic.List<string>> finishCallback) { yield break; }
public enum MoveType
{
NONE, NONE_REF, LINEAR, LINEAR_REF, LINEAR_LOOK, LINEAR_WAIT_75, LINEAR_FROM_DECK,
REVERSE, REVERSE_CLASS, SKIP, SKIP_CENTER_50, SKIP_LOOK, SKIP_LOOK_ZERO, SKIP_WAIT_75,
SKIP_WAIT_75_FROM_DECK, SKIP_TO_DECK, DIRECT, DIRECT_REF, DIRECT_LOOK, DIRECT_LOOK_SELF_LEADER,
DIRECT_HAND, DIRECT_SELF_HAND, DIRECT_DECK, DIRECT_LEADER, DIRECT_LEADER_REF, LOOK, PARABOLA,
HOMING, HOMING_WAIT, ARC, ARC_LOOK, ARC_UPWARDS, CENTER, CENTER_SELF, CENTER_SELF_REF,
CENTER_TARGET, CENTER_TARGET_REF, CENTER_SELF_ALL, CENTER_SELF_ALL_REF, CENTER_TARGET_ALL,
CENTER_TARGET_ALL_REF, CENTER_SKIP, CENTER_SKIP_50, DIRECT_EPPANEL_SELF, DIRECT_EPPANEL_OPPONENT,
DIRECT_CENTER_DIRECT, NONE_CENTER_TARGET_ALL
}
public enum TargetType { NONE, NONE_WAIT, SINGLE, SINGLE_ONLY_OPPONENT, AREA_ALL, AREA_OPPONENT, AREA_SELF }
public enum EngineType { NONE, SHURIKEN, SOLID }
public GameObject EffectContainer => null;
public bool IsPlayerBattleEffectReady => true;
public bool IsEnemyBattleEffectReady => true;
public bool IsPreInEffectReady => true;
public bool IsFieldEffectReady => true;
public bool IsBattleUIEffectReady => true;
public Effect Start(EffectType type, Vector3 pos, Quaternion rot, int layer = -1) => null;
public Effect Start(EffectType type, Vector3 pos, GameObject obj = null) => null;
public Effect Start(EffectType type, float posX, float posY) => null;
public Effect Start(EffectType type) => null;
public Effect StartTouchEffect(EffectType type, float posX, float posY) => null;
public Effect StartBuff(EffectType type, GameObject obj) => null;
public Effect StartBuffLookAt(EffectType type, GameObject fromObject, GameObject toObject) => null;
public Effect StartBuffLookAtCamera(EffectType type, GameObject fromObject, Camera toCamera) => null;
public Effect StopBuff(EffectType type, GameObject obj) => null;
public Effect FadePlay(GameObject obj, float posX, float posY) => null;
public Effect FadeStop(GameObject obj) => null;
public Effect FadeStop(EffectType type) => null;
public Effect Stop(EffectType type) => null;
public List<string> InitCommonEffect(string filePath, bool isBattle = false, bool isField = false, bool isBattleEffect = false, Action callback = null) => new List<string>();
public List<string> SetUIParticleShader(List<GameObject> effectObjList, Action callback, bool isBattle = false, bool isField = false) => new List<string>();
public List<string> SetUIParticleShader(GameObject effectObj, Action callback, bool isBattle = false, bool isField = false) => new List<string>();
public List<string> LoadUIParticleShader(GameObject effectObj, Action callback, bool isBattle) => new List<string>();
public void SetOnlyUIParticleShader(GameObject effectObj) { }
public void SetParticleShader(GameObject effectObj) { }
public void ChangeMaskShader(GameObject effectObj, int stencil = 1) { }
public void InitBattleEffect() { }
public void InitEnemyBattleEffect() { }
public void DisposeLatestMadeEffects() { }
public void ClearLastCacheEffect() { }
public void SetupEffectContainer() { }
public void DestroyBattleEffectContainer() { }
public void ImmediateDestroyBattleEffectContainer() { }
public void ClearBattleFeildEffect() { }
public void RestUnneededEffect() { }
public EffectBattle GetEffectBattle(string key) => null;
public EffectBattle GetEnemyEffectBattle(string key) => null;
public static MoveType ToStrMoveType(string str) => MoveType.NONE;
public static EngineType ToStrEngineType(string str) => EngineType.NONE;
public static TargetType ToStrTargetType(string str) => TargetType.NONE;
}
public partial class GameObjMgr { public GameObjMgr() { } }
public class GameMgr
{
public static GameMgr GetIns() => _ins ??= new GameMgr();
private static GameMgr _ins;
public GameObject m_GameManagerObj;
public bool IsNewReplayBattle;
public bool IsAdmin;
public bool IsWatchHandInvisible;
public float ScreenAspect = 1.777f;
public DateTime AnnounceTime;
public Wizard.RankWinnerReward _rankWinnerReward;
public bool IsAdminWatch { get; set; }
public bool IsWatchBattle { get; set; }
public bool IsReplayBattle { get; set; }
public bool IsNetworkBattle { get; set; }
public bool IsAINetwork { get; set; }
public bool IsPuzzleQuest { get; set; }
public bool HasAuthAdmin { get; set; }
public void ChangeAspectRatio(float newAspectRatio) { }
public void Update() { }
private EffectMgr _effect;
private SoundMgr _sound;
private DataMgr _data;
private GameObjMgr _gameObj = new GameObjMgr();
private PrefabMgr _prefab;
private InputMgr _input;
private BattleControl _battleCtrl;
private NetworkUserInfoData _netUser;
public EffectMgr GetEffectMgr() => _effect ??= new EffectMgr();
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 ??= 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;
public Wizard.MyPageTask GetMyPageTask() => null;
public Wizard.DeckUpdateTask GetDeckUpdateTask() => null;
public Wizard.CardDestructTask GetCardDestructTask() => null;
public Wizard.CardCreateTask GetCardCreateTask() => null;
public Wizard.MissionInfoTask GetMissionInfoTask() => null;
public static void CreateIns() { _ins ??= new GameMgr(); }
public void CreateMgrIns(GameObject gameobj) { }
public void BuildDeckData() { }
public void DestroyBattleManagements() { }
public void Init() { }
public void InitializeSelfInfo() { }
public void SettingSelfInfo(Dictionary<string, object> info, bool isWatchReplayRecovery) { }
public void SettingOpponentInfo(Dictionary<string, object> info, bool isWatchReplayRecovery) { }
public void SettingBattleStartSelfInfo(Dictionary<string, object> info) { }
public void SettingBattleStartOpponentInfo(Dictionary<string, object> info) { }
public void SettingSelfDeck(List<object> info) { }
public bool IsUseUnapprovedList(bool isPlayer) => false;
}
// UIManager surface (members, ViewScene enum, ChangeViewSceneParam) is generated from
// decomp into Shim/Generated/UIManager*.g.cs. This partial keeps only the singleton +
// MonoBehaviour base (gameObject/transform/StartCoroutine/StopCoroutine come from the base).
public partial class UIManager : UnityEngine.MonoBehaviour
{
private static UIManager _ins;
public static UIManager GetInstance() => _ins ??= new UIManager();
public static UIManager GetIns() => GetInstance();
}
// VideoHostingHUD (members + HUDMode enum) provided by Generated/VideoHostingHUD.g.cs
namespace Wizard
{
// RankWinnerReward, CardDestructTask, CardCreateTask, MissionInfoTask already exist
// in the copied set (declared in other files) -- only these three were missing.
public partial class MailTopTask { }
public partial class MyPageTask { }
public partial class DeckUpdateTask { }
// UIManager no-op return types (empty stubs; methods returning them return null)
public partial class LoadingViewManager { }
public partial class AccountTransferHelper { }
public class DialogManager { public DialogBase CreateDialogBaseOpenCardDetail(CardDetailUI detailUI) => default!; }
public partial class ApplicationFinishManager { }
}