本文整理汇总了C#中MouseCursor类的典型用法代码示例。如果您正苦于以下问题:C# MouseCursor类的具体用法?C# MouseCursor怎么用?C# MouseCursor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MouseCursor类属于命名空间,在下文中一共展示了MouseCursor类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: SetCursorFromVector3
public static void SetCursorFromVector3(Vector2 currentPosition, Vector2 lastPosition)
{
Vector3 delta = currentPosition - lastPosition;
float angle = Mathf.Rad2Deg * Mathf.Atan2(delta.y, delta.x);
while (angle < 0)
{
angle += 180;
}
while (angle > 180)
{
angle -= 180;
}
if (angle >= 67.5f && angle < 112.5f)
{
activeCursor = MouseCursor.ResizeVertical;
}
else if (angle >= 112.5f && angle < 157.5f)
{
activeCursor = MouseCursor.ResizeUpLeft;
}
else if (angle >= 22.5f && angle < 67.5f)
{
activeCursor = MouseCursor.ResizeUpRight;
}
else
{
activeCursor = MouseCursor.ResizeHorizontal;
}
}
开发者ID:5thFloorGames,项目名称:FollowTheLight,代码行数:32,代码来源:SabreMouse.cs
示例2: DisplayProvider
public DisplayProvider()
{
this.mouseCursor = new MouseCursor();
this.screenshot = new Screenshot();
this.tracker = new BoundsTracker();
this.waterMark = new WaterMark();
}
开发者ID:bspkrs,项目名称:screenrecorder,代码行数:7,代码来源:DisplayProvider.cs
示例3: ControlTransformer
public ControlTransformer(Service service)
{
uiMouseCursor = new MouseCursor(service) { UpdatePriority = Priority.First };
isTransforming = false;
Messenger.Default.Register<string>(this, "SetDefaultCursor", SetDefaultCursor);
Messenger.Default.Register<string>(this, "AllowChangeOfCursor", AllowChangeOfCursor);
canChangeCursor = false;
}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:8,代码来源:ControlTransformer.cs
示例4: Start
public void Start()
{
cur_mode = iMode.MODE_IDENTIFY;
scr_mouse = GameObject.Find("Main Camera").GetComponent<MouseCursor>();
UpdateCursor();
}
开发者ID:ChasmGamesProject,项目名称:UnityGameRepository,代码行数:8,代码来源:InteractMode.cs
示例5: ChangeCursor
public static CursorChangeToken ChangeCursor(this IView view, MouseCursor cursor)
{
Verify.Argument.IsNotNull(view, "view");
var oldCursor = view.MouseCursor;
view.MouseCursor = cursor;
return new CursorChangeToken(view, oldCursor);
}
开发者ID:Kuzq,项目名称:gitter,代码行数:8,代码来源:ViewExtensions.cs
示例6: ScaleSlider
private static Vector2 ScaleSlider(int id, Vector2 pos, MouseCursor cursor, Rect cursorRect)
{
Vector2 vector2_1 = (Vector2) Handles.matrix.MultiplyPoint((Vector3) pos);
Event current = Event.current;
switch (current.GetTypeForControl(id))
{
case EventType.MouseDown:
if (current.button == 0 && cursorRect.Contains(Event.current.mousePosition) && !current.alt)
{
int num = id;
GUIUtility.keyboardControl = num;
GUIUtility.hotControl = num;
SpriteEditorHandles.s_CurrentMousePosition = current.mousePosition;
SpriteEditorHandles.s_DragStartScreenPosition = current.mousePosition;
SpriteEditorHandles.s_DragScreenOffset = SpriteEditorHandles.s_CurrentMousePosition - vector2_1;
current.Use();
EditorGUIUtility.SetWantsMouseJumping(1);
break;
}
break;
case EventType.MouseUp:
if (GUIUtility.hotControl == id && (current.button == 0 || current.button == 2))
{
GUIUtility.hotControl = 0;
current.Use();
EditorGUIUtility.SetWantsMouseJumping(0);
break;
}
break;
case EventType.MouseDrag:
if (GUIUtility.hotControl == id)
{
SpriteEditorHandles.s_CurrentMousePosition += current.delta;
Vector2 vector2_2 = pos;
pos = (Vector2) Handles.s_InverseMatrix.MultiplyPoint((Vector3) SpriteEditorHandles.s_CurrentMousePosition);
if (!Mathf.Approximately((vector2_2 - pos).magnitude, 0.0f))
GUI.changed = true;
current.Use();
break;
}
break;
case EventType.KeyDown:
if (GUIUtility.hotControl == id && current.keyCode == KeyCode.Escape)
{
pos = (Vector2) Handles.s_InverseMatrix.MultiplyPoint((Vector3) (SpriteEditorHandles.s_DragStartScreenPosition - SpriteEditorHandles.s_DragScreenOffset));
GUIUtility.hotControl = 0;
GUI.changed = true;
current.Use();
break;
}
break;
case EventType.Repaint:
EditorGUIUtility.AddCursorRect(cursorRect, cursor, id);
break;
}
return pos;
}
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:57,代码来源:SpriteEditorHandles.cs
示例7: CustomActionField
public static void CustomActionField(Rect fieldRect, Action action, bool showCursorPredicate, bool clickPredicate, MouseCursor cursor)
{
if (showCursorPredicate)
AddCursorRect(fieldRect, cursor);
if (fieldRect.Contains(Event.current.mousePosition))
{
if (clickPredicate)
action();
}
}
开发者ID:srndpty,项目名称:VFW,代码行数:10,代码来源:GUIHelper.cs
示例8: CursorHighlightOptions
public CursorHighlightOptions()
{
InitializeComponent();
//
this.mouseCursor = new MouseCursor();
//
this.tbRadious.Minimum = minRadious;
this.tbRadious.Maximum = maxRadious;
this.Color = Color.FromName(defaultColorString);
this.Radious = defaultRadious;
}
开发者ID:bspkrs,项目名称:screenrecorder,代码行数:11,代码来源:CursorHighlightOptions.cs
示例9: FromUri
/// <summary>
/// Creates a <see cref="MouseCursor"/> based on the specified image
/// </summary>
/// <param name="cursorUri">The <see cref="Uri"/> of the image</param>
/// <returns>A <see cref="MouseCursor"/></returns>
public static MouseCursor FromUri(Uri cursorUri)
{
Stream bitmapStream;
Bitmap bitmap;
OpenTK.MouseCursor cursorObject;
MouseCursor cursor;
bitmapStream = Application.GetResourceStream(cursorUri);
bitmap = new Bitmap(bitmapStream);
var data = bitmap.LockBits(new System.Drawing.Rectangle(0, 0, 32, 32), System.Drawing.Imaging.ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
cursorObject = new OpenTK.MouseCursor(0,0,32, 32, data.Scan0);
bitmap.UnlockBits(data);
cursor = new MouseCursor(cursorObject);
return cursor;
}
开发者ID:yonglehou,项目名称:Photon,代码行数:19,代码来源:MouseCursor.cs
示例10: PointSlider
internal static Vector2 PointSlider(Vector2 pos, MouseCursor cursor, GUIStyle dragDot, GUIStyle dragDotActive)
{
int controlId = GUIUtility.GetControlID("Slider1D".GetHashCode(), FocusType.Keyboard);
Vector2 vector2 = (Vector2) Handles.matrix.MultiplyPoint((Vector3) pos);
Rect rect = new Rect(vector2.x - dragDot.fixedWidth * 0.5f, vector2.y - dragDot.fixedHeight * 0.5f, dragDot.fixedWidth, dragDot.fixedHeight);
if (Event.current.GetTypeForControl(controlId) == EventType.Repaint)
{
if (GUIUtility.hotControl == controlId)
dragDotActive.Draw(rect, GUIContent.none, controlId);
else
dragDot.Draw(rect, GUIContent.none, controlId);
}
return SpriteEditorHandles.ScaleSlider(pos, cursor, rect);
}
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:14,代码来源:SpriteEditorHandles.cs
示例11: PingField
public static void PingField(UnityObject obj, bool showPredicate, bool clickPredicate, MouseCursor cursor = MouseCursor.Zoom)
{
PingField(GetLastRect(), obj, showPredicate, clickPredicate, cursor);
}
开发者ID:srndpty,项目名称:VFW,代码行数:4,代码来源:GUIHelper.cs
示例12: TryScaleButton
bool TryScaleButton(Vector3 position, float size)
{
size *= HandleUtility.GetHandleSize(position);
if (Vector3.Distance(mousePosition, position) < size)
{
if (e.type == EventType.MouseDown)
return true;
else
{
mouseCursor = MouseCursor.ScaleArrow;
Handles.color = Color.green;
}
}
else
Handles.color = Color.white;
var buffer = size / 4;
Handles.DrawLine(new Vector3(position.x - size - buffer, position.y), new Vector3(position.x - size + buffer, position.y));
Handles.DrawLine(new Vector3(position.x + size - buffer, position.y), new Vector3(position.x + size + buffer, position.y));
Handles.DrawLine(new Vector3(position.x, position.y - size - buffer), new Vector3(position.x, position.y - size + buffer));
Handles.DrawLine(new Vector3(position.x, position.y + size - buffer), new Vector3(position.x, position.y + size + buffer));
Handles.RectangleCap(0, position, Quaternion.identity, size);
return false;
}
开发者ID:CaminhoneiroHell,项目名称:PolyMesh,代码行数:23,代码来源:PolyMeshEditor.cs
示例13: TryHoverCurvePoint
bool TryHoverCurvePoint(out int index)
{
if (TryHover(curvePoints, Color.white, out index))
{
mouseCursor = MouseCursor.MoveArrow;
return true;
}
return false;
}
开发者ID:CaminhoneiroHell,项目名称:PolyMesh,代码行数:9,代码来源:PolyMeshEditor.cs
示例14: OnSceneGUI
void OnSceneGUI()
{
if (target == null)
return;
if (KeyPressed(editKey))
editing = !editing;
if (editing)
{
//Update lists
if (keyPoints == null)
{
keyPoints = new List<Vector3>(polyMesh.keyPoints);
curvePoints = new List<Vector3>(polyMesh.curvePoints);
isCurve = new List<bool>(polyMesh.isCurve);
}
//Crazy hack to register undo
if (undoCallback == null)
{
undoCallback = typeof(EditorApplication).GetField("undoRedoPerformed", BindingFlags.NonPublic | BindingFlags.Static);
if (undoCallback != null)
undoCallback.SetValue(null, new EditorApplication.CallbackFunction(OnUndoRedo));
}
//Load handle matrix
Handles.matrix = polyMesh.transform.localToWorldMatrix;
//Draw points and lines
DrawAxis();
Handles.color = Color.white;
for (int i = 0; i < keyPoints.Count; i++)
{
Handles.color = nearestLine == i ? Color.green : Color.white;
DrawSegment(i);
if (selectedIndices.Contains(i))
{
Handles.color = Color.green;
DrawCircle(keyPoints[i], 0.08f);
}
else
Handles.color = Color.white;
DrawKeyPoint(i);
if (isCurve[i])
{
Handles.color = (draggingCurve && dragIndex == i) ? Color.white : Color.blue;
DrawCurvePoint(i);
}
}
//Quit on tool change
if (e.type == EventType.KeyDown)
{
switch (e.keyCode)
{
case KeyCode.Q:
case KeyCode.W:
case KeyCode.E:
case KeyCode.R:
return;
}
}
//Quit if panning or no camera exists
if (Tools.current == Tool.View || (e.isMouse && e.button > 0) || Camera.current == null || e.type == EventType.ScrollWheel)
return;
//Quit if laying out
if (e.type == EventType.Layout)
{
HandleUtility.AddDefaultControl(GUIUtility.GetControlID(FocusType.Passive));
return;
}
//Cursor rectangle
EditorGUIUtility.AddCursorRect(new Rect(0, 0, Camera.current.pixelWidth, Camera.current.pixelHeight), mouseCursor);
mouseCursor = MouseCursor.Arrow;
//Extrude key state
if (e.keyCode == extrudeKey)
{
if (extrudeKeyDown)
{
if (e.type == EventType.KeyUp)
extrudeKeyDown = false;
}
else if (e.type == EventType.KeyDown)
extrudeKeyDown = true;
}
//Update matrices and snap
worldToLocal = polyMesh.transform.worldToLocalMatrix;
inverseRotation = Quaternion.Inverse(polyMesh.transform.rotation) * Camera.current.transform.rotation;
snap = gridSnap;
//Update mouse position
screenMousePosition = new Vector3(e.mousePosition.x, Camera.current.pixelHeight - e.mousePosition.y);
var plane = new Plane(-polyMesh.transform.forward, polyMesh.transform.position);
var ray = Camera.current.ScreenPointToRay(screenMousePosition);
//.........这里部分代码省略.........
开发者ID:CaminhoneiroHell,项目名称:PolyMesh,代码行数:101,代码来源:PolyMeshEditor.cs
示例15: ScaleSlider
internal static Vector2 ScaleSlider(Vector2 pos, MouseCursor cursor, Rect cursorRect)
{
return ScaleSlider(GUIUtility.GetControlID("Slider1D".GetHashCode(), FocusType.Keyboard), pos, cursor, cursorRect);
}
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:4,代码来源:SpriteEditorHandles.cs
示例16: HandleBorderPointSlider
private void HandleBorderPointSlider(ref float x, ref float y, MouseCursor mouseCursor, bool isHidden, GUIStyle dragDot, GUIStyle dragDotActive, Color color)
{
Color color2 = GUI.color;
if (isHidden)
{
GUI.color = new Color(0f, 0f, 0f, 0f);
}
else
{
GUI.color = color;
}
Vector2 vector = SpriteEditorHandles.PointSlider(new Vector2(x, y), mouseCursor, dragDot, dragDotActive);
x = vector.x;
y = vector.y;
GUI.color = color2;
}
开发者ID:randomize,项目名称:VimConfig,代码行数:16,代码来源:SpriteEditorWindow.cs
示例17: PointSlider
internal static Vector2 PointSlider(Vector2 pos, MouseCursor cursor, GUIStyle dragDot, GUIStyle dragDotActive)
{
int controlID = GUIUtility.GetControlID("Slider1D".GetHashCode(), FocusType.Keyboard);
Vector2 vector = Handles.matrix.MultiplyPoint((Vector3) pos);
Rect position = new Rect(vector.x - (dragDot.fixedWidth * 0.5f), vector.y - (dragDot.fixedHeight * 0.5f), dragDot.fixedWidth, dragDot.fixedHeight);
if (Event.current.GetTypeForControl(controlID) == EventType.Repaint)
{
if (GUIUtility.hotControl == controlID)
{
dragDotActive.Draw(position, GUIContent.none, controlID);
}
else
{
dragDot.Draw(position, GUIContent.none, controlID);
}
}
return ScaleSlider(pos, cursor, position);
}
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:18,代码来源:SpriteEditorHandles.cs
示例18: SelectField
public static void SelectField(UnityObject obj, MouseCursor cursor = MouseCursor.Link)
{
SelectField(GetLastRect(), obj, cursor);
}
开发者ID:srndpty,项目名称:VFW,代码行数:4,代码来源:GUIHelper.cs
示例19: UpdateState
//Update state
State UpdateState()
{
switch (state)
{
//Hovering
case State.Hover:
DrawNearestLineAndSplit();
if (Tools.current == Tool.Move && TryDragSelected())
return State.DragSelected;
if (Tools.current == Tool.Rotate && TryRotateSelected())
return State.RotateSelected;
if (Tools.current == Tool.Scale && TryScaleSelected())
return State.ScaleSelected;
if (Tools.current == Tool.Move && TryExtrude())
return State.Extrude;
if (TrySelectAll())
return State.Hover;
if (TrySplitLine())
return State.Hover;
if (TryDeleteSelected())
return State.Hover;
if (TryHoverCurvePoint(out dragIndex) && TryDragCurvePoint(dragIndex))
return State.Drag;
if (TryHoverKeyPoint(out dragIndex) && TryDragKeyPoint(dragIndex))
return State.Drag;
if (TryBoxSelect())
return State.BoxSelect;
break;
//Dragging
case State.Drag:
mouseCursor = MouseCursor.MoveArrow;
DrawCircle(keyPoints[dragIndex], clickRadius);
if (draggingCurve)
MoveCurvePoint(dragIndex, mousePosition - clickPosition);
else
MoveKeyPoint(dragIndex, mousePosition - clickPosition);
if (TryStopDrag())
return State.Hover;
break;
//Box Selecting
case State.BoxSelect:
if (TryBoxSelectEnd())
return State.Hover;
break;
//Dragging selected
case State.DragSelected:
mouseCursor = MouseCursor.MoveArrow;
MoveSelected(mousePosition - clickPosition);
if (TryStopDrag())
return State.Hover;
break;
//Rotating selected
case State.RotateSelected:
mouseCursor = MouseCursor.RotateArrow;
RotateSelected();
if (TryStopDrag())
return State.Hover;
break;
//Scaling selected
case State.ScaleSelected:
mouseCursor = MouseCursor.ScaleArrow;
ScaleSelected();
if (TryStopDrag())
return State.Hover;
break;
//Extruding
case State.Extrude:
mouseCursor = MouseCursor.MoveArrow;
MoveSelected(mousePosition - clickPosition);
if (doExtrudeUpdate && mousePosition != clickPosition)
{
UpdatePoly(false, false);
doExtrudeUpdate = false;
}
if (TryStopDrag())
return State.Hover;
break;
}
return state;
}
开发者ID:CaminhoneiroHell,项目名称:PolyMesh,代码行数:92,代码来源:PolyMeshEditor.cs
示例20: TryRotateButton
bool TryRotateButton(Vector3 position, float size)
{
size *= HandleUtility.GetHandleSize(position);
var dist = Vector3.Distance(mousePosition, position);
var buffer = size / 4;
if (dist < size + buffer && dist > size - buffer)
{
if (e.type == EventType.MouseDown)
return true;
else
{
mouseCursor = MouseCursor.RotateArrow;
Handles.color = Color.green;
}
}
else
Handles.color = Color.white;
Handles.CircleCap(0, position, inverseRotation, size - buffer / 2);
Handles.CircleCap(0, position, inverseRotation, size + buffer / 2);
return false;
}
开发者ID:CaminhoneiroHell,项目名称:PolyMesh,代码行数:21,代码来源:PolyMeshEditor.cs
注:本文中的MouseCursor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论