private void RefreshProgressBars() { if (currentlySelectedMinion != null && !currentlySelectedMinion.IsNull()) { MinionIdentity minionIdentity = currentlySelectedMinion as MinionIdentity; HierarchyReferences component = expectationsTooltip.GetComponent <HierarchyReferences>(); component.GetReference("Labels").gameObject.SetActive((UnityEngine.Object)minionIdentity != (UnityEngine.Object)null); component.GetReference("MoraleBar").gameObject.SetActive((UnityEngine.Object)minionIdentity != (UnityEngine.Object)null); component.GetReference("ExpectationBar").gameObject.SetActive((UnityEngine.Object)minionIdentity != (UnityEngine.Object)null); component.GetReference("StoredMinion").gameObject.SetActive((UnityEngine.Object)minionIdentity == (UnityEngine.Object)null); experienceProgressFill.gameObject.SetActive((UnityEngine.Object)minionIdentity != (UnityEngine.Object)null); if ((UnityEngine.Object)minionIdentity == (UnityEngine.Object)null) { expectationsTooltip.SetSimpleTooltip(string.Format(UI.TABLESCREENS.INFORMATION_NOT_AVAILABLE_TOOLTIP, (currentlySelectedMinion as StoredMinionIdentity).GetStorageReason(), currentlySelectedMinion.GetProperName())); experienceBarTooltip.SetSimpleTooltip(string.Format(UI.TABLESCREENS.INFORMATION_NOT_AVAILABLE_TOOLTIP, (currentlySelectedMinion as StoredMinionIdentity).GetStorageReason(), currentlySelectedMinion.GetProperName())); EXPCount.text = string.Empty; duplicantLevelIndicator.text = UI.TABLESCREENS.NA; } else { MinionResume component2 = minionIdentity.GetComponent <MinionResume>(); float num = MinionResume.CalculatePreviousExperienceBar(component2.TotalSkillPointsGained); float num2 = MinionResume.CalculateNextExperienceBar(component2.TotalSkillPointsGained); float fillAmount = (component2.TotalExperienceGained - num) / (num2 - num); EXPCount.text = Mathf.RoundToInt(component2.TotalExperienceGained - num) + " / " + Mathf.RoundToInt(num2 - num); duplicantLevelIndicator.text = component2.AvailableSkillpoints.ToString(); experienceProgressFill.fillAmount = fillAmount; experienceBarTooltip.SetSimpleTooltip(string.Format(UI.SKILLS_SCREEN.EXPERIENCE_TOOLTIP, Mathf.RoundToInt(num2 - num) - Mathf.RoundToInt(component2.TotalExperienceGained - num))); AttributeInstance attributeInstance = Db.Get().Attributes.QualityOfLife.Lookup(component2); AttributeInstance attributeInstance2 = Db.Get().Attributes.QualityOfLifeExpectation.Lookup(component2); float num3 = 0f; float num4 = 0f; if (!string.IsNullOrEmpty(hoveredSkillID) && !component2.HasMasteredSkill(hoveredSkillID)) { List <string> list = new List <string>(); List <string> list2 = new List <string>(); list.Add(hoveredSkillID); while (list.Count > 0) { for (int num5 = list.Count - 1; num5 >= 0; num5--) { if (!component2.HasMasteredSkill(list[num5])) { num3 += (float)(Db.Get().Skills.Get(list[num5]).tier + 1); if (component2.AptitudeBySkillGroup.ContainsKey(Db.Get().Skills.Get(list[num5]).skillGroup) && component2.AptitudeBySkillGroup[Db.Get().Skills.Get(list[num5]).skillGroup] > 0f) { num4 += 1f; } foreach (string priorSkill in Db.Get().Skills.Get(list[num5]).priorSkills) { list2.Add(priorSkill); } } } list.Clear(); list.AddRange(list2); list2.Clear(); } } float num6 = attributeInstance.GetTotalValue() + num4 / (attributeInstance2.GetTotalValue() + num3); float f = Mathf.Max(attributeInstance.GetTotalValue() + num4, attributeInstance2.GetTotalValue() + num3); while (moraleNotches.Count < Mathf.RoundToInt(f)) { GameObject gameObject = UnityEngine.Object.Instantiate(moraleNotch, moraleNotch.transform.parent); gameObject.SetActive(true); moraleNotches.Add(gameObject); } while (moraleNotches.Count > Mathf.RoundToInt(f)) { GameObject gameObject2 = moraleNotches[moraleNotches.Count - 1]; moraleNotches.Remove(gameObject2); UnityEngine.Object.Destroy(gameObject2); } for (int i = 0; i < moraleNotches.Count; i++) { if ((float)i < attributeInstance.GetTotalValue() + num4) { moraleNotches[i].GetComponentsInChildren <Image>()[1].color = moraleNotchColor; } else { moraleNotches[i].GetComponentsInChildren <Image>()[1].color = Color.clear; } } moraleProgressLabel.text = UI.SKILLS_SCREEN.MORALE + ": " + attributeInstance.GetTotalValue().ToString(); if (num4 > 0f) { LocText locText = moraleProgressLabel; locText.text = locText.text + " + " + GameUtil.ApplyBoldString(GameUtil.ColourizeString(moraleNotchColor, num4.ToString())); } while (expectationNotches.Count < Mathf.RoundToInt(f)) { GameObject gameObject3 = UnityEngine.Object.Instantiate(expectationNotch, expectationNotch.transform.parent); gameObject3.SetActive(true); expectationNotches.Add(gameObject3); } while (expectationNotches.Count > Mathf.RoundToInt(f)) { GameObject gameObject4 = expectationNotches[expectationNotches.Count - 1]; expectationNotches.Remove(gameObject4); UnityEngine.Object.Destroy(gameObject4); } for (int j = 0; j < expectationNotches.Count; j++) { if ((float)j < attributeInstance2.GetTotalValue() + num3) { if ((float)j < attributeInstance2.GetTotalValue()) { expectationNotches[j].GetComponentsInChildren <Image>()[1].color = expectationNotchColor; } else { expectationNotches[j].GetComponentsInChildren <Image>()[1].color = expectationNotchProspectColor; } } else { expectationNotches[j].GetComponentsInChildren <Image>()[1].color = Color.clear; } } expectationsProgressLabel.text = UI.SKILLS_SCREEN.MORALE_EXPECTATION + ": " + attributeInstance2.GetTotalValue().ToString(); if (num3 > 0f) { LocText locText2 = expectationsProgressLabel; locText2.text = locText2.text + " + " + GameUtil.ApplyBoldString(GameUtil.ColourizeString(expectationNotchColor, num3.ToString())); } if (num6 < 1f) { expectationWarning.SetActive(true); moraleWarning.SetActive(false); } else { expectationWarning.SetActive(false); moraleWarning.SetActive(true); } string empty = string.Empty; Dictionary <string, float> dictionary = new Dictionary <string, float>(); string text = empty; empty = text + GameUtil.ApplyBoldString(UI.SKILLS_SCREEN.MORALE) + ": " + attributeInstance.GetTotalValue() + "\n"; for (int k = 0; k < attributeInstance.Modifiers.Count; k++) { dictionary.Add(attributeInstance.Modifiers[k].GetDescription(), attributeInstance.Modifiers[k].Value); } List <KeyValuePair <string, float> > list3 = dictionary.ToList(); list3.Sort((KeyValuePair <string, float> pair1, KeyValuePair <string, float> pair2) => pair2.Value.CompareTo(pair1.Value)); foreach (KeyValuePair <string, float> item in list3) { text = empty; empty = text + " • " + item.Key + ": " + ((!(item.Value > 0f)) ? UIConstants.ColorPrefixRed : UIConstants.ColorPrefixGreen) + item.Value.ToString() + UIConstants.ColorSuffix + "\n"; } empty += "\n"; text = empty; empty = text + GameUtil.ApplyBoldString(UI.SKILLS_SCREEN.MORALE_EXPECTATION) + ": " + attributeInstance2.GetTotalValue() + "\n"; for (int l = 0; l < attributeInstance2.Modifiers.Count; l++) { text = empty; empty = text + " • " + attributeInstance2.Modifiers[l].GetDescription() + ": " + ((!(attributeInstance2.Modifiers[l].Value > 0f)) ? UIConstants.ColorPrefixGreen : UIConstants.ColorPrefixRed) + attributeInstance2.Modifiers[l].GetFormattedString(component2.gameObject) + UIConstants.ColorSuffix + "\n"; } expectationsTooltip.SetSimpleTooltip(empty); } } }