feat(battle-engine): UnityEngine member + static-class shims (3526->2706)
Extend the UnityEngine value/component shims with no-op members surfaced by the compile loop (UnityWebRequest/Font/Mesh/LODGroup/AudioSource/Rigidbody/Camera/Sprite/Animation/ Transform/Material/Texture2D/Light/Input/Resources + CharacterInfo/Vector4), via partial declarations + UnityShimExt.cs. Add the missing UnityEngine static classes (PlayerPrefs/ Physics/GUI/SystemInfo/Graphics/QualitySettings/StackTraceUtility) + enums (TextureFormat/ ColorSpace/EventModifiers/RenderTextureReadWrite) + Experimental.Rendering.GraphicsFormat* in UnityStatics.cs. All cosmetic, off the battle path. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
206
SVSim.BattleEngine/Shim/UnityEngine/UnityShimExt.cs
Normal file
206
SVSim.BattleEngine/Shim/UnityEngine/UnityShimExt.cs
Normal file
@@ -0,0 +1,206 @@
|
||||
// AUTHORED SHIM (not copied). No-op member extensions to the UnityEngine value/component
|
||||
// shims, added as the M1 compile loop surfaced specific calls from copied engine/view
|
||||
// code. Signatures mirror the real UnityEngine API at the call sites (arg counts/types
|
||||
// taken from the decomp). None executes headless — all return safe defaults.
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace UnityEngine
|
||||
{
|
||||
public partial struct Vector4
|
||||
{
|
||||
public static Vector4 zero => default;
|
||||
public static Vector4 one => new Vector4(1f, 1f, 1f, 1f);
|
||||
}
|
||||
|
||||
public partial class Transform
|
||||
{
|
||||
public bool hasChanged { get; set; }
|
||||
public Matrix4x4 localToWorldMatrix => default;
|
||||
public Matrix4x4 worldToLocalMatrix => default;
|
||||
}
|
||||
|
||||
public partial class LODGroup
|
||||
{
|
||||
public bool enabled { get; set; }
|
||||
public LOD[] GetLODs() => Array.Empty<LOD>();
|
||||
}
|
||||
|
||||
public struct LOD
|
||||
{
|
||||
public float screenRelativeTransitionHeight;
|
||||
public Renderer[] renderers;
|
||||
public LOD(float height, Renderer[] rends) { screenRelativeTransitionHeight = height; renderers = rends; }
|
||||
}
|
||||
|
||||
public partial class Rigidbody
|
||||
{
|
||||
public bool isKinematic { get; set; }
|
||||
public bool useGravity { get; set; }
|
||||
public void MovePosition(Vector3 position) { }
|
||||
public void MoveRotation(Quaternion rotation) { }
|
||||
}
|
||||
|
||||
public partial class Material
|
||||
{
|
||||
public void CopyPropertiesFromMaterial(Material mat) { }
|
||||
public void SetVectorArray(string name, Vector4[] values) { }
|
||||
public void SetVectorArray(int nameID, Vector4[] values) { }
|
||||
public void SetVectorArray(string name, List<Vector4> values) { }
|
||||
public void SetVectorArray(int nameID, List<Vector4> values) { }
|
||||
}
|
||||
|
||||
public partial class Mesh
|
||||
{
|
||||
public int vertexCount => 0;
|
||||
public Vector3[] normals { get; set; }
|
||||
public Vector4[] tangents { get; set; }
|
||||
public Vector2[] uv { get; set; }
|
||||
public Color32[] colors32 { get; set; }
|
||||
public void MarkDynamic() { }
|
||||
public void RecalculateNormals() { }
|
||||
public void RecalculateTangents() { }
|
||||
}
|
||||
|
||||
public partial class Texture2D
|
||||
{
|
||||
public byte[] EncodeToPNG() => Array.Empty<byte>();
|
||||
public Color32[] GetPixels32() => Array.Empty<Color32>();
|
||||
public void SetPixels32(Color32[] colors) { }
|
||||
public bool LoadImage(byte[] data) => false;
|
||||
}
|
||||
|
||||
public partial class Sprite
|
||||
{
|
||||
public Rect textureRect => default;
|
||||
public Vector2 textureRectOffset => default;
|
||||
}
|
||||
|
||||
public partial class Shader
|
||||
{
|
||||
public static int PropertyToID(string name) => 0;
|
||||
public static void SetGlobalColor(string name, Color value) { }
|
||||
public static void SetGlobalColor(int nameID, Color value) { }
|
||||
}
|
||||
|
||||
public partial class Animation
|
||||
{
|
||||
public bool enabled { get; set; }
|
||||
public bool IsPlaying(string name) => false;
|
||||
public void Sample() { }
|
||||
}
|
||||
|
||||
public partial class AudioSource
|
||||
{
|
||||
public float pitch { get; set; }
|
||||
public bool playOnAwake { get; set; }
|
||||
public int priority { get; set; }
|
||||
public void PlayOneShot(AudioClip clip) { }
|
||||
public void PlayOneShot(AudioClip clip, float volumeScale) { }
|
||||
}
|
||||
|
||||
public partial class Camera
|
||||
{
|
||||
public bool enabled { get; set; }
|
||||
public bool allowMSAA { get; set; }
|
||||
public int eventMask { get; set; }
|
||||
public TransparencySortMode transparencySortMode { get; set; }
|
||||
public void ResetAspect() { }
|
||||
public static int GetAllCameras(Camera[] cameras) => 0;
|
||||
}
|
||||
|
||||
public enum TransparencySortMode { Default, Perspective, Orthographic, CustomAxis }
|
||||
|
||||
public partial struct CharacterInfo
|
||||
{
|
||||
public int advance;
|
||||
public int minX, maxX, minY, maxY;
|
||||
public Vector2 uvBottomLeft, uvBottomRight, uvTopLeft, uvTopRight;
|
||||
}
|
||||
|
||||
public partial class Font
|
||||
{
|
||||
public string[] fontNames { get; set; }
|
||||
public Material material { get; set; }
|
||||
public static event Action<Font> textureRebuilt;
|
||||
public bool GetCharacterInfo(char ch, out CharacterInfo info, int size, FontStyle style)
|
||||
{ info = default; return false; }
|
||||
public bool GetCharacterInfo(char ch, out CharacterInfo info, int size)
|
||||
{ info = default; return false; }
|
||||
public bool GetCharacterInfo(char ch, out CharacterInfo info)
|
||||
{ info = default; return false; }
|
||||
public void RequestCharactersInTexture(string characters, int size, FontStyle style) { }
|
||||
public void RequestCharactersInTexture(string characters, int size) { }
|
||||
public void RequestCharactersInTexture(string characters) { }
|
||||
// suppress unused-event warning while keeping the API surface
|
||||
private void _TouchTextureRebuilt() => textureRebuilt?.Invoke(this);
|
||||
}
|
||||
|
||||
public partial class Light
|
||||
{
|
||||
public Color color { get; set; }
|
||||
}
|
||||
|
||||
public partial class Time
|
||||
{
|
||||
public static float smoothDeltaTime => 0f;
|
||||
}
|
||||
|
||||
public partial class Application
|
||||
{
|
||||
public static string streamingAssetsPath => "";
|
||||
public static NetworkReachability internetReachability => NetworkReachability.NotReachable;
|
||||
public static void OpenURL(string url) { }
|
||||
}
|
||||
|
||||
public enum NetworkReachability { NotReachable, ReachableViaCarrierDataNetwork, ReachableViaLocalAreaNetwork }
|
||||
|
||||
public partial class Screen
|
||||
{
|
||||
public static int sleepTimeout { get; set; }
|
||||
public static void SetResolution(int width, int height, bool fullscreen) { }
|
||||
public static void SetResolution(int width, int height, FullScreenMode mode) { }
|
||||
}
|
||||
|
||||
public enum FullScreenMode { ExclusiveFullScreen, FullScreenWindow, MaximizedWindow, Windowed }
|
||||
|
||||
public enum IMECompositionMode { Auto, On, Off }
|
||||
|
||||
public partial class Input
|
||||
{
|
||||
public static Vector2 compositionCursorPos { get; set; }
|
||||
public static string compositionString => "";
|
||||
public static IMECompositionMode imeCompositionMode { get; set; }
|
||||
}
|
||||
|
||||
public partial class Resources
|
||||
{
|
||||
public static Object[] FindObjectsOfTypeAll(Type type) => Array.Empty<Object>();
|
||||
public static T[] FindObjectsOfTypeAll<T>() => Array.Empty<T>();
|
||||
}
|
||||
}
|
||||
|
||||
namespace UnityEngine.Networking
|
||||
{
|
||||
public partial class UnityWebRequest
|
||||
{
|
||||
public static string EscapeURL(string s) => s;
|
||||
public static UnityWebRequest Get(string uri) => new UnityWebRequest();
|
||||
public UnityWebRequestAsyncOperation SendWebRequest() => new UnityWebRequestAsyncOperation();
|
||||
public void SetRequestHeader(string name, string value) { }
|
||||
public string GetResponseHeader(string name) => null;
|
||||
public Dictionary<string, string> GetResponseHeaders() => new Dictionary<string, string>();
|
||||
public bool isDone => true;
|
||||
public float downloadProgress => 1f;
|
||||
public long responseCode => 200;
|
||||
public string error => null;
|
||||
public DownloadHandler downloadHandler { get; set; }
|
||||
public UploadHandler uploadHandler { get; set; }
|
||||
}
|
||||
|
||||
public class DownloadHandler { public byte[] data => Array.Empty<byte>(); public string text => ""; }
|
||||
public class UploadHandler { }
|
||||
public class UploadHandlerRaw : UploadHandler { public UploadHandlerRaw(byte[] data) { } }
|
||||
public class DownloadHandlerBuffer : DownloadHandler { }
|
||||
public class UnityWebRequestAsyncOperation : AsyncOperation { }
|
||||
}
|
||||
Reference in New Issue
Block a user