private void CalculateBibs(GameSave save, IEnumerable <Participant> orderedParticipants) { _bibColors = orderedParticipants.SelectMany(it => it.competitors).ToDictionary(it => it, it => Color.white); var orderedClassifications = save.classificationsData.Where(it => it.useBib) .Select(it => (it.calendarId, it.priority)).Reverse(); foreach (var(it, ind) in orderedClassifications) { var classificationResults = save.resultsContainer.classificationResults[it]; var classificationInfo = save.classificationsData[it].classification; foreach (var id in classificationResults.totalSortedResults.TakeWhile(jumperId => classificationResults.rank[jumperId] <= 1)) { var bibColor = SimpleColorPicker.Hex2Color(save.classificationsData[ind].classification.leaderBibColor); if (classificationInfo.eventType == EventType.Individual) { _bibColors[id] = bibColor; } else { foreach (var competitor in save.teams[id].competitors) { _bibColors[competitor.calendarId] = bibColor; } } } } }
public void SetValues(Color bibColor) { jumperMale.gameObject.SetActive(competitor.gender == Gender.Male); jumperFemale.gameObject.SetActive(competitor.gender == Gender.Female); jumperController.jumperModel = (competitor.gender == Gender.Male ? jumperMale : jumperFemale); bibMaterial.SetColor(Color, bibColor); helmetMaterial.SetColor(Color, SimpleColorPicker.Hex2Color(competitor.helmetColor)); suitTopFrontMaterial.SetColor(Color, SimpleColorPicker.Hex2Color(competitor.suitTopFrontColor)); suitTopBackMaterial.SetColor(Color, SimpleColorPicker.Hex2Color(competitor.suitTopBackColor)); suitBottomFrontMaterial.SetColor(Color, SimpleColorPicker.Hex2Color(competitor.suitBottomFrontColor)); suitBottomBackMaterial.SetColor(Color, SimpleColorPicker.Hex2Color(competitor.suitBottomBackColor)); skisMaterial.SetColor(Color, SimpleColorPicker.Hex2Color(competitor.skisColor)); }