当前位置: 首页>>代码示例>>C#>>正文


C# SceneView.FrameSelected方法代码示例

本文整理汇总了C#中UnityEditor.SceneView.FrameSelected方法的典型用法代码示例。如果您正苦于以下问题:C# SceneView.FrameSelected方法的具体用法?C# SceneView.FrameSelected怎么用?C# SceneView.FrameSelected使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEditor.SceneView的用法示例。


在下文中一共展示了SceneView.FrameSelected方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnGUI


//.........这里部分代码省略.........
					}
				}
				num5++;
			}
			Color centerColor2 = Handles.centerColor;
			centerColor2.a *= this.faded2Dgray * this.m_Visible.faded;
			if (centerColor2.a > 0f)
			{
				GUI.color = centerColor2;
				GUI.Label(rect, SceneViewRotation.kDirNames[num2], SceneViewRotation.styles.viewLabelStyleCentered);
			}
			if (this.faded2Dgray < 1f)
			{
				this.DrawIsoStatusSymbol(new Vector3(position.x - 8f, position.y + 8.5f, 0f), view, 1f - this.faded2Dgray);
			}
			Handles.EndGUI();
			for (int j = 0; j < 3; j++)
			{
				Vector3 rhs = SceneViewRotation.kDirectionRotations[j] * Vector3.forward;
				this.dirVisible[j].target = (Mathf.Abs(Vector3.Dot(camera.transform.forward, rhs)) < 0.9f);
			}
			float num6 = HandleUtility.GetHandleSize(Vector3.zero) * 0.2f;
			this.AxisSelectors(view, camera, num6, -1f, SceneViewRotation.styles.viewAxisLabelStyle);
			Color color = Handles.centerColor;
			color = Color.Lerp(color, Color.gray, this.faded2Dgray);
			color.a *= this.m_Visible.faded;
			if (color.a <= 0.1f)
			{
				GUI.enabled = false;
			}
			Handles.color = color;
			if (Handles.Button(Vector3.zero, Quaternion.identity, num6 * 0.8f, num6, new Handles.DrawCapFunction(Handles.CubeCap)) && !view.in2DMode)
			{
				if (Event.current.clickCount == 2)
				{
					view.FrameSelected();
				}
				else
				{
					if (Event.current.shift || Event.current.button == 2)
					{
						this.ViewFromNiceAngle(view, true);
					}
					else
					{
						this.ViewSetOrtho(view, !view.orthographic);
					}
				}
			}
			this.AxisSelectors(view, camera, num6, 1f, SceneViewRotation.styles.viewAxisLabelStyle);
			GUI.enabled = true;
			if (!view.in2DMode && Event.current.type == EditorGUIUtility.swipeGestureEventType)
			{
				Event current = Event.current;
				Vector3 a;
				if (current.delta.y > 0f)
				{
					a = Vector3.up;
				}
				else
				{
					if (current.delta.y < 0f)
					{
						a = -Vector3.up;
					}
					else
					{
						if (current.delta.x < 0f)
						{
							a = Vector3.right;
						}
						else
						{
							a = -Vector3.right;
						}
					}
				}
				Vector3 vector = -a - Vector3.forward * 0.9f;
				vector = view.camera.transform.TransformDirection(vector);
				float num7 = 0f;
				int dir = 0;
				for (int k = 0; k < 6; k++)
				{
					float num8 = Vector3.Dot(SceneViewRotation.kDirectionRotations[k] * -Vector3.forward, vector);
					if (num8 > num7)
					{
						num7 = num8;
						dir = k;
					}
				}
				this.ViewAxisDirection(view, dir);
				Event.current.Use();
			}
			HandleUtility.PopCamera(camera);
			Handles.SetCamera(camera);
			if (Event.current.type == EventType.Repaint)
			{
				Profiler.EndSample();
			}
		}
开发者ID:guozanhua,项目名称:UnityDecompiled,代码行数:101,代码来源:SceneViewRotation.cs

示例2: OnGUI

 internal void OnGUI(SceneView view)
 {
   if ((double) Mathf.Min(view.position.width, view.position.height) < 100.0)
     return;
   if (Event.current.type == EventType.Repaint)
     Profiler.BeginSample("SceneView.AxisSelector");
   this.HandleContextClick(view);
   Camera camera = view.camera;
   HandleUtility.PushCamera(camera);
   if (camera.orthographic)
     camera.orthographicSize = 0.5f;
   camera.cullingMask = 0;
   camera.transform.position = camera.transform.rotation * new Vector3(0.0f, 0.0f, -5f);
   camera.clearFlags = CameraClearFlags.Nothing;
   camera.nearClipPlane = 0.1f;
   camera.farClipPlane = 10f;
   camera.fieldOfView = view.m_Ortho.Fade(70f, 0.0f);
   SceneView.AddCursorRect(new Rect((float) ((double) view.position.width - 100.0 + 22.0), 22f, 56f, 102f), MouseCursor.Arrow);
   Handles.SetCamera(new Rect(view.position.width - 100f, 0.0f, 100f, 100f), camera);
   Handles.BeginGUI();
   this.DrawLabels(view);
   Handles.EndGUI();
   for (int index = 0; index < 3; ++index)
   {
     Vector3 rhs = SceneViewRotation.kDirectionRotations[index] * Vector3.forward;
     this.dirVisible[index].target = (double) Mathf.Abs(Vector3.Dot(camera.transform.forward, rhs)) < 0.899999976158142;
   }
   float num1 = HandleUtility.GetHandleSize(Vector3.zero) * 0.2f;
   this.AxisSelectors(view, camera, num1, -1f, SceneViewRotation.styles.viewAxisLabelStyle);
   Color color = Color.Lerp(Handles.centerColor, Color.gray, this.faded2Dgray);
   color.a *= this.m_Visible.faded;
   if ((double) color.a <= 0.100000001490116)
     GUI.enabled = false;
   Handles.color = color;
   if (Handles.Button(this.m_CenterButtonControlID, Vector3.zero, Quaternion.identity, num1 * 0.8f, num1, new Handles.DrawCapFunction(Handles.CubeCap)) && !view.in2DMode)
   {
     if (Event.current.clickCount == 2)
       view.FrameSelected();
     else if (Event.current.shift || Event.current.button == 2)
       this.ViewFromNiceAngle(view, true);
     else
       this.ViewSetOrtho(view, !view.orthographic);
   }
   this.AxisSelectors(view, camera, num1, 1f, SceneViewRotation.styles.viewAxisLabelStyle);
   GUI.enabled = true;
   if (!view.in2DMode && Event.current.type == EditorGUIUtility.swipeGestureEventType)
   {
     Event current = Event.current;
     Vector3 direction = -((double) current.delta.y <= 0.0 ? ((double) current.delta.y >= 0.0 ? ((double) current.delta.x >= 0.0 ? -Vector3.right : Vector3.right) : -Vector3.up) : Vector3.up) - Vector3.forward * 0.9f;
     Vector3 rhs = view.camera.transform.TransformDirection(direction);
     float num2 = 0.0f;
     int dir = 0;
     for (int index = 0; index < 6; ++index)
     {
       float num3 = Vector3.Dot(SceneViewRotation.kDirectionRotations[index] * -Vector3.forward, rhs);
       if ((double) num3 > (double) num2)
       {
         num2 = num3;
         dir = index;
       }
     }
     this.ViewAxisDirection(view, dir);
     Event.current.Use();
   }
   HandleUtility.PopCamera(camera);
   Handles.SetCamera(camera);
   if (Event.current.type != EventType.Repaint)
     return;
   Profiler.EndSample();
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:70,代码来源:SceneViewRotation.cs

示例3: OnGUI

 internal void OnGUI(SceneView view)
 {
     if (Mathf.Min(view.position.width, view.position.height) >= 100f)
     {
         if (Event.current.type == EventType.Repaint)
         {
             Profiler.BeginSample("SceneView.AxisSelector");
         }
         Camera camera = view.camera;
         HandleUtility.PushCamera(camera);
         if (camera.orthographic)
         {
             camera.orthographicSize = 0.5f;
         }
         camera.cullingMask = 0;
         camera.transform.position = (Vector3) (camera.transform.rotation * new Vector3(0f, 0f, -5f));
         camera.clearFlags = CameraClearFlags.Nothing;
         camera.nearClipPlane = 0.1f;
         camera.farClipPlane = 10f;
         camera.fieldOfView = view.m_Ortho.Fade(70f, 0f);
         SceneView.AddCursorRect(new Rect((view.position.width - 100f) + 22f, 22f, 56f, 102f), MouseCursor.Arrow);
         Handles.SetCamera(new Rect(view.position.width - 100f, 0f, 100f, 100f), camera);
         Handles.BeginGUI();
         Rect position = new Rect((view.position.width - 100f) + 17f, 92f, 66f, 16f);
         if (!view.in2DMode && GUI.Button(position, string.Empty, styles.viewLabelStyleLeftAligned))
         {
             if (Event.current.button == 1)
             {
                 this.DisplayContextMenu(position, view);
             }
             else
             {
                 this.ViewSetOrtho(view, !view.orthographic);
             }
         }
         int index = 8;
         Rect rect2 = position;
         float num3 = 0f;
         float num4 = 0f;
         for (int i = 0; i < kDirNames.Length; i++)
         {
             if (i != index)
             {
                 num4 += this.dirNameVisible[i].faded;
                 if (this.dirNameVisible[i].faded > 0f)
                 {
                     num3 += styles.viewLabelStyleLeftAligned.CalcSize(EditorGUIUtility.TempContent(kDirNames[i])).x * this.dirNameVisible[i].faded;
                 }
             }
         }
         if (num4 > 0f)
         {
             num3 /= num4;
         }
         rect2.x += 37f - (num3 * 0.5f);
         rect2.x = Mathf.RoundToInt(rect2.x);
         for (int j = 0; (j < this.dirNameVisible.Length) && (j < kDirNames.Length); j++)
         {
             if (j != index)
             {
                 Color color = Handles.centerColor;
                 color.a *= this.dirNameVisible[j].faded;
                 if (color.a > 0f)
                 {
                     GUI.color = color;
                     GUI.Label(rect2, kDirNames[j], styles.viewLabelStyleLeftAligned);
                 }
             }
         }
         Color centerColor = Handles.centerColor;
         centerColor.a *= this.faded2Dgray * this.m_Visible.faded;
         if (centerColor.a > 0f)
         {
             GUI.color = centerColor;
             GUI.Label(position, kDirNames[index], styles.viewLabelStyleCentered);
         }
         if (this.faded2Dgray < 1f)
         {
             this.DrawIsoStatusSymbol(new Vector3(rect2.x - 8f, rect2.y + 8.5f, 0f), view, 1f - this.faded2Dgray);
         }
         Handles.EndGUI();
         for (int k = 0; k < 3; k++)
         {
             Vector3 rhs = (Vector3) (kDirectionRotations[k] * Vector3.forward);
             this.dirVisible[k].target = Mathf.Abs(Vector3.Dot(camera.transform.forward, rhs)) < 0.9f;
         }
         float size = HandleUtility.GetHandleSize(Vector3.zero) * 0.2f;
         this.AxisSelectors(view, camera, size, -1f, styles.viewAxisLabelStyle);
         Color color3 = Color.Lerp(Handles.centerColor, Color.gray, this.faded2Dgray);
         color3.a *= this.m_Visible.faded;
         if (color3.a <= 0.1f)
         {
             GUI.enabled = false;
         }
         Handles.color = color3;
         if (Handles.Button(Vector3.zero, Quaternion.identity, size * 0.8f, size, new Handles.DrawCapFunction(Handles.CubeCap)) && !view.in2DMode)
         {
             if (Event.current.clickCount == 2)
             {
                 view.FrameSelected();
//.........这里部分代码省略.........
开发者ID:randomize,项目名称:VimConfig,代码行数:101,代码来源:SceneViewRotation.cs


注:本文中的UnityEditor.SceneView.FrameSelected方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。