本文整理汇总了C#中UnityEngine.Event类的典型用法代码示例。如果您正苦于以下问题:C# Event类的具体用法?C# Event怎么用?C# Event使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Event类属于UnityEngine命名空间,在下文中一共展示了Event类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessInput
public override void ProcessInput( Event ev )
{
base.ProcessInput( ev );
if ( usePicker )
{
Color col = parentLight.CompGlower.Props.glowColor.ToColor;
// set alpha to 1 (lights use alpha zero, but that won't show in the picker)
ColorWrapper _color = new ColorWrapper( new Color( col.r, col.g, col.b ) );
Find.WindowStack.Add( new Dialog_ColorPicker( _color, delegate
{
parentLight.ChangeColor( _color.Color );
}, ev.button == 1, true ) );
}
else
{
if( ev.button == 0 )
{
parentLight.IncrementColorIndex();
}
else if( ev.button == 1 )
{
parentLight.DecrementColorIndex();
}
}
}
示例2: Process
public override void Process(Event e)
{
#if DEBUG
if (DebugMode)
Debug.Log("KeyboardProcessor.Process");
#endif
/**
* 1) Overal key events
* */
if (e.type == EventType.KeyDown)
{
#if DEBUG
if (DebugMode)
Debug.Log("KeyboardProcessor.KeyDown");
#endif
if (SystemManager.KeyDownSignal.Connected)
SystemManager.KeyDownSignal.Emit(e);
}
else if (e.type == EventType.KeyUp)
{
#if DEBUG
if (DebugMode)
Debug.Log("KeyboardProcessor.KeyUp");
#endif
if (SystemManager.KeyUpSignal.Connected)
SystemManager.KeyUpSignal.Emit(e);
}
if (e.keyCode == KeyCode.Tab || e.character == '\t')
e.Use();
}
示例3: constructor
public static int constructor(IntPtr l)
{
try {
int argc = LuaDLL.lua_gettop(l);
UnityEngine.Event o;
if(argc==1){
o=new UnityEngine.Event();
pushValue(l,true);
pushValue(l,o);
return 2;
}
else if(argc==2){
UnityEngine.Event a1;
checkType(l,2,out a1);
o=new UnityEngine.Event(a1);
pushValue(l,true);
pushValue(l,o);
return 2;
}
return error(l,"New object failed.");
}
catch(Exception e) {
return error(l,e);
}
}
示例4: OnSceneGUI
public static void OnSceneGUI(SceneView sceneView, Event e)
{
if (e.type == EventType.Repaint || e.type == EventType.Layout)
{
OnRepaint(sceneView, e);
}
}
示例5: Process
/// <summary>
/// Note: e is null because MouseMoveProcessor doesn't deal with Event.current! (not inside of the OnGUI)
/// </summary>
/// <param name="e"></param>
public override void Process(Event e)
{
#if DEBUG
if (DebugMode)
Debug.Log("MousePositionProcessor.Process");
#endif
Vector3 pos = Input.mousePosition;
if (_rawMousePosition.x != pos.x || _rawMousePosition.y != pos.y)
{
_coords = StageUtil.FlipY(pos);
_mousePosition.X = _coords.x;
_mousePosition.Y = _coords.y;
#if DEBUG
if (DebugMode)
//Debug.Log("Input.mousePosition: " + Input.mousePosition + "; _rawMousePosition: " + _rawMousePosition + "; GlobalPosition:" + _coords);
Debug.Log("mouse: GlobalPosition:" + _mousePosition);
#endif
// propagate position to system manager
SystemManager.MousePosition.X = _mousePosition.X;
SystemManager.MousePosition.Y = _mousePosition.Y;
_rawMousePosition = pos;
//Debug.Log(" -> _rawMousePosition:" + _rawMousePosition);
if (SystemManager.Instance.MouseMoveSignal.Connected)
SystemManager.Instance.MouseMoveSignal.Emit(null, _mousePosition.Clone());
}
}
示例6: EventProc
public void EventProc(Rect position, Event e)
{
if (labels.Count == 0) return;
for (int i = 0; i < labels.Count; i++)
{
Rect buttonRect = new Rect(position.x + i * position.width / labels.Count, position.y, position.width / labels.Count, position.height);
bool hitContain = (e.button == 0) && buttonRect.Contains(e.mousePosition);
if (e.type == EventType.MouseDown && hitContain)
{
touching = true;
}
if (FASGesture.IsDragging)
{
touching = false;
}
if (e.type == EventType.MouseUp && hitContain && touching)
{
e.Use();
OnTapped(i);
selectedIndex = i;
}
}
}
示例7: eventHandler
public override void eventHandler(GameObject gameObject, QObjectList objectList, Event currentEvent, Rect curRect)
{
if (currentEvent.isMouse && currentEvent.button == 0 && curRect.Contains(currentEvent.mousePosition))
{
bool isLock = isGameObjectLock(gameObject, objectList);
if (currentEvent.type == EventType.MouseDown)
{
targetLockState = ((!isLock) == true ? 1 : 0);
}
else if (currentEvent.type == EventType.MouseDrag && targetLockState != -1)
{
if (targetLockState == (isLock == true ? 1 : 0)) return;
}
else
{
targetLockState = -1;
return;
}
List<GameObject> targetGameObjects = new List<GameObject>();
if (currentEvent.shift)
{
if (!showModifierWarning || EditorUtility.DisplayDialog("Change locking", "Are you sure you want to " + (isLock ? "unlock" : "lock") + " this GameObject and all its children? (You can disable this warning in the settings)", "Yes", "Cancel"))
{
getGameObjectListRecursive(gameObject, ref targetGameObjects);
}
}
else if (currentEvent.alt)
{
if (gameObject.transform.parent != null)
{
if (!showModifierWarning || EditorUtility.DisplayDialog("Change locking", "Are you sure you want to " + (isLock ? "unlock" : "lock") + " this GameObject and its siblings? (You can disable this warning in the settings)", "Yes", "Cancel"))
{
getGameObjectListRecursive(gameObject.transform.parent.gameObject, ref targetGameObjects, 1);
targetGameObjects.Remove(gameObject.transform.parent.gameObject);
}
}
else
{
Debug.Log("This action for root objects is supported only for Unity3d 5.3.3 and above");
return;
}
}
else
{
if (Selection.Contains(gameObject))
{
targetGameObjects.AddRange(Selection.gameObjects);
}
else
{
getGameObjectListRecursive(gameObject, ref targetGameObjects, 0);
};
}
setLock(targetGameObjects, objectList, !isLock);
currentEvent.Use();
}
}
示例8: OnContextClick
/// <summary>
///
/// </summary>
/// <param name="e"></param>
protected override void OnContextClick( Event e )
{
if ( Positionless || PointInControl( e.mousePosition ) )
{
Menu.ShowAsContext();
e.Use();
}
}
示例9: Event
internal Event(UnityEngine.Event @event)
{
[email protected] = @event;
this.originalType = @event.type;
this.originalRawType = @event.rawType;
this.overrideType = EventType.Used;
this.screenPosition = Input.mousePosition;
}
示例10: Event
public Event(Event other)
{
if (other == null)
{
throw new ArgumentException("Event to copy from is null.");
}
this.InitCopy(other);
}
示例11: OnDragPlayHead
private bool OnDragPlayHead(Event evt)
{
this.state.currentTime = this.MousePositionToTime(evt);
this.state.recording = true;
this.state.playing = false;
this.state.ResampleAnimation();
return true;
}
示例12: MousePositionToValue
public float MousePositionToValue(Event evt)
{
float num2 = this.m_ContentRect.height - evt.mousePosition.y;
TimeArea timeArea = this.state.timeArea;
float num3 = timeArea.m_Scale.y * -1f;
float num4 = (timeArea.shownArea.yMin * num3) * -1f;
return ((num2 - num4) / num3);
}
示例13: ProcessInput
public override void ProcessInput(Event ev)
{
var options = designators.Where(designator => designator.Visible)
.Select(designator => new FloatMenuOption_Group(designator.LabelCap, () => designator.ProcessInput(ev), designator))
.ToList();
Find.WindowStack.Add(new FloatMenu_Group(options));
}
示例14: IsAllowedCombination
private bool IsAllowedCombination(Event evt)
{
var currentEventModifiers = evt.modifiers;
RuntimePlatform rp = Application.platform;
bool isMac = (rp == RuntimePlatform.OSXEditor || rp == RuntimePlatform.OSXPlayer || rp == RuntimePlatform.OSXWebPlayer);
bool ctrl = isMac ? (currentEventModifiers & EventModifiers.Command) != 0 : (currentEventModifiers & EventModifiers.Control) != 0;
switch (evt.keyCode)
{
case KeyCode.Home:
case KeyCode.End:
case KeyCode.LeftControl:
case KeyCode.RightControl:
{
return true;
}
// Select All
case KeyCode.A:
{
if (ctrl)
{
return true;
}
break;
}
// Copy
case KeyCode.C:
{
if (ctrl)
{
return true;
}
break;
}
case KeyCode.V:
{
if (ctrl)
{
OnValueInserted(this, new StringEventArgs(GetClipboard()));
return false;
}
break;
}
case KeyCode.LeftArrow:
case KeyCode.RightArrow:
case KeyCode.UpArrow:
case KeyCode.DownArrow:
{
return true;
}
}
return false;
}
示例15: ProcessInput
public override void ProcessInput( Event ev )
{
base.ProcessInput( ev );
if( ev.button == 0 )
_light.IncrementColorIndex();
else if (ev.button == 1)
_light.DecrementColorIndex();
}