[longomatch] Only show players from a team template that are actually playing
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Only show players from a team template that are actually playing
- Date: Sun, 14 Nov 2010 20:51:15 +0000 (UTC)
commit e7457d12ffeb84915989a4795968e50388346d4e
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Sun Nov 14 16:48:53 2010 +0100
Only show players from a team template that are actually playing
LongoMatch/DB/Project.cs | 28 ++++++++++++++++++-----
LongoMatch/Gui/Dialog/PlayersSelectionDialog.cs | 15 +++++++-----
2 files changed, 31 insertions(+), 12 deletions(-)
---
diff --git a/LongoMatch/DB/Project.cs b/LongoMatch/DB/Project.cs
index c65601e..a0f2cc3 100644
--- a/LongoMatch/DB/Project.cs
+++ b/LongoMatch/DB/Project.cs
@@ -464,13 +464,21 @@ namespace LongoMatch.DB
public TreeStore GetLocalTeamModel() {
List<TreeIter> itersList = new List<TreeIter>();
Gtk.TreeStore dataFileListStore = new Gtk.TreeStore(typeof(object));
+
+ itersList.Capacity = localTeamTemplate.PlayersCount;
for (int i=0;i<localTeamTemplate.PlayersCount;i++) {
- itersList.Add(dataFileListStore.AppendValues(localTeamTemplate.GetPlayer(i)));
+ Player p = localTeamTemplate.GetPlayer(i);
+ if (p.Discarded)
+ itersList.Insert(i, TreeIter.Zero);
+ else
+ itersList.Insert(i, dataFileListStore.AppendValues(p));
}
for (int i=0;i<sections.Count;i++) {
foreach (MediaTimeNode tNode in sectionPlaysList[i]) {
- foreach (int player in tNode.LocalPlayers)
- dataFileListStore.AppendValues(itersList[player],tNode);
+ foreach (int player in tNode.LocalPlayers){
+ if (itersList[player].Stamp != TreeIter.Zero.Stamp)
+ dataFileListStore.AppendValues(itersList[player],tNode);
+ }
}
}
return dataFileListStore;
@@ -486,13 +494,21 @@ namespace LongoMatch.DB
public TreeStore GetVisitorTeamModel() {
List<TreeIter> itersList = new List<TreeIter>();
Gtk.TreeStore dataFileListStore = new Gtk.TreeStore(typeof(object));
+
+ itersList.Capacity = visitorTeamTemplate.PlayersCount;
for (int i=0;i<visitorTeamTemplate.PlayersCount;i++) {
- itersList.Add(dataFileListStore.AppendValues(visitorTeamTemplate.GetPlayer(i)));
+ Player p = visitorTeamTemplate.GetPlayer(i);
+ if (p.Discarded)
+ itersList.Insert(i, TreeIter.Zero);
+ else
+ itersList.Insert(i, dataFileListStore.AppendValues(p));
}
for (int i=0;i<sections.Count;i++) {
foreach (MediaTimeNode tNode in sectionPlaysList[i]) {
- foreach (int player in tNode.VisitorPlayers)
- dataFileListStore.AppendValues(itersList[player],tNode);
+ foreach (int player in tNode.VisitorPlayers){
+ if (itersList[player].Stamp != TreeIter.Zero.Stamp)
+ dataFileListStore.AppendValues(itersList[player],tNode);
+ }
}
}
return dataFileListStore;
diff --git a/LongoMatch/Gui/Dialog/PlayersSelectionDialog.cs b/LongoMatch/Gui/Dialog/PlayersSelectionDialog.cs
index 86ee9d9..84eab28 100644
--- a/LongoMatch/Gui/Dialog/PlayersSelectionDialog.cs
+++ b/LongoMatch/Gui/Dialog/PlayersSelectionDialog.cs
@@ -38,33 +38,36 @@ namespace LongoMatch.Gui.Dialog
}
public void SetPlayersInfo(TeamTemplate template) {
- int playersCount;
CheckButton button;
Player player;
+ int playersCount=0;
if (this.template != null)
return;
this.template = template;
- playersCount = template.PlayersCount;
- table1.NColumns =(uint)(playersCount/10);
+ table1.NColumns =(uint)(template.PlayersCount/10);
table1.NRows =(uint) 10;
- for (int i=0;i<playersCount;i++) {
+ for (int i=0;i<template.PlayersCount;i++) {
player = template.GetPlayer(i);
+ if (player.Discarded)
+ continue;
+
button = new CheckButton();
button.Label = player.Number + "-" + player.Name;
button.Name = i.ToString();
button.Show();
- uint row_top =(uint)(i%table1.NRows);
+ uint row_top =(uint)(playersCount%table1.NRows);
uint row_bottom = (uint) row_top+1 ;
- uint col_left = (uint) i/table1.NRows;
+ uint col_left = (uint) playersCount/table1.NRows;
uint col_right = (uint) col_left+1 ;
table1.Attach(button,col_left,col_right,row_top,row_bottom);
checkButtonsList.Add(button);
+ playersCount++;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]