Exemplo n.º 1
0
        public SubstitutionEvent SubsitutePlayer(LMTeam team, LMPlayer playerIn, LMPlayer playerOut,
                                                 SubstitutionReason reason, Time subsTime)
        {
            LineupEvent       lineup;
            SubstitutionEvent se;

            lineup = Timeline.OfType <LineupEvent> ().FirstOrDefault();
            if (lineup == null)
            {
                throw new SubstitutionException(Catalog.GetString("No lineup events found"));
            }
            if (subsTime < lineup.EventTime)
            {
                throw new SubstitutionException(Catalog.GetString("A substitution can't happen before the lineup event"));
            }
            se           = new SubstitutionEvent();
            se.EventType = SubstitutionsEventType;
            se.In        = playerIn;
            se.Out       = playerOut;
            se.Reason    = reason;
            se.EventTime = subsTime;
            se.Teams.Add(team);
            Timeline.Add(se);
            return(se);
        }
Exemplo n.º 2
0
        public SubstitutionEvent SubsitutePlayer(Team template, Player playerIn, Player playerOut,
                                                 SubstitutionReason reason, Time subsTime)
        {
            TeamType          team;
            LineupEvent       lineup;
            SubstitutionEvent se;

            if (template == LocalTeamTemplate)
            {
                team = TeamType.LOCAL;
            }
            else
            {
                team = TeamType.VISITOR;
            }
            lineup = Timeline.OfType <LineupEvent> ().FirstOrDefault();
            if (lineup == null)
            {
                throw new SubstitutionException(Catalog.GetString("No lineup events found"));
            }
            if (subsTime < lineup.EventTime)
            {
                throw new SubstitutionException(Catalog.GetString("A substitution can't happen before the lineup event"));
            }
            se           = new SubstitutionEvent();
            se.EventType = SubstitutionsEventType;
            se.In        = playerIn;
            se.Out       = playerOut;
            se.Reason    = reason;
            se.EventTime = subsTime;
            se.Team      = team;
            Timeline.Add(se);
            return(se);
        }
Exemplo n.º 3
0
        public void LoadSubstitution(ProjectLongoMatch project, SubstitutionEvent substitution)
        {
            List<PlayerLongoMatch> hfp, hbp, afp, abp;

            this.substitution = substitution;
            project.CurrentLineup (substitution.EventTime, out hfp, out hbp, out afp, out abp);
            playershbox.Visible = true;
            tagger.SubstitutionMode = false;
            tagger.ShowSubstitutionButtons = false;
            tagger.SelectionMode = MultiSelectionMode.Single;
            if (substitution.Teams.Contains (project.LocalTeamTemplate)) {
                LoadTeams (project, hfp, hbp, null, null);
            } else {
                LoadTeams (project, null, null, afp, abp);
            }
            SwitchPlayer (substitution.In, substitution.Out);
        }
Exemplo n.º 4
0
        public SubstitutionEvent SubsitutePlayer(SportsTeam team, PlayerLongoMatch playerIn, PlayerLongoMatch playerOut,
		                                          SubstitutionReason reason, Time subsTime)
        {
            LineupEvent lineup;
            SubstitutionEvent se;

            lineup = Timeline.OfType<LineupEvent> ().FirstOrDefault ();
            if (lineup == null) {
                throw new SubstitutionException (Catalog.GetString ("No lineup events found"));
            }
            if (subsTime < lineup.EventTime) {
                throw new SubstitutionException (Catalog.GetString ("A substitution can't happen before the lineup event"));
            }
            se = new SubstitutionEvent ();
            se.EventType = SubstitutionsEventType;
            se.In = playerIn;
            se.Out = playerOut;
            se.Reason = reason;
            se.EventTime = subsTime;
            se.Teams.Add (team);
            Timeline.Add (se);
            return se;
        }