public static void DrawSelectionGos() { if (Selection.transforms == null) { return; } RectTransform rectTransform; for (var index = 0; index < Selection.transforms.Length; index++) { rectTransform = Selection.transforms[index] as RectTransform; if (rectTransform == null) { continue; } SceneEditorUpdateManager.DrawCollider(rectTransform.position, rectTransform.rect, s_SelectColor); } }
private void EditorDrawLockMark() { if (!m_DrawLock || m_LockGos == null || m_LockGos.Count == 0) { return; } RectTransform rectTransform; Vector3 transformPos; Rect transformRect; Vector2 center; float lockWidth; float lockHeight; float lockTop; List <GameObject> Temp = new List <GameObject>(); for (var index = 0; index < m_LockGos.Count; index++) { if (m_LockGos[index] == null) { Temp.Add(m_LockGos[index]); continue; } rectTransform = m_LockGos[index].transform as RectTransform; if (rectTransform == null) { Renderer renderer = m_LockGos[index].GetComponent <Renderer>(); if (renderer == null) { continue; } transformPos = m_LockGos[index].transform.position; center = Vector3.zero; transformRect = new Rect(-renderer.bounds.size.x * 0.5f, -renderer.bounds.size.y * 0.5f, renderer.bounds.size.x, renderer.bounds.size.y); } else { transformRect = rectTransform.rect; transformPos = rectTransform.position; center = transformRect.center; } //边框 SceneEditorUpdateManager.DrawCollider(transformPos, transformRect, m_LockColor); lockWidth = transformRect.width * 0.4f; lockHeight = transformRect.height * 0.2f; //锁 SceneEditorUpdateManager.DrawCollider(transformPos, new Rect(center.x - lockWidth * 0.5f, center.y - lockHeight * 0.5f, lockWidth, lockHeight), m_LockColor); lockWidth = lockWidth * 0.2f; lockHeight = lockHeight * 0.5f; lockTop = lockHeight * 2; Handles.DrawLines(new Vector3[] { transformPos + new Vector3(center.x + lockWidth, center.y + lockHeight), transformPos + new Vector3(center.x + lockWidth, center.y + lockTop), transformPos + new Vector3(center.x - lockWidth, center.y + lockHeight), transformPos + new Vector3(center.x - lockWidth, center.y + lockTop), transformPos + new Vector3(center.x + lockWidth, center.y + lockTop), transformPos + new Vector3(center.x - lockWidth, center.y + lockTop) }); } for (int index = 0; index < Temp.Count; index++) { RemoveLockGoInstanceGo(Temp[index]); } }