public void AddItem(int smiley, int painvalue, int catagory, string notes, string exercise)
{
GameObject clone = NGUITools.AddChild(Grid.gameObject, TimeLinePrefab);
UISprite[] sprites = clone.GetComponentsInChildren<UISprite>();
/*
* sprites[0] = excercise sprite
* sprites[2] = smiley
*/
sprites[0].spriteName = exercise;
SetSmile(smiley, sprites[2]);
UILabel[] labels = clone.GetComponentsInChildren<UILabel>();
if(labels != null)
{
/*
* labels[0] = MiddleText
* labels[1] = MiddleHeader
* labels[2] = BottomText
* labels[3] = Exercise_Body
* labels[4] = Exercise_Header
* labels[5] = PainValue
*/
labels[0].text = "temp text";
labels[1].text = now.ToString("dd:MM:yyyy");
labels[2].text = notes;
labels[3].text = exercise;
SetCatagory(catagory, labels[4]);
labels[5].text = painvalue.ToString() + "%";
}
itemCounter++;
clone.name = itemCounter.ToString();
currentItem
= new Timeline
(); currentItem.Smile = smiley;
currentItem.Pain = painvalue;
currentItem.Notes = notes;
currentItem.Exercise = exercise;
currentItem.Date = now.ToString("dd:MM:yyyy");
DM.CreateNewTimeLineItem(currentItem);
Grid.Reposition();
}