From 18844b22338426485428996aebfd8dbdf809fe46 Mon Sep 17 00:00:00 2001 From: gamer147 Date: Fri, 3 Jul 2026 23:30:59 -0400 Subject: [PATCH] cull(engine-cleanup): pass-9 cascade round 2 after UIPanel stub --- SVSim.BattleEngine/Engine/BetterList.cs | 6 - SVSim.BattleEngine/Engine/NGUITools.cs | 64 ---------- SVSim.BattleEngine/Engine/UICamera.cs | 2 +- SVSim.BattleEngine/Engine/UIDrawCall.cs | 117 ------------------ SVSim.BattleEngine/Engine/UIGeometry.cs | 49 -------- SVSim.BattleEngine/Engine/UIPanel.cs | 8 +- SVSim.BattleEngine/Engine/UIRoot.cs | 2 - SVSim.BattleEngine/Engine/UIWidget.cs | 14 --- .../Shim/UnityEngine/UnityShim.cs | 8 +- .../Shim/UnityEngine/UnityShim2.cs | 1 - .../Shim/UnityEngine/UnityShimExt.cs | 8 -- 11 files changed, 5 insertions(+), 274 deletions(-) diff --git a/SVSim.BattleEngine/Engine/BetterList.cs b/SVSim.BattleEngine/Engine/BetterList.cs index 4b308f88..5f1cf408 100644 --- a/SVSim.BattleEngine/Engine/BetterList.cs +++ b/SVSim.BattleEngine/Engine/BetterList.cs @@ -114,10 +114,4 @@ public class BetterList } return default(T); } - - public T[] ToArray() - { - Trim(); - return buffer; - } } diff --git a/SVSim.BattleEngine/Engine/NGUITools.cs b/SVSim.BattleEngine/Engine/NGUITools.cs index 860b81d5..5fc8f52d 100644 --- a/SVSim.BattleEngine/Engine/NGUITools.cs +++ b/SVSim.BattleEngine/Engine/NGUITools.cs @@ -228,13 +228,6 @@ public static class NGUITools return gameObject.AddComponent(); } - public static T AddChild(GameObject parent, bool undo) where T : Component - { - GameObject gameObject = AddChild(parent, undo); - gameObject.name = GetTypeName(); - return gameObject.AddComponent(); - } - public static T AddWidget(GameObject go, int depth = int.MaxValue) where T : UIWidget { if (depth == int.MaxValue) @@ -353,23 +346,6 @@ public static class NGUITools } } - public static bool IsChild(Transform parent, Transform child) - { - if (parent == null || child == null) - { - return false; - } - while (child != null) - { - if (child == parent) - { - return true; - } - child = child.parent; - } - return false; - } - private static void Activate(Transform t, bool compatibilityMode) { SetActiveSelf(t.gameObject, state: true); @@ -592,46 +568,6 @@ public static class NGUITools return mSides; } - public static Vector3[] GetWorldCorners(this Camera cam, float depth, Transform relativeTo) - { - if (cam.orthographic) - { - float orthographicSize = cam.orthographicSize; - float num = 0f - orthographicSize; - float num2 = orthographicSize; - float y = 0f - orthographicSize; - float y2 = orthographicSize; - Rect rect = cam.rect; - Vector2 vector = screenSize; - float num3 = vector.x / vector.y; - num3 *= rect.width / rect.height; - num *= num3; - num2 *= num3; - Transform transform = cam.transform; - Quaternion rotation = transform.rotation; - Vector3 position = transform.position; - mSides[0] = rotation * new Vector3(num, y, depth) + position; - mSides[1] = rotation * new Vector3(num, y2, depth) + position; - mSides[2] = rotation * new Vector3(num2, y2, depth) + position; - mSides[3] = rotation * new Vector3(num2, y, depth) + position; - } - else - { - mSides[0] = cam.ViewportToWorldPoint(new Vector3(0f, 0f, depth)); - mSides[1] = cam.ViewportToWorldPoint(new Vector3(0f, 1f, depth)); - mSides[2] = cam.ViewportToWorldPoint(new Vector3(1f, 1f, depth)); - mSides[3] = cam.ViewportToWorldPoint(new Vector3(1f, 0f, depth)); - } - if (relativeTo != null) - { - for (int i = 0; i < 4; i++) - { - mSides[i] = relativeTo.InverseTransformPoint(mSides[i]); - } - } - return mSides; - } - public static void Execute(GameObject go, string funcName) where T : Component { T[] components = go.GetComponents(); diff --git a/SVSim.BattleEngine/Engine/UICamera.cs b/SVSim.BattleEngine/Engine/UICamera.cs index b8962d74..54c8ef8a 100644 --- a/SVSim.BattleEngine/Engine/UICamera.cs +++ b/SVSim.BattleEngine/Engine/UICamera.cs @@ -43,7 +43,7 @@ public class UICamera : MonoBehaviour public enum EventType { - UI_3D } +} public delegate bool GetKeyStateFunc(KeyCode key); diff --git a/SVSim.BattleEngine/Engine/UIDrawCall.cs b/SVSim.BattleEngine/Engine/UIDrawCall.cs index 08806e0c..4b25191d 100644 --- a/SVSim.BattleEngine/Engine/UIDrawCall.cs +++ b/SVSim.BattleEngine/Engine/UIDrawCall.cs @@ -32,30 +32,6 @@ public class UIDrawCall : MonoBehaviour [HideInInspector] public UIPanel panel; - [NonSerialized] - [HideInInspector] - public bool alwaysOnScreen; - - [NonSerialized] - [HideInInspector] - public BetterList verts = new BetterList(); - - [NonSerialized] - [HideInInspector] - public BetterList norms = new BetterList(); - - [NonSerialized] - [HideInInspector] - public BetterList tans = new BetterList(); - - [NonSerialized] - [HideInInspector] - public BetterList uvs = new BetterList(); - - [NonSerialized] - [HideInInspector] - public BetterList cols = new BetterList(); - private Material mMaterial; private Texture mTexture; @@ -64,34 +40,22 @@ public class UIDrawCall : MonoBehaviour private int mClipCount; - private Transform mTrans; - - private Mesh mMesh; - - private MeshFilter mFilter; - private MeshRenderer mRenderer; private Material mDynamicMat; - private int[] mIndices; - private bool mRebuildMat = true; private bool mLegacyShader; private int mRenderQueue = 3000; - private int mTriangles; - [NonSerialized] public bool isDirty; [NonSerialized] private bool mTextureClip; - public OnRenderCallback onRender; - private static List mCache = new List(10); private static int[] ClipRange = null; @@ -317,52 +281,6 @@ public class UIDrawCall : MonoBehaviour return mDynamicMat; } - private void UpdateMaterials() - { - if (!(panel == null)) - { - if (mRebuildMat || mDynamicMat == null || mClipCount != panel.clipCount || mTextureClip != (panel.clipping == Clipping.TextureMask)) - { - RebuildMaterial(); - mRebuildMat = false; - } - else if (mRenderer.sharedMaterial != mDynamicMat) - { - mRenderer.sharedMaterials = new Material[1] { mDynamicMat }; - } - } - } - - private int[] GenerateCachedIndexBuffer(int vertexCount, int indexCount) - { - int i = 0; - for (int count = mCache.Count; i < count; i++) - { - int[] array = mCache[i]; - if (array != null && array.Length == indexCount) - { - return array; - } - } - int[] array2 = new int[indexCount]; - int num = 0; - for (int j = 0; j < vertexCount; j += 4) - { - array2[num++] = j; - array2[num++] = j + 1; - array2[num++] = j + 2; - array2[num++] = j + 2; - array2[num++] = j + 3; - array2[num++] = j; - } - if (mCache.Count > 10) - { - mCache.RemoveAt(0); - } - mCache.Add(array2); - return array2; - } - private void Awake() { if (ClipRange == null) @@ -387,19 +305,6 @@ public class UIDrawCall : MonoBehaviour } } - private static UIDrawCall Create(string name, UIPanel pan, Material mat, Texture tex, Shader shader) - { - UIDrawCall uIDrawCall = Create(name); - uIDrawCall.gameObject.layer = pan.cachedGameObject.layer; - uIDrawCall.baseMaterial = mat; - uIDrawCall.mainTexture = tex; - uIDrawCall.shader = shader; - uIDrawCall.renderQueue = pan.startingRenderQueue; - uIDrawCall.sortingOrder = pan.sortingOrder; - uIDrawCall.manager = pan; - return uIDrawCall; - } - private static UIDrawCall Create(string name) { if (mInactiveList.size > 0) @@ -420,28 +325,6 @@ public class UIDrawCall : MonoBehaviour return uIDrawCall2; } - public static void ClearAll() - { - bool isPlaying = Application.isPlaying; - int num = mActiveList.size; - while (num > 0) - { - UIDrawCall uIDrawCall = mActiveList[--num]; - if ((bool)uIDrawCall) - { - if (isPlaying) - { - NGUITools.SetActive(uIDrawCall.gameObject, state: false); - } - else - { - NGUITools.DestroyImmediate(uIDrawCall.gameObject); - } - } - } - mActiveList.Clear(); - } - public static void ReleaseInactive() { int num = mInactiveList.size; diff --git a/SVSim.BattleEngine/Engine/UIGeometry.cs b/SVSim.BattleEngine/Engine/UIGeometry.cs index 9d2483a2..2f02b841 100644 --- a/SVSim.BattleEngine/Engine/UIGeometry.cs +++ b/SVSim.BattleEngine/Engine/UIGeometry.cs @@ -23,53 +23,4 @@ public class UIGeometry cols.Clear(); mRtpVerts.Clear(); } - - public void ApplyTransform(Matrix4x4 widgetToPanel, bool generateNormals = true) - { - if (verts.size > 0) - { - mRtpVerts.Clear(); - int i = 0; - for (int size = verts.size; i < size; i++) - { - mRtpVerts.Add(widgetToPanel.MultiplyPoint3x4(verts[i])); - } - if (generateNormals) - { - mRtpNormal = widgetToPanel.MultiplyVector(Vector3.back).normalized; - Vector3 normalized = widgetToPanel.MultiplyVector(Vector3.right).normalized; - mRtpTan = new Vector4(normalized.x, normalized.y, normalized.z, -1f); - } - } - else - { - mRtpVerts.Clear(); - } - } - - public void WriteToBuffers(BetterList v, BetterList u, BetterList c, BetterList n, BetterList t) - { - if (mRtpVerts == null || mRtpVerts.size <= 0) - { - return; - } - if (n == null) - { - for (int i = 0; i < mRtpVerts.size; i++) - { - v.Add(mRtpVerts.buffer[i]); - u.Add(uvs.buffer[i]); - c.Add(cols.buffer[i]); - } - return; - } - for (int j = 0; j < mRtpVerts.size; j++) - { - v.Add(mRtpVerts.buffer[j]); - u.Add(uvs.buffer[j]); - c.Add(cols.buffer[j]); - n.Add(mRtpNormal); - t.Add(mRtpTan); - } - } } diff --git a/SVSim.BattleEngine/Engine/UIPanel.cs b/SVSim.BattleEngine/Engine/UIPanel.cs index 05d64e96..374981d6 100644 --- a/SVSim.BattleEngine/Engine/UIPanel.cs +++ b/SVSim.BattleEngine/Engine/UIPanel.cs @@ -9,15 +9,10 @@ using UnityEngine; [AddComponentMenu("NGUI/UI/NGUI Panel")] public class UIPanel : UIRect { - public enum RenderQueue { Automatic} + public enum RenderQueue { } public delegate void OnGeometryUpdated(); public delegate void OnClippingMoved(UIPanel panel); - - public static List list = new List(); - public bool generateNormals; - public bool widgetsAreStatic; - public RenderQueue renderQueue; public int startingRenderQueue = 3000; public int depth; public UIDrawCall.Clipping clipping; @@ -40,7 +35,6 @@ public class UIPanel : UIRect public override void Invalidate(bool includeChildren) { } public bool hasCumulativeClipping => false; public Vector4 finalClipRegion => Vector4.zero; - public Matrix4x4 worldToLocal => Matrix4x4.identity; public int sortingOrder; public float height; diff --git a/SVSim.BattleEngine/Engine/UIRoot.cs b/SVSim.BattleEngine/Engine/UIRoot.cs index fd97c436..9cb8eebb 100644 --- a/SVSim.BattleEngine/Engine/UIRoot.cs +++ b/SVSim.BattleEngine/Engine/UIRoot.cs @@ -20,8 +20,6 @@ public class UIRoot : MonoBehaviour FitHeight } - public static List list = new List(); - public Scaling scalingStyle; public int manualWidth = 1280; diff --git a/SVSim.BattleEngine/Engine/UIWidget.cs b/SVSim.BattleEngine/Engine/UIWidget.cs index 5ac0005e..78467bf3 100644 --- a/SVSim.BattleEngine/Engine/UIWidget.cs +++ b/SVSim.BattleEngine/Engine/UIWidget.cs @@ -52,8 +52,6 @@ public class UIWidget : UIRect [SerializeField] protected int mDepth; - public OnDimensionsChanged onChange; - public OnPostFillCallback onPostFill; public bool autoResizeBoxCollider; @@ -79,9 +77,6 @@ public class UIWidget : UIRect [NonSerialized] protected Vector4 mDrawRegion = new Vector4(0f, 0f, 1f, 1f); - [NonSerialized] - private Matrix4x4 mLocalToPanel; - [NonSerialized] private bool mIsVisibleByAlpha = true; @@ -91,9 +86,6 @@ public class UIWidget : UIRect [NonSerialized] private bool mIsInFront = true; - [NonSerialized] - private float mLastAlpha; - [NonSerialized] private bool mMoved; @@ -106,12 +98,6 @@ public class UIWidget : UIRect [NonSerialized] private int mAlphaFrameID = -1; - private int mMatrixFrame = -1; - - private Vector3 mOldV0; - - private Vector3 mOldV1; - public Vector4 drawRegion { get diff --git a/SVSim.BattleEngine/Shim/UnityEngine/UnityShim.cs b/SVSim.BattleEngine/Shim/UnityEngine/UnityShim.cs index 2bf897dd..0188abd9 100644 --- a/SVSim.BattleEngine/Shim/UnityEngine/UnityShim.cs +++ b/SVSim.BattleEngine/Shim/UnityEngine/UnityShim.cs @@ -265,7 +265,7 @@ namespace UnityEngine } public class MeshRenderer : Renderer { } public class SpriteRenderer : Renderer { public Color color { get; set; } } - public class MeshFilter : Component { public Mesh mesh { get; set; } public Mesh sharedMesh { get; set; } } + public class MeshFilter : Component { public Mesh sharedMesh { get; set; } } public class ParticleSystem : Component { public int particleCount => 0; @@ -301,7 +301,7 @@ public int particleCount => 0; public void SetTexture(string n, Texture t) { } public void EnableKeyword(string k) { } } - public partial class Mesh : Object { public Vector3[] vertices { get; set; } public int[] triangles { get; set; } public void Clear() { } public void RecalculateBounds() { } } + public partial class Mesh : Object { } public class Texture : Object { public int width => 0; public int height => 0; } public partial class Texture2D : Texture { public Texture2D(int w, int h) { } public Texture2D(int w, int h, TextureFormat format, bool mipChain) { } public void Apply() { } public void SetPixel(int x, int y, Color c) { } } public enum WrapMode { Once = 1, Default = 0} @@ -335,15 +335,13 @@ public void Play(int hash, int layer, float normalizedTime) { } public int pixelHeight => 1080; public Rect rect { get; set; } public Rect pixelRect { get; set; } - public Color backgroundColor { get; set; } - public CameraClearFlags clearFlags { get; set; } public Vector3 ViewportToWorldPoint(Vector3 p) => p; public Vector3 WorldToViewportPoint(Vector3 p) => p; public Vector3 ScreenToWorldPoint(Vector3 p) => p; public Vector3 WorldToScreenPoint(Vector3 p) => p; public Ray ScreenPointToRay(Vector3 p) => default; } - public enum CameraClearFlags { Skybox = 1, Color = 2, Depth = 3} + public enum CameraClearFlags { } public partial struct CharacterInfo { } // ---- coroutine machinery (never pumped headless; types must exist) ---- diff --git a/SVSim.BattleEngine/Shim/UnityEngine/UnityShim2.cs b/SVSim.BattleEngine/Shim/UnityEngine/UnityShim2.cs index d39660da..003d3b00 100644 --- a/SVSim.BattleEngine/Shim/UnityEngine/UnityShim2.cs +++ b/SVSim.BattleEngine/Shim/UnityEngine/UnityShim2.cs @@ -32,7 +32,6 @@ namespace UnityEngine public class Collider2D : Component { public bool enabled { get; set; } } public partial class BoxCollider2D : Collider2D { public Vector2 offset { get; set; } public Vector2 size { get; set; } } public partial class Light : Behaviour { } - public class AudioListener : Behaviour { } public enum RuntimeInitializeLoadType { diff --git a/SVSim.BattleEngine/Shim/UnityEngine/UnityShimExt.cs b/SVSim.BattleEngine/Shim/UnityEngine/UnityShimExt.cs index 7b929020..753ad3b4 100644 --- a/SVSim.BattleEngine/Shim/UnityEngine/UnityShimExt.cs +++ b/SVSim.BattleEngine/Shim/UnityEngine/UnityShimExt.cs @@ -29,8 +29,6 @@ namespace UnityEngine public partial class Transform { - public bool hasChanged { get; set; } - public Matrix4x4 localToWorldMatrix => default; public Matrix4x4 worldToLocalMatrix => default; public void Translate(Vector3 translation, Space relativeTo) { } public void Rotate(Vector3 eulers, Space relativeTo) { } @@ -62,12 +60,6 @@ namespace UnityEngine 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 partial class Texture2D