cull(engine-cleanup): pass-9 cascade round 1 after UIPanel stub
This commit is contained in:
@@ -133,44 +133,6 @@ public static class NGUIMath
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Vector2 ConstrainRect(Vector2 minRect, Vector2 maxRect, Vector2 minArea, Vector2 maxArea)
|
||||
{
|
||||
Vector2 zero = Vector2.zero;
|
||||
float num = maxRect.x - minRect.x;
|
||||
float num2 = maxRect.y - minRect.y;
|
||||
float num3 = maxArea.x - minArea.x;
|
||||
float num4 = maxArea.y - minArea.y;
|
||||
if (num > num3)
|
||||
{
|
||||
float num5 = num - num3;
|
||||
minArea.x -= num5;
|
||||
maxArea.x += num5;
|
||||
}
|
||||
if (num2 > num4)
|
||||
{
|
||||
float num6 = num2 - num4;
|
||||
minArea.y -= num6;
|
||||
maxArea.y += num6;
|
||||
}
|
||||
if (minRect.x < minArea.x)
|
||||
{
|
||||
zero.x += minArea.x - minRect.x;
|
||||
}
|
||||
if (maxRect.x > maxArea.x)
|
||||
{
|
||||
zero.x -= maxRect.x - maxArea.x;
|
||||
}
|
||||
if (minRect.y < minArea.y)
|
||||
{
|
||||
zero.y += minArea.y - minRect.y;
|
||||
}
|
||||
if (maxRect.y > maxArea.y)
|
||||
{
|
||||
zero.y -= maxRect.y - maxArea.y;
|
||||
}
|
||||
return zero;
|
||||
}
|
||||
|
||||
public static Bounds CalculateAbsoluteWidgetBounds(Transform trans)
|
||||
{
|
||||
if (trans != null)
|
||||
|
||||
@@ -211,131 +211,6 @@ public static class NGUITools
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static UIPanel CreateUI(Transform trans, bool advanced3D, int layer)
|
||||
{
|
||||
UIRoot uIRoot = ((trans != null) ? FindInParents<UIRoot>(trans.gameObject) : null);
|
||||
if (uIRoot == null && UIRoot.list.Count > 0)
|
||||
{
|
||||
foreach (UIRoot item in UIRoot.list)
|
||||
{
|
||||
if (item.gameObject.layer == layer)
|
||||
{
|
||||
uIRoot = item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (uIRoot == null)
|
||||
{
|
||||
int i = 0;
|
||||
for (int count = UIPanel.list.Count; i < count; i++)
|
||||
{
|
||||
UIPanel uIPanel = UIPanel.list[i];
|
||||
GameObject gameObject = uIPanel.gameObject;
|
||||
if (gameObject.hideFlags == HideFlags.None && gameObject.layer == layer)
|
||||
{
|
||||
trans.parent = uIPanel.transform;
|
||||
trans.localScale = Vector3.one;
|
||||
return uIPanel;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (uIRoot != null)
|
||||
{
|
||||
UICamera componentInChildren = uIRoot.GetComponentInChildren<UICamera>();
|
||||
if (componentInChildren != null && componentInChildren.GetComponent<Camera>().orthographic == advanced3D)
|
||||
{
|
||||
trans = null;
|
||||
uIRoot = null;
|
||||
}
|
||||
}
|
||||
if (uIRoot == null)
|
||||
{
|
||||
GameObject gameObject2 = AddChild(null, undo: false);
|
||||
uIRoot = gameObject2.AddComponent<UIRoot>();
|
||||
if (layer == -1)
|
||||
{
|
||||
layer = LayerMask.NameToLayer("UI");
|
||||
}
|
||||
if (layer == -1)
|
||||
{
|
||||
layer = LayerMask.NameToLayer("2D UI");
|
||||
}
|
||||
gameObject2.layer = layer;
|
||||
if (advanced3D)
|
||||
{
|
||||
gameObject2.name = "UI Root (3D)";
|
||||
uIRoot.scalingStyle = UIRoot.Scaling.Constrained;
|
||||
}
|
||||
else
|
||||
{
|
||||
gameObject2.name = "UI Root";
|
||||
uIRoot.scalingStyle = UIRoot.Scaling.Flexible;
|
||||
}
|
||||
}
|
||||
UIPanel uIPanel2 = uIRoot.GetComponentInChildren<UIPanel>();
|
||||
if (uIPanel2 == null)
|
||||
{
|
||||
Camera[] array = FindActive<Camera>();
|
||||
float num = -1f;
|
||||
bool flag = false;
|
||||
int num2 = 1 << uIRoot.gameObject.layer;
|
||||
foreach (Camera camera in array)
|
||||
{
|
||||
if (camera.clearFlags == CameraClearFlags.Color || camera.clearFlags == CameraClearFlags.Skybox)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
num = Mathf.Max(num, camera.depth);
|
||||
camera.cullingMask &= ~num2;
|
||||
}
|
||||
Camera camera2 = AddChild<Camera>(uIRoot.gameObject, undo: false);
|
||||
camera2.gameObject.AddComponent<UICamera>();
|
||||
camera2.clearFlags = (flag ? CameraClearFlags.Depth : CameraClearFlags.Color);
|
||||
camera2.backgroundColor = Color.grey;
|
||||
camera2.cullingMask = num2;
|
||||
camera2.depth = num + 1f;
|
||||
if (advanced3D)
|
||||
{
|
||||
camera2.nearClipPlane = 0.1f;
|
||||
camera2.farClipPlane = 4f;
|
||||
camera2.transform.localPosition = new Vector3(0f, 0f, -700f);
|
||||
}
|
||||
else
|
||||
{
|
||||
camera2.orthographic = true;
|
||||
camera2.orthographicSize = 1f;
|
||||
camera2.nearClipPlane = -10f;
|
||||
camera2.farClipPlane = 10f;
|
||||
}
|
||||
AudioListener[] array2 = FindActive<AudioListener>();
|
||||
if (array2 == null || array2.Length == 0)
|
||||
{
|
||||
camera2.gameObject.AddComponent<AudioListener>();
|
||||
}
|
||||
uIPanel2 = uIRoot.gameObject.AddComponent<UIPanel>();
|
||||
}
|
||||
if (trans != null)
|
||||
{
|
||||
while (trans.parent != null)
|
||||
{
|
||||
trans = trans.parent;
|
||||
}
|
||||
if (IsChild(trans, uIPanel2.transform))
|
||||
{
|
||||
uIPanel2 = trans.gameObject.AddComponent<UIPanel>();
|
||||
}
|
||||
else
|
||||
{
|
||||
trans.parent = uIPanel2.transform;
|
||||
trans.localScale = Vector3.one;
|
||||
trans.localPosition = Vector3.zero;
|
||||
SetChildLayer(uIPanel2.cachedTransform, uIPanel2.cachedGameObject.layer);
|
||||
}
|
||||
}
|
||||
return uIPanel2;
|
||||
}
|
||||
|
||||
public static void SetChildLayer(Transform t, int layer)
|
||||
{
|
||||
for (int i = 0; i < t.childCount; i++)
|
||||
@@ -657,11 +532,6 @@ public static class NGUITools
|
||||
return val;
|
||||
}
|
||||
|
||||
public static Vector3[] GetSides(this Camera cam, float depth)
|
||||
{
|
||||
return cam.GetSides(depth, null);
|
||||
}
|
||||
|
||||
public static Vector3[] GetSides(this Camera cam, Transform relativeTo)
|
||||
{
|
||||
return cam.GetSides(Mathf.Lerp(cam.nearClipPlane, cam.farClipPlane, 0.5f), relativeTo);
|
||||
@@ -722,11 +592,6 @@ public static class NGUITools
|
||||
return mSides;
|
||||
}
|
||||
|
||||
public static Vector3[] GetWorldCorners(this Camera cam, float depth)
|
||||
{
|
||||
return cam.GetWorldCorners(depth, null);
|
||||
}
|
||||
|
||||
public static Vector3[] GetWorldCorners(this Camera cam, float depth, Transform relativeTo)
|
||||
{
|
||||
if (cam.orthographic)
|
||||
|
||||
@@ -9,8 +9,6 @@ public class SpringPosition : MonoBehaviour
|
||||
|
||||
public float strength = 10f;
|
||||
|
||||
public bool worldSpace;
|
||||
|
||||
public bool ignoreTimeScale;
|
||||
|
||||
public bool updateScrollView;
|
||||
|
||||
@@ -43,7 +43,6 @@ public class UICamera : MonoBehaviour
|
||||
|
||||
public enum EventType
|
||||
{
|
||||
World_3D,
|
||||
UI_3D }
|
||||
|
||||
public delegate bool GetKeyStateFunc(KeyCode key);
|
||||
@@ -100,8 +99,6 @@ public class UICamera : MonoBehaviour
|
||||
|
||||
public static OnScreenResize onScreenResize;
|
||||
|
||||
public EventType eventType = EventType.UI_3D;
|
||||
|
||||
public bool useMouse = true;
|
||||
|
||||
public bool useTouch = true;
|
||||
|
||||
@@ -24,14 +24,6 @@ public class UIDrawCall : MonoBehaviour
|
||||
[HideInInspector]
|
||||
public int widgetCount;
|
||||
|
||||
[NonSerialized]
|
||||
[HideInInspector]
|
||||
public int depthStart = int.MaxValue;
|
||||
|
||||
[NonSerialized]
|
||||
[HideInInspector]
|
||||
public int depthEnd = int.MinValue;
|
||||
|
||||
[NonSerialized]
|
||||
[HideInInspector]
|
||||
public UIPanel manager;
|
||||
@@ -40,10 +32,6 @@ public class UIDrawCall : MonoBehaviour
|
||||
[HideInInspector]
|
||||
public UIPanel panel;
|
||||
|
||||
[NonSerialized]
|
||||
[HideInInspector]
|
||||
public Texture2D clipTexture;
|
||||
|
||||
[NonSerialized]
|
||||
[HideInInspector]
|
||||
public bool alwaysOnScreen;
|
||||
@@ -148,18 +136,6 @@ public class UIDrawCall : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public Transform cachedTransform
|
||||
{
|
||||
get
|
||||
{
|
||||
if (mTrans == null)
|
||||
{
|
||||
mTrans = base.transform;
|
||||
}
|
||||
return mTrans;
|
||||
}
|
||||
}
|
||||
|
||||
public Material baseMaterial
|
||||
{
|
||||
get
|
||||
@@ -357,125 +333,6 @@ public class UIDrawCall : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateGeometry(int widgetCount)
|
||||
{
|
||||
this.widgetCount = widgetCount;
|
||||
int size = verts.size;
|
||||
if (size > 0 && size == uvs.size && size == cols.size && size % 4 == 0)
|
||||
{
|
||||
if (mFilter == null)
|
||||
{
|
||||
mFilter = base.gameObject.GetComponent<MeshFilter>();
|
||||
}
|
||||
if (mFilter == null)
|
||||
{
|
||||
mFilter = base.gameObject.AddComponent<MeshFilter>();
|
||||
}
|
||||
if (verts.size < 65000)
|
||||
{
|
||||
int num = (size >> 1) * 3;
|
||||
bool flag = mIndices == null || mIndices.Length != num;
|
||||
if (mMesh == null)
|
||||
{
|
||||
mMesh = new Mesh();
|
||||
mMesh.hideFlags = HideFlags.DontSave;
|
||||
mMesh.name = ((mMaterial != null) ? ("[NGUI] " + mMaterial.name) : "[NGUI] Mesh");
|
||||
mMesh.MarkDynamic();
|
||||
flag = true;
|
||||
}
|
||||
bool flag2 = uvs.buffer.Length != verts.buffer.Length || cols.buffer.Length != verts.buffer.Length || (norms.buffer != null && norms.buffer.Length != verts.buffer.Length) || (tans.buffer != null && tans.buffer.Length != verts.buffer.Length);
|
||||
if (!flag2 && panel != null && panel.renderQueue != UIPanel.RenderQueue.Automatic)
|
||||
{
|
||||
flag2 = mMesh == null || mMesh.vertexCount != verts.buffer.Length;
|
||||
}
|
||||
if (!flag2 && verts.size << 1 < verts.buffer.Length)
|
||||
{
|
||||
flag2 = true;
|
||||
}
|
||||
mTriangles = verts.size >> 1;
|
||||
if (flag2 || verts.buffer.Length > 65000)
|
||||
{
|
||||
if (flag2 || mMesh.vertexCount != verts.size)
|
||||
{
|
||||
mMesh.Clear();
|
||||
flag = true;
|
||||
}
|
||||
mMesh.vertices = verts.ToArray();
|
||||
mMesh.uv = uvs.ToArray();
|
||||
mMesh.colors32 = cols.ToArray();
|
||||
if (norms != null)
|
||||
{
|
||||
mMesh.normals = norms.ToArray();
|
||||
}
|
||||
if (tans != null)
|
||||
{
|
||||
mMesh.tangents = tans.ToArray();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mMesh.vertexCount != verts.buffer.Length)
|
||||
{
|
||||
mMesh.Clear();
|
||||
flag = true;
|
||||
}
|
||||
mMesh.vertices = verts.buffer;
|
||||
mMesh.uv = uvs.buffer;
|
||||
mMesh.colors32 = cols.buffer;
|
||||
if (norms != null)
|
||||
{
|
||||
mMesh.normals = norms.buffer;
|
||||
}
|
||||
if (tans != null)
|
||||
{
|
||||
mMesh.tangents = tans.buffer;
|
||||
}
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
mIndices = GenerateCachedIndexBuffer(size, num);
|
||||
mMesh.triangles = mIndices;
|
||||
}
|
||||
if (flag2 || !alwaysOnScreen)
|
||||
{
|
||||
mMesh.RecalculateBounds();
|
||||
}
|
||||
mFilter.mesh = mMesh;
|
||||
}
|
||||
else
|
||||
{
|
||||
mTriangles = 0;
|
||||
if (mFilter.mesh != null)
|
||||
{
|
||||
mFilter.mesh.Clear();
|
||||
}
|
||||
Debug.LogError("Too many vertices on one panel: " + verts.size);
|
||||
}
|
||||
if (mRenderer == null)
|
||||
{
|
||||
mRenderer = base.gameObject.GetComponent<MeshRenderer>();
|
||||
}
|
||||
if (mRenderer == null)
|
||||
{
|
||||
mRenderer = base.gameObject.AddComponent<MeshRenderer>();
|
||||
}
|
||||
UpdateMaterials();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mFilter.mesh != null)
|
||||
{
|
||||
mFilter.mesh.Clear();
|
||||
}
|
||||
Debug.LogError("UIWidgets must fill the buffer with 4 vertices per quad. Found " + size);
|
||||
}
|
||||
verts.Clear();
|
||||
uvs.Clear();
|
||||
cols.Clear();
|
||||
norms.Clear();
|
||||
tans.Clear();
|
||||
}
|
||||
|
||||
private int[] GenerateCachedIndexBuffer(int vertexCount, int indexCount)
|
||||
{
|
||||
int i = 0;
|
||||
@@ -530,11 +387,6 @@ public class UIDrawCall : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public static UIDrawCall Create(UIPanel panel, Material mat, Texture tex, Shader shader)
|
||||
{
|
||||
return Create(null, panel, mat, tex, shader);
|
||||
}
|
||||
|
||||
private static UIDrawCall Create(string name, UIPanel pan, Material mat, Texture tex, Shader shader)
|
||||
{
|
||||
UIDrawCall uIDrawCall = Create(name);
|
||||
@@ -590,12 +442,6 @@ public class UIDrawCall : MonoBehaviour
|
||||
mActiveList.Clear();
|
||||
}
|
||||
|
||||
public static void ReleaseAll()
|
||||
{
|
||||
ClearAll();
|
||||
ReleaseInactive();
|
||||
}
|
||||
|
||||
public static void ReleaseInactive()
|
||||
{
|
||||
int num = mInactiveList.size;
|
||||
@@ -609,26 +455,4 @@ public class UIDrawCall : MonoBehaviour
|
||||
}
|
||||
mInactiveList.Clear();
|
||||
}
|
||||
|
||||
public static void Destroy(UIDrawCall dc)
|
||||
{
|
||||
if (!dc)
|
||||
{
|
||||
return;
|
||||
}
|
||||
dc.onRender = null;
|
||||
if (Application.isPlaying)
|
||||
{
|
||||
if (mActiveList.Remove(dc))
|
||||
{
|
||||
NGUITools.SetActive(dc.gameObject, state: false);
|
||||
mInactiveList.Add(dc);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mActiveList.Remove(dc);
|
||||
NGUITools.DestroyImmediate(dc.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,27 +9,20 @@ using UnityEngine;
|
||||
[AddComponentMenu("NGUI/UI/NGUI Panel")]
|
||||
public class UIPanel : UIRect
|
||||
{
|
||||
public enum RenderQueue { Automatic, StartAt, Explicit }
|
||||
public enum RenderQueue { Automatic}
|
||||
|
||||
public delegate void OnGeometryUpdated();
|
||||
public delegate void OnClippingMoved(UIPanel panel);
|
||||
|
||||
public static List<UIPanel> list = new List<UIPanel>();
|
||||
|
||||
public OnGeometryUpdated onGeometryUpdated;
|
||||
public bool generateNormals;
|
||||
public bool widgetsAreStatic;
|
||||
public bool cullWhileDragging = true;
|
||||
public bool alwaysOnScreen;
|
||||
public bool anchorOffset;
|
||||
public bool softBorderPadding = true;
|
||||
public RenderQueue renderQueue;
|
||||
public int startingRenderQueue = 3000;
|
||||
public int depth;
|
||||
public UIDrawCall.Clipping clipping;
|
||||
public Vector4 baseClipRegion;
|
||||
public Vector2 clipSoftness;
|
||||
public bool hasMoved;
|
||||
public Vector2 clipOffset;
|
||||
public int clipCount;
|
||||
|
||||
@@ -45,9 +38,6 @@ public class UIPanel : UIRect
|
||||
// UIRect virtual overrides
|
||||
public override bool canBeAnchored => false;
|
||||
public override void Invalidate(bool includeChildren) { }
|
||||
|
||||
public bool hasClipping => false;
|
||||
public bool hasRectClipping => false;
|
||||
public bool hasCumulativeClipping => false;
|
||||
public Vector4 finalClipRegion => Vector4.zero;
|
||||
public Matrix4x4 worldToLocal => Matrix4x4.identity;
|
||||
@@ -61,10 +51,7 @@ public class UIPanel : UIRect
|
||||
public bool IsVisible(UIWidget w) => true;
|
||||
public Vector3 CalculateConstrainOffset(Vector3 min, Vector3 max) => Vector3.zero;
|
||||
public bool ConstrainTargetToBounds(Transform target, bool immediate) => false;
|
||||
public static int CompareFunc(UIPanel a, UIPanel b) => 0;
|
||||
public static UIPanel Find(Transform trans, bool createIfMissing, int layer) => null;
|
||||
public UIDrawCall FindDrawCall(UIWidget w) => null;
|
||||
public void AddWidget(UIWidget w) { }
|
||||
public void RemoveWidget(UIWidget w) { }
|
||||
public void SetDirty() { }
|
||||
}
|
||||
|
||||
@@ -26,8 +26,6 @@ public class UIScrollView : MonoBehaviour
|
||||
|
||||
public delegate void OnDragNotification();
|
||||
|
||||
public static BetterList<UIScrollView> list = new BetterList<UIScrollView>();
|
||||
|
||||
public Movement movement;
|
||||
|
||||
public DragEffect dragEffect = DragEffect.MomentumAndSpring;
|
||||
@@ -97,18 +95,6 @@ public class UIScrollView : MonoBehaviour
|
||||
|
||||
public UIPanel panel => mPanel;
|
||||
|
||||
public bool isDragging
|
||||
{
|
||||
get
|
||||
{
|
||||
if (mPressed)
|
||||
{
|
||||
return mDragStarted;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual Bounds bounds
|
||||
{
|
||||
get
|
||||
@@ -495,21 +481,6 @@ public class UIScrollView : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdatePosition()
|
||||
{
|
||||
if (!mIgnoreCallbacks && (horizontalScrollBar != null || verticalScrollBar != null))
|
||||
{
|
||||
mIgnoreCallbacks = true;
|
||||
mCalculatedBounds = false;
|
||||
Vector2 pivotOffset = NGUIMath.GetPivotOffset(contentPivot);
|
||||
float x = ((horizontalScrollBar != null) ? horizontalScrollBar.value : pivotOffset.x);
|
||||
float y = ((verticalScrollBar != null) ? verticalScrollBar.value : (1f - pivotOffset.y));
|
||||
SetDragAmount(x, y, updateScrollbars: false);
|
||||
UpdateScrollbars(recalculateBounds: true);
|
||||
mIgnoreCallbacks = false;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void MoveRelative(Vector3 relative)
|
||||
{
|
||||
mTrans.localPosition += relative;
|
||||
|
||||
@@ -56,8 +56,6 @@ public class UIWidget : UIRect
|
||||
|
||||
public OnPostFillCallback onPostFill;
|
||||
|
||||
public UIDrawCall.OnRenderCallback mOnRender;
|
||||
|
||||
public bool autoResizeBoxCollider;
|
||||
|
||||
public bool hideIfOffScreen;
|
||||
@@ -655,39 +653,6 @@ public class UIWidget : UIRect
|
||||
}
|
||||
}
|
||||
|
||||
[DebuggerHidden]
|
||||
[DebuggerStepThrough]
|
||||
public static int PanelCompareFunc(UIWidget left, UIWidget right)
|
||||
{
|
||||
if (left.mDepth < right.mDepth)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if (left.mDepth > right.mDepth)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
Material material = left.material;
|
||||
Material material2 = right.material;
|
||||
if (material == material2)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (material == null)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (material2 == null)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if (material.GetInstanceID() >= material2.GetInstanceID())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public Bounds CalculateBounds(Transform relativeParent)
|
||||
{
|
||||
if (relativeParent == null)
|
||||
@@ -959,118 +924,6 @@ public class UIWidget : UIRect
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool UpdateTransform(int frame)
|
||||
{
|
||||
Transform transform = base.cachedTransform;
|
||||
mPlayMode = Application.isPlaying;
|
||||
if (mMoved)
|
||||
{
|
||||
mMoved = true;
|
||||
mMatrixFrame = -1;
|
||||
transform.hasChanged = false;
|
||||
Vector2 vector = pivotOffset;
|
||||
float num = (0f - vector.x) * (float)mWidth;
|
||||
float num2 = (0f - vector.y) * (float)mHeight;
|
||||
float x = num + (float)mWidth;
|
||||
float y = num2 + (float)mHeight;
|
||||
mOldV0 = panel.worldToLocal.MultiplyPoint3x4(transform.TransformPoint(num, num2, 0f));
|
||||
mOldV1 = panel.worldToLocal.MultiplyPoint3x4(transform.TransformPoint(x, y, 0f));
|
||||
}
|
||||
else if (!panel.widgetsAreStatic && transform.hasChanged)
|
||||
{
|
||||
mMatrixFrame = -1;
|
||||
transform.hasChanged = false;
|
||||
Vector2 vector2 = pivotOffset;
|
||||
float num3 = (0f - vector2.x) * (float)mWidth;
|
||||
float num4 = (0f - vector2.y) * (float)mHeight;
|
||||
float x2 = num3 + (float)mWidth;
|
||||
float y2 = num4 + (float)mHeight;
|
||||
Vector3 vector3 = panel.worldToLocal.MultiplyPoint3x4(transform.TransformPoint(num3, num4, 0f));
|
||||
Vector3 vector4 = panel.worldToLocal.MultiplyPoint3x4(transform.TransformPoint(x2, y2, 0f));
|
||||
if (Vector3.SqrMagnitude(mOldV0 - vector3) > 1E-06f || Vector3.SqrMagnitude(mOldV1 - vector4) > 1E-06f)
|
||||
{
|
||||
mMoved = true;
|
||||
mOldV0 = vector3;
|
||||
mOldV1 = vector4;
|
||||
}
|
||||
}
|
||||
if (mMoved && onChange != null)
|
||||
{
|
||||
onChange();
|
||||
}
|
||||
if (!mMoved)
|
||||
{
|
||||
return mChanged;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool UpdateGeometry(int frame)
|
||||
{
|
||||
float num = CalculateFinalAlpha(frame);
|
||||
if (mIsVisibleByAlpha && mLastAlpha != num)
|
||||
{
|
||||
mChanged = true;
|
||||
}
|
||||
mLastAlpha = num;
|
||||
if (mChanged)
|
||||
{
|
||||
if (mIsVisibleByAlpha && num > 0.001f && shader != null)
|
||||
{
|
||||
bool result = geometry.hasVertices;
|
||||
if (fillGeometry)
|
||||
{
|
||||
geometry.Clear();
|
||||
OnFill(geometry.verts, geometry.uvs, geometry.cols);
|
||||
}
|
||||
if (geometry.hasVertices)
|
||||
{
|
||||
if (mMatrixFrame != frame)
|
||||
{
|
||||
mLocalToPanel = panel.worldToLocal * base.cachedTransform.localToWorldMatrix;
|
||||
mMatrixFrame = frame;
|
||||
}
|
||||
geometry.ApplyTransform(mLocalToPanel, panel.generateNormals);
|
||||
mMoved = false;
|
||||
mChanged = false;
|
||||
return true;
|
||||
}
|
||||
mChanged = false;
|
||||
return result;
|
||||
}
|
||||
if (geometry.hasVertices)
|
||||
{
|
||||
if (fillGeometry)
|
||||
{
|
||||
geometry.Clear();
|
||||
}
|
||||
mMoved = false;
|
||||
mChanged = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (mMoved && geometry.hasVertices)
|
||||
{
|
||||
if (mMatrixFrame != frame)
|
||||
{
|
||||
mLocalToPanel = panel.worldToLocal * base.cachedTransform.localToWorldMatrix;
|
||||
mMatrixFrame = frame;
|
||||
}
|
||||
geometry.ApplyTransform(mLocalToPanel, panel.generateNormals);
|
||||
mMoved = false;
|
||||
mChanged = false;
|
||||
return true;
|
||||
}
|
||||
mMoved = false;
|
||||
mChanged = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
public void WriteToBuffers(BetterList<Vector3> v, BetterList<Vector2> u, BetterList<Color32> c, BetterList<Vector3> n, BetterList<Vector4> t)
|
||||
{
|
||||
geometry.WriteToBuffers(v, u, c, n, t);
|
||||
}
|
||||
|
||||
public virtual void MakePixelPerfect()
|
||||
{
|
||||
Vector3 localPosition = base.cachedTransform.localPosition;
|
||||
|
||||
@@ -123,7 +123,6 @@ namespace UnityEngine
|
||||
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));
|
||||
|
||||
@@ -133,7 +133,6 @@ namespace UnityEngine
|
||||
public void SetParent(Transform p, bool worldPositionStays) { }
|
||||
public void SetSiblingIndex(int i) { }
|
||||
public int GetSiblingIndex() => 0;
|
||||
public Vector3 lossyScale => Vector3.one;
|
||||
public Vector3 up { get => Vector3.up; set { } }
|
||||
public Vector3 TransformPoint(Vector3 p) => p;
|
||||
public Vector3 TransformPoint(float x, float y, float z) => new Vector3(x, y, z);
|
||||
@@ -381,7 +380,7 @@ public void Play(int hash, int layer, float normalizedTime) { }
|
||||
public static int targetFrameRate { get; set; }
|
||||
public static RuntimePlatform platform => RuntimePlatform.WindowsPlayer;
|
||||
}
|
||||
public enum RuntimePlatform { WindowsPlayer, OSXPlayer, IPhonePlayer, Android, WindowsEditor, OSXEditor, XBOX360, BlackBerryPlayer}
|
||||
public enum RuntimePlatform { WindowsPlayer, OSXPlayer, IPhonePlayer, Android, OSXEditor, BlackBerryPlayer}
|
||||
public static partial class Time
|
||||
{
|
||||
public static float deltaTime => 0f;
|
||||
|
||||
@@ -51,8 +51,6 @@ namespace UnityEngine
|
||||
|
||||
public partial class Rigidbody
|
||||
{
|
||||
public bool isKinematic { get; set; }
|
||||
public bool useGravity { get; set; }
|
||||
public void MovePosition(Vector3 position) { }
|
||||
public void MoveRotation(Quaternion rotation) { }
|
||||
}
|
||||
|
||||
@@ -46,8 +46,6 @@ namespace UnityEngine
|
||||
public static string deviceUniqueIdentifier => "";
|
||||
public static string operatingSystem => "";
|
||||
public static string graphicsDeviceName => "";
|
||||
public static string graphicsDeviceVersion => "";
|
||||
public static int graphicsShaderLevel => 0;
|
||||
public static int systemMemorySize => 0;
|
||||
public static int processorCount => 1;
|
||||
public static bool SupportsTextureFormat(TextureFormat format) => true;
|
||||
|
||||
Reference in New Issue
Block a user