Files
SVSimServer/SVSim.BattleEngine/Shim/UnityEngine/Primitives.cs
gamer147 8bb392dcd6 port(m1): wave 6h — CS0246 app types + Unity members/enums (236->210)
- Generated app types: ChapterCharaDecider, DownloadInfoGetter, DeckSelection(Confirm)DialogDisplay,
  SubChapterStorySectionBtn, EvolutionHideMessageVfx; nested OpeningShowCharacterPanelVfx on OpeningVfx.
- EffectMgr.MoveType: full 47-value decomp enum (was 4).
- MonoBehaviour.print, Debug.isDebugBuild, LayerMask.LayerToName,
  SystemLanguage.Chinese, RuntimePlatform.XBOX360/BlackBerryPlayer/+console values.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-06 00:15:46 -04:00

196 lines
13 KiB
C#

// AUTHORED SHIM (not copied). Minimal no-op UnityEngine value-type surface. Grows via
// the M1 compile loop -- members added are exactly those the copied engine references
// (geometry/math used inside never-run VFX/layout code; IsForecast suppresses playback,
// so numeric results here never feed authoritative game state).
using System;
namespace UnityEngine
{
public struct Vector2
{
public float x, y;
public Vector2(float x, float y) { this.x = x; this.y = y; }
public static Vector2 zero => new Vector2(0, 0);
public static Vector2 one => new Vector2(1, 1);
public static Vector2 up => new Vector2(0, 1);
public static Vector2 down => new Vector2(0, -1);
public static Vector2 left => new Vector2(-1, 0);
public static Vector2 right => new Vector2(1, 0);
public float magnitude => (float)Math.Sqrt(x * x + y * y);
public float sqrMagnitude => x * x + y * y;
public Vector2 normalized { get { float m = magnitude; return m > 1e-6f ? new Vector2(x / m, y / m) : zero; } }
public static float Distance(Vector2 a, Vector2 b) => (a - b).magnitude;
public static float Dot(Vector2 a, Vector2 b) => a.x * b.x + a.y * b.y;
public static float Angle(Vector2 from, Vector2 to) => 0f;
public void Normalize() { var n = normalized; x = n.x; y = n.y; }
public static Vector2 Lerp(Vector2 a, Vector2 b, float t) => new Vector2(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t);
public static Vector2 operator +(Vector2 a, Vector2 b) => new Vector2(a.x + b.x, a.y + b.y);
public static Vector2 operator -(Vector2 a, Vector2 b) => new Vector2(a.x - b.x, a.y - b.y);
public static Vector2 operator -(Vector2 a) => new Vector2(-a.x, -a.y);
public static Vector2 operator *(Vector2 a, float s) => new Vector2(a.x * s, a.y * s);
public static Vector2 operator *(float s, Vector2 a) => new Vector2(a.x * s, a.y * s);
public static Vector2 operator /(Vector2 a, float s) => new Vector2(a.x / s, a.y / s);
public static Vector2 operator *(Vector2 a, Vector2 b) => new Vector2(a.x * b.x, a.y * b.y);
public static bool operator ==(Vector2 a, Vector2 b) => a.x == b.x && a.y == b.y;
public static bool operator !=(Vector2 a, Vector2 b) => !(a == b);
public override bool Equals(object o) => o is Vector2 v && this == v;
public override int GetHashCode() => x.GetHashCode() ^ (y.GetHashCode() << 2);
public static implicit operator Vector2(Vector3 v) => new Vector2(v.x, v.y);
public static implicit operator Vector3(Vector2 v) => new Vector3(v.x, v.y, 0);
}
public struct Vector3
{
public float x, y, z;
public Vector3(float x, float y, float z) { this.x = x; this.y = y; this.z = z; }
public Vector3(float x, float y) { this.x = x; this.y = y; this.z = 0; }
public static Vector3 zero => new Vector3(0, 0, 0);
public static Vector3 one => new Vector3(1, 1, 1);
public static Vector3 up => new Vector3(0, 1, 0);
public static Vector3 down => new Vector3(0, -1, 0);
public static Vector3 left => new Vector3(-1, 0, 0);
public static Vector3 right => new Vector3(1, 0, 0);
public static Vector3 forward => new Vector3(0, 0, 1);
public static Vector3 back => new Vector3(0, 0, -1);
public float magnitude => (float)Math.Sqrt(x * x + y * y + z * z);
public float sqrMagnitude => x * x + y * y + z * z;
public Vector3 normalized { get { float m = magnitude; return m > 1e-6f ? new Vector3(x / m, y / m, z / m) : zero; } }
public static float Distance(Vector3 a, Vector3 b) => (a - b).magnitude;
public static float SqrMagnitude(Vector3 a) => a.sqrMagnitude;
public static float Dot(Vector3 a, Vector3 b) => a.x * b.x + a.y * b.y + a.z * b.z;
public static Vector3 Cross(Vector3 a, Vector3 b) => new Vector3(a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x);
public static Vector3 Scale(Vector3 a, Vector3 b) => new Vector3(a.x * b.x, a.y * b.y, a.z * b.z);
public void Scale(Vector3 s) { x *= s.x; y *= s.y; z *= s.z; }
public static Vector3 Lerp(Vector3 a, Vector3 b, float t) => new Vector3(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t, a.z + (b.z - a.z) * t);
public static Vector3 LerpUnclamped(Vector3 a, Vector3 b, float t) => Lerp(a, b, t);
public static Vector3 MoveTowards(Vector3 a, Vector3 b, float d) => b;
public static Vector3 operator +(Vector3 a, Vector3 b) => new Vector3(a.x + b.x, a.y + b.y, a.z + b.z);
public static Vector3 operator -(Vector3 a, Vector3 b) => new Vector3(a.x - b.x, a.y - b.y, a.z - b.z);
public static Vector3 operator -(Vector3 a) => new Vector3(-a.x, -a.y, -a.z);
public static Vector3 operator *(Vector3 a, float s) => new Vector3(a.x * s, a.y * s, a.z * s);
public static Vector3 operator *(float s, Vector3 a) => new Vector3(a.x * s, a.y * s, a.z * s);
public static Vector3 operator /(Vector3 a, float s) => new Vector3(a.x / s, a.y / s, a.z / s);
public static bool operator ==(Vector3 a, Vector3 b) => a.x == b.x && a.y == b.y && a.z == b.z;
public static bool operator !=(Vector3 a, Vector3 b) => !(a == b);
public override bool Equals(object o) => o is Vector3 v && this == v;
public override int GetHashCode() => x.GetHashCode() ^ y.GetHashCode() ^ z.GetHashCode();
}
public struct Quaternion
{
public float x, y, z, w;
public Quaternion(float x, float y, float z, float w) { this.x = x; this.y = y; this.z = z; this.w = w; }
public static Quaternion identity => new Quaternion(0, 0, 0, 1);
public static Quaternion Euler(float x, float y, float z) => identity;
public static Quaternion Euler(Vector3 e) => identity;
public static Quaternion AngleAxis(float angle, Vector3 axis) => identity;
public static Quaternion LookRotation(Vector3 fwd) => identity;
public static Quaternion Slerp(Quaternion a, Quaternion b, float t) => identity;
public static Quaternion FromToRotation(Vector3 from, Vector3 to) => identity;
public static Quaternion Inverse(Quaternion rotation) => identity;
public Vector3 eulerAngles { get => Vector3.zero; set { } }
public static Vector3 operator *(Quaternion q, Vector3 v) => v;
public static Quaternion operator *(Quaternion a, Quaternion b) => identity;
}
public struct Color
{
public float r, g, b, a;
public Color(float r, float g, float b, float a) { this.r = r; this.g = g; this.b = b; this.a = a; }
public Color(float r, float g, float b) { this.r = r; this.g = g; this.b = b; this.a = 1f; }
public static Color white => new Color(1, 1, 1, 1);
public static Color black => new Color(0, 0, 0, 1);
public static Color clear => new Color(0, 0, 0, 0);
public static Color red => new Color(1, 0, 0, 1);
public static Color green => new Color(0, 1, 0, 1);
public static Color blue => new Color(0, 0, 1, 1);
public static Color yellow => new Color(1, 0.92f, 0.016f, 1);
public static Color cyan => new Color(0, 1, 1, 1);
public static Color magenta => new Color(1, 0, 1, 1);
public static Color gray => new Color(0.5f, 0.5f, 0.5f, 1);
public static Color grey => gray;
public static Color Lerp(Color a, Color b, float t) => new Color(a.r + (b.r - a.r) * t, a.g + (b.g - a.g) * t, a.b + (b.b - a.b) * t, a.a + (b.a - a.a) * t);
public static Color operator *(Color c, float s) => new Color(c.r * s, c.g * s, c.b * s, c.a * s);
public static Color operator *(Color a, Color b) => new Color(a.r * b.r, a.g * b.g, a.b * b.b, a.a * b.a);
public static Color operator +(Color a, Color b) => new Color(a.r + b.r, a.g + b.g, a.b + b.b, a.a + b.a);
public static implicit operator Color(Color32 c) => new Color(c.r / 255f, c.g / 255f, c.b / 255f, c.a / 255f);
public static implicit operator Color32(Color c) => new Color32(
(byte)(Mathf.Clamp01(c.r) * 255f), (byte)(Mathf.Clamp01(c.g) * 255f),
(byte)(Mathf.Clamp01(c.b) * 255f), (byte)(Mathf.Clamp01(c.a) * 255f));
public static bool operator ==(Color a, Color b) => a.r == b.r && a.g == b.g && a.b == b.b && a.a == b.a;
public static bool operator !=(Color a, Color b) => !(a == b);
public override bool Equals(object o) => o is Color c && this == c;
public override int GetHashCode() => r.GetHashCode() ^ (g.GetHashCode() << 2) ^ (b.GetHashCode() << 4) ^ (a.GetHashCode() << 6);
}
public static class Mathf
{
public const float PI = 3.14159265f;
public const float Infinity = float.PositiveInfinity;
public const float NegativeInfinity = float.NegativeInfinity;
public const float Epsilon = 1.401298E-45f;
public const float Deg2Rad = PI / 180f;
public const float Rad2Deg = 180f / PI;
public static float Floor(float f) => (float)Math.Floor(f);
public static int FloorToInt(float f) => (int)Math.Floor(f);
public static float Ceil(float f) => (float)Math.Ceiling(f);
public static int CeilToInt(float f) => (int)Math.Ceiling(f);
public static float Round(float f) => (float)Math.Round(f);
public static int RoundToInt(float f) => (int)Math.Round(f);
public static float Abs(float f) => Math.Abs(f);
public static int Abs(int f) => Math.Abs(f);
public static float Max(float a, float b) => Math.Max(a, b);
public static int Max(int a, int b) => Math.Max(a, b);
public static float Max(params float[] values) { float m = float.NegativeInfinity; foreach (var v in values) m = Math.Max(m, v); return m; }
public static int Max(params int[] values) { int m = int.MinValue; foreach (var v in values) m = Math.Max(m, v); return m; }
public static float Min(float a, float b) => Math.Min(a, b);
public static int Min(int a, int b) => Math.Min(a, b);
public static float Min(params float[] values) { float m = float.PositiveInfinity; foreach (var v in values) m = Math.Min(m, v); return m; }
public static int Min(params int[] values) { int m = int.MaxValue; foreach (var v in values) m = Math.Min(m, v); return m; }
public static float Clamp(float v, float lo, float hi) => Math.Max(lo, Math.Min(hi, v));
public static int Clamp(int v, int lo, int hi) => Math.Max(lo, Math.Min(hi, v));
public static float Clamp01(float v) => Math.Max(0f, Math.Min(1f, v));
public static float Lerp(float a, float b, float t) => a + (b - a) * Clamp01(t);
public static float LerpUnclamped(float a, float b, float t) => a + (b - a) * t;
public static float LerpAngle(float a, float b, float t) => a + (b - a) * Clamp01(t);
public static float MoveTowards(float a, float b, float d) => b;
public static float SmoothDamp(float cur, float target, ref float vel, float time) { vel = 0; return target; }
public static float SmoothDamp(float cur, float target, ref float vel, float time, float maxSpeed) { vel = 0; return target; }
public static float SmoothDampAngle(float cur, float target, ref float vel, float time) { vel = 0; return target; }
public static float SmoothStep(float a, float b, float t) => Lerp(a, b, t);
public static float Sin(float f) => (float)Math.Sin(f);
public static float Cos(float f) => (float)Math.Cos(f);
public static float Tan(float f) => (float)Math.Tan(f);
public static float Asin(float f) => (float)Math.Asin(f);
public static float Acos(float f) => (float)Math.Acos(f);
public static float Atan(float f) => (float)Math.Atan(f);
public static float Atan2(float y, float x) => (float)Math.Atan2(y, x);
public static float Sqrt(float f) => (float)Math.Sqrt(f);
public static float Pow(float f, float p) => (float)Math.Pow(f, p);
public static float Exp(float f) => (float)Math.Exp(f);
public static float Log(float f) => (float)Math.Log(f);
public static float Log(float f, float b) => (float)Math.Log(f, b);
public static float Log10(float f) => (float)Math.Log10(f);
public static float Sign(float f) => Math.Sign(f);
public static bool Approximately(float a, float b) => Math.Abs(a - b) < 1e-6f;
public static float Repeat(float t, float length) => t - Floor(t / length) * length;
public static float PingPong(float t, float length) => length - Math.Abs(Repeat(t, length * 2) - length);
public static float DeltaAngle(float a, float b) => Repeat(b - a + 180f, 360f) - 180f;
public static float GammaToLinearSpace(float v) => v;
public static float LinearToGammaSpace(float v) => v;
}
public static class Debug
{
public static void Log(object m) { }
public static void LogFormat(string m, params object[] a) { }
public static void LogWarning(object m) { }
public static void LogError(object m) { }
public static void LogException(Exception e) { }
public static void Assert(bool c) { }
public static void DrawLine(Vector3 a, Vector3 b) { }
public static void DrawRay(Vector3 a, Vector3 b) { }
public static bool isDebugBuild => false;
}
}