/// <summary> /// Updates the total player picks and total value based on the selected prize levels /// </summary> public void updateInfo() { if (Prizes.getNumPrizeLevels() > 0) { DivModel.clearPrizeLevelList(); for (int i = 0; i < Prizes.getNumPrizeLevels(); i++) { if (DivModel.levelBoxes[i].IsSelected) { DivModel.addPrizeLevel(Prizes.getPrizeLevel(i)); } } DivModel.TotalPlayerPicks = DivModel.calculateTotalCollections(); DivModel.TotalPrizeValue = DivModel.calculateDivisionValue(); } SectionContainer.validateDivision(); }
/// <summary> /// Listens for "shouts" made by other classes, if it is subscribed to that class /// </summary> /// <param name="pass"></param> public void onListen(object pass) { if (pass is PrizeLevels.PrizeLevels) { Prizes = (PrizeLevels.PrizeLevels)pass; for (int i = 0; i < DivisionModel.MAX_PRIZE_BOXES; i++) { DivModel.levelBoxes[i].IsAvailable = false; } for (int i = 0; i < Prizes.getNumPrizeLevels(); i++) { DivModel.levelBoxes[i].IsAvailable = true; } DivModel.clearPrizeLevelList(); updateDivision(); } }
/// <summary> /// Updates all of the info and prize level box data in the division /// </summary> public void updateDivision() { if (Prizes.getNumPrizeLevels() > 0) { for (int i = 0; i < DivisionModel.MAX_PRIZE_BOXES; i++) { if (DivModel.levelBoxes[i].IsAvailable && DivModel.levelBoxes[i].IsSelected) { DivModel.addPrizeLevel(Prizes.getPrizeLevel(i)); } else { DivModel.levelBoxes[i].IsSelected = false; } } DivModel.TotalPlayerPicks = DivModel.calculateTotalCollections(); DivModel.TotalPrizeValue = DivModel.calculateDivisionValue(); } }