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


C# dfMouseEventArgs.Use方法代码示例

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


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

示例1: OnMouseMove

    public void OnMouseMove( dfControl control, dfMouseEventArgs args )
    {
        if( animating || !dragging )
            return;

        this.momentum = ( momentum + args.MoveDelta.Scale( 1, -1 ) ) * 0.5f;

        args.Use();

        if( args.Buttons.IsSet( dfMouseButtons.Left ) )
        {

            var ray = args.Ray;
            var distance = 0f;
            var direction = Camera.main.transform.TransformDirection( Vector3.back );
            var plane = new Plane( direction, lastPosition );
            plane.Raycast( ray, out distance );

            var pos = ( ray.origin + ray.direction * distance ).Quantize( control.PixelsToUnits() );
            var offset = pos - lastPosition;

            var transformPos = ( control.transform.position + offset ).Quantize( control.PixelsToUnits() );
            control.transform.position = transformPos;

            lastPosition = pos;

        }
    }
开发者ID:dashqasar,项目名称:GoogleMap,代码行数:28,代码来源:TouchThrow.cs

示例2: OnMouseMove

    protected internal override void OnMouseMove( dfMouseEventArgs args )
    {
        args.Use();

        if( args.Buttons.IsSet( dfMouseButtons.Left ) )
        {

            var ray = args.Ray;
            var distance = 0f;
            var direction = GetCamera().transform.TransformDirection( Vector3.back );
            var plane = new Plane( direction, lastPosition );
            plane.Raycast( ray, out distance );

            var pos = ( ray.origin + ray.direction * distance ).Quantize( parent.PixelsToUnits() );
            var offset = pos - lastPosition;

            var transformPos = ( parent.transform.position + offset ).Quantize( parent.PixelsToUnits() );
            parent.transform.position = transformPos;

            lastPosition = pos;

        }

        base.OnMouseMove( args );
    }
开发者ID:AhrenLi,项目名称:2048,代码行数:25,代码来源:dfDragHandle.cs

示例3: OnMouseDown

    public void OnMouseDown( dfControl control, dfMouseEventArgs args )
    {
        if( !args.Used && args.Buttons == dfMouseButtons.Middle )
        {

            if( contextMenu.IsOpen )
            {
                contextMenu.Close();
                return;
            }

            args.Use();

            var hitPosition = control.GetHitPosition( args );
            var host = contextMenu.host;

            host.RelativePosition = hitPosition - host.Size * 0.5f;
            host.BringToFront();
            host.Show();
            host.Focus();

            contextMenu.Open();

        }
    }
开发者ID:jscott1989,项目名称:public-access-wars,代码行数:25,代码来源:RadialContextMenu.cs

示例4: HelpClicked

    public void HelpClicked(dfControl control, dfMouseEventArgs args)
    {
        args.Use();
        TextAsset description = Resources.Load<TextAsset>("Descriptions/" + bi.className);
        GameObject prefab = (GameObject)Resources.Load("Prefabs/Buildings/" + bi.className);

        Dialog.Instance.SetDialog(bi.buildingName, description.text, "Continue", true, false,prefab);
    }
开发者ID:jackmott,项目名称:solescape,代码行数:8,代码来源:HelpButton.cs

示例5: OnMouseDown

 protected internal override void OnMouseDown(dfMouseEventArgs args)
 {
     base.GetRootContainer().BringToFront();
     args.Use();
     Plane plane = new Plane(this.parent.transform.TransformDirection(Vector3.back), this.parent.transform.position);
     Ray ray = args.Ray;
     float single = 0f;
     plane.Raycast(args.Ray, out single);
     this.lastPosition = ray.origin + (ray.direction * single);
     base.OnMouseDown(args);
 }
开发者ID:HexHash,项目名称:LegacyRust,代码行数:11,代码来源:dfDragHandle.cs

示例6: OnMouseWheel

    void OnMouseWheel( dfControl sender, dfMouseEventArgs args )
    {
        if( args.Used )
            return;

        args.Use();

        if( args.WheelDelta > 0 )
            SelectPrevious();
        else
            SelectNext();
    }
开发者ID:dashqasar,项目名称:GoogleMap,代码行数:12,代码来源:DemoListField.cs

示例7: OnMouseDown

    protected internal override void OnMouseDown( dfMouseEventArgs args )
    {
        GetRootContainer().BringToFront();

        args.Use();

        var plane = new Plane( parent.transform.TransformDirection( Vector3.back ), parent.transform.position );
        var ray = args.Ray;

        var distance = 0f;
        plane.Raycast( args.Ray, out distance );

        lastPosition = ( ray.origin + ray.direction * distance );

        base.OnMouseDown( args );
    }
开发者ID:haozi000005,项目名称:happy2d,代码行数:16,代码来源:dfDragHandle.cs

示例8: OnMouseDown

    public void OnMouseDown( dfControl control, dfMouseEventArgs args )
    {
        control.BringToFront();

        animating = false;
        momentum = Vector2.zero;

        dragging = true;
        args.Use();

        var plane = new Plane( control.transform.TransformDirection( Vector3.back ), control.transform.position );
        var ray = args.Ray;

        var distance = 0f;
        plane.Raycast( args.Ray, out distance );

        lastPosition = ( ray.origin + ray.direction * distance );
    }
开发者ID:dashqasar,项目名称:GoogleMap,代码行数:18,代码来源:TouchThrow.cs

示例9: OnMouseMove

 protected internal override void OnMouseMove(dfMouseEventArgs args)
 {
     args.Use();
     if (args.Buttons.IsSet(dfMouseButtons.Left))
     {
         Ray ray = args.Ray;
         float single = 0f;
         Vector3 vector3 = base.GetCamera().transform.TransformDirection(Vector3.back);
         Plane plane = new Plane(vector3, this.lastPosition);
         plane.Raycast(ray, out single);
         Vector3 vector31 = (ray.origin + (ray.direction * single)).Quantize(this.parent.PixelsToUnits());
         Vector3 vector32 = vector31 - this.lastPosition;
         Vector3 vector33 = (this.parent.transform.position + vector32).Quantize(this.parent.PixelsToUnits());
         this.parent.transform.position = vector33;
         this.lastPosition = vector31;
     }
     base.OnMouseMove(args);
 }
开发者ID:HexHash,项目名称:LegacyRust,代码行数:18,代码来源:dfDragHandle.cs

示例10: OnMouseMove

    protected internal override void OnMouseMove( dfMouseEventArgs args )
    {
        if( !args.Buttons.IsSet( dfMouseButtons.Left ) )
        {
            base.OnMouseMove( args );
            return;
        }

        this.Value = getValueFromMouseEvent( args );
        args.Use();

        Signal( "OnMouseMove", this, args );
        raiseMouseMoveEvent( args );
    }
开发者ID:AhrenLi,项目名称:2048,代码行数:14,代码来源:dfSlider.cs

示例11: OnMouseDown

    protected internal override void OnMouseDown( dfMouseEventArgs args )
    {
        if( args.Source != this )
        {
            base.OnMouseDown( args );
            return;
        }

        var setCursorPosition =
            !ReadOnly &&
            args.Buttons.IsSet( dfMouseButtons.Left ) &&
            (
                ( !HasFocus && !SelectOnFocus ) ||
                ( Time.realtimeSinceStartup - whenGotFocus ) > 0.25f
            );

        if( setCursorPosition )
        {

            var index = getCharIndexOfMouse( args );
            if( index != cursorIndex )
            {
                cursorIndex = index;
                cursorShown = true;
                Invalidate();
                args.Use();
            }

            mouseSelectionAnchor = cursorIndex;
            selectionStart = selectionEnd = cursorIndex;

            if( Time.realtimeSinceStartup - tripleClickTimer < 0.25f )
            {
                SelectAll();
                tripleClickTimer = 0f;
            }

        }

        base.OnMouseDown( args );
    }
开发者ID:BjarkeHou,项目名称:ProjectGuard,代码行数:41,代码来源:dfTextbox.cs

示例12: OnMouseMove

    protected internal override void OnMouseMove( dfMouseEventArgs args )
    {
        if( args is dfTouchEventArgs || isMouseDown )
        {

            if( !args.Used && ( args.Position - touchStartPosition ).magnitude > 5 )
            {

                var delta = args.MoveDelta.Scale( -1, 1 );

                // Calculate the effective screen size
                var manager = GetManager();
                var screenSize = manager.GetScreenSize();

                // Obtain a reference to the camera used to render this control
                var renderCamera = manager.RenderCamera;

                // Scale the movement amount by the difference between the "virtual"
                // screen size and the real screen size
                delta.x = screenSize.x * ( delta.x / renderCamera.pixelWidth );
                delta.y = screenSize.y * ( delta.y / renderCamera.pixelHeight );

                // Set the new scroll position and momentum
                ScrollPosition += delta;
                scrollMomentum = ( scrollMomentum + delta ) * 0.5f;

                args.Use();

            }

        }

        base.OnMouseMove( args );
    }
开发者ID:AhrenLi,项目名称:2048,代码行数:34,代码来源:dfScrollPanel.cs

示例13: OnMouseUp

    protected internal override void OnMouseUp( dfMouseEventArgs args )
    {
        //Parent.PerformLayout();
        Parent.MakePixelPerfect();

        args.Use();

        base.OnMouseUp( args );
    }
开发者ID:AhrenLi,项目名称:2048,代码行数:9,代码来源:dfResizeHandle.cs

示例14: OnMouseDown

    protected internal override void OnMouseDown( dfMouseEventArgs args )
    {
        args.Use();

        var plane = new Plane( parent.transform.TransformDirection( Vector3.back ), parent.transform.position );
        var ray = args.Ray;

        var distance = 0f;
        plane.Raycast( args.Ray, out distance );

        mouseAnchorPos = ( ray.origin + ray.direction * distance );

        startSize = parent.Size;
        startPosition = parent.RelativePosition;

        #region Calculate the min and max edge positions

        minEdgePos = startPosition;
        maxEdgePos = (Vector2)startPosition + startSize;

        var minSize = parent.CalculateMinimumSize();

        var maxSize = parent.MaximumSize;
        if( maxSize.magnitude <= float.Epsilon )
        {
            maxSize = Vector2.one * 2048;
        }

        if( ( Edges & ResizeEdge.Left ) == ResizeEdge.Left )
        {
            minEdgePos.x = maxEdgePos.x - maxSize.x;
            maxEdgePos.x = maxEdgePos.x - minSize.x;
        }
        else if( ( Edges & ResizeEdge.Right ) == ResizeEdge.Right )
        {
            minEdgePos.x = startPosition.x + minSize.x;
            maxEdgePos.x = startPosition.x + maxSize.x;
        }

        if( ( Edges & ResizeEdge.Top ) == ResizeEdge.Top )
        {
            minEdgePos.y = maxEdgePos.y - maxSize.y;
            maxEdgePos.y = maxEdgePos.y - minSize.y;
        }
        else if( ( Edges & ResizeEdge.Bottom ) == ResizeEdge.Bottom )
        {
            minEdgePos.y = startPosition.y + minSize.y;
            maxEdgePos.y = startPosition.y + maxSize.y;
        }

        #endregion
    }
开发者ID:AhrenLi,项目名称:2048,代码行数:52,代码来源:dfResizeHandle.cs

示例15: OnMouseDown

    protected internal override void OnMouseDown( dfMouseEventArgs args )
    {
        if( args.Buttons.IsSet( dfMouseButtons.Left ) )
            this.Focus();

        if( args.Source == incButton || args.Source == decButton )
            return;

        if( ( args.Source != track && args.Source != thumb ) || !args.Buttons.IsSet( dfMouseButtons.Left ) )
        {
            base.OnMouseDown( args );
            return;
        }

        if( args.Source == this.thumb )
        {

            // Find the point where the ray intersects the thumb
            RaycastHit hitInfo;
            thumb.collider.Raycast( args.Ray, out hitInfo, 1000f );

            // Calculate the thumb's center in global space
            var thumbCenter = thumb.transform.position + thumb.Pivot.TransformToCenter( thumb.Size * PixelsToUnits() );

            // Calculate the offset between the intersect point and the
            // thumb's upper left corner so that the thumb can always
            // be positioned relative to the mouse while dragging
            this.thumbMouseOffset = ( thumbCenter - hitInfo.point );

        }
        else
        {
            updateFromTrackClick( args );
        }

        args.Use();
        Signal( "OnMouseDown", args );
    }
开发者ID:haozi000005,项目名称:happy2d,代码行数:38,代码来源:dfScrollbar.cs


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