public void createPedigree()
{
// clear old pedigreeCreatures
ClearControls();
if (creature != null)
{
this.SuspendLayout();
labelEmptyInfo.Visible = false;
// create ancestors
createParentsChild(creature, 278, 60, true, true);
if (creature.Mother != null)
{
if (createParentsChild(creature.Mother, 10, 20, false))
lines[1].Add(new int[] { 259, 79, 278, 79 });
}
if (creature.Father != null)
{
if (createParentsChild(creature.Father, 546, 20, false))
lines[1].Add(new int[] { 546, 79, 527, 159 });
}
// create descendants
int row = 0;
// scrolloffsets
int xS = AutoScrollPosition.X;
int yS = AutoScrollPosition.Y;
foreach (Creature c in children)
{
PedigreeCreature pc = new PedigreeCreature(c, enabledColorRegions);
pc.Location = new Point(10 + xS, 200 + 35 * row + yS);
for (int s = 0; s < 7; s++)
{
if (creature.levelsWild[s] >= 0 && creature.levelsWild[s] == c.levelsWild[s])
lines[0].Add(new int[] { 10 + 38 + 28 * s, 200 + 35 * row + 6, 10 + 38 + 28 * s, 200 + 35 * row + 15, 0 });
}
pc.CreatureClicked += new PedigreeCreature.CreatureChangedEventHandler(CreatureClicked);
pc.CreatureEdit += new PedigreeCreature.CreatureEditEventHandler(CreatureEdit);
pc.BestBreedingPartners += new PedigreeCreature.CreaturePartnerEventHandler(BestBreedingPartners);
Controls.Add(pc);
pcs.Add(pc);
row++;
}
pictureBox.Image = CreatureColored.getColoredCreature(creature.colors, creature.species, enabledColorRegions, 256);
this.Invalidate();
this.ResumeLayout();
}
else
{
noCreatureSelected();
}
}