Ejemplo n.º 1
0
        public void OnNewTag(EventType evType, List <Player> players, TeamType team, List <Tag> tags,
                             Time start, Time stop, Time eventTime, Score score, PenaltyCard card, DashboardButton btn)
        {
            if (player == null || openedProject == null)
            {
                return;
            }

            if (projectType == ProjectType.CaptureProject ||
                projectType == ProjectType.URICaptureProject)
            {
                if (!capturer.Capturing)
                {
                    guiToolkit.WarningMessage(Catalog.GetString("Video capture is stopped"));
                    return;
                }
            }
            Log.Debug(String.Format("New play created start:{0} stop:{1} category:{2}",
                                    start.ToMSecondsString(), stop.ToMSecondsString(),
                                    evType.Name));
            /* Add the new created play to the project and update the GUI*/
            var play = openedProject.AddEvent(evType, start, stop, eventTime, null, score, card);

            play.Team = team;
            if (players != null)
            {
                play.Players = players;
            }
            if (tags != null)
            {
                play.Tags = tags;
            }
            AddNewPlay(play);
        }
Ejemplo n.º 2
0
                #pragma warning disable 0618
        public static void Migrate0(Dashboard dashboard, IDictionary <string, Guid> dashboardNameToID = null,
                                    IDictionary <string, Guid> scoreNameToID   = null,
                                    IDictionary <string, Guid> penaltyNameToID = null)
        {
            Guid id;

            if (dashboard.Version != 0)
            {
                return;
            }

            if (dashboardNameToID == null)
            {
                dashboardNameToID = new Dictionary <string, Guid> ();
            }
            if (scoreNameToID == null)
            {
                scoreNameToID = new Dictionary <string, Guid> ();
            }
            if (penaltyNameToID == null)
            {
                penaltyNameToID = new Dictionary <string, Guid> ();
            }

            if (dashboard.ID == Guid.Empty)
            {
                if (!dashboardNameToID.TryGetValue(dashboard.Name, out id))
                {
                    dashboardNameToID [dashboard.Name] = id = Guid.NewGuid();
                }
                dashboard.ID = id;
            }

            foreach (ScoreButton button in dashboard.List.OfType <ScoreButton> ())
            {
                Score score = button.OldScore;

                if (!scoreNameToID.TryGetValue(score.Name, out id))
                {
                    scoreNameToID [score.Name] = id = Guid.NewGuid();
                }
                button.EventType            = button.EventType.Clone();
                button.EventType.ID         = id;
                button.ScoreEventType.Score = score;
            }

            foreach (PenaltyCardButton button in dashboard.List.OfType <PenaltyCardButton> ())
            {
                PenaltyCard penalty = button.OldPenaltyCard;

                if (!penaltyNameToID.TryGetValue(penalty.Name, out id))
                {
                    penaltyNameToID [penalty.Name] = id = Guid.NewGuid();
                }
                button.EventType    = button.EventType.Clone();
                button.EventType.ID = id;
                button.PenaltyCardEventType.PenaltyCard = penalty;
            }
            dashboard.Version = 1;
        }
Ejemplo n.º 3
0
 public void EmitNewEvent(EventType eventType, List <Player> players = null, TeamType team = TeamType.NONE,
                          List <Tag> tags = null, Time start  = null, Time stop        = null,
                          Time eventTime  = null, Score score = null, PenaltyCard card = null)
 {
     if (NewEventEvent != null)
     {
         NewEventEvent(eventType, players, team, tags, start, stop, eventTime, score, card, null);
     }
 }
Ejemplo n.º 4
0
 void HandleNewTagEvent(EventType evntType, List <Player> players, TeamType team, List <Tag> tags,
                        Time start, Time stop, Time eventTime, Score score, PenaltyCard card, DashboardButton btn)
 {
     /* Forward event until we have players integrted in the dashboard layout */
     if (NewTagEvent != null)
     {
         NewTagEvent(evntType, players, team, tags, start, stop, eventTime, score, card, btn);
     }
     //Config.EventsBroker.EmitNewTag (button, players, tags, start, stop);
 }
Ejemplo n.º 5
0
        void HandleNewTagEvent(EventType eventType, List <Player> players, TeamType team, List <Tag> tags,
                               Time start, Time stop, Time eventTime, Score score, PenaltyCard card, DashboardButton btn)
        {
            TimelineEvent play = project.AddEvent(eventType, start, stop, eventTime, null, score, card, false);

            play.Team    = teamtagger.SelectedTeam;
            play.Players = selectedPlayers ?? new List <Player> ();
            play.Tags    = tags ?? new List <Tag> ();
            teamtagger.ResetSelection();
            selectedPlayers = null;
            Config.EventsBroker.EmitNewDashboardEvent(play, btn, true, null);
        }
Ejemplo n.º 6
0
        public void TestSerialization()
        {
            PenaltyCard pc = new PenaltyCard();

            pc.Color = Color.Red;
            pc.Name  = "test";
            pc.Shape = CardShape.Circle;

            Utils.CheckSerialization(pc);

            PenaltyCard pc2 = Utils.SerializeDeserialize(pc);

            Assert.AreEqual(pc.Name, pc2.Name);
            Assert.AreEqual(pc.Color, pc2.Color);
            Assert.AreEqual(pc.Shape, pc2.Shape);
        }
Ejemplo n.º 7
0
        void HandleTaggerClickedEvent(ICanvasObject co)
        {
            DashboardButtonObject tagger;
            EventButton           button;
            Time        start = null, stop = null, eventTime = null;
            List <Tag>  tags  = null;
            PenaltyCard card  = null;
            Score       score = null;

            tagger = co as DashboardButtonObject;

            if (tagger is TagObject)
            {
                TagObject tag = tagger as TagObject;
                if (tag.Active)
                {
                    /* All tag buttons from the same group that are active */
                    foreach (TagObject to in Objects.OfType <TagObject>().
                             Where(t => t.TagButton.Tag.Group == tag.TagButton.Tag.Group &&
                                   t.Active && t != tagger))
                    {
                        to.Active = false;
                    }
                }
                return;
            }

            if (NewTagEvent == null || !(tagger.Button is EventButton))
            {
                return;
            }

            button = tagger.Button as EventButton;

            if (Mode == DashboardMode.Edit)
            {
                return;
            }

            if (button.TagMode == TagMode.Predefined)
            {
                stop      = CurrentTime + button.Stop;
                start     = CurrentTime - button.Start;
                eventTime = CurrentTime;
            }
            else
            {
                stop      = CurrentTime;
                start     = tagger.Start - button.Start;
                eventTime = tagger.Start;
            }

            tags = new List <Tag> ();
            if (tagger is CategoryObject)
            {
                tags.AddRange((tagger as CategoryObject).SelectedTags);
            }
            foreach (TagObject to in Objects.OfType <TagObject>())
            {
                if (to.Active)
                {
                    tags.Add(to.TagButton.Tag);
                }
                to.Active = false;
            }
            if (button is PenaltyCardButton)
            {
                card = (button as PenaltyCardButton).PenaltyCard;
            }
            if (button is ScoreButton)
            {
                score = (button as ScoreButton).Score;
            }

            NewTagEvent(button.EventType, null, TeamType.NONE, tags, start, stop, eventTime, score, card, button);
        }