예제 #1
0
 private Action GetIsChangeStates(IKeyboardController control)
 {
     _thingsToDo += IsCapsChange(control);
     _thingsToDo += IsNumChange(control);
     _thingsToDo += IsLangChange(control);
     return(_thingsToDo);
 }
예제 #2
0
 private Action GetStates(IKeyboardController control)
 {
     _thingsToDo += CheckCaps(control);
     _thingsToDo += CheckNumLock(control);
     _thingsToDo += CheckLang(control);
     return(_thingsToDo);
 }
예제 #3
0
        public void DefineKeyboardControl(IKeyboardController _pool, string controllerId)
        {
            var pool = Compatibility.Check <KeyboardController <HommCommand> >(this, _pool);

            if (controllerId == TwoPlayersId.Left)
            {
                pool.Add(Keys.W, () => new HommCommand {
                    Movement = new Movement(Direction.Up)
                });
                pool.Add(Keys.S, () => new HommCommand {
                    Movement = new Movement(Direction.Down)
                });
                pool.Add(Keys.A, () => new HommCommand {
                    Movement = new Movement(Direction.LeftDown)
                });
                pool.Add(Keys.D, () => new HommCommand {
                    Movement = new Movement(Direction.RightDown)
                });
                pool.Add(Keys.Q, () => new HommCommand {
                    Movement = new Movement(Direction.LeftUp)
                });
                pool.Add(Keys.E, () => new HommCommand {
                    Movement = new Movement(Direction.RightUp)
                });
                pool.Add(Keys.Space, () => new HommCommand {
                    Order = new PurchaseOrder(10)
                });
            }
            else if (controllerId == TwoPlayersId.Right)
            {
                pool.Add(Keys.I, () => new HommCommand {
                    Movement = new Movement(Direction.Up)
                });
                pool.Add(Keys.K, () => new HommCommand {
                    Movement = new Movement(Direction.Down)
                });
                pool.Add(Keys.J, () => new HommCommand {
                    Movement = new Movement(Direction.LeftDown)
                });
                pool.Add(Keys.L, () => new HommCommand {
                    Movement = new Movement(Direction.RightDown)
                });
                pool.Add(Keys.U, () => new HommCommand {
                    Movement = new Movement(Direction.LeftUp)
                });
                pool.Add(Keys.O, () => new HommCommand {
                    Movement = new Movement(Direction.RightUp)
                });
                pool.Add(Keys.Enter, () => new HommCommand {
                    Order = new PurchaseOrder(10)
                });
            }

            pool.StopCommand = () => new HommCommand {
                Movement = new Wait()
            };
        }
예제 #4
0
        public void DefineKeyboardControl(IKeyboardController _pool, string controllerId)
        {
            var pool = Compatibility.Check <KeyboardController <MoveAndGripCommand> >(this, _pool);

            this.AddGripKeys(pool, controllerId);
            this.AddSimpleMovementKeys(pool, controllerId);
            pool.StopCommand = () => new MoveAndGripCommand {
                SimpleMovement = SimpleMovement.Stand(0.1)
            };
        }
예제 #5
0
        private Action CheckNumLock(IKeyboardController control)
        {
            if (IsLocked.IsNumLocked)
            {
                NumStatus = true;
                return(control.NumLockOn);
            }

            NumStatus = false;
            return(control.NumLockOff);
        }
예제 #6
0
        private Action CheckCaps(IKeyboardController control)
        {
            if (IsLocked.IsCapsLocked)
            {
                CapsStatus = true;
                return(control.CapsLockOn);
            }

            CapsStatus = false;
            return(control.CapsLockOff);
        }
예제 #7
0
        private Action CheckLang(IKeyboardController control)
        {
            var currentLayout = KeyboardLayout.GetCurrentKeyboardLayout();

            LangStatus = currentLayout;
            switch (LangStatus)
            {
            case "en-US":
                return(control.SetEng);

            case "he-IL":
                return(control.SetHeb);

            default:
                return(null);
            }
        }
예제 #8
0
        public void Load()
        {
            mouse    = new MouseController(this);
            keyboard = new KeyboardController(this);

            Initialize();

            this.EventSubscribe <TimePreUpdateEvent>(e =>
            {
                foreach (var player in players)
                {
                    var actions = (List <IInputAction>)player.Actions;

                    foreach (InputAction action in actions)
                    {
                        action.Update(e.DeltaTime);
                    }
                }

                Update();
            });
        }
예제 #9
0
파일: HommRules.cs 프로젝트: FoKycHuK/CVARC
        public void DefineKeyboardControl(IKeyboardController _pool, string controllerId)
        {
            var pool = Compatibility.Check <KeyboardController <HommCommand> >(this, _pool);

            if (controllerId == TwoPlayersId.Left)
            {
                pool.Add(Keys.W, () => new HommCommand {
                    Movement = new HexMovement(Direction.Up)
                });
                pool.Add(Keys.S, () => new HommCommand {
                    Movement = new HexMovement(Direction.Down)
                });
                pool.Add(Keys.A, () => new HommCommand {
                    Movement = new HexMovement(Direction.LeftDown)
                });
                pool.Add(Keys.D, () => new HommCommand {
                    Movement = new HexMovement(Direction.RightDown)
                });
                pool.Add(Keys.Q, () => new HommCommand {
                    Movement = new HexMovement(Direction.LeftUp)
                });
                pool.Add(Keys.E, () => new HommCommand {
                    Movement = new HexMovement(Direction.RightUp)
                });

                pool.Add(Keys.Space, () => new HommCommand {
                    HireOrder = new HireOrder(5)
                });

                pool.Add(Keys.X, () => new HommCommand
                {
                    WaitInGarrison = new Dictionary <UnitType, int> {
                        { UnitType.Militia, 5 }
                    }
                });
            }
            else if (controllerId == TwoPlayersId.Right)
            {
                pool.Add(Keys.I, () => new HommCommand {
                    Movement = new HexMovement(Direction.Up)
                });
                pool.Add(Keys.K, () => new HommCommand {
                    Movement = new HexMovement(Direction.Down)
                });
                pool.Add(Keys.J, () => new HommCommand {
                    Movement = new HexMovement(Direction.LeftDown)
                });
                pool.Add(Keys.L, () => new HommCommand {
                    Movement = new HexMovement(Direction.RightDown)
                });
                pool.Add(Keys.U, () => new HommCommand {
                    Movement = new HexMovement(Direction.LeftUp)
                });
                pool.Add(Keys.O, () => new HommCommand {
                    Movement = new HexMovement(Direction.RightUp)
                });

                pool.Add(Keys.Enter, () => new HommCommand {
                    HireOrder = new HireOrder(5)
                });

                pool.Add(Keys.M, () => new HommCommand
                {
                    WaitInGarrison = new Dictionary <UnitType, int> {
                        { UnitType.Militia, 5 }
                    }
                });
            }

            pool.StopCommand = () => new HommCommand {
                Movement = new HexMovement(waitDuration: 0.1)
            };
        }
예제 #10
0
 private Action IsCapsChange(IKeyboardController control)
 {
     return(CapsStatus == IsLocked.IsCapsLocked
         ? null
         : CheckCaps(control));
 }
예제 #11
0
 private static Action StartTimeAnimation(IKeyboardController control)
 {
     return(control.TimeAnimation);
 }
예제 #12
0
 private static Action StartClearCustom(IKeyboardController control)
 {
     return(control.ClearCustom);
 }
예제 #13
0
 private static Action StartBaseSet(IKeyboardController control)
 {
     return(control.SetBase);
 }
예제 #14
0
 private static Action StartSecondAnimation(IKeyboardController control)
 {
     return(control.SecondAnimation);
 }
예제 #15
0
 private static Action StartFirstAnimation(IKeyboardController control)
 {
     return(control.FirstAnimation);
 }
예제 #16
0
 public OpenTaskManagerCommand(IKeyboardController keyboardController)
 {
     this.keyboardController = keyboardController;
 }
예제 #17
0
 private Action IsNumChange(IKeyboardController control)
 {
     return(NumStatus == IsLocked.IsNumLocked
         ? null
         : CheckNumLock(control));
 }
예제 #18
0
 private Action IsLangChange(IKeyboardController control)
 {
     return(LangStatus == KeyboardLayout.GetCurrentKeyboardLayout()
         ? null
         : CheckLang(control));
 }
예제 #19
0
        public void DefineKeyboardControl(IKeyboardController _pool, string controllerId)
        {
            var pool = Compatibility.Check <KeyboardController <PudgeCommand> >(this, _pool);

            if (controllerId == TwoPlayersId.Left)
            {
                pool.Add(Keys.W, () => new PudgeCommand {
                    GameMovement = new GameMovement {
                        Range = keyboardMovementRange
                    }
                });
                pool.Add(Keys.A,
                         () => new PudgeCommand {
                    GameMovement = new GameMovement {
                        Angle = keyboardRotationAngle
                    }
                });
                pool.Add(Keys.D,
                         () => new PudgeCommand {
                    GameMovement = new GameMovement {
                        Angle = -keyboardRotationAngle
                    }
                });
                pool.Add(Keys.Space, () => new PudgeCommand {
                    MakeHook = true
                });
                pool.Add(Keys.F, () => new PudgeCommand {
                    MakeDagger        = true,
                    DaggerDestination = new DaggerDestinationPoint(0, 0)
                });
                pool.Add(Keys.G, () => new PudgeCommand {
                    MakeWard = true
                });
            }
            else
            {
                pool.Add(Keys.I, () => new PudgeCommand {
                    GameMovement = new GameMovement {
                        Range = MovementRange
                    }
                });
                pool.Add(Keys.J,
                         () => new PudgeCommand {
                    GameMovement = new GameMovement {
                        Angle = keyboardRotationAngle
                    }
                });
                pool.Add(Keys.L,
                         () => new PudgeCommand {
                    GameMovement = new GameMovement {
                        Angle = -keyboardRotationAngle
                    }
                });
                pool.Add(Keys.Enter, () => new PudgeCommand {
                    MakeHook = true
                });
            }
            pool.StopCommand = () => new PudgeCommand {
                GameMovement = new GameMovement {
                    WaitTime = WaitDuration
                }
            };
        }
예제 #20
0
 public void DefineKeyboardControl(IKeyboardController keyboardController, string controllerId)
 {
 }