Esempio n. 1
0
        public void TestAddDefaultPositions()
        {
            TimelineEventLongoMatch evt = new TimelineEventLongoMatch ();
            evt.EventType = new EventType ();
            evt.EventType.TagFieldPosition = false;
            evt.EventType.TagHalfFieldPosition = false;
            evt.EventType.TagGoalPosition = false;

            Assert.IsNull (evt.FieldPosition);
            Assert.IsNull (evt.HalfFieldPosition);
            Assert.IsNull (evt.GoalPosition);
            evt.AddDefaultPositions ();
            Assert.IsNull (evt.FieldPosition);
            Assert.IsNull (evt.HalfFieldPosition);
            Assert.IsNull (evt.GoalPosition);

            evt.EventType.TagFieldPosition = true;
            evt.AddDefaultPositions ();
            Assert.IsNotNull (evt.FieldPosition);
            Assert.IsNull (evt.HalfFieldPosition);
            Assert.IsNull (evt.GoalPosition);

            evt.EventType.TagFieldPosition = false;
            evt.EventType.TagHalfFieldPosition = true;
            evt.AddDefaultPositions ();
            Assert.IsNotNull (evt.FieldPosition);
            Assert.IsNotNull (evt.HalfFieldPosition);
            Assert.IsNull (evt.GoalPosition);

            evt.EventType.TagFieldPosition = false;
            evt.EventType.TagHalfFieldPosition = false;
            evt.EventType.TagGoalPosition = true;
            evt.AddDefaultPositions ();
            Assert.IsNotNull (evt.FieldPosition);
            Assert.IsNotNull (evt.HalfFieldPosition);
            Assert.IsNotNull (evt.GoalPosition);

            /* Adding the default positions doesn't not overwrite the existing data */
            evt.EventType.FieldPositionIsDistance = true;
            evt.EventType.HalfFieldPositionIsDistance = true;
            evt.FieldPosition.Points [0].X = 100;
            evt.FieldPosition.Points [0].Y = 100;
            evt.HalfFieldPosition.Points [0].X = 100;
            evt.HalfFieldPosition.Points [0].Y = 100;
            evt.AddDefaultPositions ();
            Assert.AreEqual (1, evt.FieldPosition.Points.Count);
            Assert.AreEqual (1, evt.HalfFieldPosition.Points.Count);
            Assert.AreEqual (100, evt.FieldPosition.Points [0].X);
            Assert.AreEqual (100, evt.HalfFieldPosition.Points [0].X);
        }
        public void LoadPlay(TimelineEventLongoMatch play)
        {
            field.Visible = play.EventType.TagFieldPosition;
            hfield.Visible = play.EventType.TagHalfFieldPosition;
            goal.Visible = play.EventType.TagGoalPosition;

            play.AddDefaultPositions ();

            if (play.FieldPosition != null) {
                field.Tagger.Points = play.FieldPosition.Points;
            }
            if (play.HalfFieldPosition != null) {
                hfield.Tagger.Points = play.HalfFieldPosition.Points;
            }
            if (play.GoalPosition != null) {
                goal.Tagger.Points = play.GoalPosition.Points;
            }
        }