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


C# dfControl.OnDragEnter方法代码示例

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


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

示例1: ProcessInput

            public void ProcessInput( dfInputManager manager, IInputAdapter adapter, Ray ray, dfControl control, bool retainFocusSetting )
            {

            var position = adapter.GetMousePosition();

            buttonsDown = dfMouseButtons.None;
            buttonsReleased = dfMouseButtons.None;
            buttonsPressed = dfMouseButtons.None;

            getMouseButtonInfo( adapter, ref buttonsDown, ref buttonsReleased, ref buttonsPressed );

            float scroll = adapter.GetAxis( scrollAxisName );
            if( !Mathf.Approximately( scroll, 0f ) )
            {
                // By default the mouse wheel is reported in increments of 0.1f,
                // which is just a useless number for UI, but this can be changed
                // by the user in the Unity Input Manager. We'll assume that if the
                // number reported is less than 1 then it is probably safe to
                // assume that we can massage it for UI purposes.
                scroll = Mathf.Sign( scroll ) * Mathf.Max( 1, Mathf.Abs( scroll ) );
            }

            mouseMoveDelta = position - lastPosition;
            lastPosition = position;

            #region Drag and drop

            if( dragState == dfDragDropState.Dragging )
            {

                if( buttonsReleased == dfMouseButtons.None )
                {

                    // Do nothing if the drag operation is over the source control
                    // and no buttons have been released.
                    if( control == activeControl )
                        return;

                    if( control != lastDragControl )
                    {

                        if( lastDragControl != null )
                        {
                            var dragArgs = new dfDragEventArgs( lastDragControl, dragState, dragData, ray, position );
                            lastDragControl.OnDragLeave( dragArgs );
                        }

                        if( control != null )
                        {
                            var dragArgs = new dfDragEventArgs( control, dragState, dragData, ray, position );
                            control.OnDragEnter( dragArgs );
                        }

                        lastDragControl = control;

                        return;

                    }

                    if( control != null )
                    {

                        if( mouseMoveDelta.magnitude > 1.0f )
                        {
                            var dragArgs = new dfDragEventArgs( control, dragState, dragData, ray, position );
                            control.OnDragOver( dragArgs );
                        }

                    }

                    return;

                }

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

                    var dragArgs = new dfDragEventArgs( control, dfDragDropState.Dragging, dragData, ray, position );
                    control.OnDragDrop( dragArgs );

                    // If there was no event consumer, or if the event consumer did not
                    // change the state from Dragging (which is not a valid state for
                    // a drop event) then just cancel the operation
                    if( !dragArgs.Used || dragArgs.State == dfDragDropState.Dragging )
                        dragArgs.State = dfDragDropState.Cancelled;

                    dragArgs = new dfDragEventArgs( activeControl, dragArgs.State, dragArgs.Data, ray, position );
                    dragArgs.Target = control;
                    activeControl.OnDragEnd( dragArgs );

                }
                else
                {
                    var cancelState = ( control == null ) ? dfDragDropState.CancelledNoTarget : dfDragDropState.Cancelled;
                    var dragArgs = new dfDragEventArgs( activeControl, cancelState, dragData, ray, position );
                    activeControl.OnDragEnd( dragArgs );
                }

                dragState = dfDragDropState.None;
                lastDragControl = null;
//.........这里部分代码省略.........
开发者ID:zc1415926,项目名称:Unity-SelectCharacter-Scene,代码行数:101,代码来源:dfInputManager.cs


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