本文整理汇总了C#中OperationMode.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# OperationMode.ToString方法的具体用法?C# OperationMode.ToString怎么用?C# OperationMode.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OperationMode
的用法示例。
在下文中一共展示了OperationMode.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnGUI
/// <summary>
/// Draws the EditorWindow's GUI.
/// </summary>
public void OnGUI()
{
GUILayout.BeginVertical();
#region - Operation mode -
GUILayout.Label("Operation mode");
GUIContent[] modes = new GUIContent[] {
new GUIContent("Fly", "Where do you want to fly today?"),
new GUIContent("Orbit", "Round, round, round we go"),
new GUIContent("Telekinesis", "Watch where you're levitating that piano!"),
new GUIContent("Grab Move", "Excuse me, yes. HDS coming through. I've got a package people")
};
_operationMode = (OperationMode)GUILayout.SelectionGrid((int)_operationMode, modes, 4);
#endregion - Operation mode -
#region - Coordinate system -
// Enable the coordsys only in Telekinesis mode.
GUI.enabled = _operationMode == OperationMode.Telekinesis;
GUILayout.Label("Coordinate system");
string[] coordSystems = new string[] { "Camera", "World", "Parent", "Local" };
_coordSys = (CoordinateSystem)GUILayout.SelectionGrid((int)_coordSys, coordSystems, 4);
#endregion - Coordinate system -
#region - Snapping -
// Disable the constraint controls in Fly and Orbit mode.
GUI.enabled = _operationMode != OperationMode.Fly && _operationMode != OperationMode.Orbit;
GUILayout.Space(10);
GUILayout.Label("Snap");
GUILayout.Space(4);
GUILayout.BeginHorizontal();
_snapTranslation = GUILayout.Toggle(_snapTranslation, "Grid snap");
_snapDistance = EditorGUILayout.FloatField(_snapDistance);
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
_snapRotation = GUILayout.Toggle(_snapRotation, "Angle snap");
_snapAngle = EditorGUILayout.IntField(_snapAngle);
GUILayout.EndHorizontal();
// Re-enable gui.
GUI.enabled = true;
#endregion- Snapping -
#region - Locking and sensitivity -
GUILayout.Space(10);
GUILayout.Label("Lock");
GUILayout.Space(4);
EditorGUI.BeginChangeCheck();
_lockHorizon = GUILayout.Toggle(_lockHorizon, "Horizon");
if (EditorGUI.EndChangeCheck() && _lockHorizon)
StraightenHorizon();
SpaceNavigator.Instance.OnGUI();
#endregion - Locking and sensitivity -
#region - Axes inversion per mode -
GUILayout.Space(10);
GUILayout.Label("Invert axes in " + _operationMode.ToString() + " mode");
GUILayout.Space(4);
bool tx, ty, tz, rx, ry, rz;
switch (_operationMode) {
case OperationMode.Fly:
tx = _flyInvertTranslation.x < 0; ty = _flyInvertTranslation.y < 0; tz = _flyInvertTranslation.z < 0;
rx = _flyInvertRotation.x < 0; ry = _flyInvertRotation.y < 0; rz = _flyInvertRotation.z < 0;
break;
case OperationMode.Orbit:
tx = _orbitInvertTranslation.x < 0; ty = _orbitInvertTranslation.y < 0; tz = _orbitInvertTranslation.z < 0;
rx = _orbitInvertRotation.x < 0; ry = _orbitInvertRotation.y < 0; rz = _orbitInvertRotation.z < 0;
break;
case OperationMode.Telekinesis:
tx = _telekinesisInvertTranslation.x < 0; ty = _telekinesisInvertTranslation.y < 0; tz = _telekinesisInvertTranslation.z < 0;
rx = _telekinesisInvertRotation.x < 0; ry = _telekinesisInvertRotation.y < 0; rz = _telekinesisInvertRotation.z < 0;
break;
case OperationMode.GrabMove:
tx = _grabMoveInvertTranslation.x < 0; ty = _grabMoveInvertTranslation.y < 0; tz = _grabMoveInvertTranslation.z < 0;
rx = _grabMoveInvertRotation.x < 0; ry = _grabMoveInvertRotation.y < 0; rz = _grabMoveInvertRotation.z < 0;
break;
default:
throw new ArgumentOutOfRangeException();
}
GUILayout.BeginHorizontal();
GUILayout.Label("Translation\t\t");
EditorGUI.BeginChangeCheck();
tx = GUILayout.Toggle(tx, "X");
ty = GUILayout.Toggle(ty, "Y");
tz = GUILayout.Toggle(tz, "Z");
if (EditorGUI.EndChangeCheck()) {
switch (_operationMode) {
case OperationMode.Fly:
_flyInvertTranslation = new Vector3(tx ? -1 : 1, ty ? -1 : 1, tz ? -1 : 1);
break;
case OperationMode.Orbit:
_orbitInvertTranslation = new Vector3(tx ? -1 : 1, ty ? -1 : 1, tz ? -1 : 1);
//.........这里部分代码省略.........