예제 #1
0
파일: SceneFrame.cs 프로젝트: SylarLi/EGUI2
 private void DrawNetGrid()
 {
     PersistentGUI.BeginHandlesColor(UserSetting.NetGridLineColor);
     for (int x = 0, index = 0; x < rect.width; x += UserSetting.NetGridLineSpace, index += 1)
     {
         Handles.DrawAAPolyLine(UserSetting.NetGridLineWidth * (index % 10 == 0 ? 2 : 1), new Vector3(x, 0, 0),
                                new Vector3(x, rect.height, 0));
     }
     for (int y = 0, index = 0; y < rect.height; y += UserSetting.NetGridLineSpace, index += 1)
     {
         Handles.DrawAAPolyLine(UserSetting.NetGridLineWidth * (index % 10 == 0 ? 2 : 1), new Vector3(0, y, 0),
                                new Vector3(rect.width, y, 0));
     }
     PersistentGUI.EndHandlesColor();
 }
예제 #2
0
파일: SceneFrame.cs 프로젝트: SylarLi/EGUI2
        private void OnDrawSelection()
        {
            var selectedNodes = UserDatabase.selection.nodes;

            if (selectedNodes == null || selectedNodes.Length == 0)
            {
                return;
            }
            foreach (var selectedNode in selectedNodes)
            {
                PersistentGUI.BeginMatrix(GUI.matrix * selectedNode.guiMatrix);
                var localRect = selectedNode.localRect;
                var scale     = selectedNode.worldScale;
                scale.x = Mathf.Max(scale.x, 0.01f);
                scale.y = Mathf.Max(scale.y, 0.01f);
                var ww  = UserSetting.SceneNodeSelectionLineWidth / scale.x;
                var wh  = UserSetting.SceneNodeSelectionLineWidth / scale.y;
                var ww2 = ww * 0.5f;
                var wh2 = wh * 0.5f;
                PersistentGUI.BeginHandlesColor(UserSetting.SceneNodeSelectionColor);
                Handles.DrawAAPolyLine(wh,
                                       new Vector3(localRect.x + ww2, localRect.y + wh2, 0),
                                       new Vector3(localRect.xMax - ww2, localRect.y + wh2, 0));
                Handles.DrawAAPolyLine(ww,
                                       new Vector3(localRect.xMax - ww2, localRect.y + wh2, 0),
                                       new Vector3(localRect.xMax - ww2, localRect.yMax - wh2, 0));
                Handles.DrawAAPolyLine(wh,
                                       new Vector3(localRect.xMax - ww2, localRect.yMax - wh2, 0),
                                       new Vector3(localRect.x + ww2, localRect.yMax - wh2, 0));
                Handles.DrawAAPolyLine(ww,
                                       new Vector3(localRect.x + ww2, localRect.yMax - wh2, 0),
                                       new Vector3(localRect.x + ww2, localRect.y + wh2, 0));
                PersistentGUI.EndHandlesColor();
                PersistentGUI.EndMatrix();
            }
        }