Ejemplo n.º 1
0
		/// <summary>
		/// Configures the row's content, only adding widgets that are new.
		/// </summary>
		/// <param name="row">The row being configured.</param>
		/// <param name="minion">The Duplicant for this row.</param>
		/// <param name="columns">The columns to display.</param>
		/// <param name="screen">The parent table screen.</param>
		private static void ConfigureContent(TableRow row, IAssignableIdentity minion,
				IDictionary<string, TableColumn> columns, TableScreen screen) {
			bool def = row.isDefault;
			var go = row.gameObject;
			row.minion = minion;
			ConfigureImage(row, minion);
			foreach (var pair in columns) {
				var column = pair.Value;
				var widgets = row.widgets;
				string id = column.scrollerID;
				// Columns cannot be deleted in vanilla
				if (!widgets.TryGetValue(column, out GameObject widget)) {
					// Create a new one
					if (minion == null) {
						if (def)
							widget = column.GetDefaultWidget(go);
						else
							widget = column.GetHeaderWidget(go);
					} else
						widget = column.GetMinionWidget(go);
					widgets.Add(column, widget);
					column.widgets_by_row.Add(row, widget);
				}
				// Update the scroller if needed
				if (!string.IsNullOrEmpty(id) && column.screen.column_scrollers.Contains(id))
					ConfigureScroller(row, go, id, widget, screen);
			}
			// Run events after the update is complete
			foreach (var pair in columns) {
				var column = pair.Value;
				if (column.widgets_by_row.TryGetValue(row, out GameObject widget)) {
					string id = column.scrollerID;
					column.on_load_action?.Invoke(minion, widget);
					// Apparently the order just... works out? <shrug>
				}
			}
			if (minion != null)
				go.name = minion.GetProperName();
			else if (def)
				go.name = "defaultRow";
			// "Click to go to Duplicant"
			if (row.selectMinionButton != null)
				row.selectMinionButton.transform.SetAsLastSibling();
			// Update the border sizes
			foreach (var pair in row.scrollerBorders) {
				var border = pair.Value;
				var rt = border.rectTransform();
				float width = rt.rect.width;
				border.transform.SetParent(go.transform);
				rt.anchorMin = rt.anchorMax = Vector2.up;
				rt.sizeDelta = new Vector2(width, 374.0f);
				var scrollRT = row.scrollers[pair.Key].transform.parent.rectTransform();
				Vector3 a = scrollRT.GetLocalPosition();
				a.x -= scrollRT.sizeDelta.x * 0.5f;
				a.y = rt.GetLocalPosition().y - rt.anchoredPosition.y;
				rt.SetLocalPosition(a);
			}
		}
        /// <summary>
        /// Generates the tool tip text for the specified Duplicant row.
        /// </summary>
        /// <returns>The tool tip text to display for allowing or disallowing.</returns>
        private string GetTooltip()
        {
            string text = "";

            // UNITY WHY
            if (targetIdentity != null && !targetIdentity.IsNull())
            {
                if (currentState == AllowableState.Allowed)
                {
                    text = string.Format(STRINGS.UI.UISIDESCREENS.ASSIGNABLESIDESCREEN.
                                         UNASSIGN_TOOLTIP, targetIdentity.GetProperName());
                }
                else
                {
                    text = string.Format(STRINGS.UI.UISIDESCREENS.ASSIGNABLESIDESCREEN.
                                         ASSIGN_TO_TOOLTIP, targetIdentity.GetProperName());
                }
            }
            return(text);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Compares two rows by the current allow state.
        /// </summary>
        private int CompareByAllowed(IAssignableIdentity id1, IAssignableIdentity id2)
        {
            int result = allowRows[id1].currentState.CompareTo(allowRows[id2].
                                                               currentState);

            if (result == 0)
            {
                result = id1.GetProperName().CompareTo(id2.GetProperName());
            }
            return(result * (sortReversed ? -1 : 1));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Fired by the rows when a row is clicked in the UI.
        /// </summary>
        /// <param name="identity">The Duplicant (or "public") that was selected or
        /// deselected.</param>
        internal void OnRowClicked(IAssignableIdentity identity)
        {
            if (identity != null && !identity.IsNull())
            {
#if DEBUG
                PUtil.LogDebug("Selected row " + identity.GetProperName());
#endif
                if (identity is MinionAssignablesProxy trueDupe)
                {
                    // Actual Duplicant
                    int prefabID = trueDupe.TargetInstanceID;
                    if (profile.IsPublicAllowed())
                    {
                        ConvertPublicToExplicit();
                    }
                    if (profile.IsAllowed(prefabID))
                    {
                        profile.RemoveDuplicant(prefabID);
                    }
                    else
                    {
                        profile.AddDuplicant(prefabID);
                    }
                }
                else
                {
                    // "Public"
                    if (profile.IsPublicAllowed())
                    {
                        profile.DisallowAll();
                    }
                    else
                    {
                        profile.AllowAll();
                    }
                }
                // Cheaper than a full rebuild
                foreach (var row in allowRows)
                {
                    row.Value.Refresh();
                }
            }
        }
Ejemplo n.º 5
0
    public void Setup(Schedulable schedulable)
    {
        this.schedulable = schedulable;
        IAssignableIdentity component = schedulable.GetComponent <IAssignableIdentity>();

        portrait.SetIdentityObject(component, true);
        label.text = component.GetProperName();
        MinionIdentity minionIdentity = (MinionIdentity)component;
        Traits         component2     = minionIdentity.GetComponent <Traits>();

        if (component2.HasTrait("NightOwl"))
        {
            nightOwlIcon.SetActive(true);
        }
        else if (component2.HasTrait("EarlyBird"))
        {
            earlyBirdIcon.SetActive(true);
        }
        dropDown.Initialize(ScheduleManager.Instance.GetSchedules().Cast <IListableOption>(), OnDropEntryClick, null, DropEntryRefreshAction, false, schedulable);
    }
Ejemplo n.º 6
0
 private void ConfigureNameLabel(IAssignableIdentity identity, GameObject widget_go)
 {
     on_load_name_label(identity, widget_go);
     if (identity != null)
     {
         string  result    = string.Empty;
         ToolTip component = widget_go.GetComponent <ToolTip>();
         if ((UnityEngine.Object)component != (UnityEngine.Object)null)
         {
             ToolTip toolTip = component;
             toolTip.OnToolTip = (Func <string>)Delegate.Combine(toolTip.OnToolTip, (Func <string>) delegate
             {
                 MinionIdentity minionIdentity = identity as MinionIdentity;
                 if ((UnityEngine.Object)minionIdentity != (UnityEngine.Object)null)
                 {
                     StringBuilder stringBuilder = new StringBuilder();
                     stringBuilder.Append("<b>" + UI.DETAILTABS.STATS.NAME + "</b>");
                     foreach (AttributeInstance attribute in minionIdentity.GetAttributes())
                     {
                         if (attribute.Attribute.ShowInUI == Klei.AI.Attribute.Display.Skill)
                         {
                             string text = UIConstants.ColorPrefixWhite;
                             if (attribute.GetTotalValue() > 0f)
                             {
                                 text = UIConstants.ColorPrefixGreen;
                             }
                             else if (attribute.GetTotalValue() < 0f)
                             {
                                 text = UIConstants.ColorPrefixRed;
                             }
                             stringBuilder.Append("\n    • " + attribute.Name + ": " + text + attribute.GetTotalValue() + UIConstants.ColorSuffix);
                         }
                     }
                     result = stringBuilder.ToString();
                 }
                 else if ((UnityEngine.Object)(identity as StoredMinionIdentity) != (UnityEngine.Object)null)
                 {
                     result = string.Format(UI.TABLESCREENS.INFORMATION_NOT_AVAILABLE_TOOLTIP, (identity as StoredMinionIdentity).GetStorageReason(), identity.GetProperName());
                 }
                 return(result);
             });
         }
     }
 }
Ejemplo n.º 7
0
    private string HoverPersonalPriority(object widget_go_obj)
    {
        GameObject gameObject = widget_go_obj as GameObject;
        PrioritizationGroupTableColumn prioritizationGroupTableColumn = GetWidgetColumn(gameObject) as PrioritizationGroupTableColumn;
        ChoreGroup choreGroup = prioritizationGroupTableColumn.userData as ChoreGroup;
        string     text       = null;
        TableRow   widgetRow  = GetWidgetRow(gameObject);

        switch (widgetRow.rowType)
        {
        case TableRow.RowType.Header:
        {
            string text2 = UI.JOBSSCREEN.HEADER_TOOLTIP.ToString();
            text2 = text2.Replace("{Job}", choreGroup.Name);
            string text3 = UI.JOBSSCREEN.HEADER_DETAILS_TOOLTIP.ToString();
            text3 = text3.Replace("{Description}", choreGroup.description);
            HashSet <string> hashSet = new HashSet <string>();
            foreach (ChoreType choreType in choreGroup.choreTypes)
            {
                hashSet.Add(choreType.Name);
            }
            StringBuilder stringBuilder = new StringBuilder();
            int           num           = 0;
            foreach (string item in hashSet)
            {
                stringBuilder.Append(item);
                if (num < hashSet.Count - 1)
                {
                    stringBuilder.Append(", ");
                }
                num++;
            }
            text3 = text3.Replace("{ChoreList}", stringBuilder.ToString());
            return(text2.Replace("{Details}", text3));
        }

        case TableRow.RowType.Default:
            text = UI.JOBSSCREEN.NEW_MINION_ITEM_TOOLTIP.ToString();
            break;

        case TableRow.RowType.Minion:
        case TableRow.RowType.StoredMinon:
            text = UI.JOBSSCREEN.ITEM_TOOLTIP.ToString();
            text = text.Replace("{Name}", widgetRow.name);
            break;
        }
        ToolTip             componentInChildren = gameObject.GetComponentInChildren <ToolTip>();
        IAssignableIdentity identity            = widgetRow.GetIdentity();
        MinionIdentity      minionIdentity      = identity as MinionIdentity;

        if ((UnityEngine.Object)minionIdentity != (UnityEngine.Object)null)
        {
            IPersonalPriorityManager priorityManager = GetPriorityManager(widgetRow);
            int    personalPriority = priorityManager.GetPersonalPriority(choreGroup);
            string newValue         = GetPriorityStr(personalPriority);
            string priorityValue    = GetPriorityValue(personalPriority);
            if (priorityManager.IsChoreGroupDisabled(choreGroup))
            {
                Trait  trait     = null;
                Traits component = minionIdentity.GetComponent <Traits>();
                foreach (Trait trait2 in component.TraitList)
                {
                    if (trait2.disabledChoreGroups != null)
                    {
                        ChoreGroup[] disabledChoreGroups = trait2.disabledChoreGroups;
                        foreach (ChoreGroup choreGroup2 in disabledChoreGroups)
                        {
                            if (choreGroup2.IdHash == choreGroup.IdHash)
                            {
                                trait = trait2;
                                break;
                            }
                        }
                        if (trait != null)
                        {
                            break;
                        }
                    }
                }
                text = UI.JOBSSCREEN.TRAIT_DISABLED.ToString();
                text = text.Replace("{Name}", minionIdentity.GetProperName());
                text = text.Replace("{Job}", choreGroup.Name);
                text = text.Replace("{Trait}", trait.Name);
                componentInChildren.ClearMultiStringTooltip();
                componentInChildren.AddMultiStringTooltip(text, null);
            }
            else
            {
                text = text.Replace("{Job}", choreGroup.Name);
                text = text.Replace("{Priority}", newValue);
                text = text.Replace("{PriorityValue}", priorityValue);
                componentInChildren.ClearMultiStringTooltip();
                componentInChildren.AddMultiStringTooltip(text, null);
                if ((UnityEngine.Object)minionIdentity != (UnityEngine.Object)null)
                {
                    text = "\n" + UI.JOBSSCREEN.MINION_SKILL_TOOLTIP.ToString();
                    text = text.Replace("{Name}", minionIdentity.GetProperName());
                    text = text.Replace("{Attribute}", choreGroup.attribute.Name);
                    AttributeInstance attributeInstance        = minionIdentity.GetAttributes().Get(choreGroup.attribute);
                    float             totalValue               = attributeInstance.GetTotalValue();
                    TextStyleSetting  tooltipTextStyle_Ability = TooltipTextStyle_Ability;
                    text += GameUtil.ColourizeString(tooltipTextStyle_Ability.textColor, totalValue.ToString());
                    componentInChildren.AddMultiStringTooltip(text, null);
                }
                componentInChildren.AddMultiStringTooltip(UI.HORIZONTAL_RULE + "\n" + GetUsageString(), null);
            }
        }
        else if ((UnityEngine.Object)(identity as StoredMinionIdentity) != (UnityEngine.Object)null)
        {
            componentInChildren.AddMultiStringTooltip(string.Format(UI.JOBSSCREEN.CANNOT_ADJUST_PRIORITY, identity.GetProperName(), (identity as StoredMinionIdentity).GetStorageReason()), null);
        }
        return(string.Empty);
    }
    protected void on_tooltip_name(IAssignableIdentity minion, GameObject widget_go, ToolTip tooltip)
    {
        tooltip.ClearMultiStringTooltip();
        TableRow widgetRow = GetWidgetRow(widget_go);

        switch (widgetRow.rowType)
        {
        case TableRow.RowType.Header:
            break;

        case TableRow.RowType.Default:
            break;

        case TableRow.RowType.StoredMinon:
            break;

        case TableRow.RowType.Minion:
            if (minion != null)
            {
                tooltip.AddMultiStringTooltip(string.Format(UI.TABLESCREENS.GOTO_DUPLICANT_BUTTON, minion.GetProperName()), null);
            }
            break;
        }
    }
    private void on_tooltip_consumable_info(IAssignableIdentity minion, GameObject widget_go, ToolTip tooltip)
    {
        tooltip.ClearMultiStringTooltip();
        ConsumableInfoTableColumn consumableInfoTableColumn = GetWidgetColumn(widget_go) as ConsumableInfoTableColumn;
        TableRow widgetRow = GetWidgetRow(widget_go);

        EdiblesManager.FoodInfo foodInfo = consumableInfoTableColumn.consumable_info as EdiblesManager.FoodInfo;
        int num = 0;

        if (foodInfo != null)
        {
            int            num2           = foodInfo.Quality;
            MinionIdentity minionIdentity = minion as MinionIdentity;
            if ((UnityEngine.Object)minionIdentity != (UnityEngine.Object)null)
            {
                AttributeInstance attributeInstance = minionIdentity.GetAttributes().Get(Db.Get().Attributes.FoodExpectation);
                num2 += Mathf.RoundToInt(attributeInstance.GetTotalValue());
            }
            string effectForFoodQuality = Edible.GetEffectForFoodQuality(num2);
            Effect effect = Db.Get().effects.Get(effectForFoodQuality);
            foreach (AttributeModifier selfModifier in effect.SelfModifiers)
            {
                if (selfModifier.AttributeId == Db.Get().Attributes.QualityOfLife.Id)
                {
                    num += Mathf.RoundToInt(selfModifier.Value);
                }
            }
        }
        switch (widgetRow.rowType)
        {
        case TableRow.RowType.Header:
            tooltip.AddMultiStringTooltip(consumableInfoTableColumn.consumable_info.ConsumableName, null);
            if (foodInfo != null)
            {
                tooltip.AddMultiStringTooltip(string.Format(UI.CONSUMABLESSCREEN.FOOD_AVAILABLE, GameUtil.GetFormattedCalories(WorldInventory.Instance.GetAmount(consumableInfoTableColumn.consumable_info.ConsumableId.ToTag()) * foodInfo.CaloriesPerUnit, GameUtil.TimeSlice.None, true)), null);
                tooltip.AddMultiStringTooltip(string.Format(UI.CONSUMABLESSCREEN.FOOD_QUALITY, GameUtil.AddPositiveSign(num.ToString(), num > 0)), null);
                tooltip.AddMultiStringTooltip("\n" + foodInfo.Description, null);
            }
            else
            {
                tooltip.AddMultiStringTooltip(string.Format(UI.CONSUMABLESSCREEN.FOOD_AVAILABLE, GameUtil.GetFormattedUnits(WorldInventory.Instance.GetAmount(consumableInfoTableColumn.consumable_info.ConsumableId.ToTag()), GameUtil.TimeSlice.None, true)), null);
            }
            break;

        case TableRow.RowType.Default:
            if (consumableInfoTableColumn.get_value_action(minion, widget_go) == ResultValues.True)
            {
                tooltip.AddMultiStringTooltip(string.Format(UI.CONSUMABLESSCREEN.NEW_MINIONS_FOOD_PERMISSION_ON, consumableInfoTableColumn.consumable_info.ConsumableName), null);
            }
            else
            {
                tooltip.AddMultiStringTooltip(string.Format(UI.CONSUMABLESSCREEN.NEW_MINIONS_FOOD_PERMISSION_OFF, consumableInfoTableColumn.consumable_info.ConsumableName), null);
            }
            break;

        case TableRow.RowType.Minion:
        case TableRow.RowType.StoredMinon:
            if (minion != null)
            {
                if (consumableInfoTableColumn.get_value_action(minion, widget_go) == ResultValues.True)
                {
                    tooltip.AddMultiStringTooltip(string.Format(UI.CONSUMABLESSCREEN.FOOD_PERMISSION_ON, minion.GetProperName(), consumableInfoTableColumn.consumable_info.ConsumableName), null);
                }
                else
                {
                    tooltip.AddMultiStringTooltip(string.Format(UI.CONSUMABLESSCREEN.FOOD_PERMISSION_OFF, minion.GetProperName(), consumableInfoTableColumn.consumable_info.ConsumableName), null);
                }
                if (foodInfo != null && (UnityEngine.Object)(minion as MinionIdentity) != (UnityEngine.Object)null)
                {
                    tooltip.AddMultiStringTooltip(string.Format(UI.CONSUMABLESSCREEN.FOOD_QUALITY_VS_EXPECTATION, GameUtil.AddPositiveSign(num.ToString(), num > 0), minion.GetProperName()), null);
                }
                else if ((UnityEngine.Object)(minion as StoredMinionIdentity) != (UnityEngine.Object)null)
                {
                    tooltip.AddMultiStringTooltip(string.Format(UI.CONSUMABLESSCREEN.CANNOT_ADJUST_PERMISSIONS, (minion as StoredMinionIdentity).GetStorageReason()), null);
                }
            }
            break;
        }
    }
Ejemplo n.º 10
0
    private string GetTooltip()
    {
        ToolTip component = GetComponent <ToolTip>();

        component.ClearMultiStringTooltip();
        if (targetIdentity != null && !targetIdentity.IsNull())
        {
            switch (currentState)
            {
            case AssignableState.Selected:
                component.AddMultiStringTooltip(string.Format(UI.UISIDESCREENS.ASSIGNABLESIDESCREEN.UNASSIGN_TOOLTIP, targetIdentity.GetProperName()), null);
                break;

            case AssignableState.Disabled:
                component.AddMultiStringTooltip(string.Format(UI.UISIDESCREENS.ASSIGNABLESIDESCREEN.DISABLED_TOOLTIP, targetIdentity.GetProperName()), null);
                break;

            default:
                component.AddMultiStringTooltip(string.Format(UI.UISIDESCREENS.ASSIGNABLESIDESCREEN.ASSIGN_TO_TOOLTIP, targetIdentity.GetProperName()), null);
                break;
            }
        }
        return(string.Empty);
    }
Ejemplo n.º 11
0
 /// <summary>
 /// Compares two rows by the Duplicant's name.
 /// </summary>
 private int CompareByName(IAssignableIdentity id1, IAssignableIdentity id2)
 {
     return(id1.GetProperName().CompareTo(id2.GetProperName()) *
            (sortReversed ? -1 : 1));
 }
Ejemplo n.º 12
0
 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);
         }
     }
 }