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


C# UnityEngine.Event类代码示例

本文整理汇总了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();
                }
            }
        }
开发者ID:RawCode,项目名称:CommunityCoreLibrary,代码行数:28,代码来源:ChangeColor.cs

示例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();
        }
开发者ID:darktable,项目名称:eDriven,代码行数:35,代码来源:KeyboardProcessor.cs

示例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);
     }
 }
开发者ID:dafei2015,项目名称:hugula,代码行数:25,代码来源:Lua_UnityEngine_Event.cs

示例4: OnSceneGUI

 public static void OnSceneGUI(SceneView sceneView, Event e)
 {
     if (e.type == EventType.Repaint || e.type == EventType.Layout)
     {
         OnRepaint(sceneView, e);
     }
 }
开发者ID:5thFloorGames,项目名称:FollowTheLight,代码行数:7,代码来源:Toolbar.cs

示例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());
            }
        }
开发者ID:bwheatley,项目名称:edriven,代码行数:36,代码来源:MousePositionProcessor.cs

示例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;
                }
            }
        }
开发者ID:sinfonia2015,项目名称:iOS_AdditionCrash,代码行数:30,代码来源:FresviiGUISegmentedControl.cs

示例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();
            }
        }
开发者ID:abarleze,项目名称:GitUnityTest,代码行数:60,代码来源:QLockComponent.cs

示例8: OnContextClick

 /// <summary>
 /// 
 /// </summary>
 /// <param name="e"></param>
 protected override void OnContextClick( Event e )
 {
     if ( Positionless || PointInControl( e.mousePosition ) )
     {
         Menu.ShowAsContext();
         e.Use();
     }
 }
开发者ID:ChelseaLing,项目名称:UForms,代码行数:12,代码来源:ContextMenuControl.cs

示例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;
 }
开发者ID:HexHash,项目名称:LegacyRust,代码行数:8,代码来源:Event.cs

示例10: Event

 public Event(Event other)
 {
     if (other == null)
     {
         throw new ArgumentException("Event to copy from is null.");
     }
     this.InitCopy(other);
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:8,代码来源:Event.cs

示例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;
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:8,代码来源:AnimEditorOverlay.cs

示例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);
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:8,代码来源:AnimEditorOverlay.cs

示例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));
        }
开发者ID:RWA-Team,项目名称:RimworldAscension,代码行数:8,代码来源:Designator_Group.cs

示例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;
        }
开发者ID:drussilla,项目名称:ConsoleX,代码行数:58,代码来源:ReadOnlyInputField.cs

示例15: ProcessInput

        public override void ProcessInput( Event ev )
        {
            base.ProcessInput( ev );

            if( ev.button == 0 )
                _light.IncrementColorIndex();
            else if (ev.button == 1)
                _light.DecrementColorIndex();
        }
开发者ID:DAOWAce,项目名称:CommunityCoreLibrary,代码行数:9,代码来源:CommandChangeColor.cs


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