public ExportXML(String location, Game game)
 {
     this.xmlDocLocation = location;
     this.game = game;
     this.configuration = Program.getConfiguration();
     writeXml();
 }
Exemple #2
0
 public Team getSetWinner(Game game)
 {
     if (this.isSetWon())
     {
         if (teamAScore > teamBScore)
             return game.TeamA;
         else
             return game.TeamB;
     }
     return null;
 }
Exemple #3
0
        // ---------------------------------------------------------------------
        // methods
        // ---------------------------------------------------------------------
        
        // The team played the ball in the next to last click event gets either a +1 or 0
        public void setNewScore(Game game, bool teamAup)
        {
            Tuple<Position, Position> last2Positions = getLast2Positions();

            // trivial case, ball was outside the field or not even service succeeded
            if (last2Positions == null)
            {
                kill = false;
                return;
            }
            if (last2Positions.Item2.WorldX < 0 || last2Positions.Item2.WorldY < 0 || last2Positions.Item2.WorldY > 16 || last2Positions.Item2.WorldX > 8)
            {
                // no point, attack failed
                kill = false;
                return;
            }
            
            // find attacking team
            Team madeAttack;
            if (teamAup)
            {
                if (last2Positions.Item1.WorldY <= 8)
                    madeAttack = game.TeamA;
                else
	                madeAttack = game.TeamB;
            }
            else
            {
                if (last2Positions.Item1.WorldY <= 8)
                    madeAttack = game.TeamB;
                else
                    madeAttack = game.TeamA;
            }

            // increment attacking team score
            if (teamAup)
            {
                if (last2Positions.Item2.WorldY > 8 && madeAttack == game.TeamA)
                {
                    game.Sets[game.Sets.Count - 1].TeamAScore += 1;
                    kill = true;
                    return;
                }
                if (last2Positions.Item2.WorldY <= 8 && madeAttack == game.TeamB)
                {
                    game.Sets[game.Sets.Count - 1].TeamBScore += 1;
                    kill = true;
                    return;
                }
            }

            else
            {
                if (last2Positions.Item2.WorldY <= 8 && madeAttack == game.TeamA)
                {
                    game.Sets[game.Sets.Count - 1].TeamAScore += 1;
                    kill = true;
                    return;
                }
                if (last2Positions.Item2.WorldY > 8 && madeAttack == game.TeamB)
                {
                    game.Sets[game.Sets.Count - 1].TeamBScore += 1;
                    kill = true;
                    return;
                }
            }
            // in any other case, there is no change of score for either team.
            kill = false;
            return;
        }
        /************************************* END OF VARIABLE DEFINITIONS ********************************************************/





        public Form_Main(XmlOutput xmlDoc)
        {
            InitializeComponent();

            // Load default configuration
            configuration = Program.getConfiguration();
            applyConfiguration(configuration);


            newgame = false;


            this.game = new Game(configuration.Teama, configuration.Teamb);


            // add the first set
            this.game.Sets.Add(new Set(1));

            capture_stream = new CaptureStream();
            capture = Program.Capture;
           
            list_timestamps = new List<long>();
            imageList_screenshots = new ImageList();
            imageList_screenshots.ImageSize = new Size(84, 68);

            codec = Emgu.CV.CvInvoke.CV_FOURCC('P', 'I', 'M', '1');

            this.StartPosition = FormStartPosition.Manual;
            this.DesktopLocation = new Point(0, 0);

            this.xmlDoc = xmlDoc;

            xmlDoc.setGame(this.game);
        }
 public void setGame(Game game) { this.game = game; }