Пример #1
0
        private static void T_FinishedMatch(object sender, giMyMatchData.Args.WinnerEventArgs e)
        {
            Console.Clear();
            MyMatch m = (MyMatch)sender;

            DisplayMatch.Display(m, null, null, e.winnerId);
            Console.WriteLine($"\n\nThe match has finished! The winner is {m[e.winnerId]} ! Congrats! \n\n");
        }
Пример #2
0
        private static void T_FinishedPoint(object sender, giMyMatchData.Args.WinnerEventArgs e)
        {
            Console.Clear();
            MyMatch m = (MyMatch)sender;

            DisplayMatch.Display(m, e.winnerId, null, e.winnerId);
            Console.WriteLine($"\nA point has been made, the point maker is {m[e.winnerId]}\n");
        }
Пример #3
0
        private static void T_FinishedSet(object sender, giMyMatchData.Args.WinnerEventArgs e)
        {
            Console.Clear();
            MyMatch m = (MyMatch)sender;

            DisplayMatch.Display(m, null, null, e.winnerId);
            Console.WriteLine($"\nA set has finished, the set winner is {m[e.winnerId]}\n");
        }
Пример #4
0
        private static void T_NewMatchCreated(object sender, MyMatch e)
        {
            Console.WriteLine("\nA match has been created \n" + e + "\n");
            DisplayMatch.Display(e);
            //COMMENT S'ABBONNER AU MATCH? LE CODE EN BAS NE LE FAIT PAS CORRECTEMENT! ON S'ABONNE A UNE RÉFERENCE EXTERNE, PAS AU MATCH DEDANS LE TOURNOI!
            //Tournament t = sender as Tournament;
            //MyMatch m = (MyMatch) t.GetMatch(e.Joueurs[0], e.Joueurs[1]);
            //m.FinishedGame += T_FinishedGame;
            //m.FinishedMatch += T_FinishedGame;
            //m.FinishedPoint += T_FinishedPoint;
            //m.FinishedSet += T_FinishedSet;

            e.FinishedGame  += T_FinishedGame;
            e.FinishedMatch += T_FinishedMatch;
            e.FinishedPoint += T_FinishedPoint;
            e.FinishedSet   += T_FinishedSet;
            Thread.Sleep(1000);
        }
        private void submitScore_Click(object sender, RoutedEventArgs e)
        {
            var          vm             = this.DataContext as OrganizerViewModel;
            Station      primaryStation = null;
            DisplayMatch primaryMatch   = null;

            foreach (KeyValuePair <string, Station> entry in Stations.Instance.Dict)
            {
                Station station = entry.Value;
                if (station.isPrimaryStream())
                {
                    primaryStation = station;
                }
            }

            if (primaryStation != null)
            {
                foreach (DisplayMatch match in vm.OpenMatches)
                {
                    if (match.Match.IsMatchInProgress && match.Match.StationAssignment == primaryStation.Name)
                    {
                        primaryMatch = match;
                        break;
                    }
                }

                if (primaryMatch != null)
                {
                    int p1ScoreValue = 0;
                    int p2ScoreValue = 0;
                    int.TryParse(p1Score.Text, out p1ScoreValue);
                    int.TryParse(p2Score.Text, out p2ScoreValue);

                    if (playersSwapped)
                    {
                        int tmpValue = p1ScoreValue;
                        p1ScoreValue = p2ScoreValue;
                        p2ScoreValue = tmpValue;
                    }

                    var scores = new SetScore[] { SetScore.Create(p1ScoreValue, p2ScoreValue) };

                    if (p1ScoreValue > p2ScoreValue)
                    {
                        primaryMatch.Player1WinsScored.Execute(scores);
                    }
                    else if (p1ScoreValue < p2ScoreValue)
                    {
                        primaryMatch.Player2WinsScored.Execute(scores);
                    }
                    else
                    {
                        MessageBox.Show("Both players are tied with the same score. Increase one player's score first so a winner can be determined.", "Cannot Report Score", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }
                else
                {
                    MessageBox.Show("There is no match in progress on the primary streaming station.", "Cannot Report Score", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            else
            {
                MessageBox.Show("There is no primary streaming station. Please set at least one station to type Stream. The first station in the list of type Stream will be the primary streaming station.", "Cannot Report Score", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }