//Move the Snake by pressing the keyboard arrows private void Window_KeyDown(object sender, KeyEventArgs e) { switch (e.Key) { case Key.P: if (!isPaused) { PausePlayer.Play(); PausedLabel.Visibility = Visibility.Visible; isPaused = true; timer.Stop(); } else if (isPaused) { PausePlayer.Play(); PausedLabel.Visibility = Visibility.Hidden; isPaused = false; timer.Start(); } break; case Key.Up: if (LastKey != (int)Key.Up && !isPaused) { UpPlayer.Play(); MoveSnake(0); LastKey = (int)Key.Up; } break; case Key.Down: if (LastKey != (int)Key.Down && !isPaused) { DownPlayer.Play(); MoveSnake(1); LastKey = (int)Key.Down; } break; case Key.Right: if (LastKey != (int)Key.Right && !isPaused) { RightPlayer.Play(); MoveSnake(2); LastKey = (int)Key.Right; } break; case Key.Left: if (LastKey != (int)Key.Left && !isPaused) { LeftPlayer.Play(); MoveSnake(3); LastKey = (int)Key.Left; } break; } }
public void CheckRoundCard() { LeftPlayer.DrawNextNCard(null, 1, AddCardReason.RoundCard); if (LeftPlayer.SpikeManager.HasSpike("doublecard")) { LeftPlayer.DrawNextNCard(null, 1, AddCardReason.RoundCard); } RightPlayer.DrawNextNCard(null, 1, AddCardReason.RoundCard); if (RightPlayer.SpikeManager.HasSpike("doublecard")) { RightPlayer.DrawNextNCard(null, 1, AddCardReason.RoundCard); } }
public RankedDoublePlayer(LeftPlayer leftPlayer, RightPlayer rightPlayer, Values.StatType type, Form mainform) { InitializeComponent(); this.mainForm = mainform; this.leftPlayer = leftPlayer; this.rightPlayer = rightPlayer; this.type = type; this.pictureBoxLeft.SizeMode = PictureBoxSizeMode.Zoom; this.pictureBoxRight.SizeMode = PictureBoxSizeMode.Zoom; int xLeft = (panelLeft.Size.Width - this.labelPlayerNameLeft.Size.Width) / 2; this.labelPlayerNameLeft.Location = new Point(xLeft, this.labelPlayerNameLeft.Location.Y); int xRight = (panelRight.Size.Width - this.labelPlayerNameRight.Size.Width) / 2; this.labelPlayerNameRight.Location = new Point(xRight, this.labelPlayerNameRight.Location.Y); if (this.leftPlayer != null && this.rightPlayer != null) { if (type == Values.StatType.RankedFPP) { this.statsLeft = this.leftPlayer.CalculatedRankedFppStats; this.statsRight = this.rightPlayer.CalculatedRankedFppStats; } else if (type == Values.StatType.RankedTPP) { this.statsLeft = this.leftPlayer.CalculatedRankedTppStats; this.statsRight = this.rightPlayer.CalculatedRankedTppStats; } this.UpdateStatLabels(); this.DisplayComparisonArrows(); DoublePlayerMatchFiltering doubleFiltering = new DoublePlayerMatchFiltering(this.leftPlayer.Matches, this.leftPlayer.Name, this.rightPlayer.Matches, this.rightPlayer.Name, this.type, "competitive"); Tuple <List <GraphPlot>, List <GraphPlot> > tuple = doubleFiltering.GetList(); this.BuildChart(tuple.Item1, tuple.Item2); } }
public void Update(bool isFast, float pastRound, int round) { LeftPlayer.Update(isFast, pastRound, round); RightPlayer.Update(isFast, pastRound, round); }
public NormalDoublePlayer(LeftPlayer leftPlayer, RightPlayer rightPlayer, Values.StatType type, Form form) { InitializeComponent(); this.leftPlayerFraggerRatingGauge.From = 0; this.leftPlayerFraggerRatingGauge.To = 100; this.leftPlayerFraggerRatingGauge.Base.LabelsVisibility = Visibility.Hidden; this.leftPlayerFraggerRatingGauge.Base.Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(242, 169, 0)); this.rightPlayerFraggerRatingGauge.From = 0; this.rightPlayerFraggerRatingGauge.To = 100; this.rightPlayerFraggerRatingGauge.Base.LabelsVisibility = Visibility.Hidden; this.rightPlayerFraggerRatingGauge.Base.Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(242, 169, 0)); this.leftPlayerFraggerRatingGauge.Base.GaugeActiveFill = new LinearGradientBrush { GradientStops = new GradientStopCollection { new GradientStop(Colors.Yellow, 0), new GradientStop(Colors.Orange, .5), new GradientStop(Colors.Red, 1) } }; this.rightPlayerFraggerRatingGauge.Base.GaugeActiveFill = new LinearGradientBrush { GradientStops = new GradientStopCollection { new GradientStop(Colors.Yellow, 0), new GradientStop(Colors.Orange, .5), new GradientStop(Colors.Red, 1) } }; if (form != null) { this.mainForm = form; } if (leftPlayer != null && rightPlayer != null) { this.leftPlayer = leftPlayer; this.rightPlayer = rightPlayer; this.type = type; this.unrankedLeft = this.GetUnrankedObjectType(this.leftPlayer); this.unrankedRight = this.GetUnrankedObjectType(this.rightPlayer); this.UpdateStatLabels(); this.DisplayComparisonArrows(); DoublePlayerMatchFiltering doubleFiltering = new DoublePlayerMatchFiltering(this.leftPlayer.Matches, this.leftPlayer.Name, this.rightPlayer.Matches, this.rightPlayer.Name, this.type, "official"); Tuple <List <GraphPlot>, List <GraphPlot> > tuple = doubleFiltering.GetList(); this.BuildChart(tuple.Item1, tuple.Item2); } }
public void DrawScreen() { Draw(Output.Graphics, default(Vector)); LeftPlayer?.Draw(Output.Graphics, new Vector(-100, 0)); RightPlayer?.Draw(Output.Graphics, new Vector(100, 0)); }