private GoalListWrapperModel createTestGoals() { List <GoalModel> goalList = new List <GoalModel> (); goalList.Add(new GoalModel(1, "Test goal 1", 10, 3, false)); goalList.Add(new GoalModel(2, "Test goal 2", 1, 1, false)); goalList.Add(new GoalModel(3, "Test goal 3", 5, 0, false)); GoalListWrapperModel goalsListWrapper = new GoalListWrapperModel(); goalsListWrapper.goalList = goalList; return(goalsListWrapper); }
void Start() { goalCellList = new List <GameObject> (); percentages = new List <float> (); GoalListWrapperModel goals = getObjectFromJson(); foreach (GoalModel g in goals.goalList) { GameObject goalCell = Instantiate <GameObject> (GoalCellPrefab); goalCell.name = "Goal" + g.id; goalCell.transform.parent = this.transform; goalCell.transform.localScale = Vector3.one; goalCellList.Add(goalCell); getObjectiveTextComponent(goalCell).text = g.id + ": " + g.name; transform.Find(goalCell.name + "/Objective/objectiveText").GetComponent <Text> ().fontSize = 30; float completedPercent = ((float)g.completedTasks / (float)g.totalTasks); percentages.Add(completedPercent); // getProgressImage (goalCell).fillAmount = completedPercent; // getCompletedProgress (goalCell).text = (completedPercent * 100).ToString ("F") + "%"; } }