• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# DragInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中DragInfo的典型用法代码示例。如果您正苦于以下问题:C# DragInfo类的具体用法?C# DragInfo怎么用?C# DragInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DragInfo类属于命名空间,在下文中一共展示了DragInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: DraggingHandler

    void DraggingHandler(DragInfo dragInfo)
    {
        if (debug) Debug.Log("====DraggingHandler====\n|| fingercount: " + dragInfo.fingerCount +
                                        " || index: " + dragInfo.index +
                                        " || isFlick: " + dragInfo.isFlick +
                                        " || pos: " + dragInfo.pos );

        if (dragInfo.pos.x / Screen.width <= 0.3)
        {
            yTouchLeft = dragInfo.pos.y / Screen.height;
            Debug.Log("Left: " + yTouchLeft );
        }

        if (dragInfo.pos.x / Screen.width >= 0.7)
        {
            yTouchRight = dragInfo.pos.y / Screen.height;
            Debug.Log("Right: " + yTouchRight );
        }

        speedModifier = (yTouchLeft >= yTouchRight) ? yTouchLeft : yTouchRight;

        directionModifier = yTouchLeft - yTouchRight;
        Debug.Log("Direction: " + directionModifier );

        Debug.Log("speedModifier: " + speedModifier );

        Vector3 pos = Megaman.transform.localPosition;
        pos.x = megamanInitialX + directionModifier*-1;
        float offsettedSpeedModifier = speedModifier - 0.5f;
        pos.z = megamanInitialZ + offsettedSpeedModifier;
        Megaman.transform.localPosition = pos;
        //Debug.Log("orbit.XModifier: "+orbit.XModifier);
    }
开发者ID:asglu,项目名称:supersomething,代码行数:33,代码来源:GameController.cs


示例2: DraggingStartHandler

 void DraggingStartHandler(DragInfo dragInfo)
 {
     if (debug) Debug.Log("====DraggingStartHandler====\n|| fingercount: " + dragInfo.fingerCount +
                          " || index: " + dragInfo.index +
                          " || isFlick: " + dragInfo.isFlick +
                          " || pos: " + dragInfo.pos );
 }
开发者ID:asglu,项目名称:supersomething,代码行数:7,代码来源:GameController.cs


示例3: OnDraggingEnd

        void OnDraggingEnd(DragInfo drag)
        {
            pointer.enabled = false;

            IT_Gesture.onMouse1E -= OnTouch;

            IT_Gesture.onDraggingEndE -= OnDraggingEnd;
        }
开发者ID:tetsujp84,项目名称:karaketsua,代码行数:8,代码来源:FMovePointer.cs


示例4: OnChargeForMove

        //スワイプによる移動操作検知
        void OnChargeForMove(DragInfo dragInfo)
        {
            //自分キャラ
            if (BCharacterManager.Instance.GetCharacterOnTile(dragInfo.pos) != this.character) return;

            //キャラクター移動用
            IT_Gesture.onDraggingEndE += OnDragMove;
        }
开发者ID:tetsujp84,项目名称:karaketsua,代码行数:9,代码来源:BCharacterMoverManual.cs


示例5: OnDraggingStart

        //移動開始
        void OnDraggingStart(DragInfo drag)
        {
            //タッチ位置取得

            dragPosition = drag.pos;
            IT_Gesture.onMouse1E += OnTouch;

            IT_Gesture.onDraggingEndE += OnDraggingEnd;
        }
开发者ID:tetsujp84,项目名称:karaketsua,代码行数:10,代码来源:FCharacter.cs


示例6: OnDrag

    void OnDrag(DragInfo info)
    {
        if (vertical) scrollDelta = info.delta.y;
        else scrollDelta = info.delta.x;

        MoveChildren(scrollDelta*scrollSpeed);

        scrollDelta /= Mathf.Abs(scrollDelta);
    }
开发者ID:90ninecents,项目名称:SWAPPZ-1,代码行数:9,代码来源:ScrollingPane.cs


示例7: OnDragging

 //called when one finger drag are detected
 void OnDragging(DragInfo dragInfo)
 {
     //apply the DPI scaling
     dragInfo.delta/=IT_Gesture.GetDPIFactor();
     //vertical movement is corresponded to rotation in x-axis
     this.orbitSpeedX=-dragInfo.delta.y* this.rotXSpeedModifier;
     //horizontal movement is corresponded to rotation in y-axis
     this.orbitSpeedY=dragInfo.delta.x* this.rotYSpeedModifier;
 }
开发者ID:SHEePYTaGGeRNeP,项目名称:GTO4Mobile,代码行数:10,代码来源:RTSCam_RotateObject.cs


示例8: OnDraggingStart

        //移動開始
        void OnDraggingStart(DragInfo drag)
        {
            //タッチ位置取得
            pointer.enabled = true;
            DragPosition = drag.pos;
            IT_Gesture.onMouse1E += OnTouch;

            IT_Gesture.onDraggingEndE += OnDraggingEnd;
        }
开发者ID:tetsujp84,项目名称:karaketsua,代码行数:10,代码来源:FMovePointer.cs


示例9: HandleGestureonDraggingStartE

 void HandleGestureonDraggingStartE(DragInfo dragInfo)
 {
     if (!isDragging) return;
     Transform puck = PickObject (dragInfo.pos);
     if (puck) {
         lastPuck = puck;
         baseHeight = puck.position.y;
         puck.renderer.material.color = Color.green;
     }
 }
开发者ID:thevole,项目名称:unitygestures,代码行数:10,代码来源:TouchPlay.cs


示例10: HandleDragging

 void HandleDragging(DragInfo dragInfo)
 {
     if (!isDragging) return;
     if (lastPuck) {
         DisplayText ("Dragging puck to: " + dragInfo.pos);
         Vector3 worldPos = GetWorldPos (dragInfo.pos);
         lastPuck.transform.position = worldPos;
     } else {
         DisplayText ("Dragging to: " + dragInfo.pos);
     }
 }
开发者ID:thevole,项目名称:unitygestures,代码行数:11,代码来源:TouchPlay.cs


示例11: Obj2ToCursor

    //assign dragObj2 to the dragInfo position, and display the appropriate tooltip
    void Obj2ToCursor(DragInfo dragInfo)
    {
        Vector3 p=Camera.main.ScreenToWorldPoint(new Vector3(dragInfo.pos.x, dragInfo.pos.y, 30));
        dragObj2.position=p;

        if(dragInfo.isMouse){
            dragTextMesh2.text="Dragging with mouse"+(dragInfo.index+1);
        }
        else{
            dragTextMesh2.text="Dragging with finger"+(dragInfo.index+1);
        }
    }
开发者ID:prasantha60,项目名称:PeoplePilot,代码行数:13,代码来源:TapDemo.cs


示例12: OnDragging

 //called when one finger drag are detected
 void OnDragging(DragInfo dragInfo)
 {
     //if the drag is perform using mouse2, use it as a two finger drag
     if(dragInfo.isMouse && dragInfo.index==1) OnMFDragging(dragInfo);
     //else perform normal orbiting
     else{
         //vertical movement is corresponded to rotation in x-axis
         orbitSpeedX=-dragInfo.delta.y*rotXSpeedModifier;
         //horizontal movement is corresponded to rotation in y-axis
         orbitSpeedY=dragInfo.delta.x*rotYSpeedModifier;
     }
 }
开发者ID:alusor,项目名称:Recompensas,代码行数:13,代码来源:RotateObject.cs


示例13: MouseRoutine

    IEnumerator MouseRoutine(int index)
    {
        mouseIndex.Add(index);

        bool dragStarted=false;

        Vector2 startPos=Input.mousePosition;
        Vector2 lastPos=startPos;

        float timeStart=Mathf.Infinity;

        while(mouseIndex.Contains(index)){

            Vector2 curPos=Input.mousePosition;

            if(!dragStarted){
                if(Vector3.Distance(curPos, startPos)>minDragDistance){
                    dragStarted=true;
                    Vector2 delta=curPos-startPos;
                    DragInfo dragInfo=new DragInfo(curPos, delta, 1, index, true);
                    IT_Gesture.DraggingStart(dragInfo);

                    timeStart=Time.realtimeSinceStartup;
                }
            }
            else{
                if(curPos!=lastPos){
                    Vector2 delta=curPos-lastPos;
                    DragInfo dragInfo=new DragInfo(curPos, delta, 1, index, true);
                    IT_Gesture.Dragging(dragInfo);
                }
                else if(fireOnDraggingWhenNotMoving){
                    DragInfo dragInfo=new DragInfo(curPos, Vector2.zero, 1, index, true);
                    IT_Gesture.Dragging(dragInfo);
                }
            }

            lastPos=curPos;

            yield return null;
        }

        if(dragStarted){
            bool isFlick=false;
            if(Time.realtimeSinceStartup-timeStart<0.5f) isFlick=true;

            Vector2 delta=lastPos-startPos;
            DragInfo dragInfo=new DragInfo(lastPos, delta, 1, index, isFlick, true);

            IT_Gesture.DraggingEnd(dragInfo);
        }
    }
开发者ID:hellaeon,项目名称:ballblazer,代码行数:52,代码来源:DragDetector.cs


示例14: OnDragging

    //called when one finger drag are detected
    void OnDragging(DragInfo dragInfo)
    {
        Debug.Log("drag "+dragInfo.delta);
        if(dragInfo.type!=2){
            //vertical movement is corresponded to rotation in x-axis
            orbitSpeedX=-dragInfo.delta.y*rotXSpeedModifier;
            //horizontal movement is corresponded to rotation in y-axis
            orbitSpeedY=dragInfo.delta.x*rotYSpeedModifier;
        }

        //if the drag is perform using mouse2, use it as a two finger drag
        if(dragInfo.type==2) OnDFDragging(dragInfo);
    }
开发者ID:johannaph,项目名称:nowBabyGit12,代码行数:14,代码来源:RTSCam.cs


示例15: OnDragging

 //called when one finger drag are detected
 void OnDragging(DragInfo dragInfo)
 {
     //if the drag is perform using mouse2, use it as a two finger drag
     if(dragInfo.isMouse && dragInfo.index==1) this.OnMFDragging(dragInfo);
     //else perform normal orbiting
     else{
         //apply the DPI scaling
         dragInfo.delta/=IT_Gesture.GetDPIFactor();
         //vertical movement is corresponded to rotation in x-axis
         this.orbitSpeedX=-dragInfo.delta.y* this.rotXSpeedModifier;
         //horizontal movement is corresponded to rotation in y-axis
         this.orbitSpeedY=dragInfo.delta.x* this.rotYSpeedModifier;
     }
 }
开发者ID:SHEePYTaGGeRNeP,项目名称:GTO4Mobile,代码行数:15,代码来源:RTSCam.cs


示例16: ConvertDragToDirection

 public static Directions ConvertDragToDirection(DragInfo drag)
 {
     Vector2 normalized = (drag.pos - dragStart).normalized;
     if (normalized.x > 0 && Math.Abs(normalized.y) < normalized.x)
         return Directions.Right;
     if (normalized.y > 0 && Math.Abs(normalized.x) < normalized.y)
         return Directions.Up;
     if (normalized.x < 0 && Math.Abs(normalized.y) > normalized.x)
         return Directions.Left;
     if (normalized.y < 0 && Math.Abs(normalized.x) > normalized.y)
         return Directions.Down;
     Debug.Log("Converting Drag to Directions Failed");
     return Directions.None;
 }
开发者ID:SHEePYTaGGeRNeP,项目名称:GTO4Mobile,代码行数:14,代码来源:InputManager.cs


示例17: OnMFDragging

    //called when a dual finger or a right mouse drag is detected
    void OnMFDragging(DragInfo dragInfo)
    {
        //make a new direction, pointing horizontally at the direction of the camera y-rotation
        Quaternion direction=Quaternion.Euler(0, transform.parent.rotation.eulerAngles.y, 0);

        //calculate forward movement based on vertical input
        Vector3 moveDirZ=transform.parent.InverseTransformDirection(direction*Vector3.forward*-dragInfo.delta.y);
        //calculate sideway movement base on horizontal input
        Vector3 moveDirX=transform.parent.InverseTransformDirection(direction*Vector3.right*-dragInfo.delta.x);

        //move the cmera
        transform.parent.Translate(moveDirZ * panSpeedModifier * Time.deltaTime);
        transform.parent.Translate(moveDirX * panSpeedModifier * Time.deltaTime);
    }
开发者ID:asglu,项目名称:supersomething,代码行数:15,代码来源:RTSCam.cs


示例18: Obj1ToCursor

    //assign dragObj1 to the dragInfo position, and display the appropriate tooltip
    void Obj1ToCursor(DragInfo dragInfo)
    {
        //~ LayerMask layer=~(1<<dragObj1.gameObject.layer);
        //~ Ray ray = Camera.main.ScreenPointToRay (dragInfo.pos);
        //~ RaycastHit hit;
        //~ if (Physics.Raycast (ray, out hit, Mathf.Infinity, layer)) {
            //~ dragObj1.position=hit.point;
        //~ }

        Vector3 p=Camera.main.ScreenToWorldPoint(new Vector3(dragInfo.pos.x, dragInfo.pos.y, 30));
        this.dragObj1.position=p+ this.dragOffset1;

        if(dragInfo.isMouse){
            this.dragTextMesh1.text="Dragging with mouse"+(dragInfo.index+1);
        }
        else{
            this.dragTextMesh1.text="Dragging with finger"+(dragInfo.index+1);
        }
    }
开发者ID:SHEePYTaGGeRNeP,项目名称:GTO4Mobile,代码行数:20,代码来源:TapDemo.cs


示例19: MouseRoutine

    IEnumerator MouseRoutine(int index)
    {
        mouseIndex.Add(index);

        bool dragStarted=false;

        Vector2 startPos=Input.mousePosition;
        Vector2 lastPos=startPos;

        while(mouseIndex.Contains(index)){

            Vector2 curPos=Input.mousePosition;

            if(!dragStarted){
                if(Vector3.Distance(curPos, startPos)>minDragDistance){
                    dragStarted=true;
                    Vector2 delta=curPos-startPos;
                    DragInfo dragInfo=new DragInfo(curPos, delta, 1, index, true);
                    Gesture.DraggingStart(dragInfo);
                }
            }
            else{
                if(curPos!=lastPos){
                    Vector2 delta=curPos-lastPos;
                    DragInfo dragInfo=new DragInfo(curPos, delta, 1, index, true);
                    Gesture.Dragging(dragInfo);
                }
            }

            lastPos=curPos;

            yield return null;
        }

        if(dragStarted){
            Vector2 delta=lastPos-startPos;
            DragInfo dragInfo=new DragInfo(lastPos, delta, 1, index, true);
            Gesture.DraggingEnd(dragInfo);
        }
    }
开发者ID:thevole,项目名称:unitygestures,代码行数:40,代码来源:DragDetector.cs


示例20: DropInfo

        public DropInfo(object sender, DragEventArgs e, DragInfo dragInfo, string dataFormat)
        {
            Data = (e.Data.GetDataPresent(dataFormat)) ? e.Data.GetData(dataFormat) : e.Data;
            DragInfo = dragInfo;

            VisualTarget = sender as UIElement;

            if (sender is ItemsControl)
            {
                ItemsControl itemsControl = (ItemsControl)sender;
                UIElement item = itemsControl.GetItemContainerAt(e.GetPosition(itemsControl));

                VisualTargetOrientation = itemsControl.GetItemsPanelOrientation();

                if (item != null)
                {
                    ItemsControl itemParent = ItemsControl.ItemsControlFromItemContainer(item);

                    InsertIndex = itemParent.ItemContainerGenerator.IndexFromContainer(item);
                    TargetCollection = itemParent.ItemsSource ?? itemParent.Items;
                    TargetItem = itemParent.ItemContainerGenerator.ItemFromContainer(item);
                    VisualTargetItem = item;

                    if (VisualTargetOrientation == Orientation.Vertical)
                    {
                        if (e.GetPosition(item).Y > item.RenderSize.Height / 2) InsertIndex++;
                    }
                    else
                    {
                        if (e.GetPosition(item).X > item.RenderSize.Width / 2) InsertIndex++;
                    }
                }
                else
                {
                    TargetCollection = itemsControl.ItemsSource ?? itemsControl.Items;
                    InsertIndex = itemsControl.Items.Count;
                }
            }
        }
开发者ID:eolandezhang,项目名称:Diagram,代码行数:39,代码来源:DropInfo.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# DragOperation类代码示例发布时间:2022-05-24
下一篇:
C# DragEventHandler类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap