cull(engine-cleanup): pass-9 cascade round 2 after UIPanel stub
This commit is contained in:
@@ -114,10 +114,4 @@ public class BetterList<T>
|
||||
}
|
||||
return default(T);
|
||||
}
|
||||
|
||||
public T[] ToArray()
|
||||
{
|
||||
Trim();
|
||||
return buffer;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,13 +228,6 @@ public static class NGUITools
|
||||
return gameObject.AddComponent<T>();
|
||||
}
|
||||
|
||||
public static T AddChild<T>(GameObject parent, bool undo) where T : Component
|
||||
{
|
||||
GameObject gameObject = AddChild(parent, undo);
|
||||
gameObject.name = GetTypeName<T>();
|
||||
return gameObject.AddComponent<T>();
|
||||
}
|
||||
|
||||
public static T AddWidget<T>(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<T>(GameObject go, string funcName) where T : Component
|
||||
{
|
||||
T[] components = go.GetComponents<T>();
|
||||
|
||||
@@ -43,7 +43,7 @@ public class UICamera : MonoBehaviour
|
||||
|
||||
public enum EventType
|
||||
{
|
||||
UI_3D }
|
||||
}
|
||||
|
||||
public delegate bool GetKeyStateFunc(KeyCode key);
|
||||
|
||||
|
||||
@@ -32,30 +32,6 @@ public class UIDrawCall : MonoBehaviour
|
||||
[HideInInspector]
|
||||
public UIPanel panel;
|
||||
|
||||
[NonSerialized]
|
||||
[HideInInspector]
|
||||
public bool alwaysOnScreen;
|
||||
|
||||
[NonSerialized]
|
||||
[HideInInspector]
|
||||
public BetterList<Vector3> verts = new BetterList<Vector3>();
|
||||
|
||||
[NonSerialized]
|
||||
[HideInInspector]
|
||||
public BetterList<Vector3> norms = new BetterList<Vector3>();
|
||||
|
||||
[NonSerialized]
|
||||
[HideInInspector]
|
||||
public BetterList<Vector4> tans = new BetterList<Vector4>();
|
||||
|
||||
[NonSerialized]
|
||||
[HideInInspector]
|
||||
public BetterList<Vector2> uvs = new BetterList<Vector2>();
|
||||
|
||||
[NonSerialized]
|
||||
[HideInInspector]
|
||||
public BetterList<Color32> cols = new BetterList<Color32>();
|
||||
|
||||
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<int[]> mCache = new List<int[]>(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;
|
||||
|
||||
@@ -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<Vector3> v, BetterList<Vector2> u, BetterList<Color32> c, BetterList<Vector3> n, BetterList<Vector4> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<UIPanel> list = new List<UIPanel>();
|
||||
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;
|
||||
|
||||
|
||||
@@ -20,8 +20,6 @@ public class UIRoot : MonoBehaviour
|
||||
FitHeight
|
||||
}
|
||||
|
||||
public static List<UIRoot> list = new List<UIRoot>();
|
||||
|
||||
public Scaling scalingStyle;
|
||||
|
||||
public int manualWidth = 1280;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) ----
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user