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

C# FTouch类代码示例

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

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



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

示例1: HandleMultiTouch

    public void HandleMultiTouch(FTouch[] touches)
    {
        foreach(FTouch touch in touches)
        {
            if(touch.phase == TouchPhase.Began)
            {

                //we go reverse order so that if we remove a banana it doesn't matter
                //and also so that that we check from front to back

                for (int b = _bananas.Count-1; b >= 0; b--)
                {
                    BBanana banana = _bananas[b];

                    Vector2 touchPos = banana.GlobalToLocal(touch.position);

                    if(banana.textureRect.Contains(touchPos))
                    {
                        HandleGotBanana(banana);
                        break; //break so that a touch can only hit one banana at a time
                    }
                }
            }
        }
    }
开发者ID:stylophone,项目名称:Futile,代码行数:25,代码来源:BInGamePage.cs


示例2: HandleMultiTouch

 public void HandleMultiTouch(FTouch[] touches)
 {
     foreach(FTouch touch in touches)
     {
         if (touch.phase == TouchPhase.Ended) {
             if (_draw!=null) {
                 _draw.RemoveFromContainerAnimated();
                 _draw=null;
             }
         } else if (touch.phase == TouchPhase.Began) {
             if (_draw==null) {
                 float c0=RXRandom.Float();
                 float c1=RXRandom.Float();
                 float c2=RXRandom.Float();
                 float c3=RXRandom.Float();
                 float c4=RXRandom.Float();
                 float c5=RXRandom.Float();
                 _draw = new FMotionStreakWithBorderSprite("Futile_White", // texture name
                     10+RXRandom.Int(20),  //Number of quads in the trail
                     x => 15.0f*(float)Math.Sin (1.0f*x*x*x*Math.PI),  // width of the band function, x represents the offset in the band and 0<= x <=1
                     x => new Color(c0,c1,c2,(float)Math.Sin (1.0f*x*Math.PI)),  //color of the band function, x represents the offset in the band and 0<= x <=1
                     x => 10f*(float)Math.Sin (1.0f*x*Math.PI),
                     x => new Color(c3,c4,c5,(float)Math.Sin (1.0f*x*Math.PI))
                     );
                 AddChild(_draw);
             }
             _draw.PushPosition(touch.position);
         } else if (touch.phase == TouchPhase.Moved) {
             if (_draw!=null) _draw.PushPosition(touch.position);
         }
     }
 }
开发者ID:tanis2000,项目名称:Futile,代码行数:32,代码来源:PageTestMotionStreak.cs


示例3: HandleMultiTouch

 public void HandleMultiTouch(FTouch[] touches)
 {
     foreach(FTouch touch in touches){
         if(touch.phase == TouchPhase.Ended){
         }
     }
 }
开发者ID:rhololkeolke,项目名称:Game-Design-Class,代码行数:7,代码来源:HowToPlayPage.cs


示例4: HandleMultiTouch

 public void HandleMultiTouch(FTouch[] touches)
 {
     if (touches.Length > 0){
         touchPos = touches[0].position;
     }
     if (touches.Length > 1){
         shoot();
     }
 }
开发者ID:ktn,项目名称:KevinEnemyPractice,代码行数:9,代码来源:InGamePage.cs


示例5: HandleMultiTouch

 public void HandleMultiTouch(FTouch[] touches)
 {
     foreach(FTouch touch in touches)
     {
         if (touch.phase == TouchPhase.Ended) {
             TestSpeechBubbles(touch.position);
         }
     }
 }
开发者ID:tanis2000,项目名称:Futile,代码行数:9,代码来源:PageTestSpeechBubbles.cs


示例6: HandleMultiTouch

 public void HandleMultiTouch(FTouch[] touches)
 {
     foreach(FTouch touch in touches)
     {
         if (touch.phase == TouchPhase.Ended) {
             //Click(touch.position);
         }
     }
 }
开发者ID:tanis2000,项目名称:Futile,代码行数:9,代码来源:PageTestHole.cs


示例7: HandleMultiTouch

 public void HandleMultiTouch(FTouch[] touches)
 {
     foreach(FTouch touch in touches)
     {
         if (touch.phase == TouchPhase.Ended) {
             ChangeSplitRatio(touch.position);
         } else if (touch.phase == TouchPhase.Moved) {
             ChangeSplitRatio(touch.position);
         }
     }
 }
开发者ID:tanis2000,项目名称:Futile,代码行数:11,代码来源:PageTestSplitSprite.cs


示例8: HandleSingleTouchBegan

 public bool HandleSingleTouchBegan(FTouch touch)
 {
     if (this.selectedActor != null && this.selectedActor.TurnState == ActorState.AwaitingCommand)
     {
         return false;
     }
     else
     {
         return true;
     }
 }
开发者ID:HaKDMoDz,项目名称:awayteam,代码行数:11,代码来源:MissionPage.cs


示例9: HandleSingleTouchMoved

    public void HandleSingleTouchMoved(FTouch touch)
    {
        rejector++;

        if(rejector > 0) // Nevermind this. I'm trying to figure out why touches cause lag on android
        {
            float xPos = mBombaNode.GlobalToLocal(touch.position).x;

            mPepper.setPosition(xPos);
            rejector = 0;
        }
    }
开发者ID:edbartley,项目名称:BombaFiesta-Unity3D-Futile,代码行数:12,代码来源:BombaMain.cs


示例10: HandleSingleTouchBegan

    public bool HandleSingleTouchBegan(FTouch touch)
    {
        foreach (FSprite sprite in compartmentSprites) {
            /*if (sprite.textureRect.Contains(sprite.GlobalToLocal(touch.position))) {
                if (sprite.color == Color.blue) sprite.color = Color.red;
                else sprite.color = Color.blue;
            }*/
            Debug.Log(sprite.textureRect);
            //Debug.Log(sprite.element.atlas.texture.GetPixel((int)touch.position.x, (int)touch.position.y));
        }

        return true;
    }
开发者ID:wtrebella,项目名称:FutilePrototyper,代码行数:13,代码来源:WTCompartments.cs


示例11: HandleSingleTouchBegan

    public virtual bool HandleSingleTouchBegan(FTouch touch)
    {
        Vector2 touchPos = base.GetLocalTouchPosition(touch);

        if (_hitRect.Contains(touchPos))
        {
            indicatorValue = Mathf.Abs((base.x - _hitRect.width / 2) - _movableIndicator.x) / _hitRect.width;
            _movableIndicator.x = Mathf.Clamp(LocalToGlobal(touchPos).x, (base.x - _hitRect.width / 2) + _movableIndicator.width / 2, (base.x + _hitRect.width / 2) - _movableIndicator.width / 2);
            return true;
        }

        return false;
    }
开发者ID:riktothepast,项目名称:LD30,代码行数:13,代码来源:RSlider.cs


示例12: HandleMultiTouch

    public void HandleMultiTouch(FTouch[] touches)
    {
        foreach(FTouch touch in touches)
        {
            {

                //we go reverse order so that if we remove a banana it doesn't matter
                //and also so that that we check from front to back
                terrain.Update((this.GetLocalTouchPosition(touch)));
            terrain.RemoveTiles();

            }
        }
    }
开发者ID:philipcass,项目名称:art_game,代码行数:14,代码来源:InGamePage.cs


示例13: HandleSingleTouchEnded

    public void HandleSingleTouchEnded(FTouch touch)
    {
        var gridVector = this.map.GlobalToGrid(touch.position);
        Debug.Log("Touch at: " + touch.position + ", map grid: " + gridVector);

        if (this.selectedActor != null)
        {
            var actorState = this.selectedActor.TurnState;
            if (actorState == ActorState.SelectingDestination)
            {
                if (this.pathfindResults != null && this.pathfindResults.VisitablePoints.Contains(gridVector))
                {
                    this.selectedActor.HasMovedThisTurn = true;
                    this.selectedActor.TurnState = ActorState.AwaitingCommand;
                    this.map.UpdateLocation(this.selectedActor, gridVector);

                    // Recompute the set of attackable points, since the actor has moved.
                    var tempEnum = MoveAndAttackHelper.GetAttackablePoints(this.map, gridVector, 1, 6);
                    this.localAttackablePoints = new HashSet<Vector2i>(tempEnum);
                    this.showButtonStrip(this.selectedActor);
                    this.clearHighlights();
                }
            }
            else if(actorState == ActorState.SelectingEnemy)
            {
                if (this.localAttackablePoints.Contains(gridVector))
                {
                    Debug.Log("Attacking point: " + gridVector);
                    Vector2 source = new Vector2(this.selectedActor.x, this.selectedActor.y);
                    Vector2 dest = this.map.GridToGlobal(gridVector);
                    this.ShootLaser(source, dest);
                }
            }
        }
        else if (this.map.TryGetActor(gridVector, out this.selectedActor))
        {
            var actorState = this.selectedActor.TurnState;
            if (actorState == ActorState.TurnStart)
            {
                this.selectedActor.TurnState = ActorState.AwaitingCommand;
                this.pathfindResults = MoveAndAttackHelper.Pathfind(this.map, this.selectedActor);
                var tempEnum = MoveAndAttackHelper.GetAttackablePoints(this.map, gridVector, 1, 6);
                this.localAttackablePoints = new HashSet<Vector2i>(tempEnum);
                this.showButtonStrip(this.selectedActor);
            }
        }
    }
开发者ID:HaKDMoDz,项目名称:awayteam,代码行数:47,代码来源:MissionPage.cs


示例14: HandleTouch

    public virtual void HandleTouch(FTouch touch)
    {
        Vector2 touchPos = this.GlobalToLocal(touch.position);

        Rect expandedRect = _hitRect.CloneWithExpansion(expansionAmount);

        if (expandedRect.Contains(touchPos))
        {
            if (!continuousTouch) {
                if (touch.phase != TouchPhase.Began) {
                    return;
                }
            }
            if (SignalPress != null) SignalPress();
            alpha = 1f;
        }
    }
开发者ID:riktothepast,项目名称:LD30,代码行数:17,代码来源:ButtonSprite.cs


示例15: HandleMultiTouch

    public void HandleMultiTouch(FTouch[] touches)
    {
        foreach(FTouch touch in touches) {
            if (touch.phase == TouchPhase.Began) {
                for (int i = thingies.Count - 1; i >= 0; i--) {
                    Thingy thingy = thingies[i];
                    FSprite sprite = thingy.GetChildAt(0) as FSprite;
                    Vector2 touchPos = sprite.GlobalToLocal(touch.position);
                    Rect rect = sprite.textureRect;

                    if (rect.Contains(touchPos)) {
                        HandleGotThingy(thingy);
                        break;
                    }
                }
            }
        }
    }
开发者ID:wtrebella,项目名称:Catch-Me,代码行数:18,代码来源:GamePage.cs


示例16: HandleMultiTouch

    public void HandleMultiTouch(FTouch[] touches)
    {
        foreach(FTouch touch in touches)
        {
            {

                if((this.localRect.CloneAndMultiply(4)).Contains(this.GetLocalTouchPosition(touch))) {
                    p = touch.position;
                    p = Vector3.Max(p, new Vector3(-Futile.screen.halfWidth+32, -Futile.screen.halfHeight + 32, 0));
                    p = Vector3.Min(p, new Vector3(Futile.screen.halfWidth-32, Futile.screen.halfHeight - 32, 0));
                    float dist = Vector2.Distance(new Vector2(this.x, this.y), new Vector2(p.x, p.y));

                    Go.killAllTweensWithTarget(this);
                    Go.to(this, 1.0f / dist, new TweenConfig().floatProp("x", p.x).floatProp("y", p.y));
                    break;
                }

            }
        }
    }
开发者ID:philipcass,项目名称:art_game,代码行数:20,代码来源:BasePlayer.cs


示例17: HandleSingleTouchEnded

    public virtual void HandleSingleTouchEnded(FTouch touch)
    {
        Vector2 touchPos = base.GetLocalTouchPosition(touch);

        //expand the hitrect so that it has more error room around the edges
        //this is what Apple does on iOS and it makes for better usability
        Rect expandedRect = _hitRect.CloneWithExpansion(expansionAmount);

        if (expandedRect.Contains(touchPos))
        {
            if (SignalRelease != null) SignalRelease();
            indicatorValue = Mathf.Abs((base.x - _hitRect.width / 2) - _movableIndicator.x) / _hitRect.width;
            _movableIndicator.x = Mathf.Clamp(LocalToGlobal(touchPos).x, (base.x - _hitRect.width / 2) + _movableIndicator.width / 2, (base.x + _hitRect.width / 2) - _movableIndicator.width / 2);
            indicatorValue = indicatorValue >= 0.92 ? indicatorValue + 0.1f : indicatorValue;
            indicatorValue = Mathf.Clamp(indicatorValue, 0, 1);
        }
        else
        {
        }
    }
开发者ID:riktothepast,项目名称:LD30,代码行数:20,代码来源:RSlider.cs


示例18: HandleMultiTouch

    public void HandleMultiTouch(FTouch[] touches)
    {
        foreach(FTouch touch in touches)
        {
            if (touch.phase == TouchPhase.Ended) {
                if (_draw!=null) {
                    _draw.Flush();
                }
            } else if (touch.phase == TouchPhase.Began) {
                if (_draw!=null) {
                    _draw.RemoveFromContainer();
                    _draw=null;
                }
                _draw=new FDrawingSprite("Futile_White");
                AddChild(_draw);

                _draw.SetLineThickness(RXRandom.Range(4f,10f));
                Color color=RandomUtils.RandomColor();
                color.a=1f;
                _draw.SetLineColor(color);

                _draw.PushBorder (RXRandom.Range(2f,5f),RandomUtils.RandomColor(),RXRandom.Float()<0.5f?true:false);
                _draw.PushTopBorder (RXRandom.Range(2f,5f),RandomUtils.RandomColor(),RXRandom.Float()<0.5f?true:false);
                //_draw.PushBorder (4,new Color(1f,1f,0f,1f),false);
                if (RXRandom.Float()<0.5f) {
                    _draw.PushBorder (RXRandom.Range(1f,4f),RandomUtils.RandomColor(),RXRandom.Float()<0.5f?true:false);
                    if (RXRandom.Float()<0.5f) {
                        _draw.PushBorder (RXRandom.Range(1f,4f),RandomUtils.RandomColor(),RXRandom.Float()<0.5f?true:false);
                        if (RXRandom.Float()<0.5f) {
                            _draw.PushBorder (RXRandom.Range(1f,4f),RandomUtils.RandomColor(),RXRandom.Float()<0.5f?true:false);
                        }
                    }
                }

                _draw.MoveTo(touch.position.x,touch.position.y);
            } else if (touch.phase == TouchPhase.Moved) {
                if (_draw==null) return;
                _draw.LineTo(touch.position.x,touch.position.y);
            }
        }
    }
开发者ID:tanis2000,项目名称:Futile,代码行数:41,代码来源:PageTestDrawing.cs


示例19: onUpdate

    public override void onUpdate(FTouch[] touches)
    {
        //If not starting
        if (m_StartTime > START_DURATION) {
            //Manage blinking
            m_Time -= Time.deltaTime;
            m_Instruction1.isVisible = m_Time > BLINK_DURATION;
            if (m_Time < 0) m_Time += BLINK_DURATION * 2;

            //if game exist
            if (m_Game != null) {
                //For each touch,
                for (int i = 0; i < touches.Length; i++) {
                    //If released
                    if (touches[i].phase == TouchPhase.Ended) {
                        //SFX
                        FSoundManager.PlaySound("success");

                        //Start
                        m_StartTime = START_DURATION;
                        RemoveAllChildren();
                        AddChild(m_Title);
                    }
                }
            }
        } else {
            //Reduce start duration
            m_StartTime -= Time.deltaTime;
            if (m_StartTime < 0) {
                //Start game
                m_Active = false;
                m_Game.start();
            } else {
                //Move
                m_Title.y = Futile.screen.height * 0.6f;
                m_Title.y += ((Futile.screen.height * 0.4f) + (m_Title.textureRect.height / 2)) * (START_DURATION - m_StartTime) / START_DURATION;
            }
        }
    }
开发者ID:hitnoodle,项目名称:prototype-game-game,代码行数:39,代码来源:StateTitle.cs


示例20: UpdateWithTouch

        void UpdateWithTouch( FTouch touch )
        {
            if (touchId == -1 && TouchIsBegan( touch ) && TouchIsWithinRange( touch ))
            {
                touchId = touch.fingerId;
                SetPosition( touch.position );
            }

            if (touchId == touch.fingerId)
            {
                if (TouchIsEnded( touch ))
                {
                    delta = Vector2.zero;
                    value = Vector2.zero;
                    touchId = -1;
                    return;
                }

                delta = Vector2.ClampMagnitude( touch.position - GetPosition(), 64.0f );
                value = delta / 64.0f;

                return;
            }
        }
开发者ID:hiyijia,项目名称:InControl,代码行数:24,代码来源:VirtualControlStick.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# FVector2类代码示例发布时间:2022-05-24
下一篇:
C# FStage类代码示例发布时间: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