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


C# dfControl.OnMouseWheel方法代码示例

本文整理汇总了C#中dfControl.OnMouseWheel方法的典型用法代码示例。如果您正苦于以下问题:C# dfControl.OnMouseWheel方法的具体用法?C# dfControl.OnMouseWheel怎么用?C# dfControl.OnMouseWheel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dfControl的用法示例。


在下文中一共展示了dfControl.OnMouseWheel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProcessInput


//.........这里部分代码省略.........
                // Let the last control know that the button was released whether it was
                // released over the control or not
                activeControl.OnMouseUp( new dfMouseEventArgs( activeControl, buttonsReleased, 0, ray, position, scroll ) );

                // If all buttons are up, then we need to reset the mouse state
                if( buttonsDown == dfMouseButtons.None && activeControl != control )
                {
                    setActive( manager, null, position, ray );
                }

                return;

            }

            #endregion

            #region Doesn't matter if buttons are down or not

            if( activeControl != null && activeControl == control )
            {

                if( mouseMoveDelta.magnitude == 0 && Time.realtimeSinceStartup - lastHoverTime > manager.hoverNotifactionFrequency )
                {
                    activeControl.OnMouseHover( new dfMouseEventArgs( activeControl, buttonsDown, 0, ray, position, scroll ) );
                    lastHoverTime = Time.realtimeSinceStartup;
                }

            }

            #endregion

            #region No buttons down

            if( buttonsDown == dfMouseButtons.None )
            {

                if( scroll != 0 && control != null )
                {
                    setActive( manager, control, position, ray );
                    control.OnMouseWheel( new dfMouseEventArgs( control, buttonsDown, 0, ray, position, scroll ) );
                    return;
                }

                setActive( manager, control, position, ray );

            }

            #endregion

            #region Some buttons down

            else if( buttonsDown != dfMouseButtons.None ) // Some buttons are down
            {

                if( activeControl != null )
                {

                    // Special case: Another control with a higher RenderOrder is now under the mouse.
                    // This can happen when a control moves, such as when you click on a slider and the
                    // thumb position is updated to be under the mouse (when it wasn't previously)
                    if( control != null && control.RenderOrder > activeControl.RenderOrder )
                    {
                        // TODO: What to do about this when a control has capture?
                    }

                    // If the mouse was moved notify the control, otherwise nothing to do
                    // NOTE: This is similar to "mouse capture" on Windows Forms
                    if( mouseMoveDelta.magnitude >= DRAG_START_DELTA )
                    {

                        if( ( buttonsDown & ( dfMouseButtons.Left | dfMouseButtons.Right ) ) != 0 && dragState != dfDragDropState.Denied )
                        {
                            var dragArgs = new dfDragEventArgs( activeControl ) { Position = position };
                            activeControl.OnDragStart( dragArgs );
                            if( dragArgs.State == dfDragDropState.Dragging )
                            {
                                dragState = dfDragDropState.Dragging;
                                dragData = dragArgs.Data;
                                return;
                            }
                            else
                            {
                                dragState = dfDragDropState.Denied;
                            }
                        }

                    }

                }

            }

            #endregion

            if( activeControl != null && mouseMoveDelta.magnitude >= 1 )
            {
                var moveArgs = new dfMouseEventArgs( activeControl, buttonsDown, 0, ray, position, scroll ) { MoveDelta = mouseMoveDelta };
                activeControl.OnMouseMove( moveArgs );
            }
        }
开发者ID:zc1415926,项目名称:Unity-SelectCharacter-Scene,代码行数:101,代码来源:dfInputManager.cs


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