本文整理汇总了C#中UnityEngine.Event.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Event.Equals方法的具体用法?C# Event.Equals怎么用?C# Event.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.Event
的用法示例。
在下文中一共展示了Event.Equals方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleKeyboardShortcuts
/// <summary>
/// Determines which key command is pressed and responds accordingly.
/// </summary>
/// <param name="keyDownEvent">The keyboard event.</param>
/// <returns>True if the keyboard shortcut exists, false otherwise.</returns>
public void HandleKeyboardShortcuts(Event keyDownEvent)
{
KeyCode key = keyDownEvent.keyCode;
// Tools:
// Move/resize
if (key == CutsceneHotkeys.MoveResizeTool.key) {
currentTool = Tool.MoveResize;
EDebug.Log("Cutscene Editor: switching to Move/Resize tool");
// Scissors
} else if (key == CutsceneHotkeys.ScissorsTool.key) {
currentTool = Tool.Scissors;
EDebug.Log("Cutscene Editor: switching to Scissors tool");
// Zoom
} else if (key == CutsceneHotkeys.ZoomTool.key) {
currentTool = Tool.Zoom;
EDebug.Log("Cutscene Editor: switching to Zoom tool");
}
// Timeline navigation:
// Set in point
else if (key == CutsceneHotkeys.SetInPont.key) {
scene.inPoint = scene.playhead;
EDebug.Log("Cutscene Editor: setting in point");
// Set out point
} else if (key == CutsceneHotkeys.SetOutPoint.key) {
scene.outPoint = scene.playhead;
EDebug.Log("Cutscene Editor: setting out point");
// Scrub left
} else if (keyDownEvent.Equals(Event.KeyboardEvent("left"))) {
scene.playhead -= CutsceneTimeline.scrubSmallJump;
EDebug.Log("Cutscene Editor: moving playhead left");
// Scrub left large
} else if (keyDownEvent.Equals(Event.KeyboardEvent("#left"))) {
scene.playhead -= CutsceneTimeline.scrubLargeJump;
EDebug.Log("Cutscene Editor: moving playhead left");
// Scrub right
} else if (keyDownEvent.Equals(Event.KeyboardEvent("right"))) {
scene.playhead += CutsceneTimeline.scrubSmallJump;
EDebug.Log("Cutscene Editor: moving playhead right");
// Scrub right large
} else if (keyDownEvent.Equals(Event.KeyboardEvent("#right"))) {
scene.playhead += CutsceneTimeline.scrubLargeJump;
EDebug.Log("Cutscene Editor: moving playhead right");
// Go to previous split point
} else if (keyDownEvent.Equals(Event.KeyboardEvent("up"))) {
scene.playhead = selectedTrack.GetTimeOfNextSplit(scene.playhead);
EDebug.Log("Cutscene Editor: moving playhead to previous split point");
// Go to next split point
} else if (keyDownEvent.Equals(Event.KeyboardEvent("down"))) {
scene.playhead = selectedTrack.GetTimeOfPreviousSplit(scene.playhead);
EDebug.Log("Cutscene Editor: moving playhead to next split point");
// Go to in point
} else if (keyDownEvent.Equals(Event.KeyboardEvent("#up"))) {
scene.playhead = scene.inPoint;
EDebug.Log("Cutscene Editor: moving playhead to next split point");
// Go to out point
} else if (keyDownEvent.Equals(Event.KeyboardEvent("#down"))) {
scene.playhead = scene.outPoint;
EDebug.Log("Cutscene Editor: moving playhead to next split point");
}
// Track selection:
// Select track 1
else if (key == CutsceneHotkeys.SelectTrack1.key) {
SelectTrackAtIndex(1);
// Select track 2
} else if (key == CutsceneHotkeys.SelectTrack2.key) {
SelectTrackAtIndex(2);
// Select track 3
} else if (key == CutsceneHotkeys.SelectTrack3.key) {
SelectTrackAtIndex(3);
// Select track 4
} else if (key == CutsceneHotkeys.SelectTrack4.key) {
SelectTrackAtIndex(4);
// Select track 5
} else if (key == CutsceneHotkeys.SelectTrack5.key) {
SelectTrackAtIndex(5);
// Select track 6
} else if (key == CutsceneHotkeys.SelectTrack6.key) {
SelectTrackAtIndex(6);
// Select track 7
} else if (key == CutsceneHotkeys.SelectTrack7.key) {
SelectTrackAtIndex(7);
// Select track 8
} else if (key == CutsceneHotkeys.SelectTrack8.key) {
SelectTrackAtIndex(8);
// Select track 9
} else if (key == CutsceneHotkeys.SelectTrack9.key) {
SelectTrackAtIndex(9);
}
//.........这里部分代码省略.........
示例2: key_down
private bool key_down(Event e, string key)
{
return e.Equals(Event.KeyboardEvent(key));
}
示例3: OnSceneGUI
Event currentEvent;// = (Event)0;
void OnSceneGUI(SceneView scnView)
{
currentEvent = Event.current;
if(editLevel == EditLevel.Geometry && currentEvent.Equals(Event.KeyboardEvent("v")))
{
currentEvent.Use();
snapToVertex = true;
}
/**
* Snap stuff
*/
if(currentEvent.type == EventType.KeyUp)
snapToVertex = false;
if(currentEvent.type == EventType.MouseDown && currentEvent.button == 1)
rightMouseDown = true;
if(currentEvent.type == EventType.MouseUp && currentEvent.button == 1 || currentEvent.type == EventType.Ignore)
rightMouseDown = false;
#if !PROTOTYPE
// e.type == EventType.DragUpdated ||
if(currentEvent.type == EventType.DragPerform)
{
GameObject go = HandleUtility.PickGameObject(currentEvent.mousePosition, false);
if(go != null && System.Array.Exists(DragAndDrop.objectReferences, x => x is Texture2D || x is Material))
{
pb_Object pb = go.GetComponent<pb_Object>();
if( pb )
{
Material mat = null;
foreach(Object t in DragAndDrop.objectReferences)
{
if(t is Material)
{
mat = (Material)t;
break;
}
/* This works, but throws some bullshit errors. Not creating a material leaks, so disable this functionality. */
else
if(t is Texture2D)
{
mat = new Material(Shader.Find("Diffuse"));
mat.mainTexture = (Texture2D)t;
string texPath = AssetDatabase.GetAssetPath(mat.mainTexture);
int lastDot = texPath.LastIndexOf(".");
texPath = texPath.Substring(0, texPath.Length - (texPath.Length-lastDot));
texPath = AssetDatabase.GenerateUniqueAssetPath(texPath + ".mat");
AssetDatabase.CreateAsset(mat, texPath);
AssetDatabase.Refresh();
break;
}
}
if(mat != null)
{
if(editLevel == EditLevel.Geometry)
{
pbUndo.RecordObjects(selection, "Set Face Materials");
foreach(pb_Object pbs in selection)
pbs.SetFaceMaterial(pbs.SelectedFaces.Length < 1 ? pbs.faces : pbs.SelectedFaces, mat);
}
else
{
pbUndo.RecordObject(pb, "Set Object Material");
pb.SetFaceMaterial(pb.faces, mat);
}
pb.ToMesh();
pb.Refresh();
pb.Optimize();
currentEvent.Use();
}
}
}
}
#endif
DrawHandleGUI(scnView);
if(editLevelToolbarRect.Contains(currentEvent.mousePosition))
scnView.Repaint();
if(!rightMouseDown && getKeyUp != KeyCode.None)
{
if(ShortcutCheck(currentEvent))
{
currentEvent.Use();
//.........这里部分代码省略.........