Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Actions"/> class.
        /// </summary>
        /// <param name="driver">The <see cref="IWebDriver"/> object on which the actions built will be performed.</param>
        public Actions(IWebDriver driver)
        {
            IHasInputDevices inputDevicesDriver = driver as IHasInputDevices;
            if (inputDevicesDriver == null)
            {
                IWrapsDriver wrapper = driver as IWrapsDriver;
                while (wrapper != null)
                {
                    inputDevicesDriver = wrapper.WrappedDriver as IHasInputDevices;
                    if (inputDevicesDriver != null)
                    {
                        break;
                    }

                    wrapper = wrapper.WrappedDriver as IWrapsDriver;
                }
            }

            if (inputDevicesDriver == null)
            {
                throw new ArgumentException("The IWebDriver object must implement or wrap a driver that implements IHasInputDevices.", "driver");
            }

            this.keyboard = inputDevicesDriver.Keyboard;
            this.mouse = inputDevicesDriver.Mouse;
        }
Beispiel #2
0
 public static void Initialize(         
  IConsole console,
  ISurface surface,
  IStyle style,
  IDrawings drawing,
  IShapes shapes,
  IImages images,
  IControls controls,
  ISounds sounds,         
  IKeyboard keyboard,
  IMouse mouse,
  ITimer timer,
  IFlickr flickr,
  ISpeech speech,
  CancellationToken token)
 {
     TextWindow.Init(console);
      Desktop.Init(surface);
      GraphicsWindow.Init(style, surface, drawing, keyboard, mouse);
      Shapes.Init(shapes);
      ImageList.Init(images);
      Turtle.Init(surface, drawing, shapes);
      Controls.Init(controls);
      Sound.Init(sounds);
      Timer.Init(timer);
      Stack.Init();
      Flickr.Init(flickr);
      Speech.Init(speech);
      Program.Init(token);
 }
 public void Before()
 {
     this.mouse = A.Fake<IMouse>(wrapped => wrapped.Wrapping(this.CreateMouse()));
     A.CallTo(() => this.mouse.LeftDown()).Invokes(_ => { });
     A.CallTo(() => this.mouse.LeftDown(A<Coordinate>._)).Invokes(_ => { });
     Logger.Debug = Console.WriteLine;
 }
Beispiel #4
0
 public void SetUp()
 {
     stubKeyboard = MockRepository.GenerateStub<IKeyboard>();
     stubMouse = MockRepository.GenerateStub<IMouse>();
     stubKeyMapping = MockRepository.GenerateStub<IKeyMapping>();
     gameInput = new GameInput(stubKeyMapping, stubKeyboard, stubMouse);
 }
Beispiel #5
0
 public MouseButton(IMouse mouse, MouseButtonLabel button)
 {
     this.mouse = mouse;
     this.button = button;
     prevPressed = false;
     nowPressed = false;
 }
Beispiel #6
0
    void Start()
    {
        Mouse = MouseManager.Instance;
        //Gamepads = GamepadsManager.Instance;
        DestinationDistance = 100;

        introTrack = GetComponentsInChildren<AudioSource>()[1];
    }
Beispiel #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MoveMouseAction"/> class.
 /// </summary>
 /// <param name="mouse">The <see cref="IMouse"/> with which the action will be performed.</param>
 /// <param name="actionTarget">An <see cref="ILocatable"/> describing an element at which to perform the action.</param>
 public MoveMouseAction(IMouse mouse, ILocatable actionTarget)
     : base(mouse, actionTarget)
 {
     if (actionTarget == null)
     {
         throw new ArgumentException("Must provide a location for a move action.", "actionTarget");
     }
 }
Beispiel #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Actions"/> class.
 /// </summary>
 /// <param name="driver">The <see cref="IWebDriver"/> object on which the actions built will be performed.</param>
 public Actions(IWebDriver driver)
 {
     IHasInputDevices inputDevicesDriver = driver as IHasInputDevices;
     if (inputDevicesDriver != null)
     {
         this.keyboard = inputDevicesDriver.Keyboard;
         this.mouse = inputDevicesDriver.Mouse;
     }
 }
 internal WindowRelativeMouse(IntPtr parenthWnd, IntPtr hWnd, IMouse mouse, INativeMethodWrapper nativeMethodWrapper, IRetrier retry, Settings settings = null)
 {
     this.parenthWnd = parenthWnd;
     this.hWnd = hWnd;
     this.absoluteMouse = mouse;
     this.nativeMethodWrapper = nativeMethodWrapper;
     this.retry = retry;
     this.settings = settings ?? new Settings();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultActionSequenceBuilder"/> class.
 /// </summary>
 /// <param name="driver">The <see cref="IWebDriver"/> object on which the actions built will be performed.</param>
 public DefaultActionSequenceBuilder(IWebDriver driver)
 {
     IHasInputDevices inputDevicesDriver = driver as IHasInputDevices;
     if (inputDevicesDriver != null)
     {
         this.keyboard = inputDevicesDriver.Keyboard;
         this.mouse = inputDevicesDriver.Mouse;
     }
 }
        public void Before()
        {
            this.hWnd = new IntPtr(1337);
            this.innerMouse = A.Fake<IMouse>();
            this.nativeMethodWrapper = A.Fake<INativeMethodWrapper>();
            this.retrierFactory = new NRetryTimerFactory(0);
            this.retrier = new Retrier(this.retrierFactory);

            this.windowRelativeMouse = new WindowRelativeMouse(this.hWnd, this.hWnd, this.innerMouse, this.nativeMethodWrapper, this.retrier);
        }
Beispiel #12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SingleKeyAction"/> class.
        /// </summary>
        /// <param name="keyboard">The <see cref="IKeyboard"/> to use in performing the action.</param>
        /// <param name="mouse">The <see cref="IMouse"/> to use in setting focus to the element on which to perform the action.</param>
        /// <param name="actionTarget">An <see cref="ILocatable"/> object providing the element on which to perform the action.</param>
        /// <param name="key">The modifier key (<see cref="Keys.Shift"/>, <see cref="Keys.Control"/>, <see cref="Keys.Alt"/>) to use in the action.</param>
        protected SingleKeyAction(IKeyboard keyboard, IMouse mouse, ILocatable actionTarget, string key)
            : base(keyboard, mouse, actionTarget)
        {
            if (!ModifierKeys.Contains(key))
            {
                throw new ArgumentException("key must be a modifier key (Keys.Shift, Keys.Control, or Keys.Alt)", "key");
            }

            this.key = key;
        }
Beispiel #13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Actions"/> class.
        /// </summary>
        /// <param name="driver">The <see cref="IWebDriver"/> object on which the actions built will be performed.</param>
        public Actions(IWebDriver driver)
        {
            IHasInputDevices inputDevicesDriver = driver as IHasInputDevices;
            if (inputDevicesDriver == null)
            {
                throw new ArgumentException("The IWebDriver object must implement IHasInputDevices.", "driver");
            }

            this.keyboard = inputDevicesDriver.Keyboard;
            this.mouse = inputDevicesDriver.Mouse;
        }
        public void OnMouseClick(IMouse mouse, Point location)
        {
            switch (_state)
            {
                case State.WaitLineBeginPoint:
                    _begin = location;
                    _state = State.WaitLineEndPoint;
                    break;

                case State.WaitLineEndPoint:
                    _end = location;
                    _state = State.WaitLineBeginPoint;
                    mouse.DrawPad.Add(new Line(_begin, _end));
                    break;
            }
        }
Beispiel #15
0
 public MoveToHandler(IMouse mouse, IElementFactory elementFactory)
 {
     this.mouse = mouse;
     this.elementFactory = elementFactory;
 }
 public ClickElementHandler(IMouse mouse, IOverlay overlay, IElementFactory elementFactory)
 {
     this.mouse = mouse;
     this.overlay = overlay;
     this.elementFactory = elementFactory;
 }
Beispiel #17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SendKeysAction"/> class.
 /// </summary>
 /// <param name="keyboard">The <see cref="IKeyboard"/> to use in performing the action.</param>
 /// <param name="mouse">The <see cref="IMouse"/> to use in setting focus to the element on which to perform the action.</param>
 /// <param name="actionTarget">An <see cref="ILocatable"/> object providing the element on which to perform the action.</param>
 /// <param name="keysToSend">The key sequence to send.</param>
 public SendKeysAction(IKeyboard keyboard, IMouse mouse, ILocatable actionTarget, string keysToSend)
     : base(keyboard, mouse, actionTarget)
 {
     this.keysToSend = keysToSend;
 }
Beispiel #18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Mouse"/> class.
 /// </summary>
 /// <param name="assets">The asset manager for this user interface module.</param>
 /// <param name="core">The basic core functionalities of the mouse unit.</param>
 public Mouse(AssetManager assets, IMouse core)
 {
     this.Assets = assets;
     Mouse.core  = core;
 }
 private void ReleaseInterfaces()
 {
     Maze = null;
     Mouse = null;
 }
Beispiel #20
0
 private void ReleaseInterfaces()
 {
     Maze  = null;
     Mouse = null;
 }
Beispiel #21
0
 private static unsafe void OnMouseWheel(IMouse mouse, ScrollWheel scrollWheel)
 {
     //We don't want to be able to zoom in too close or too far away so clamp to these values
     CameraZoom = Math.Clamp(CameraZoom - scrollWheel.Y, 1.0f, 45f);
 }
Beispiel #22
0
 private static unsafe void OnMouseWheel(IMouse mouse, ScrollWheel scrollWheel)
 {
     Camera.ModifyZoom(scrollWheel.Y);
 }
Beispiel #23
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MoveToOffsetAction"/> class.
 /// </summary>
 /// <param name="mouse">The <see cref="IMouse"/> with which the action will be performed.</param>
 /// <param name="actionTarget">An <see cref="ILocatable"/> describing an element at which to perform the action.</param>
 /// <param name="offsetX">The horizontal offset from the origin of the target to which to move the mouse.</param>
 /// <param name="offsetY">The vertical offset from the origin of the target to which to move the mouse.</param>
 public MoveToOffsetAction(IMouse mouse, ILocatable actionTarget, int offsetX, int offsetY)
     : base(mouse, actionTarget)
 {
     this.offsetX = offsetX;
     this.offsetY = offsetY;
 }
Beispiel #24
0
 public MouseRegionWidget(IMouse mouse)
 {
     this.mouse = mouse;
     this.SubscribeToEvents();
 }
Beispiel #25
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="ClickAndHoldAction" /> class.
 /// </summary>
 /// <param name="mouse">The <see cref="IMouse" /> with which the action will be performed.</param>
 /// <param name="actionTarget">An <see cref="ILocatable" /> describing an element at which to perform the action.</param>
 public ClickAndHoldAction(IMouse mouse, ILocatable actionTarget) : base(mouse, actionTarget)
 {
 }
Beispiel #26
0
        public FiftyBird(IGameLoop gameLoop, IGraphics graphics, IAudio audio, IKeyboard keyboard, IMouse mouse) : base(nameof(FiftyBird), gameLoop, graphics, audio, keyboard, mouse)
        {
            Keyboard = new StatefulKeyboard(keyboard);
            Mouse    = new StatefulMouse(mouse);

            // initialize state machine with all state - returning functions
            StateMachine = new StateMachine(new Dictionary <string, State>
            {
                ["title"]     = new TitleScreenState(),
                ["countdown"] = new CountdownState(),
                ["play"]      = new PlayState(),
                ["score"]     = new ScoreState()
            });

            Instance = this;
        }
Beispiel #27
0
 private static void MouseOnClick(IMouse arg1, MouseButton arg2)
 {
     Console.WriteLine($"M{arg1.Index}> {arg2} single click.");
 }
Beispiel #28
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ContextClickAction"/> class.
 /// </summary>
 /// <param name="mouse">The <see cref="IMouse"/> with which the action will be performed.</param>
 /// <param name="actionTarget">An <see cref="ILocatable"/> describing an element at which to perform the action.</param>
 public ContextClickAction(IMouse mouse, ILocatable actionTarget)
     : base(mouse, actionTarget)
 {
 }
 public RunnerGame(IMouse mouse, IKeyboard keyboard)
     : base(mouse, keyboard)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="KeyboardAction"/> class.
 /// </summary>
 /// <param name="keyboard">The <see cref="IKeyboard"/> to use in performing the action.</param>
 /// <param name="mouse">The <see cref="IMouse"/> to use in setting focus to the element on which to perform the action.</param>
 /// <param name="actionTarget">An <see cref="ILocatable"/> object providing the element on which to perform the action.</param>
 protected KeyboardAction(IKeyboard keyboard, IMouse mouse, ILocatable actionTarget)
     : base(actionTarget)
 {
     this.keyboard = keyboard;
     this.mouse    = mouse;
 }
Beispiel #31
0
 /// <summary>
 /// Initializes a new instance of the <see cref="KeyDownAction"/> class.
 /// </summary>
 /// <param name="keyboard">The <see cref="IKeyboard"/> to use in performing the action.</param>
 /// <param name="mouse">The <see cref="IMouse"/> to use in setting focus to the element on which to perform the action.</param>
 /// <param name="actionTarget">An <see cref="ILocatable"/> object providing the element on which to perform the action.</param>
 /// <param name="key">The modifier key (<see cref="Keys.Shift"/>, <see cref="Keys.Control"/>, <see cref="Keys.Alt"/>) to use in the action.</param>
 public KeyDownAction(IKeyboard keyboard, IMouse mouse, ILocatable actionTarget, string key)
     : base(keyboard, mouse, actionTarget, key)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="KeyDownAction"/> class.
 /// </summary>
 /// <param name="keyboard">The <see cref="IKeyboard"/> to use in performing the action.</param>
 /// <param name="mouse">The <see cref="IMouse"/> to use in setting focus to the element on which to perform the action.</param>
 /// <param name="actionTarget">An <see cref="ILocatable"/> object providing the element on which to perform the action.</param>
 /// <param name="key">The modifier key (<see cref="Keys.Shift"/>, <see cref="Keys.Control"/>, <see cref="Keys.Alt"/>) to use in the action.</param>
 public KeyDownAction(IKeyboard keyboard, IMouse mouse, ILocatable actionTarget, string key)
     : base(keyboard, mouse, actionTarget, key)
 {
 }
Beispiel #33
0
 protected void HandleMouseUp(IMouse mouse, MouseButton btn) => MouseUp?.Invoke(mouse, btn);
Beispiel #34
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ButtonReleaseAction"/> class.
 /// </summary>
 /// <param name="mouse">The <see cref="IMouse"/> with which the action will be performed.</param>
 /// <param name="actionTarget">An <see cref="ILocatable"/> describing an element at which to perform the action.</param>
 public ButtonReleaseAction(IMouse mouse, ILocatable actionTarget)
     : base(mouse, actionTarget)
 {
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref = "DoubleClickAction"/> class.
 /// </summary>
 /// <param name = "mouse">The <see cref = "IMouse"/> with which the action will be performed.</param>
 /// <param name = "actionTarget">An <see cref = "ILocatable"/> describing an element at which to perform the action.</param>
 public DoubleClickAction(IMouse mouse, ILocatable actionTarget) : base(mouse, actionTarget)
 {
 }
Beispiel #36
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MouseAction"/> class.
 /// </summary>
 /// <param name="mouse">The <see cref="IMouse"/> with which the action will be performed.</param>
 /// <param name="target">An <see cref="ILocatable"/> describing an element at which to perform the action.</param>
 public MouseAction(IMouse mouse, ILocatable target)
     : base(target)
 {
     this.mouse = mouse;
 }
 public void Init(IMaze maze, IMouse mouse)
 {
     Maze = maze;
     Mouse = mouse;
 }
Beispiel #38
0
 public MouseWheel(IMouse mouse)
 {
     this.mouse = mouse;
     prevWheel = 0;
 }
        /*
         * code reference:
         * http://blogs.msdn.com/b/mattwar/archive/2005/02/11/371274.aspx
         *
         * julia's comment:
         *  1. try to identify the cycle detection / back tracking code
         *  2. Try to understand code.
         */
        public static bool FindCheese(IMouse mouse, int rows, int cols)
        {
            Cell[,] grid = new Cell[rows, cols];

            int r = 0;
            int c = 0;

            // set terminal, so we don't backtrack past the origin

            grid[r, c].prev = 4;

            while (!mouse.IsCheeseHere()) {

                byte d = grid[r,c].next;

                if (d < 4) {

                    // increment so we know what to try next

                    grid[r,c].next++;

                    // determine next relative position

                    int nr = (r + dr[d] + rows) % rows;

                    int nc = (c + dc[d] + cols) % cols;

                    // only try to move to cells we have not already visited

                    if (grid[nr,nc].next == 0 && mouse.Move((Direction)d)) {

                        r = nr;

                        c = nc;

                        // remember how to get back
                        grid[r, c].prev = (byte)((d + 2) % 4);
                    }

                }
                else {

                    // backtrack
                    d = grid[r, c].prev;

                    if (d == 4)
                        return false;

                    mouse.Move((Direction)d);

                    r = (r + dr[d] + rows) % rows;

                    c = (c + dc[d] + cols) % cols;
                }
            }

            return true;
        }
Beispiel #40
0
    //IGamepads Gamepads;
    void Start()
    {
        Pico.LevelChanged += Initialize;
        Initialize();

        Anchor = Instantiate(Pico.ProjectorTemplate) as GameObject;
        Anchor.name = "Anchor";
        Anchor.GetComponent<ProjectorBehaviour>().IsGizmo = true;
        Anchor.FindChild("Inner").active = false;
        Anchor.FindChild("Pyramid").active = false;
        HighlightFace = Anchor.FindChild("Highlight Face");
        HighlightFace.GetComponentInChildren<Renderer>().enabled = false;

        //Keyboard = KeyboardManager.Instance;
        //Keyboard.RegisterKey(KeyCode.W);
        //Keyboard.RegisterKey(KeyCode.S);
        //Keyboard.RegisterKey(KeyCode.R);
        //Keyboard.RegisterKey(KeyCode.Z);
        //Keyboard.RegisterKey(KeyCode.Space);
        //Keyboard.RegisterKey(KeyCode.LeftControl);
        //Keyboard.RegisterKey(KeyCode.Escape);

        Anchor.transform.position = new Vector3(0, 0, 0);

        Mouse = MouseManager.Instance;
           // Gamepads = GamepadsManager.Instance;
    }
Beispiel #41
0
 public KeyboardInputMap(IKeyboard keyboard, IMouse mouse)
 {
     this.keyboard = keyboard;
     this.mouse    = mouse;
 }
Beispiel #42
0
 public MazeEditor(IMazeElementProcessing _mazeElementProcessing, IMouse _mouse, IInputMouseButtons _inputButtons)
 {
     mazeElementProcessing = _mazeElementProcessing;
     Mouse        = _mouse;
     inputButtons = _inputButtons;
 }
Beispiel #43
0
 public Laptop AddMouse(IMouse mouse)
 {
     _mouse = mouse;
     return(this);
 }
Beispiel #44
0
 internal static void Init(
  IStyle style, 
  ISurface surface, 
  IDrawings graphics, 
  IKeyboard keyboard,      
  IMouse mouse)
 {
     _surface = surface;
      _drawings = graphics;
      _keyboard = keyboard;
      _style = style;
      _mouse = mouse;
      PenWidth = 2.0;
      BrushColor = "purple";
      PenColor = "black";
      FontSize = 12;
      FontName = "Tahoma";
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ButtonReleaseAction"/> class.
 /// </summary>
 /// <param name="mouse">The <see cref="IMouse"/> with which the action will be performed.</param>
 /// <param name="actionTarget">An <see cref="ILocatable"/> describing an element at which to perform the action.</param>
 public ButtonReleaseAction(IMouse mouse, ILocatable actionTarget)
     : base(mouse, actionTarget)
 {
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="RemoteWebDriver"/> class
        /// </summary>
        /// <param name="commandExecutor">An <see cref="ICommandExecutor"/> object which executes commands for the driver.</param>
        /// <param name="desiredCapabilities">An <see cref="ICapabilities"/> object containing the desired capabilities of the browser.</param>
        public RemoteWebDriver(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
        {
            this.executor = commandExecutor;
            this.StartClient();
            this.StartSession(desiredCapabilities);
            this.mouse = new RemoteMouse(this);
            this.keyboard = new RemoteKeyboard(this);

            if (this.capabilities.HasCapability(CapabilityType.SupportsApplicationCache))
            {
                object appCacheCapability = this.capabilities.GetCapability(CapabilityType.SupportsApplicationCache);
                if (appCacheCapability is bool && (bool)appCacheCapability)
                {
                    this.appCache = new RemoteApplicationCache(this);
                }
            }

            if (this.capabilities.HasCapability(CapabilityType.SupportsLocationContext))
            {
                object locationContextCapability = this.capabilities.GetCapability(CapabilityType.SupportsLocationContext);
                if (locationContextCapability is bool && (bool)locationContextCapability)
                {
                this.locationContext = new RemoteLocationContext(this);
                }
            }

            if (this.capabilities.HasCapability(CapabilityType.SupportsWebStorage))
            {
                object webContextCapability = this.capabilities.GetCapability(CapabilityType.SupportsWebStorage);
                if (webContextCapability is bool && (bool)webContextCapability)
                {
                    this.storage = new RemoteWebStorage(this);
                }
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="MoveToOffsetAction"/> class.
 /// </summary>
 /// <param name="mouse">The <see cref="IMouse"/> with which the action will be performed.</param>
 /// <param name="actionTarget">An <see cref="ILocatable"/> describing an element at which to perform the action.</param>
 /// <param name="offsetX">The horizontal offset from the origin of the target to which to move the mouse.</param>
 /// <param name="offsetY">The vertical offset from the origin of the target to which to move the mouse.</param>
 public MoveToOffsetAction(IMouse mouse, ILocatable actionTarget, int offsetX, int offsetY)
     : base(mouse, actionTarget)
 {
     this.offsetX = offsetX;
     this.offsetY = offsetY;
 }
Beispiel #48
0
 public MoveToHandler(IMouse mouse, IOverlay overlay, IElementFactory elementFactory)
 {
     this.mouse          = mouse;
     this.overlay        = overlay;
     this.elementFactory = elementFactory;
 }
Beispiel #49
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Label"/> class.
 /// </summary>
 /// <param name="mouse">The mouse servicve.</param>
 /// <param name="parent">The parent.</param>
 protected Label(IMouse mouse, UserInterfaceElement parent = null)
     : base(mouse, parent)
 {
 }
Beispiel #50
0
 private static void MouseOnDoubleClick(IMouse arg1, MouseButton arg2, Vector2 pos)
 {
     Console.WriteLine($"M{arg1.Index}> {arg2} double click.");
 }
Beispiel #51
0
        public IFrame <IDTDanmakuAssets> GetNextFrame(IKeyboard keyboardInput, IMouse mouseInput, IKeyboard previousKeyboardInput, IMouse previousMouseInput, IDisplay <IDTDanmakuAssets> display)
        {
            /*
             *      Note that since these debug things bypass regular game logic, they may break other stuff or crash the program
             *      (Should be used for debugging / development only)
             */
            if (this.debugMode)
            {
                if (keyboardInput.IsPressed(Key.Seven))
                {
                    for (int i = 0; i < 6; i++)
                    {
                        this.gameLogic = this.gameLogic.GetNextFrame(new EmptyKeyboard(), new EmptyMouse(), new EmptyKeyboard(), new EmptyMouse());
                    }

                    if (keyboardInput.IsPressed(Key.Q))
                    {
                        for (int i = 0; i < 27; i++)
                        {
                            this.gameLogic = this.gameLogic.GetNextFrame(new EmptyKeyboard(), new EmptyMouse(), new EmptyKeyboard(), new EmptyMouse());
                        }
                    }
                }
            }

            this.gameLogic = this.gameLogic.GetNextFrame(keyboardInput, mouseInput, previousKeyboardInput, previousMouseInput);

            if (this.gameLogic.IsGameOver())
            {
                return(new GameOverFrame(fps: fps, rng: this.rng, guidGenerator: this.guidGenerator, soundVolume: this.gameLogic.GetSoundVolume(), debugMode: this.debugMode));
            }

            if (this.gameLogic.HasPlayerWon())
            {
                return(new YouWinFrame(fps: fps, rng: this.rng, guidGenerator: this.guidGenerator, soundVolume: this.gameLogic.GetSoundVolume(), debugMode: this.debugMode));
            }

            if (keyboardInput.IsPressed(Key.Esc) && !previousKeyboardInput.IsPressed(Key.Esc))
            {
                return(new GamePausedScreenFrame(frame: this, fps: this.fps, rng: this.rng, guidGenerator: this.guidGenerator, soundVolume: this.gameLogic.GetSoundVolume(), debugMode: this.debugMode));
            }

            return(this);
        }
Beispiel #52
0
        protected Game(string gameName, IGameLoop gameLoop, IGraphics graphics, IAudio audio, IKeyboard keyboard, IMouse mouse = null, IFileSystem fileSystem = null)
        {
            GameName      = gameName;
            this.gameLoop = gameLoop;
            Graphics      = graphics;
            Audio         = audio;
            Keyboard      = keyboard;
            Mouse         = mouse;
            FileSystem    = fileSystem;

            Sounds = new Dictionary <string, ISource>();
            Random = new Random();

            Instance = this;
        }
 /// <summary>
 ///     Initializes a new instance of the <see cref="MouseAction" /> class.
 /// </summary>
 /// <param name="mouse">The <see cref="IMouse" /> with which the action will be performed.</param>
 /// <param name="target">An <see cref="ILocatable" /> describing an element at which to perform the action.</param>
 public MouseAction(IMouse mouse, ILocatable target) : base(target)
 {
     Mouse = mouse;
 }
Beispiel #54
0
 public void Init(IMaze maze, IMouse mouse)
 {
     Maze  = maze;
     Mouse = mouse;
 }
Beispiel #55
0
 /// <summary>
 /// Initializes a new instance of the RemoteWebDriver class
 /// </summary>
 /// <param name="commandExecutor">An <see cref="ICommandExecutor"/> object which executes commands for the driver.</param>
 /// <param name="desiredCapabilities">An <see cref="ICapabilities"/> object containing the desired capabilities of the browser.</param>
 public RemoteWebDriver(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
 {
     this.executor = commandExecutor;
     this.StartClient();
     this.StartSession(desiredCapabilities);
     this.mouse = new RemoteMouse(this);
     this.keyboard = new RemoteKeyboard(this);
 }
Beispiel #56
0
 private static void MouseOnMouseMove(IMouse arg1, Vector2 arg2)
 {
     Console.WriteLine($"M{arg1.Index}> Moved: {arg2}");
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SendKeysAction"/> class.
 /// </summary>
 /// <param name="keyboard">The <see cref="IKeyboard"/> to use in performing the action.</param>
 /// <param name="mouse">The <see cref="IMouse"/> to use in setting focus to the element on which to perform the action.</param>
 /// <param name="actionTarget">An <see cref="ILocatable"/> object providing the element on which to perform the action.</param>
 /// <param name="keysToSend">The key sequence to send.</param>
 public SendKeysAction(IKeyboard keyboard, IMouse mouse, ILocatable actionTarget, string keysToSend)
     : base(keyboard, mouse, actionTarget)
 {
     this.keysToSend = keysToSend;
 }
Beispiel #58
0
 private static void MouseOnScroll(IMouse arg1, ScrollWheel arg2)
 {
     Console.WriteLine($"K{arg1.Index}> Scrolled: ({arg2.X}, {arg2.Y})");
 }
Beispiel #59
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ClickAction"/> class.
 /// </summary>
 /// <param name="mouse">The <see cref="IMouse"/> with which the action will be performed.</param>
 /// <param name="actionTarget">An <see cref="ILocatable"/> describing an element at which to perform the action.</param>
 public ClickAction(IMouse mouse, ILocatable actionTarget)
     : base(mouse, actionTarget)
 {
 }
Beispiel #60
0
 private static void MouseOnMouseUp(IMouse arg1, MouseButton arg2)
 {
     Console.WriteLine($"M{arg1.Index}> {arg2} up.");
 }