コード例 #1
0
ファイル: VirtualAxis.cs プロジェクト: ApmeM/FloodItBot
            public override void Update(
                InputKeyboardComponent inputKeyboard,
                InputMouseComponent inputMouse,
                InputTouchComponent inputTouch,
                InputGamePadComponent inputGamePad)
            {
                if (!inputTouch.IsConnected || !inputTouch.CurrentTouches.Any())
                {
                    this.Value = 0;
                    return;
                }

                bool leftTouch;
                bool rightTouch;

                if (this.isVertical)
                {
                    leftTouch  = inputTouch.CurrentTouches.Any(a => a.Position.Y < this.region.Height / 2f);
                    rightTouch = inputTouch.CurrentTouches.Any(a => a.Position.Y >= this.region.Height / 2f);
                }
                else
                {
                    leftTouch  = inputTouch.CurrentTouches.Any(a => a.Position.X < this.region.Width / 2f);
                    rightTouch = inputTouch.CurrentTouches.Any(a => a.Position.X >= this.region.Width / 2f);
                }

                this.SetValue(leftTouch, rightTouch);
            }
コード例 #2
0
            public override void Update(
                InputKeyboardComponent inputKeyboard,
                InputMouseComponent inputMouse,
                InputTouchComponent inputTouch,
                InputGamePadComponent inputGamePad)
            {
                if (inputGamePad.DpadRightDown)
                {
                    this.ValueX = 1;
                }
                else if (inputGamePad.DpadLeftDown)
                {
                    this.ValueX = -1;
                }
                else
                {
                    this.ValueX = 0;
                }

                if (inputGamePad.DpadDownDown)
                {
                    this.ValueY = 1;
                }
                else if (inputGamePad.DpadUpDown)
                {
                    this.ValueY = -1;
                }
                else
                {
                    this.ValueY = 0;
                }
            }
コード例 #3
0
            public override void Update(
                InputKeyboardComponent inputKeyboard,
                InputMouseComponent inputMouse,
                InputTouchComponent inputTouch,
                InputGamePadComponent inputGamePad)
            {
                if (!inputTouch.IsConnected || !inputTouch.CurrentTouches.Any())
                {
                    this.ValueX = 0;
                    this.ValueY = 0;
                    return;
                }

                bool leftTouch;
                bool rightTouch;
                bool upTouch;
                bool downTouch;

                upTouch    = inputTouch.CurrentTouches.Any(a => a.Position.Y < this.region.Height / 2f);
                downTouch  = inputTouch.CurrentTouches.Any(a => a.Position.Y >= this.region.Height / 2f);
                leftTouch  = inputTouch.CurrentTouches.Any(a => a.Position.X < this.region.Width / 2f);
                rightTouch = inputTouch.CurrentTouches.Any(a => a.Position.X >= this.region.Width / 2f);

                this.SetValue(upTouch, downTouch, leftTouch, rightTouch);
            }
コード例 #4
0
 public override void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad)
 {
     this.IsDown = inputKeyboard.IsKeyDown(this.Key);
 }
コード例 #5
0
 public override void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad)
 {
     this.IsDown = this.ButtonValue;
 }
コード例 #6
0
 public override void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad)
 {
     this.IsDown = inputTouch.IsConnected && inputTouch.CurrentTouches.Any();
 }
コード例 #7
0
 public override void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad)
 {
     this.IsDown = inputMouse.RightMouseButtonDown;
 }
コード例 #8
0
 public override void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad)
 {
     this.IsDown = inputGamePad.IsRightTriggerDown(this.Threshold);
 }
コード例 #9
0
ファイル: VirtualAxis.cs プロジェクト: ApmeM/FloodItBot
 public override void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad)
 {
     this.SetValue(inputMouse.LeftMouseButtonDown, inputMouse.RightMouseButtonDown);
 }
コード例 #10
0
ファイル: VirtualAxis.cs プロジェクト: ApmeM/FloodItBot
 public override void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad)
 {
     this.Value = this.AxisValue;
 }
コード例 #11
0
 public override void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad)
 {
     this.IsDown = inputGamePad.DpadLeftDown;
 }
コード例 #12
0
ファイル: VirtualAxis.cs プロジェクト: ApmeM/FloodItBot
 public override void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad)
 {
     this.SetValue(inputKeyboard.IsKeyDown(this.Negative), inputKeyboard.IsKeyDown(this.Positive));
 }
コード例 #13
0
ファイル: VirtualAxis.cs プロジェクト: ApmeM/FloodItBot
 public override void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad)
 {
     this.Value = Mathf.SignThreshold(inputGamePad.GetRightStick(this.Deadzone).Y, this.Deadzone);
 }
コード例 #14
0
 public override void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad)
 {
     this.ValueX = this.JoysticValue.X;
     this.ValueY = this.JoysticValue.Y;
 }
コード例 #15
0
 public virtual void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad)
 {
     foreach (var node in this.Nodes)
     {
         node.Update(inputKeyboard, inputMouse, inputTouch, inputGamePad);
     }
 }
コード例 #16
0
            public override void Update(
                InputKeyboardComponent inputKeyboard,
                InputMouseComponent inputMouse,
                InputTouchComponent inputTouch,
                InputGamePadComponent inputGamePad)
            {
                var value = inputGamePad.GetRightStick(this.Deadzone);

                this.ValueX = value.X;
                this.ValueY = value.Y;
            }
コード例 #17
0
ファイル: VirtualAxis.cs プロジェクト: ApmeM/FloodItBot
            public override void Update(
                InputKeyboardComponent inputKeyboard,
                InputMouseComponent inputMouse,
                InputTouchComponent inputTouch,
                InputGamePadComponent inputGamePad)
            {
                var multiplier = this.InvertResult ? -1 : 1;

                this.Value = multiplier * Mathf.SignThreshold(
                    inputGamePad.GetLeftStick(this.Deadzone).Y,
                    this.Deadzone);
            }
コード例 #18
0
            public override void Update(
                InputKeyboardComponent inputKeyboard,
                InputMouseComponent inputMouse,
                InputTouchComponent inputTouch,
                InputGamePadComponent inputGamePad)
            {
                var up    = inputKeyboard.IsKeyDown(this.Up);
                var down  = inputKeyboard.IsKeyDown(this.Down);
                var left  = inputKeyboard.IsKeyDown(this.Left);
                var right = inputKeyboard.IsKeyDown(this.Right);

                this.SetValue(up, down, left, right);
            }
コード例 #19
0
ファイル: VirtualAxis.cs プロジェクト: ApmeM/FloodItBot
        public override void Update(
            InputKeyboardComponent inputKeyboard,
            InputMouseComponent inputMouse,
            InputTouchComponent inputTouch,
            InputGamePadComponent inputGamePad)
        {
            base.Update(inputKeyboard, inputMouse, inputTouch, inputGamePad);

            var thisTickValue = 0f;

            for (var i = 0; i < this.Nodes.Count; i++)
            {
                var val = ((Node)this.Nodes[i]).Value;

                if (val == null)
                {
                    thisTickValue = this.CheckOverlap(this.Value);
                    break;
                }

                if (val == 0)
                {
                    continue;
                }

                var newResult = Math.Sign(val.Value);
                var oldResult = Math.Sign(thisTickValue);

                if (oldResult == newResult)
                {
                    continue;
                }

                if (thisTickValue == 0)
                {
                    thisTickValue = newResult;
                    continue;
                }

                thisTickValue = this.CheckOverlap(this.Value);
                break;
            }

            this.Value = thisTickValue;
        }
コード例 #20
0
ファイル: VirtualAxis.cs プロジェクト: ApmeM/FloodItBot
 public override void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad)
 {
     if (inputGamePad.DpadDownDown)
     {
         this.Value = 1f;
     }
     else if (inputGamePad.DpadUpDown)
     {
         this.Value = -1f;
     }
     else
     {
         this.Value = 0f;
     }
 }
コード例 #21
0
        public override void Update(
            InputKeyboardComponent inputKeyboard,
            InputMouseComponent inputMouse,
            InputTouchComponent inputTouch,
            InputGamePadComponent inputGamePad)
        {
            base.Update(inputKeyboard, inputMouse, inputTouch, inputGamePad);

            var downLastFrame = this.IsDown;

            this.IsDown = false;
            foreach (var node in this.Nodes)
            {
                if (((Node)node).IsDown)
                {
                    this.IsDown = true;
                    break;
                }
            }

            this.IsPressed  = !downLastFrame && this.IsDown;
            this.IsReleased = downLastFrame && !this.IsDown;
        }
コード例 #22
0
 public abstract void Update(
     InputKeyboardComponent inputKeyboard,
     InputMouseComponent inputMouse,
     InputTouchComponent inputTouch,
     InputGamePadComponent inputGamePad);