Example #1
0
 public Display()
 {
     Logger.writeGeneralLog("Beginning startup functions.");
     InitializeComponent();
     Logger.writeGeneralLog("Screen objects created"); /*
                                                        * System.Drawing.Text.PrivateFontCollection privateFonts = new System.Drawing.Text.PrivateFontCollection();
                                                        * privateFonts.AddFontFile(Path.Combine(Application.StartupPath, "erbos_draco_1st_open_nbp.ttf"));
                                                        * privateFonts.AddFontFile(Path.Combine(Application.StartupPath, "GODOFWAR.TTF"));
                                                        * Logger.writeGeneralLog("Fonts added to private fonts array");
                                                        * System.Drawing.Font scoreFont = new Font(privateFonts.Families[0], 27);
                                                        * System.Drawing.Font timeFont = new Font(privateFonts.Families[0], 40);
                                                        * System.Drawing.Font titleFont = new Font(privateFonts.Families[1], 36);
                                                        * Logger.writeGeneralLog("Font objects created");
                                                        * team1Name.Font = titleFont;
                                                        * team2Name.Font = titleFont;
                                                        * team2ScoreLbl.Font = scoreFont;
                                                        * team1ScoreLbl.Font = scoreFont;
                                                        * timerLabel.Font = timeFont;
                                                        * titleLabel.Font = titleFont;*/
     Logger.writeGeneralLog("Fonts applied to labels");
     GameUtility.setupObjects();
     WhatsNewScreen.shouldPopOnStart();
     Logger.writeGeneralLog("Game objects setup complete");
     GUIupdate = new Thread(new ThreadStart(updateComponents)); // create a GUI updating thread
     GUIupdate.IsBackground = true;                             // make the GUI updating thread a background thread so it closes when the window closes
     GUIupdate.Start();                                         // start the GUI updating thread
     Logger.writeGeneralLog("GUI updating thread created and started");
     referee.Show();                                            // create the referee window so that points can be allocated and team names set
     Logger.writeGeneralLog("Referee window is now shown");
     GoFullscreen(screenMode);                                  // set the fullscreen mode
     Logger.writeGeneralLog("Fullscreen setting applied");
     if (WhatsNewScreen.isShowing == true)
     {
         newScreen.Show();
     }
 }
Example #2
0
 /// <summary>
 /// Pauses a match, a paused match can only be resumed or stopped, not restarted
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void pauseButton_Click(object sender, EventArgs e)
 {
     Console.WriteLine("pause button pushed");
     GameUtility.pauseMatch();
 }
Example #3
0
 /// <summary>
 /// Resumes a paused match
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void resumeButton_Click(object sender, EventArgs e)
 {
     Console.WriteLine("Resume button pushed.");
     GameUtility.resumeMatch();
 }
Example #4
0
        /// <summary>
        /// Parses data received from the arduino and fires off the proper event based on the parsed data
        /// </summary>
        /// <param name="data"></param>
        void parseReceivedData(string data)
        {
            switch (int.Parse(data)) //This switch handles all possible events from the arduino and has a failsafe incase we cannot setermine the error
            {
            case 0:
                Console.WriteLine("Command received was a start match command. Starting Match");
                setDataText("Match Start.");
                GameUtility.beginMatch();
                break;

            case 1:
                Console.WriteLine("Command received was a team 1 band score.");
                setDataText("Team 1 Rubber Bands");
                if (GameUtility.matchState == 1)
                {
                    if (subtractModeTeam1)
                    {
                        Console.WriteLine("Subtraction mode is activated on team 1! Subtracting instead of adding.");
                        Display.team1Score -= ScoreValues[0];
                    }
                    else
                    {
                        Display.team1Score += ScoreValues[0];
                    }
                }
                break;

            case 2:
                Console.WriteLine("Command received was a team 1 ping pong score.");
                setDataText("Team 1 Ping Pong");
                if (GameUtility.matchState == 1)
                {
                    if (subtractModeTeam1)
                    {
                        Console.WriteLine("Subtraction mode is activated on team 1! Subtracting instead of adding.");
                        Display.team1Score -= ScoreValues[1];
                    }
                    else
                    {
                        Display.team1Score += ScoreValues[1];
                    }
                }
                break;

            case 3:
                Console.WriteLine("Command received was a team 1 push off score.");
                setDataText("Team 1 Pushing");
                if (GameUtility.matchState == 1)
                {
                    if (subtractModeTeam1)
                    {
                        Console.WriteLine("Subtraction mode is activated on team 1! Subtracting instead of adding.");
                        Display.team1Score -= ScoreValues[3];
                    }
                    else
                    {
                        Display.team1Score += ScoreValues[3];
                    }
                }
                break;

            case 4:
                Console.WriteLine("Command received was a team 1 disabled score.");
                setDataText("Team 1 Disable");
                if (GameUtility.matchState == 1)
                {
                    if (subtractModeTeam1)
                    {
                        Console.WriteLine("Subtraction mode is activated on team 1! Subtracting instead of adding.");
                        Display.team1Score -= ScoreValues[2];
                    }
                    else
                    {
                        Display.team1Score += ScoreValues[2];
                    }
                }
                break;

            case 5:
                Console.WriteLine("Command received was a team 2 band score.");
                setDataText("Team 2 Rubber Bands");
                if (GameUtility.matchState == 1)
                {
                    if (GameUtility.matchState == 1)
                    {
                        if (subtractModeTeam2)
                        {
                            Console.WriteLine("Subtraction mode is activated on team 2! Subtracting instead of adding.");
                            Display.team2Score -= ScoreValues[0];
                        }
                        else
                        {
                            Display.team2Score += ScoreValues[0];
                        }
                    }
                }
                break;

            case 6:
                Console.WriteLine("Command received was a team 2 ping pong score.");
                setDataText("Team 2 Ping Pong");
                if (GameUtility.matchState == 1)
                {
                    if (subtractModeTeam2)
                    {
                        Console.WriteLine("Subtraction mode is activated on team 2! Subtracting instead of adding.");
                        Display.team2Score -= ScoreValues[1];
                    }
                    else
                    {
                        Display.team2Score += ScoreValues[1];
                    }
                }
                break;

            case 7:
                Console.WriteLine("Command received was a team 2 push off score.");
                setDataText("Team 2 Pushing");
                if (GameUtility.matchState == 1)
                {
                    if (subtractModeTeam2)
                    {
                        Console.WriteLine("Subtraction mode is activated on team 2! Subtracting instead of adding.");
                        Display.team2Score -= ScoreValues[3];
                    }
                    else
                    {
                        Display.team2Score += ScoreValues[3];
                    }
                }
                break;

            case 8:
                Console.WriteLine("Command received was a team 2 disabled score.");
                setDataText("Team 2 Disable");
                if (GameUtility.matchState == 1)
                {
                    if (subtractModeTeam2)
                    {
                        Console.WriteLine("Subtraction mode is activated on team 2! Subtracting instead of adding.");
                        Display.team2Score -= ScoreValues[2];
                    }
                    else
                    {
                        Display.team2Score += ScoreValues[2];
                    }
                }
                break;

            default:
                Console.WriteLine("Command was not determinable.");
                break;
            }
        }