private void Form1_Load(object sender, EventArgs e) { ActiveControl = label1; GetAllControls(this, AllControls); AllControls.Reverse(); List <Timer> tempTimers = new List <Timer>() { TimeController, AnimationController, DrawController, EngineController }; Finder.SetTimers(tempTimers); Finder.SetAllControls(AllControls); ScoreInterface.Instance.GetType(); Games = new List <Game>(); Games.Add(new LoLGame((MetroPanel)Finder.FindElementWithTag("WoWPanel1"))); Games.Add(new LoLGame((MetroPanel)Finder.FindElementWithTag("WoWPanel2"))); Games.Add(new JumperGame((MetroPanel)Finder.FindElementWithTag("JumperPanel1"))); Games.Add(new JumperGame((MetroPanel)Finder.FindElementWithTag("JumperPanel2"))); GameManager.Instance.SetGames(Games); AnimationController.Start(); DrawController.Start(); foreach (Control c in AllControls) { if (c is MetroTile) { c.Click += ChangeFocus; } } metroToggle1.Checked = true; metroComboBox1.SelectedIndex = 0; }
public override void Update(GameTime gameTime) { // <UP> key --> Select previous easing function. if (InputService.IsPressed(Keys.Up, true)) { _selectedEasingFunctionIndex--; if (_selectedEasingFunctionIndex < 0) { _selectedEasingFunctionIndex = _easingFunctions.Length - 1; } } // <DOWN> key --> Select next easing function. if (InputService.IsPressed(Keys.Down, true)) { _selectedEasingFunctionIndex++; if (_selectedEasingFunctionIndex >= _easingFunctions.Length) { _selectedEasingFunctionIndex = 0; } } // <1>, <2>, <3> --> Select easing mode. if (InputService.IsPressed(Keys.D1, false)) { _selectedEasingMode = EasingMode.EaseIn; } else if (InputService.IsPressed(Keys.D2, false)) { _selectedEasingMode = EasingMode.EaseOut; } else if (InputService.IsPressed(Keys.D3, false)) { _selectedEasingMode = EasingMode.EaseInOut; } if (_animationController.State == AnimationState.Filling) { // The current animation has finished - it is now holding the last animation // value because the fill behavior is set to 'Hold' by default. // (_fromToAnimation.FillBehavior == FillBehavior.Hold). // Stop the animation. _animationController.Stop(); // Switch the From and To values of the horizontal animation to move the sprite back // to the other screen side. Rectangle bounds = GraphicsService.GraphicsDevice.Viewport.TitleSafeArea; if (_animatableFloat.Value < bounds.Center.X) { _fromToAnimation.From = bounds.Left + 200; _fromToAnimation.To = bounds.Right - 200; } else { _fromToAnimation.From = bounds.Right - 200; _fromToAnimation.To = bounds.Left + 200; } // Set easing function. _fromToAnimation.EasingFunction = _easingFunctions[_selectedEasingFunctionIndex]; // Set easing mode. EasingFunction currentEasingFunction = _fromToAnimation.EasingFunction as EasingFunction; if (currentEasingFunction != null) { currentEasingFunction.Mode = _selectedEasingMode; } // Start the new animation. _animationController.Start(); } base.Update(gameTime); }