Exemplo n.º 1
0
        private void CreateDefaultPlayerSubCategories()
        {
            PlayerSubCategory subcat;

            /* Local team players */
            playerSubcatList = new List <PlayerSubCategory>();
            subcat           = new PlayerSubCategory {
                Name = Catalog.GetString("Local team players"), AllowMultiple = true, FastTag = true
            };
            subcat.Add(Team.LOCAL);
            playerSubcatList.Add(subcat);

            /* Visitor team players */
            subcat = new PlayerSubCategory {
                Name = Catalog.GetString("Visitor team players"), AllowMultiple = true, FastTag = true
            };
            subcat.Add(Team.VISITOR);
            playerSubcatList.Add(subcat);

            /* Local and Visitor team players */
            subcat = new PlayerSubCategory {
                Name = Catalog.GetString("All teams players"), AllowMultiple = true, FastTag = true
            };
            subcat.Add(Team.LOCAL);
            subcat.Add(Team.VISITOR);
            playerSubcatList.Add(subcat);
        }
Exemplo n.º 2
0
        public void AddDefaultItem(int index)
        {
            PlayerSubCategory localplayers, visitorplayers;
            TagSubCategory    period;
            TeamSubCategory   team;
            Color             c = new Color((Byte)255, (Byte)0, (Byte)0);
            HotKey            h = new HotKey();

            team = new TeamSubCategory {
                Name          = Catalog.GetString("Team"),
                AllowMultiple = false,
                FastTag       = true
            };
            team.Add(Team.LOCAL);
            team.Add(Team.VISITOR);

            localplayers = new PlayerSubCategory {
                Name          = Catalog.GetString("Local Team Players"),
                AllowMultiple = true,
                FastTag       = true
            };
            localplayers.Add(Team.LOCAL);

            visitorplayers = new PlayerSubCategory {
                Name          = Catalog.GetString("Visitor Team Players"),
                AllowMultiple = true,
                FastTag       = true
            };
            visitorplayers.Add(Team.VISITOR);

            period = new TagSubCategory {
                Name          = Catalog.GetString("Period"),
                AllowMultiple = false,
                FastTag       = true,
            };
            period.Add("1");
            period.Add("2");

            Category cat = new Category {
                Name  = "Category " + index,
                Color = c,
                Start = new Time {
                    Seconds = 10
                },
                Stop = new Time {
                    Seconds = 10
                },
                SortMethod = SortMethodType.SortByStartTime,
                HotKey     = h,
                Position   = index - 1,
            };

            cat.SubCategories.Add(team);
            cat.SubCategories.Add(localplayers);
            cat.SubCategories.Add(visitorplayers);
            cat.SubCategories.Add(period);
            Insert(index, cat);
        }
Exemplo n.º 3
0
        int GetPlayerCount(List <Play> plays, Player player, PlayerSubCategory subcat)
        {
            PlayerTag tag;

            tag = new PlayerTag {
                SubCategory = subcat, Value = player
            };
            return(plays.Where(p => p.Players.Contains(tag)).Count());
        }
Exemplo n.º 4
0
 public void Load(PlayerSubCategory subcat, TeamTemplate local,
                  TeamTemplate visitor, PlayersTagStore players)
 {
     this.subcat  = subcat;
     this.local   = local;
     this.visitor = visitor;
     this.players = players;
     SetPlayersInfo();
     UpdateSelectedPlayers();
 }
Exemplo n.º 5
0
 public PlayersSelectionDialog(PlayerSubCategory subcat, TeamTemplate template,
                               PlayersTagStore players)
 {
     this.Build();
     this.subcat   = subcat;
     this.template = template;
     this.players  = players;
     SetPlayersInfo();
     UpdateSelectedPlayers();
 }
Exemplo n.º 6
0
        public void Load(PlayerSubCategory subcat, TeamTemplate local,
			TeamTemplate visitor, PlayersTagStore players)
        {
            this.subcat = subcat;
            this.local = local;
            this.visitor = visitor;
            this.players = players;
            SetPlayersInfo();
            UpdateSelectedPlayers();
        }
 public PlayersTaggerWidget(PlayerSubCategory subcat, TeamTemplate local,
                            TeamTemplate visitor, PlayersTagStore players)
 {
     this.Build();
     CategoryLabel.Markup = "<b>" + subcat.Name + "</b>";
     tagger = new PlayersTagger();
     tagger.Load(subcat, local, visitor, players);
     tagger.Show();
     GtkAlignment.Add(tagger);
 }
Exemplo n.º 8
0
        public PlayersTaggerWidget(PlayerSubCategory subcat, TeamTemplate local,
			TeamTemplate visitor, PlayersTagStore players)
        {
            this.Build ();
            CategoryLabel.Markup = "<b>" + subcat.Name + "</b>";
            tagger = new PlayersTagger();
            tagger.Load(subcat, local, visitor, players);
            tagger.Show();
            GtkAlignment.Add(tagger);
        }
Exemplo n.º 9
0
 public PlayersTaggerWidget(PlayerSubCategory subcat, TeamTemplate template,
                            PlayersTagStore players)
 {
     this.Build();
     this.subcat          = subcat;
     this.players         = players;
     this.template        = template;
     CategoryLabel.Markup = "<b>" + subcat.Name + "</b>";
     LoadTagsLabel();
     editbutton.Clicked += OnEditClicked;
 }
Exemplo n.º 10
0
        public void AddPlayerSubcategory(PlayerSubCategory subcat, PlayersTagStore tags)
        {
            TeamTemplate local=null, visitor=null;

            /* the notebook starts invisible */
            playersnotebook.Visible = true;
            if (subcat.Contains(Team.LOCAL))
                local = localTeamTemplate;
            if (subcat.Contains(Team.VISITOR))
                visitor = visitorTeamTemplate;

            PlayersTaggerWidget widget = new PlayersTaggerWidget(subcat, local, visitor, tags);
            widget.Show();
            playersbox.PackStart(widget, true, true, 0);
        }
Exemplo n.º 11
0
        public void AddPlayerSubcategory(PlayerSubCategory subcat, PlayersTagStore tags)
        {
            TeamTemplate local = null, visitor = null;

            /* the notebook starts invisible */
            playersnotebook.Visible = true;
            if (subcat.Contains(Team.LOCAL))
            {
                local = localTeamTemplate;
            }
            if (subcat.Contains(Team.VISITOR))
            {
                visitor = visitorTeamTemplate;
            }

            PlayersTaggerWidget widget = new PlayersTaggerWidget(subcat, local, visitor, tags);

            widget.Show();
            playersbox.PackStart(widget, true, true, 0);
        }
Exemplo n.º 12
0
        public void AddDefaultSubcategories(Category cat)
        {
            PlayerSubCategory localplayers, visitorplayers;

            localplayers = new PlayerSubCategory {
                Name          = Catalog.GetString("Local Team Players"),
                AllowMultiple = true,
                FastTag       = true
            };
            localplayers.Add(Team.LOCAL);

            visitorplayers = new PlayerSubCategory {
                Name          = Catalog.GetString("Visitor Team Players"),
                AllowMultiple = true,
                FastTag       = true
            };
            visitorplayers.Add(Team.VISITOR);

            cat.SubCategories.Add(localplayers);
            cat.SubCategories.Add(visitorplayers);
        }
Exemplo n.º 13
0
        public void AddPlayerSubcategory(PlayerSubCategory subcat, PlayersTagStore tags)
        {
            TeamTemplate template;

            /* the notebook starts invisible */
            playersnotebook.Visible = true;
            if (subcat.Contains(Team.LOCAL))
            {
                template = localTeamTemplate;
            }
            /* FIXME: Add support for subcategories with both teams */
            //else if (subcat.Contains(Team.VISITOR))
            else
            {
                template = visitorTeamTemplate;
            }

            PlayersTaggerWidget widget = new PlayersTaggerWidget(subcat, template, tags);

            widget.Show();
            playersbox.PackStart(widget, false, true, 0);
        }
Exemplo n.º 14
0
        void ExportCategory(Category cat)
        {
            string      headers;
            List <Play> plays;

            output.Add("CATEGORY: " + cat.Name);
            plays = project.PlaysInCategory(cat);

            /* Write Headers for this category */
            headers = "Name;Start;Stop;Team";
            foreach (ISubCategory subcat in cat.SubCategories)
            {
                TagSubCategory ts = subcat as TagSubCategory;
                if (ts == null)
                {
                    continue;
                }

                foreach (string desc in ts.ElementsDesc())
                {
                    headers += String.Format(";{0}:{1}", ts.Name, desc);
                }
            }

            /* Players subcategories */
            foreach (ISubCategory subcat in cat.SubCategories)
            {
                PlayerSubCategory ps = subcat as PlayerSubCategory;
                if (ps == null)
                {
                    continue;
                }
                headers += ";" + ps.Name;
            }
            output.Add(headers);

            foreach (Play play in plays.OrderBy(p => p.Start))
            {
                string line;

                line = String.Format("{0};{1};{2};{3}", play.Name,
                                     play.Start.ToMSecondsString(),
                                     play.Stop.ToMSecondsString(),
                                     play.Team);

                /* Strings Tags */
                foreach (ISubCategory subcat in cat.SubCategories)
                {
                    TagSubCategory ts = subcat as TagSubCategory;
                    if (ts == null)
                    {
                        continue;
                    }

                    foreach (string desc in ts.ElementsDesc())
                    {
                        StringTag t = new StringTag {
                            SubCategory = subcat, Value = desc
                        };
                        line += ";" + (play.Tags.Contains(t) ? "1" : "0");
                    }
                }

                /* Player Tags */
                foreach (ISubCategory subcat in cat.SubCategories)
                {
                    PlayerSubCategory ps = subcat as PlayerSubCategory;
                    if (ps == null)
                    {
                        continue;
                    }

                    line += ";";
                    foreach (PlayerTag p in play.Players.GetTags(ps))
                    {
                        line += p.Value.Name + " ";
                    }
                }
                output.Add(line);
            }
            output.Add("");
        }
Exemplo n.º 15
0
        int GetPlayerCount(List<Play> plays, Player player, PlayerSubCategory subcat)
        {
            PlayerTag tag;

            tag = new PlayerTag{SubCategory=subcat, Value=player};
            return plays.Where(p => p.Players.Contains(tag)).Count();
        }