Files
SVSimServer/SVSim.BattleEngine/Shim/UnityEngine/UnityShim.cs
gamer147 957af3d1ec feat(battle-engine): full Unity/VFX/god-object shims + expanded copy closure (2570 files)
Authored Unity primitive/object-model shim, VFX layer (control-flow-preserving, InstantVfx never invokes its action -- headless suppression), god-object stubs (GameMgr/EffectMgr/UIManager with faithfully-extracted nested enums), View/UI/Touch tree, LitJson+BetterList+Tuple copied, third-party stubs. Discovered Roslyn header-error masking: fixing class-header type errors unmasks body references, so the true copy closure is ~2570 files (was 782 under masking). Errors: masked-25720 -> 268; our shim files compile clean. Remaining: ~50 residual shim/external types, 24 NGUI UI-base overrides, static-type fixes, plus likely 1-2 more unmask waves.
2026-06-05 17:22:20 -04:00

167 lines
8.9 KiB
C#

// AUTHORED SHIM (not copied). No-op UnityEngine surface for headless battle
// resolution. Grows via the M1 compile loop -- add only members the compiler
// demands. State-bearing battle logic lives in Engine/; nothing here computes
// game state (Unity calls are VFX/IO/rendering, suppressed by IsForecast).
using System;
using System.Collections;
namespace UnityEngine
{
// ---- value types (Vector2/3, Quaternion, Color, Mathf, Debug live in Primitives.cs) ----
public struct Vector4 { public float x, y, z, w; public Vector4(float x, float y, float z, float w){ this.x=x; this.y=y; this.z=z; this.w=w; } }
public struct Color32 { public byte r, g, b, a; public Color32(byte r, byte g, byte b, byte a){ this.r=r; this.g=g; this.b=b; this.a=a; } }
public struct Bounds { public Vector3 center, size; public Bounds(Vector3 c, Vector3 s){ center=c; size=s; } }
public struct Rect { public float x, y, width, height; public Rect(float x, float y, float w, float h){ this.x=x; this.y=y; width=w; height=h; } }
public struct Matrix4x4 { public static Matrix4x4 identity => new Matrix4x4(); }
public struct Plane { }
public struct Ray { }
public struct RaycastHit { }
public struct LayerMask { public int value; public static int NameToLayer(string n) => 0; public static implicit operator int(LayerMask m) => m.value; }
// ---- core object model ----
public class Object
{
public string name { get; set; }
public int GetInstanceID() => 0;
public override string ToString() => name ?? base.ToString();
public static void Destroy(Object o) { }
public static void Destroy(Object o, float t) { }
public static void DestroyImmediate(Object o) { }
public static void DontDestroyOnLoad(Object o) { }
public static T Instantiate<T>(T original) where T : Object => original;
public static T FindObjectOfType<T>() where T : Object => null;
public static bool operator ==(Object a, Object b) => ReferenceEquals(a, b);
public static bool operator !=(Object a, Object b) => !ReferenceEquals(a, b);
public static implicit operator bool(Object o) => !ReferenceEquals(o, null);
public override bool Equals(object o) => ReferenceEquals(this, o);
public override int GetHashCode() => System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(this);
}
public class Component : Object
{
public Transform transform => null;
public GameObject gameObject => null;
public T GetComponent<T>() => default;
public T GetComponentInChildren<T>() => default;
public T[] GetComponentsInChildren<T>() => new T[0];
public T GetComponentInParent<T>() => default;
}
public class Behaviour : Component { public bool enabled { get; set; } }
public class MonoBehaviour : Behaviour
{
public Coroutine StartCoroutine(IEnumerator routine) => null;
public Coroutine StartCoroutine(string methodName) => null;
public void StopCoroutine(IEnumerator routine) { }
public void StopCoroutine(Coroutine routine) { }
public void StopAllCoroutines() { }
public void Invoke(string methodName, float time) { }
public void CancelInvoke() { }
public bool IsInvoking() => false;
}
public class Transform : Component, IEnumerable
{
public Vector3 position { get; set; }
public Vector3 localPosition { get; set; }
public Vector3 localScale { get; set; } = new Vector3(1, 1, 1);
public Vector3 localEulerAngles { get; set; }
public Vector3 eulerAngles { get; set; }
public Quaternion rotation { get; set; }
public Quaternion localRotation { get; set; }
public Transform parent { get; set; }
public int childCount => 0;
public Transform Find(string n) => null;
public Transform GetChild(int i) => null;
public void SetParent(Transform p) { }
public void SetParent(Transform p, bool worldPositionStays) { }
public void SetSiblingIndex(int i) { }
public int GetSiblingIndex() => 0;
public void SetAsLastSibling() { }
public void SetAsFirstSibling() { }
public IEnumerator GetEnumerator() { yield break; }
}
public class GameObject : Object
{
public GameObject() { }
public GameObject(string name) { this.name = name; }
public Transform transform => null;
public bool activeSelf => false;
public bool activeInHierarchy => false;
public int layer { get; set; }
public string tag { get; set; }
public void SetActive(bool value) { }
public T GetComponent<T>() => default;
public T GetComponentInChildren<T>() => default;
public T AddComponent<T>() where T : Component => default;
public Component AddComponent(Type t) => null;
public static GameObject Find(string n) => null;
}
public class ScriptableObject : Object { }
// ---- rendering / physics / audio (pure no-op presentation) ----
public class Renderer : Component { public Material material { get; set; } public Material[] materials { get; set; } public bool enabled { get; set; } }
public class MeshRenderer : Renderer { }
public class SkinnedMeshRenderer : Renderer { }
public class SpriteRenderer : Renderer { public Sprite sprite { get; set; } }
public class MeshFilter : Component { public Mesh mesh { get; set; } }
public class ParticleSystem : Component { }
public class ParticleSystemRenderer : Renderer { }
public class LODGroup : Component { }
public class Collider : Component { public bool enabled { get; set; } }
public class BoxCollider : Collider { }
public class Rigidbody : Component { }
public class Rigidbody2D : Component { }
public class Material : Object { public Material() { } public Material(Material src) { } public Color color { get; set; } public void SetFloat(string n, float v) { } public void SetColor(string n, Color c) { } public void SetTexture(string n, Texture t) { } }
public class Mesh : Object { }
public class Texture : Object { }
public class Texture2D : Texture { public Texture2D(int w, int h) { } }
public class RenderTexture : Texture { }
public class Sprite : Object { }
public class Shader : Object { public static Shader Find(string n) => null; }
public class AnimationClip : Object { }
public class Animation : Component { }
public class Animator : Component { }
public class AnimationCurve { }
public class AudioClip : Object { }
public class AudioSource : Component { }
public class Camera : Component { public static Camera main => null; }
public struct CharacterInfo { }
// ---- coroutine machinery (never pumped headless; types must exist) ----
public class YieldInstruction { }
public sealed class Coroutine : YieldInstruction { }
public sealed class WaitForEndOfFrame : YieldInstruction { }
public sealed class WaitForSeconds : YieldInstruction { public WaitForSeconds(float s) { } }
public sealed class WaitForFixedUpdate : YieldInstruction { }
// ---- input ----
public struct Touch { public int fingerId; public Vector2 position; public TouchPhase phase; }
// ---- enums (grow members as the compiler demands) ----
public enum FontStyle { Normal, Bold, Italic, BoldAndItalic }
public enum TouchPhase { Began, Moved, Stationary, Ended, Canceled }
public enum KeyCode { None }
// ---- attributes: permissive ctors accept any compile-time attribute args ----
public class SerializeField : Attribute { }
public class HideInInspector : Attribute { }
public class ExecuteInEditMode : Attribute { }
public class AddComponentMenu : Attribute { public AddComponentMenu(string n) { } public AddComponentMenu(string n, int o) { } }
public class ContextMenu : Attribute { public ContextMenu(string n) { } }
public class RequireComponent : Attribute { public RequireComponent(Type a) { } public RequireComponent(Type a, Type b) { } }
public class HeaderAttribute : Attribute { public HeaderAttribute(string h) { } }
public class TooltipAttribute : Attribute { public TooltipAttribute(string t) { } }
public class SpaceAttribute : Attribute { public SpaceAttribute() { } public SpaceAttribute(float h) { } }
public class RangeAttribute : Attribute { public RangeAttribute(float min, float max) { } }
public class MultilineAttribute : Attribute { public MultilineAttribute() { } public MultilineAttribute(int lines) { } }
// ---- subsystem singletons / statics ----
public static class Application { public static bool isEditor => false; public static bool isPlaying => true; public static string persistentDataPath => ""; }
public static class Time { public static float deltaTime => 0f; public static float time => 0f; public static float unscaledDeltaTime => 0f; public static int frameCount => 0; }
public static class Screen { public static int width => 1920; public static int height => 1080; }
}