Files
SVSimServer/SVSim.BattleEngine/Shim/UnityEngine/UnityShimExt.cs
gamer147 be10425819 feat(battle-engine): VfxWith ctor arg order + Unity conversions + ITouchProcessor reattach (1102->958)
- VfxWith<T> ctor params were swapped ((T,VfxBase) vs decomp (VfxBase,T)) -> ~38
  CS1503 across SkillCollectionBase/BattleCardBase skill-processing (ProcessInfo
  <-> VfxBase). These are on the resolution path. Fixed to match decomp.
- UnityEngine primitives: implicit Vector3/Vector2<->Vector4 + Color->Color32
  conversions; Transform.Translate/Rotate(Vector3,Space) overloads (iTween).
- ITouchProcessor was dropped from touch-processor stubs by base-clause recovery;
  re-attach via Shim/View/TouchProcessorIfaces.cs (interface-only for generated
  full-surface stubs, interface+no-op members for the empty hand stubs).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-05 23:18:35 -04:00

218 lines
8.3 KiB
C#

// 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 Vector4(float x, float y, float z) { this.x = x; this.y = y; this.z = z; this.w = 0f; }
public Vector4(float x, float y) { this.x = x; this.y = y; this.z = 0f; this.w = 0f; }
// UnityEngine implicitly promotes/truncates between Vector2/3/4.
public static implicit operator Vector4(Vector3 v) => new Vector4(v.x, v.y, v.z, 0f);
public static implicit operator Vector3(Vector4 v) => new Vector3(v.x, v.y, v.z);
public static implicit operator Vector4(Vector2 v) => new Vector4(v.x, v.y, 0f, 0f);
public static implicit operator Vector2(Vector4 v) => new Vector2(v.x, v.y);
}
public partial class Transform
{
public bool hasChanged { get; set; }
public Matrix4x4 localToWorldMatrix => default;
public Matrix4x4 worldToLocalMatrix => default;
public void Translate(float x, float y) { }
public void Rotate(float x, float y) { }
public void Translate(Vector3 translation, Space relativeTo) { }
public void Rotate(Vector3 eulers, Space relativeTo) { }
}
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 { }
}