Skip to content

Commit

Permalink
Added parents-parameter. Bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cadon committed Feb 22, 2016
1 parent 8afc937 commit 1e7ddf8
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 60 deletions.
2 changes: 2 additions & 0 deletions ARKBreedingStats/Creature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public class Creature
[XmlIgnore]
public bool[] topBreedingStats; // indexes of stats that are top for that species in the creaturecollection. TODO: is it possible to exclude this from saving? It is and should recalculated when loaded or new creatures are added anyway
public string owner;
public string father;
public string mother;

public Creature()
{
Expand Down
101 changes: 71 additions & 30 deletions ARKBreedingStats/CreatureBox.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

71 changes: 42 additions & 29 deletions ARKBreedingStats/CreatureBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public partial class CreatureBox : UserControl
public delegate void ChangedEventHandler(object sender, int listViewIndex, Creature creature);
public event ChangedEventHandler Changed;
public int indexInListView;
private Gender gender;

public CreatureBox()
{
Expand All @@ -35,16 +36,6 @@ private void initializeVars()
InitializeComponent();
this.creature = null;
stats = new StatDisplay[] { statDisplayHP, statDisplaySt, statDisplayOx, statDisplayFo, statDisplayWe, statDisplayDm, statDisplaySp, statDisplayTo };
ToolTip tt = new ToolTip();
tt.SetToolTip(this.labelHeaderDomLevelSet, "Set the spend domesticated Levels here");
tt.SetToolTip(labelGender, "Gender of the Cretaure");
tt.SetToolTip(labelStatHeader, "Wild-levels, Domesticated-levels, Value that is inherited, Current Value of the Creature");
tt.SetToolTip(buttonEdit, "Edit");
}

public void setCreature(Creature creature)
{
this.creature = creature;
numUDLevelsDom = new NumericUpDown[] { numericUpDown1, numericUpDown2, numericUpDown3, numericUpDown4, numericUpDown5, numericUpDown6, numericUpDown7 };
stats[0].Title = "HP";
stats[1].Title = "St";
Expand All @@ -57,7 +48,19 @@ public void setCreature(Creature creature)
stats[5].Percent = true;
stats[6].Percent = true;
statDisplayTo.ShowBar = false;
textBoxName.Text = creature.name;
ToolTip tt = new ToolTip();
tt.SetToolTip(this.labelHeaderDomLevelSet, "Set the spend domesticated Levels here");
tt.SetToolTip(labelGender, "Gender of the Cretaure");
tt.SetToolTip(labelStatHeader, "Wild-levels, Domesticated-levels, Value that is inherited, Current Value of the Creature");
tt.SetToolTip(buttonEdit, "Edit");
tt.SetToolTip(labelM, "Mother");
tt.SetToolTip(labelF, "Father");
}

public void setCreature(Creature creature)
{
this.creature = creature;
panel1.Visible = false;
for (int s = 0; s < 8; s++) { updateStat(s); }
updateLabel();
}
Expand All @@ -82,17 +85,19 @@ public void buttonEdit_Click(object sender, EventArgs e)
{
textBoxName.Text = creature.name;
textBoxOwner.Text = creature.owner;
switch (creature.gender)
textBoxMother.Text = creature.mother;
textBoxFather.Text = creature.father;
gender = creature.gender;
switch (gender)
{
case Gender.Female:
checkBoxFemale.Checked = true;
buttonGender.Text = "♀";
break;
case Gender.Male:
checkBoxMale.Checked = true;
buttonGender.Text = "♂";
break;
default:
checkBoxFemale.Checked = false;
checkBoxMale.Checked = false;
buttonGender.Text = "?";
break;
}
textBoxName.SelectAll();
Expand Down Expand Up @@ -129,8 +134,10 @@ private void closeSettings(bool save)
if (save)
{
creature.name = textBoxName.Text;
creature.gender = (checkBoxMale.Checked ? Gender.Male : (checkBoxFemale.Checked ? Gender.Female : Gender.Neutral));
creature.gender = gender;
creature.owner = textBoxOwner.Text;
creature.mother = textBoxMother.Text;
creature.father = textBoxFather.Text;
for (int s = 0; s < 7; s++)
{
creature.levelsDom[s] = (int)numUDLevelsDom[s].Value;
Expand All @@ -153,18 +160,6 @@ public void Clear()
}
}

private void checkBoxFemale_CheckedChanged(object sender, EventArgs e)
{
if (checkBoxFemale.Checked)
checkBoxMale.Checked = false;
}

private void checkBoxMale_CheckedChanged(object sender, EventArgs e)
{
if (checkBoxMale.Checked)
checkBoxFemale.Checked = false;
}

private void button1_Click(object sender, EventArgs e)
{
closeSettings(true);
Expand All @@ -175,5 +170,23 @@ private void buttonCancel_Click(object sender, EventArgs e)
closeSettings(false);
}

private void buttonGender_Click(object sender, EventArgs e)
{
switch (gender)
{
case Gender.Female:
gender = Gender.Male;
buttonGender.Text = "♂";
break;
case Gender.Male:
gender = Gender.Neutral;
buttonGender.Text = "?";
break;
default:
gender = Gender.Female;
buttonGender.Text = "♀";
break;
}
}
}
}
7 changes: 6 additions & 1 deletion ARKBreedingStats/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,7 @@ private void saveCollectionToFileName(String fileName)
MessageBox.Show("Error during serialization.\nErrormessage:\n\n" + e.Message, "Serialization-Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
// TODO handle serialization problems.
}
setCollectionChanged(false);
file.Close();
}

Expand Down Expand Up @@ -1017,9 +1018,9 @@ private void showCreaturesInListView(List<Creature> creatures)
private void creatureBoxListView_Changed(object sender, int index, Creature cr)
{
// data of the selected creature changed, update listview

// replace old row with new one
listViewLibrary.Items[index] = createCreatureLVItem(cr, listViewLibrary.Items[index].Group);
setCollectionChanged(true);
}

private ListViewItem createCreatureLVItem(Creature cr, ListViewGroup g)
Expand Down Expand Up @@ -1169,6 +1170,8 @@ private void newToolStripMenuItem_Click(object sender, EventArgs e)
creatureCollection = new CreatureCollection();
updateCreatureListings();
Properties.Settings.Default.LastSaveFile = "";
currentFileName = "";
setCollectionChanged(false);

}

Expand Down Expand Up @@ -1376,5 +1379,7 @@ private void setCollectionChanged(bool changed)
this.Text = "ARK Breeding Stat Extractor - " + System.IO.Path.GetFileName(currentFileName) + (changed ? " *" : "");
}

// TODO: function to recalculate all dino-values (if stats or multipliers change)

}
}

0 comments on commit 1e7ddf8

Please sign in to comment.