Inheritance: ITemplate
示例#1
1
 void AddTeam(Team tpl, Dashboard cats)
 {
     TreeIter iter = store.AppendValues (tpl.TeamName, null);
     foreach (Player p in tpl.List) {
         store.AppendValues (iter, p.Name, p);
     }
 }
示例#2
0
 public override void SetFilter(EventsFilter filter, Project project)
 {
     this.local = project.LocalTeamTemplate;
     this.visitor = project.VisitorTeamTemplate;
     localTeam.Name = local.TeamName;
     visitorTeam.Name = visitor.TeamName;
     base.SetFilter (filter, project);
 }
示例#3
0
 public void TestColor()
 {
     Team t = new Team ();
     Assert.AreEqual (t.Color, t.Colors [0]);
     t.ActiveColor = -1;
     Assert.AreEqual (t.Color, t.Colors [0]);
     t.ActiveColor = t.Colors.Length + 1;
     Assert.AreEqual (t.Color, t.Colors [0]);
     t.ActiveColor = 1;
     Assert.AreEqual (t.Color, t.Colors [1]);
 }
示例#4
0
 public TeamStats(Project project, EventsFilter filter, TeamType team)
 {
     this.project = project;
     this.filter = filter;
     this.team = team;
     if (team == TeamType.LOCAL) {
         this.template = project.LocalTeamTemplate;
     } else {
         this.template = project.VisitorTeamTemplate;
     }
     PlayersStats = new List<PlayerStats> ();
     foreach (Player p in this.template.List) {
         PlayersStats.Add (new PlayerStats (project, filter, p));
     }
 }
示例#5
0
        public void EmitSubstitutionEvent(Team team, Player p1, Player p2,
		                                   SubstitutionReason reason, Time time)
        {
            if (PlayerSubstitutionEvent != null) {
                PlayerSubstitutionEvent (team, p1, p2, reason, time);
            }
        }
示例#6
0
 void LoadTemplate(Team template, TeamType team, bool forceColor)
 {
     if (team == TeamType.LOCAL) {
         hometemplate = template;
         hometacticsentry.Text = hometemplate.FormationStr;
         SetButtonColor (homecolor1, hometemplate.Colors [0]);
         SetButtonColor (homecolor2, hometemplate.Colors [1]);
         homecolor1button.Active = homecolor2button.Active = false;
         if ((forceColor && template.ActiveColor == 1) ||
             (awaytemplate != null && awaytemplate.Color.Equals (hometemplate.Color))) {
             homecolor2button.Click ();
         } else {
             homecolor1button.Click ();
         }
     } else {
         awaytemplate = template;
         awaytacticsentry.Text = awaytemplate.FormationStr;
         SetButtonColor (awaycolor1, awaytemplate.Colors [0]);
         SetButtonColor (awaycolor2, awaytemplate.Colors [1]);
         awaycolor1button.Active = awaycolor2button.Active = false;
         if ((forceColor && template.ActiveColor == 1) ||
             (hometemplate != null && hometemplate.Color.Equals (awaytemplate.Color))) {
             awaycolor2button.Click ();
         } else {
             awaycolor1button.Click ();
         }
     }
     teamtagger.LoadTeams (hometemplate, awaytemplate,
         analysisTemplate.FieldBackground);
 }
示例#7
0
        void HandlePlayersSubstitutionEvent(Team team, Player p1, Player p2,
		                                     SubstitutionReason reason, Time time)
        {
            team.List.Swap (p1, p2);
            teamtagger.Substitute (p1, p2, team);
        }
示例#8
0
文件: Team.cs 项目: GNOME/longomatch
 public static Team DefaultTemplate(int playersCount)
 {
     Team defaultTemplate = new Team ();
     defaultTemplate.FillDefaultTemplate (playersCount);
     return defaultTemplate;
 }
示例#9
0
        public void TestPlayingPlayers()
        {
            Team t = new Team ();
            Player p1, p2, p3;

            t.Name = "test";
            t.TeamName = "team";

            Assert.AreEqual (t.PlayingPlayersList.Count, 0);

            p1 = new Player { Name = "P1", Playing = true };
            p2 = new Player { Name = "P2", Playing = false };
            p3 = new Player { Name = "P3", Playing = true };
            t.List.Add (p1);
            Assert.AreEqual (t.PlayingPlayersList.Count, 1);
            t.List.Add (p2);
            Assert.AreEqual (t.PlayingPlayersList.Count, 1);
            t.List.Add (p3);
            Assert.AreEqual (t.PlayingPlayersList.Count, 2);
            Assert.AreEqual (t.PlayingPlayersList [0], p1);
            Assert.AreEqual (t.PlayingPlayersList [1], p3);
        }
示例#10
0
        public void TestSerialization()
        {
            Team t = new Team ();

            Utils.CheckSerialization (t);

            t.Name = "test";
            t.TeamName = "team";
            t.Shield = Utils.LoadImageFromFile ();
            t.List.Add (new Player { Name = "P1" });
            t.List.Add (new Player { Name = "P2" });
            t.List.Add (new Player { Name = "P3" });

            Utils.CheckSerialization (t);

            Team newt = Utils.SerializeDeserialize (t);

            Assert.AreEqual (t.ID, newt.ID);
            Assert.AreEqual (t.Name, newt.Name);
            Assert.AreEqual (t.TeamName, newt.TeamName);
            Assert.AreEqual (t.Shield.Width, 16);
            Assert.AreEqual (t.Shield.Height, 16);
            Assert.AreEqual (t.List.Count, newt.List.Count);
            Assert.AreEqual (t.List [0].Name, newt.List [0].Name);
            Assert.AreEqual (t.List [1].Name, newt.List [1].Name);
            Assert.AreEqual (t.List [2].Name, newt.List [2].Name);
        }
示例#11
0
        public void SetTeam(Team template, List<TimelineEvent> plays)
        {
            Dictionary<Player, TreeIter> playersDict = new Dictionary<Player, TreeIter> ();

            Log.Debug ("Updating teams models with template:" + template);
            team = new TreeStore (typeof(object));

            foreach (var player in template.List) {
                /* Add a root in the tree with the option name */
                var iter = team.AppendValues (player);
                playersDict.Add (player, iter);
                Log.Debug ("Adding new player to the model: " + player);
            }

            foreach (var play in plays) {
                foreach (var player in play.Players) {
                    if (playersDict.ContainsKey (player)) {
                        team.AppendValues (playersDict [player], new object[1] { play });
                        Log.Debug ("Adding new play to player: " + player);
                    }
                }
            }
            playerstreeview.Model = team;
            playerstreeview.Colors = true;
            playerstreeview.Project = Project;
        }
示例#12
0
 bool SaveTemplate(Team template)
 {
     try {
         provider.Update (template);
         return true;
     } catch (InvalidTemplateFilenameException ex) {
         Config.GUIToolkit.ErrorMessage (ex.Message, this);
         return false;
     }
 }
示例#13
0
        void LoadTeam(Team team)
        {
            PromptSave (true);

            loadedTeam = team;
            team.TemplateEditorMode = true;
            teamtemplateeditor1.Team = loadedTeam;
        }
示例#14
0
        void HandlePlayerSubstitutionEvent(Team team, Player p1, Player p2, SubstitutionReason reason, Time time)
        {
            if (openedProject != null) {
                TimelineEvent evt;

                try {
                    evt = openedProject.SubsitutePlayer (team, p1, p2, reason, time);
                    analysisWindow.AddPlay (evt);
                    filter.Update ();
                } catch (SubstitutionException ex) {
                    guiToolkit.ErrorMessage (ex.Message);
                }
            }
        }