port(m1): wave 7j — Material/Plane/Socket overloads + IDictionary extension (24->12)

- Material.SetVector(int nameID, Vector4); Plane(Vector3, float d) ctor; Socket.On
  (SocketIOEventTypes, callback) overload.
- Global GetValueOrDefault(this IDictionary<,>) extension — the BCL form only binds to
  IReadOnlyDictionary, so the IDictionary call mis-resolved to JsonDataExtension.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-06-06 01:00:12 -04:00
parent ad58994b8e
commit f63d1cc2e2
3 changed files with 13 additions and 1 deletions

View File

@@ -99,3 +99,13 @@ namespace BestHTTP.Decompression.Zlib
public static class TimeNativePlugin { public static float GetDeviceOperatingTime() => 0f; }
public static class Packsize { public static bool Test() => true; }
public static class DllCheck { public static bool Test() => true; }
// The BCL's CollectionExtensions.GetValueOrDefault only binds to IReadOnlyDictionary;
// copied code calls it on an IDictionary<,> static type (where the only by-name match is
// the copied JsonDataExtension.GetValueOrDefault(JsonData,...) — wrong receiver). Supply the
// IDictionary form globally so the call resolves.
public static class ShimDictionaryExtensions
{
public static TValue GetValueOrDefault<TKey, TValue>(this System.Collections.Generic.IDictionary<TKey, TValue> dict, TKey key, TValue defaultValue)
=> dict != null && dict.TryGetValue(key, out var v) ? v : defaultValue;
}

View File

@@ -47,7 +47,7 @@ namespace UnityEngine
public override int GetHashCode() => x.GetHashCode() ^ (y.GetHashCode() << 2) ^ (width.GetHashCode() << 4) ^ (height.GetHashCode() << 6);
}
public struct Matrix4x4 { public static Matrix4x4 identity => new Matrix4x4(); public Vector3 MultiplyPoint(Vector3 p) => p; public Vector3 MultiplyPoint3x4(Vector3 p) => p; public Vector3 MultiplyVector(Vector3 v) => v; public static Matrix4x4 TRS(Vector3 t, Quaternion r, Vector3 s) => identity; public Matrix4x4 inverse => identity; public static Matrix4x4 operator *(Matrix4x4 a, Matrix4x4 b) => identity; public Vector4 GetColumn(int i) => default; public Vector4 GetRow(int i) => default; public float this[int row, int col] { get => 0f; set { } } }
public struct Plane { public Plane(Vector3 normal, Vector3 point) { } public Plane(Vector3 a, Vector3 b, Vector3 c) { } public bool Raycast(Ray r, out float enter) { enter = 0; return false; } }
public struct Plane { public Plane(Vector3 normal, Vector3 point) { } public Plane(Vector3 inNormal, float d) { } public Plane(Vector3 a, Vector3 b, Vector3 c) { } public bool Raycast(Ray r, out float enter) { enter = 0; return false; } }
public struct Ray { public Ray(Vector3 origin, Vector3 dir) { this.origin = origin; this.direction = dir; } public Vector3 origin; public Vector3 direction; public Vector3 GetPoint(float d) => origin; }
public struct RaycastHit { public Vector3 point; public Vector3 normal; public float distance; public Collider collider; public Transform transform; public GameObject gameObject; }
public struct RaycastHit2D { public Vector3 point; public Vector3 normal; public float distance; public Collider2D collider; public Transform transform; public static implicit operator bool(RaycastHit2D hit) => hit.collider != null; }
@@ -281,6 +281,7 @@ namespace UnityEngine
public void SetColor(string n, Color c) { }
public void SetTexture(string n, Texture t) { }
public void SetVector(string n, Vector4 v) { }
public void SetVector(int nameID, Vector4 v) { }
public void SetMatrix(string n, Matrix4x4 m) { }
public void SetTextureOffset(string n, Vector2 o) { }
public void EnableKeyword(string k) { }

View File

@@ -142,6 +142,7 @@ namespace BestHTTP.SocketIO
{
public string Id => "";
public Socket On(string eventName, SocketIOCallback callback) => this;
public Socket On(BestHTTP.SocketIO.SocketIOEventTypes type, SocketIOCallback callback) => this;
public Socket Off(string eventName) => this;
public Socket Off() => this;
public Socket Emit(string eventName, params object[] args) => this;