示例#1
0
    public void SetPointHighlight(Vector2 point)
    {
        highlightPoint.SetActive(true);
        Vector2       relativePosition = layer.graph.GetRelativePosition(point);
        RectTransform transform        = highlightPoint.rectTransform();
        float         x          = relativePosition.x;
        Vector2       sizeDelta  = layer.graph.rectTransform().sizeDelta;
        float         num        = x * sizeDelta.x;
        Vector2       sizeDelta2 = layer.graph.rectTransform().sizeDelta;
        float         x2         = num - sizeDelta2.x / 2f;
        float         y          = relativePosition.y;
        Vector2       sizeDelta3 = layer.graph.rectTransform().sizeDelta;
        float         num2       = y * sizeDelta3.y;
        Vector2       sizeDelta4 = layer.graph.rectTransform().sizeDelta;

        transform.SetLocalPosition(new Vector2(x2, num2 - sizeDelta4.y / 2f));
        ToolTip component = layer.graph.GetComponent <ToolTip>();

        component.ClearMultiStringTooltip();
        ToolTip toolTip       = component;
        Vector3 localPosition = highlightPoint.rectTransform().localPosition;

        toolTip.tooltipPositionOffset = new Vector2(localPosition.x, layer.graph.rectTransform().rect.height / 2f - 12f);
        component.SetSimpleTooltip(layer.graph.axis_x.name + " " + point.x + ", " + Mathf.RoundToInt(point.y) + " " + layer.graph.axis_y.name);
        ToolTipScreen.Instance.SetToolTip(component);
    }
    private void on_tooltip_consumable_info_super(IAssignableIdentity minion, GameObject widget_go, ToolTip tooltip)
    {
        tooltip.ClearMultiStringTooltip();
        TableRow widgetRow = GetWidgetRow(widget_go);

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

        case TableRow.RowType.Header:
            tooltip.AddMultiStringTooltip(UI.CONSUMABLESSCREEN.TOOLTIP_TOGGLE_ALL.text, null);
            break;

        case TableRow.RowType.Default:
            tooltip.AddMultiStringTooltip(UI.CONSUMABLESSCREEN.NEW_MINIONS_TOOLTIP_TOGGLE_ROW, null);
            break;

        case TableRow.RowType.Minion:
            if ((UnityEngine.Object)(minion as MinionIdentity) != (UnityEngine.Object)null)
            {
                tooltip.AddMultiStringTooltip(string.Format(UI.CONSUMABLESSCREEN.TOOLTIP_TOGGLE_ROW.text, (minion as MinionIdentity).gameObject.GetProperName()), null);
            }
            break;
        }
    }
示例#3
0
    private string OnSickTooltip()
    {
        int num = CountSickDupes();

        SickTooltip.ClearMultiStringTooltip();
        SickTooltip.AddMultiStringTooltip(string.Format(UI.TOOLTIPS.METERSCREEN_SICK_DUPES, num.ToString()), ToolTipStyle_Header);
        for (int i = 0; i < Components.LiveMinionIdentities.Count; i++)
        {
            MinionIdentity minionIdentity = Components.LiveMinionIdentities[i];
            string         text           = minionIdentity.GetComponent <KSelectable>().GetName();
            Sicknesses     sicknesses     = minionIdentity.GetComponent <MinionModifiers>().sicknesses;
            if (sicknesses.IsInfected())
            {
                text += " (";
                int num2 = 0;
                foreach (SicknessInstance item in sicknesses)
                {
                    text = text + ((num2 <= 0) ? string.Empty : ", ") + item.modifier.Name;
                    num2++;
                }
                text += ")";
            }
            bool selected = i == immunityDisplayInfo.selectedIndex;
            AddToolTipLine(SickTooltip, text, selected);
        }
        return(string.Empty);
    }
 public void ClearTooltip()
 {
     if ((Object)tooltip != (Object)null)
     {
         tooltip.ClearMultiStringTooltip();
     }
 }
示例#5
0
 private string OnRedAlertTooltip()
 {
     RedAlertTooltip.ClearMultiStringTooltip();
     RedAlertTooltip.AddMultiStringTooltip(UI.TOOLTIPS.RED_ALERT_TITLE, ToolTipStyle_Header);
     RedAlertTooltip.AddMultiStringTooltip(UI.TOOLTIPS.RED_ALERT_CONTENT, ToolTipStyle_Property);
     return(string.Empty);
 }
    protected void on_tooltip_qualityoflife_expectations(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.Minion:
        {
            MinionIdentity minionIdentity = minion as MinionIdentity;
            if ((UnityEngine.Object)minionIdentity != (UnityEngine.Object)null)
            {
                tooltip.AddMultiStringTooltip(Db.Get().Attributes.QualityOfLife.Lookup(minionIdentity).GetAttributeValueTooltip(), null);
            }
            break;
        }

        case TableRow.RowType.StoredMinon:
            StoredMinionTooltip(minion, tooltip);
            break;
        }
    }
示例#7
0
 private void RefreshToolTip(MinionResume resume)
 {
     if ((Object)resume != (Object)null)
     {
         AttributeInstance attributeInstance  = Db.Get().Attributes.QualityOfLife.Lookup(resume);
         AttributeInstance attributeInstance2 = Db.Get().Attributes.QualityOfLifeExpectation.Lookup(resume);
         ToolTip           component          = GetComponent <ToolTip>();
         component.ClearMultiStringTooltip();
         component.AddMultiStringTooltip(minion.GetProperName() + "\n\n", TooltipTextStyle_Header);
         component.AddMultiStringTooltip(string.Format(UI.SKILLS_SCREEN.CURRENT_MORALE, attributeInstance.GetTotalValue(), attributeInstance2.GetTotalValue()), null);
         component.AddMultiStringTooltip("\n" + UI.DETAILTABS.STATS.NAME + "\n\n", TooltipTextStyle_Header);
         foreach (AttributeInstance attribute in resume.GetAttributes())
         {
             if (attribute.Attribute.ShowInUI == Attribute.Display.Skill)
             {
                 string text = UIConstants.ColorPrefixWhite;
                 if (attribute.GetTotalValue() > 0f)
                 {
                     text = UIConstants.ColorPrefixGreen;
                 }
                 else if (attribute.GetTotalValue() < 0f)
                 {
                     text = UIConstants.ColorPrefixRed;
                 }
                 component.AddMultiStringTooltip("    • " + attribute.Name + ": " + text + attribute.GetTotalValue() + UIConstants.ColorSuffix, null);
             }
         }
     }
 }
 private void ConfigureToolTip(ToolTip tooltip, string status)
 {
     tooltip.ClearMultiStringTooltip();
     tooltip.AddMultiStringTooltip(status, null);
     if ((UnityEngine.Object)SaveGame.Instance != (UnityEngine.Object)null && !progressParent.gameObject.activeSelf)
     {
         tooltip.AddMultiStringTooltip(COLONY_ACHIEVEMENTS.MISC_REQUIREMENTS.STATUS.EXPAND_TOOLTIP, null);
     }
 }
示例#9
0
    private void RefreshNotes()
    {
        blockTypeCounts.Clear();
        foreach (ScheduleBlockType resource in Db.Get().ScheduleBlockTypes.resources)
        {
            blockTypeCounts[resource.Id] = 0;
        }
        foreach (ScheduleBlock block in schedule.GetBlocks())
        {
            foreach (ScheduleBlockType allowed_type in block.allowed_types)
            {
                Dictionary <string, int> dictionary;
                string id;
                (dictionary = blockTypeCounts)[id = allowed_type.Id] = dictionary[id] + 1;
            }
        }
        ToolTip component = noteEntryRight.GetComponent <ToolTip>();

        component.ClearMultiStringTooltip();
        int num = 0;

        foreach (KeyValuePair <string, int> blockTypeCount in blockTypeCounts)
        {
            if (blockTypeCount.Value == 0)
            {
                num++;
                component.AddMultiStringTooltip(string.Format(UI.SCHEDULEGROUPS.NOTIME, Db.Get().ScheduleBlockTypes.Get(blockTypeCount.Key).Name), null);
            }
        }
        if (num > 0)
        {
            noteEntryRight.text = string.Format(UI.SCHEDULEGROUPS.MISSINGBLOCKS, num);
        }
        else
        {
            noteEntryRight.text = string.Empty;
        }
        int    numBlocks  = blockTypeCounts[Db.Get().ScheduleBlockTypes.Recreation.Id];
        string breakBonus = QualityOfLifeNeed.GetBreakBonus(numBlocks);

        if (breakBonus != null)
        {
            Effect effect = Db.Get().effects.Get(breakBonus);
            if (effect != null)
            {
                foreach (AttributeModifier selfModifier in effect.SelfModifiers)
                {
                    if (selfModifier.AttributeId == Db.Get().Attributes.QualityOfLife.Id)
                    {
                        noteEntryLeft.text = string.Format(UI.SCHEDULESCREEN.DOWNTIME_MORALE, selfModifier.GetFormattedString(null));
                        noteEntryLeft.GetComponent <ToolTip>().SetSimpleTooltip(string.Format(UI.SCHEDULESCREEN.SCHEDULE_DOWNTIME_MORALE, selfModifier.GetFormattedString(null)));
                    }
                }
            }
        }
    }
 private string OnToolTip()
 {
     if ((Object)GameClock.Instance != (Object)null)
     {
         tooltip.ClearMultiStringTooltip();
         tooltip.AddMultiStringTooltip(string.Format(UI.ASTEROIDCLOCK.CYCLES_OLD, Days()), tooltipstyle_Days);
         tooltip.AddMultiStringTooltip(string.Format(UI.ASTEROIDCLOCK.TIME_PLAYED, (GameClock.Instance.GetTimePlayedInSeconds() / 3600f).ToString("0.00")), tooltipstyle_Playtime);
     }
     return(string.Empty);
 }
示例#11
0
    private void RefreshMinions()
    {
        int count = Components.LiveMinionIdentities.Count;

        if (count != cachedMinionCount)
        {
            cachedMinionCount   = count;
            currentMinions.text = count.ToString("0");
            MinionsTooltip.ClearMultiStringTooltip();
            MinionsTooltip.AddMultiStringTooltip(string.Format(UI.TOOLTIPS.METERSCREEN_POPULATION, count.ToString("0")), ToolTipStyle_Header);
        }
    }
 private void Start()
 {
     inputField.minValue     = 0f;
     inputField.maxValue     = (float)MAX_VALUE;
     inputField.currentValue = (float)SaveGame.Instance.minGermCountForDisinfect;
     inputField.SetDisplayValue(SaveGame.Instance.minGermCountForDisinfect.ToString());
     inputField.onEndEdit += delegate
     {
         ReceiveValueFromInput(inputField.currentValue);
     };
     inputField.decimalPlaces = 1;
     inputField.Activate();
     slider.minValue         = 0f;
     slider.maxValue         = (float)(MAX_VALUE / SLIDER_CONVERSION);
     slider.wholeNumbers     = true;
     slider.value            = (float)(SaveGame.Instance.minGermCountForDisinfect / SLIDER_CONVERSION);
     slider.onReleaseHandle += OnReleaseHandle;
     slider.onDrag          += delegate
     {
         ReceiveValueFromSlider(slider.value);
     };
     slider.onPointerDown += delegate
     {
         ReceiveValueFromSlider(slider.value);
     };
     slider.onMove += delegate
     {
         ReceiveValueFromSlider(slider.value);
         OnReleaseHandle();
     };
     unitsLabel.SetText(UI.OVERLAYS.DISEASE.DISINFECT_THRESHOLD_DIAGRAM.UNITS);
     minLabel.SetText(UI.OVERLAYS.DISEASE.DISINFECT_THRESHOLD_DIAGRAM.MIN_LABEL);
     maxLabel.SetText(UI.OVERLAYS.DISEASE.DISINFECT_THRESHOLD_DIAGRAM.MAX_LABEL);
     thresholdPrefix.SetText(UI.OVERLAYS.DISEASE.DISINFECT_THRESHOLD_DIAGRAM.THRESHOLD_PREFIX);
     toolTip.OnToolTip = delegate
     {
         toolTip.ClearMultiStringTooltip();
         if (SaveGame.Instance.enableAutoDisinfect)
         {
             toolTip.AddMultiStringTooltip(UI.OVERLAYS.DISEASE.DISINFECT_THRESHOLD_DIAGRAM.TOOLTIP.ToString().Replace("{NumberOfGerms}", SaveGame.Instance.minGermCountForDisinfect.ToString()), null);
         }
         else
         {
             toolTip.AddMultiStringTooltip(UI.OVERLAYS.DISEASE.DISINFECT_THRESHOLD_DIAGRAM.TOOLTIP_DISABLED.ToString(), null);
         }
         return(string.Empty);
     };
     disabledImage.gameObject.SetActive(!SaveGame.Instance.enableAutoDisinfect);
     toggle.isOn            = SaveGame.Instance.enableAutoDisinfect;
     toggle.onValueChanged += OnClickToggle;
 }
    private void ConfigureToggle(KToggle toggle, bool disabled, bool active, string tooltip, TextStyleSetting tooltip_style)
    {
        toggle.interactable = active;
        toggle.GetComponent <KToggle>().interactable = !disabled;
        if (disabled)
        {
            toggle.GetComponentInChildren <ImageToggleState>().SetDisabled();
        }
        else
        {
            toggle.GetComponentInChildren <ImageToggleState>().SetActiveState(active);
        }
        ToolTip component = toggle.GetComponent <ToolTip>();

        component.ClearMultiStringTooltip();
        component.AddMultiStringTooltip(tooltip, tooltip_style);
    }
示例#14
0
    private string OnStressTooltip()
    {
        float maxStress = GameUtil.GetMaxStress();

        StressTooltip.ClearMultiStringTooltip();
        StressTooltip.AddMultiStringTooltip(string.Format(UI.TOOLTIPS.METERSCREEN_AVGSTRESS, Mathf.Round(maxStress).ToString() + "%"), ToolTipStyle_Header);
        Amount stress = Db.Get().Amounts.Stress;
        IList <MinionIdentity> stressedMinions = GetStressedMinions();

        for (int i = 0; i < stressedMinions.Count; i++)
        {
            MinionIdentity minionIdentity = stressedMinions[i];
            AmountInstance amount         = stress.Lookup(minionIdentity);
            AddToolTipAmountPercentLine(StressTooltip, amount, minionIdentity, i == stressDisplayInfo.selectedIndex);
        }
        return(string.Empty);
    }
示例#15
0
 public void Refresh()
 {
     if (minion != null)
     {
         portrait.SetIdentityObject(minion, true);
         string         empty          = string.Empty;
         MinionIdentity minionIdentity = minion as MinionIdentity;
         hatDropDown.gameObject.SetActive(true);
         if ((Object)minionIdentity != (Object)null)
         {
             MinionResume component              = minionIdentity.GetComponent <MinionResume>();
             int          availableSkillpoints   = component.AvailableSkillpoints;
             int          totalSkillPointsGained = component.TotalSkillPointsGained;
             masteryPoints.text = ((availableSkillpoints <= 0) ? "0" : GameUtil.ApplyBoldString(GameUtil.ColourizeString(new Color(0.5f, 1f, 0.5f, 1f), availableSkillpoints.ToString())));
             AttributeInstance attributeInstance  = Db.Get().Attributes.QualityOfLife.Lookup(component);
             AttributeInstance attributeInstance2 = Db.Get().Attributes.QualityOfLifeExpectation.Lookup(component);
             morale.text = $"{attributeInstance.GetTotalValue()}/{attributeInstance2.GetTotalValue()}";
             RefreshToolTip(component);
             List <IListableOption> list = new List <IListableOption>();
             foreach (KeyValuePair <string, bool> item in component.MasteryBySkillID)
             {
                 if (item.Value)
                 {
                     list.Add(new SkillListable(item.Key));
                 }
             }
             hatDropDown.Initialize(list, OnHatDropEntryClick, hatDropDownSort, hatDropEntryRefreshAction, false, minion);
             empty = ((!string.IsNullOrEmpty(component.TargetHat)) ? component.TargetHat : component.CurrentHat);
         }
         else
         {
             StoredMinionIdentity storedMinionIdentity = minion as StoredMinionIdentity;
             ToolTip component2 = GetComponent <ToolTip>();
             component2.ClearMultiStringTooltip();
             component2.AddMultiStringTooltip(string.Format(UI.TABLESCREENS.INFORMATION_NOT_AVAILABLE_TOOLTIP, storedMinionIdentity.GetStorageReason(), minion.GetProperName()), null);
             empty = ((!string.IsNullOrEmpty(storedMinionIdentity.targetHat)) ? storedMinionIdentity.targetHat : storedMinionIdentity.currentHat);
             masteryPoints.text = UI.TABLESCREENS.NA;
             morale.text        = UI.TABLESCREENS.NA;
         }
         SetColor((skillsScreen.CurrentlySelectedMinion != minion) ? unselected_color : selected_color);
         HierarchyReferences component3 = GetComponent <HierarchyReferences>();
         RefreshHat(empty);
         component3.GetReference("openButton").gameObject.SetActive((Object)minionIdentity != (Object)null);
     }
 }
    private string GetJobTooltip(GameObject go)
    {
        ToolTip component = go.GetComponent <ToolTip>();

        component.ClearMultiStringTooltip();
        OverviewColumnIdentity component2 = go.GetComponent <OverviewColumnIdentity>();

        if (component2.columnID != "AllTasks")
        {
            ChoreGroup choreGroup = Db.Get().ChoreGroups.Get(component2.columnID);
            component.AddMultiStringTooltip(component2.Column_DisplayName, TextStyle_JobTooltip_Title);
            component.AddMultiStringTooltip(choreGroup.description, TextStyle_JobTooltip_Description);
            component.AddMultiStringTooltip("\n", TextStyle_JobTooltip_Description);
            component.AddMultiStringTooltip(UI.TOOLTIPS.JOBSSCREEN_ATTRIBUTES, TextStyle_JobTooltip_Description);
            component.AddMultiStringTooltip("•  " + choreGroup.attribute.Name, TextStyle_JobTooltip_RelevantAttributes);
        }
        return(string.Empty);
    }
    protected void on_tooltip_sort_qualityoflife_expectations(IAssignableIdentity minion, GameObject widget_go, ToolTip tooltip)
    {
        tooltip.ClearMultiStringTooltip();
        TableRow widgetRow = GetWidgetRow(widget_go);

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

        case TableRow.RowType.Minion:
        case TableRow.RowType.StoredMinon:
            break;

        case TableRow.RowType.Header:
            tooltip.AddMultiStringTooltip(UI.TABLESCREENS.COLUMN_SORT_BY_EXPECTATIONS, null);
            break;
        }
    }
    private void AddCheckboxLine(Amount amount, Transform parentContainer, Func <GameObject, string> label_text_func, Func <GameObject, CheckboxLineDisplayType> display_condition, Func <GameObject, bool> checkbox_value_func, Func <GameObject, string> tooltip_func = null)
    {
        GameObject          gameObject = Util.KInstantiateUI(CheckboxLinePrefab, base.gameObject, false);
        HierarchyReferences component  = gameObject.GetComponent <HierarchyReferences>();

        gameObject.GetComponent <ToolTip>().refreshWhileHovering = true;
        gameObject.SetActive(true);
        CheckboxLine item = default(CheckboxLine);

        item.go = gameObject;
        item.parentContainer   = parentContainer;
        item.amount            = amount;
        item.locText           = (component.GetReference("Label") as LocText);
        item.get_value         = checkbox_value_func;
        item.display_condition = display_condition;
        item.label_text_func   = label_text_func;
        item.go.name           = "Checkbox_";
        if (amount != null)
        {
            GameObject go = item.go;
            go.name += amount.Name;
        }
        else
        {
            GameObject go2 = item.go;
            go2.name += "Unnamed";
        }
        if (tooltip_func != null)
        {
            item.tooltip = tooltip_func;
            ToolTip tt = item.go.GetComponent <ToolTip>();
            tt.refreshWhileHovering = true;
            tt.OnToolTip            = delegate
            {
                tt.ClearMultiStringTooltip();
                tt.AddMultiStringTooltip(tooltip_func(selectedEntity), null);
                return(string.Empty);
            };
        }
        checkboxLines.Add(item);
    }
示例#19
0
    private string OnRationsTooltip()
    {
        rationsDict.Clear();
        float calories = RationTracker.Get().CountRations(rationsDict, true);

        RationsText.text = GameUtil.GetFormattedCalories(calories, GameUtil.TimeSlice.None, true);
        RationsTooltip.ClearMultiStringTooltip();
        RationsTooltip.AddMultiStringTooltip(string.Format(UI.TOOLTIPS.METERSCREEN_MEALHISTORY, GameUtil.GetFormattedCalories(calories, GameUtil.TimeSlice.None, true)), ToolTipStyle_Header);
        RationsTooltip.AddMultiStringTooltip(string.Empty, ToolTipStyle_Property);
        IOrderedEnumerable <KeyValuePair <string, float> > source = rationsDict.OrderByDescending(delegate(KeyValuePair <string, float> x)
        {
            EdiblesManager.FoodInfo foodInfo2 = Game.Instance.ediblesManager.GetFoodInfo(x.Key);
            return(x.Value * (foodInfo2?.CaloriesPerUnit ?? (-1f)));
        });
        Dictionary <string, float> dictionary = source.ToDictionary((KeyValuePair <string, float> t) => t.Key, (KeyValuePair <string, float> t) => t.Value);

        foreach (KeyValuePair <string, float> item in dictionary)
        {
            EdiblesManager.FoodInfo foodInfo = Game.Instance.ediblesManager.GetFoodInfo(item.Key);
            RationsTooltip.AddMultiStringTooltip((foodInfo == null) ? string.Format(UI.TOOLTIPS.METERSCREEN_INVALID_FOOD_TYPE, item.Key) : $"{foodInfo.Name}: {GameUtil.GetFormattedCalories(item.Value * foodInfo.CaloriesPerUnit, GameUtil.TimeSlice.None, true)}", ToolTipStyle_Property);
        }
        return(string.Empty);
    }
示例#20
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);
    }
    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 AddNotification(Notification notification)
    {
        notifications.Add(notification);
        notification.Idx = notificationIncrement++;
        Entry entry = null;

        entriesByMessage.TryGetValue(notification.titleText, out entry);
        if (entry == null)
        {
            GameObject label;
            if (notification.Type == NotificationType.Messages)
            {
                label = Util.KInstantiateUI(MessagesPrefab, MessagesFolder, false);
            }
            else
            {
                label = Util.KInstantiateUI(LabelPrefab, LabelsFolder, false);
            }
            label.GetComponentInChildren <NotificationAnimator>().Init();
            label.gameObject.SetActive(true);
            KImage     componentInChildren  = label.GetComponentInChildren <KImage>(true);
            Button[]   componentsInChildren = label.gameObject.GetComponentsInChildren <Button>();
            ColorBlock colors = componentsInChildren[0].colors;
            if (notification.Type == NotificationType.Bad || notification.Type == NotificationType.DuplicantThreatening)
            {
                colors.normalColor = badColorBG;
            }
            else if (notification.Type == NotificationType.Messages)
            {
                colors.normalColor = messageColorBG;
                Debug.Assert(notification.GetType() == typeof(MessageNotification), $"Notification: \"{notification.titleText}\" is not of type MessageNotification");
                componentsInChildren[1].onClick.AddListener(delegate
                {
                    List <Notification> list = notifications.FindAll((Notification n) => n.titleText == notification.titleText);
                    foreach (Notification item in list)
                    {
                        MessageNotification messageNotification = (MessageNotification)item;
                        Messenger.Instance.RemoveMessage(messageNotification.message);
                        messageNotification.Clear();
                    }
                });
            }
            else if (notification.Type == NotificationType.Tutorial)
            {
                colors.normalColor = warningColorBG;
            }
            else
            {
                colors.normalColor = normalColorBG;
            }
            componentsInChildren[0].colors = colors;
            componentsInChildren[0].onClick.AddListener(delegate
            {
                OnClick(entry);
            });
            if (notification.ToolTip != null)
            {
                label.GetComponentInChildren <ToolTip>().OnToolTip = delegate
                {
                    ToolTip componentInChildren2 = label.GetComponentInChildren <ToolTip>();
                    componentInChildren2.ClearMultiStringTooltip();
                    componentInChildren2.AddMultiStringTooltip(notification.ToolTip(entry.notifications, notification.tooltipData), TooltipTextStyle);
                    return(string.Empty);
                };
            }
            entry = new Entry(label);
            entriesByMessage[notification.titleText] = entry;
            entries.Add(entry);
            LocText[] componentsInChildren2 = label.GetComponentsInChildren <LocText>();
            LocText[] array = componentsInChildren2;
            foreach (LocText locText in array)
            {
                switch (notification.Type)
                {
                case NotificationType.Bad:
                    locText.color = badColor;
                    componentInChildren.sprite = icon_bad;
                    break;

                case NotificationType.DuplicantThreatening:
                    locText.color = badColor;
                    componentInChildren.sprite = icon_bad;
                    break;

                case NotificationType.Tutorial:
                    locText.color = warningColor;
                    componentInChildren.sprite = icon_warning;
                    break;

                case NotificationType.Messages:
                    locText.color = messageColor;
                    componentInChildren.sprite = icon_message;
                    break;

                default:
                    locText.color = normalColor;
                    componentInChildren.sprite = icon_normal;
                    break;
                }
                componentInChildren.color = locText.color;
                string str = string.Empty;
                if (KTime.Instance.UnscaledGameTime - initTime > 5f && notification.playSound)
                {
                    PlayDingSound(notification, 0);
                }
                else
                {
                    str = "too early";
                }
                if (AudioDebug.Get().debugNotificationSounds)
                {
                    Debug.Log("Notification(" + notification.titleText + "):" + str);
                }
            }
        }
        entry.Add(notification);
        entry.UpdateMessage(notification, true);
        dirty = true;
        SortNotifications();
    }
    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;
        }
    }
示例#24
0
 public void RefreshBuildingButton(BuildingDef def, KToggle toggle, HashedString buildingCategory)
 {
     if (!((UnityEngine.Object)toggle == (UnityEngine.Object)null))
     {
         if (GetToggleEntryForCategory(buildingCategory, out ToggleEntry toggleEntry) && toggleEntry.pendingResearchAttentions.Contains(def.Tag))
         {
             toggle.GetComponent <PlanCategoryNotifications>().ToggleAttention(true);
         }
         TechItem techItem = Db.Get().TechItems.TryGet(def.PrefabID);
         bool     flag     = TechRequirementsMet(techItem);
         bool     flag2    = TechRequirementsUpcoming(techItem);
         if (toggle.gameObject.activeSelf != flag2)
         {
             toggle.gameObject.SetActive(flag2);
             ConfigurePanelSize();
             SetScrollPoint(0f);
         }
         if (toggle.gameObject.activeInHierarchy && !((UnityEngine.Object)toggle.bgImage == (UnityEngine.Object)null))
         {
             Image  image    = toggle.bgImage.GetComponentsInChildren <Image>()[1];
             Sprite uISprite = def.GetUISprite("ui", false);
             if ((UnityEngine.Object)uISprite == (UnityEngine.Object)null)
             {
                 uISprite = defaultBuildingIconSprite;
             }
             image.sprite = uISprite;
             image.SetNativeSize();
             image.rectTransform().sizeDelta /= 4f;
             ToolTip component = toggle.gameObject.GetComponent <ToolTip>();
             PositionTooltip(toggle, component);
             component.ClearMultiStringTooltip();
             string name   = def.Name;
             string effect = def.Effect;
             component.AddMultiStringTooltip(name, buildingToolTipSettings.BuildButtonName);
             component.AddMultiStringTooltip(effect, buildingToolTipSettings.BuildButtonDescription);
             LocText componentInChildren = toggle.GetComponentInChildren <LocText>();
             if ((UnityEngine.Object)componentInChildren != (UnityEngine.Object)null)
             {
                 componentInChildren.text = def.Name;
             }
             ImageToggleState.State state = (BuildableState(def) == RequirementsState.Complete) ? ImageToggleState.State.Inactive : ImageToggleState.State.Disabled;
             state = ((!((UnityEngine.Object)toggle.gameObject == (UnityEngine.Object)selectedBuildingGameObject) || (BuildableState(def) != RequirementsState.Complete && !DebugHandler.InstantBuildMode && !Game.Instance.SandboxModeActive)) ? ((BuildableState(def) == RequirementsState.Complete || DebugHandler.InstantBuildMode || Game.Instance.SandboxModeActive) ? ImageToggleState.State.Inactive : ImageToggleState.State.Disabled) : ImageToggleState.State.Active);
             if ((UnityEngine.Object)toggle.gameObject == (UnityEngine.Object)selectedBuildingGameObject && state == ImageToggleState.State.Disabled)
             {
                 state = ImageToggleState.State.DisabledActive;
             }
             else if (state == ImageToggleState.State.Disabled)
             {
                 state = ImageToggleState.State.Disabled;
             }
             toggle.GetComponent <ImageToggleState>().SetState(state);
             Material material = (BuildableState(def) != RequirementsState.Complete && !DebugHandler.InstantBuildMode && !Game.Instance.SandboxModeActive) ? desaturatedUIMaterial : defaultUIMaterial;
             if ((UnityEngine.Object)image.material != (UnityEngine.Object)material)
             {
                 image.material = material;
                 if ((UnityEngine.Object)material == (UnityEngine.Object)desaturatedUIMaterial)
                 {
                     if (flag)
                     {
                         image.color = new Color(1f, 1f, 1f, 0.6f);
                     }
                     else
                     {
                         image.color = new Color(1f, 1f, 1f, 0.15f);
                     }
                 }
                 else
                 {
                     image.color = Color.white;
                 }
             }
             Image fgImage = toggle.gameObject.GetComponent <KToggle>().fgImage;
             fgImage.gameObject.SetActive(false);
             if (!flag)
             {
                 fgImage.sprite = Overlay_NeedTech;
                 fgImage.gameObject.SetActive(true);
                 string newString = string.Format(UI.PRODUCTINFO_REQUIRESRESEARCHDESC, techItem.parentTech.Name);
                 component.AddMultiStringTooltip("\n", buildingToolTipSettings.ResearchRequirement);
                 component.AddMultiStringTooltip(newString, buildingToolTipSettings.ResearchRequirement);
             }
             else if (BuildableState(def) != RequirementsState.Complete)
             {
                 fgImage.gameObject.SetActive(false);
                 component.AddMultiStringTooltip("\n", buildingToolTipSettings.ResearchRequirement);
                 string newString2 = UI.PRODUCTINFO_MISSINGRESOURCES_HOVER;
                 component.AddMultiStringTooltip(newString2, buildingToolTipSettings.ResearchRequirement);
                 foreach (Recipe.Ingredient ingredient in def.CraftRecipe.Ingredients)
                 {
                     string newString3 = string.Format("{0}{1}: {2}", "• ", ingredient.tag.ProperName(), GameUtil.GetFormattedMass(ingredient.amount, GameUtil.TimeSlice.None, GameUtil.MetricMassFormat.UseThreshold, true, "{0:0.#}"));
                     component.AddMultiStringTooltip(newString3, buildingToolTipSettings.ResearchRequirement);
                 }
                 component.AddMultiStringTooltip(string.Empty, buildingToolTipSettings.ResearchRequirement);
             }
         }
     }
 }
示例#25
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);
    }
    public void Initialize(ComplexFabricator target)
    {
        if ((Object)target == (Object)null)
        {
            Debug.LogError("ComplexFabricator provided was null.");
        }
        else
        {
            targetFab = target;
            base.gameObject.SetActive(true);
            recipeMap = new Dictionary <GameObject, ComplexRecipe>();
            recipeToggles.ForEach(delegate(GameObject rbi)
            {
                Object.Destroy(rbi.gameObject);
            });
            recipeToggles.Clear();
            GridLayoutGroup component = recipeGrid.GetComponent <GridLayoutGroup>();
            switch (targetFab.sideScreenStyle)
            {
            case StyleSetting.ListResult:
            case StyleSetting.ListInput:
            case StyleSetting.ListInputOutput:
            {
                component.constraintCount = 1;
                GridLayoutGroup gridLayoutGroup2 = component;
                Vector2         cellSize2        = component.cellSize;
                gridLayoutGroup2.cellSize = new Vector2(262f, cellSize2.y);
                break;
            }

            case StyleSetting.ClassicFabricator:
                component.constraintCount       = 128;
                component.cellSize              = new Vector2(78f, 96f);
                buttonScrollContainer.minHeight = 100f;
                break;

            case StyleSetting.ListQueueHybrid:
                component.constraintCount       = 1;
                component.cellSize              = new Vector2(264f, 64f);
                buttonScrollContainer.minHeight = 66f;
                break;

            default:
            {
                component.constraintCount = 3;
                GridLayoutGroup gridLayoutGroup = component;
                Vector2         cellSize        = component.cellSize;
                gridLayoutGroup.cellSize = new Vector2(116f, cellSize.y);
                break;
            }
            }
            int             num     = 0;
            ComplexRecipe[] recipes = targetFab.GetRecipes();
            ComplexRecipe[] array   = recipes;
            foreach (ComplexRecipe recipe in array)
            {
                bool flag = false;
                if (DebugHandler.InstantBuildMode)
                {
                    flag = true;
                }
                else if (recipe.RequiresTechUnlock() && recipe.IsRequiredTechUnlocked())
                {
                    flag = true;
                }
                else if (target.GetRecipeQueueCount(recipe) != 0)
                {
                    flag = true;
                }
                else if (AnyRecipeRequirementsDiscovered(recipe))
                {
                    flag = true;
                }
                else if (HasAnyRecipeRequirements(recipe))
                {
                    flag = true;
                }
                if (flag)
                {
                    num++;
                    Tuple <Sprite, Color> uISprite  = Def.GetUISprite(recipe.ingredients[0].material, "ui", false);
                    Tuple <Sprite, Color> uISprite2 = Def.GetUISprite(recipe.results[0].material, "ui", false);
                    KToggle    newToggle            = null;
                    GameObject entryGO;
                    switch (target.sideScreenStyle)
                    {
                    case StyleSetting.ListInputOutput:
                    case StyleSetting.GridInputOutput:
                    {
                        newToggle = Util.KInstantiateUI <KToggle>(recipeButtonMultiple, recipeGrid, false);
                        entryGO   = newToggle.gameObject;
                        HierarchyReferences           component2  = newToggle.GetComponent <HierarchyReferences>();
                        ComplexRecipe.RecipeElement[] ingredients = recipe.ingredients;
                        foreach (ComplexRecipe.RecipeElement recipeElement in ingredients)
                        {
                            GameObject gameObject = Util.KInstantiateUI(component2.GetReference("FromIconPrefab").gameObject, component2.GetReference("FromIcons").gameObject, true);
                            gameObject.GetComponent <Image>().sprite = Def.GetUISprite(recipeElement.material, "ui", false).first;
                            gameObject.GetComponent <Image>().color  = Def.GetUISprite(recipeElement.material, "ui", false).second;
                            gameObject.gameObject.name = recipeElement.material.Name;
                        }
                        ComplexRecipe.RecipeElement[] results = recipe.results;
                        foreach (ComplexRecipe.RecipeElement recipeElement2 in results)
                        {
                            GameObject gameObject2 = Util.KInstantiateUI(component2.GetReference("ToIconPrefab").gameObject, component2.GetReference("ToIcons").gameObject, true);
                            gameObject2.GetComponent <Image>().sprite = Def.GetUISprite(recipeElement2.material, "ui", false).first;
                            gameObject2.GetComponent <Image>().color  = Def.GetUISprite(recipeElement2.material, "ui", false).second;
                            gameObject2.gameObject.name = recipeElement2.material.Name;
                        }
                        break;
                    }

                    case StyleSetting.ListQueueHybrid:
                    {
                        newToggle = Util.KInstantiateUI <KToggle>(recipeButtonQueueHybrid, recipeGrid, false);
                        entryGO   = newToggle.gameObject;
                        recipeMap.Add(entryGO, recipe);
                        Image image = entryGO.GetComponentsInChildrenOnly <Image>()[2];
                        if (recipe.nameDisplay == ComplexRecipe.RecipeNameDisplay.Ingredient)
                        {
                            image.sprite = uISprite.first;
                            image.color  = uISprite.second;
                        }
                        else
                        {
                            image.sprite = uISprite2.first;
                            image.color  = uISprite2.second;
                        }
                        entryGO.GetComponentInChildren <LocText>().text = recipe.GetUIName();
                        bool flag2 = HasAllRecipeRequirements(recipe);
                        image.material = ((!flag2) ? Assets.UIPrefabs.TableScreenWidgets.DesaturatedUIMaterial : Assets.UIPrefabs.TableScreenWidgets.DefaultUIMaterial);
                        RefreshQueueCountDisplay(entryGO, targetFab);
                        entryGO.GetComponent <HierarchyReferences>().GetReference <MultiToggle>("DecrementButton").onClick = delegate
                        {
                            target.DecrementRecipeQueueCount(recipe, false);
                            RefreshQueueCountDisplay(entryGO, target);
                        };
                        entryGO.GetComponent <HierarchyReferences>().GetReference <MultiToggle>("IncrementButton").onClick = delegate
                        {
                            target.IncrementRecipeQueueCount(recipe);
                            RefreshQueueCountDisplay(entryGO, target);
                        };
                        entryGO.gameObject.SetActive(true);
                        break;
                    }

                    default:
                    {
                        newToggle = Util.KInstantiateUI <KToggle>(recipeButton, recipeGrid, false);
                        entryGO   = newToggle.gameObject;
                        Image componentInChildrenOnly = newToggle.gameObject.GetComponentInChildrenOnly <Image>();
                        if (target.sideScreenStyle == StyleSetting.GridInput || target.sideScreenStyle == StyleSetting.ListInput)
                        {
                            componentInChildrenOnly.sprite = uISprite.first;
                            componentInChildrenOnly.color  = uISprite.second;
                        }
                        else
                        {
                            componentInChildrenOnly.sprite = uISprite2.first;
                            componentInChildrenOnly.color  = uISprite2.second;
                        }
                        break;
                    }
                    }
                    if (targetFab.sideScreenStyle == StyleSetting.ClassicFabricator)
                    {
                        newToggle.GetComponentInChildren <LocText>().text = recipe.results[0].material.ProperName();
                    }
                    else if (targetFab.sideScreenStyle != StyleSetting.ListQueueHybrid)
                    {
                        newToggle.GetComponentInChildren <LocText>().text = string.Format(UI.UISIDESCREENS.REFINERYSIDESCREEN.RECIPE_FROM_TO_WITH_NEWLINES, recipe.ingredients[0].material.ProperName(), recipe.results[0].material.ProperName());
                    }
                    ToolTip component3 = entryGO.GetComponent <ToolTip>();
                    component3.toolTipPosition       = ToolTip.TooltipPosition.Custom;
                    component3.parentPositionAnchor  = new Vector2(0f, 0.5f);
                    component3.tooltipPivot          = new Vector2(1f, 1f);
                    component3.tooltipPositionOffset = new Vector2(-24f, 20f);
                    component3.ClearMultiStringTooltip();
                    component3.AddMultiStringTooltip(recipe.GetUIName(), styleTooltipHeader);
                    component3.AddMultiStringTooltip(recipe.description, styleTooltipBody);
                    newToggle.onClick += delegate
                    {
                        ToggleClicked(newToggle);
                    };
                    entryGO.SetActive(true);
                    recipeToggles.Add(entryGO);
                }
            }
            if (recipeToggles.Count > 0)
            {
                LayoutElement component4 = buttonScrollContainer.GetComponent <LayoutElement>();
                float         num2       = (float)num;
                Vector2       sizeDelta  = recipeButtonQueueHybrid.rectTransform().sizeDelta;
                component4.minHeight = Mathf.Min(451f, 2f + num2 * sizeDelta.y);
                subtitleLabel.SetText(UI.UISIDESCREENS.FABRICATORSIDESCREEN.SUBTITLE);
                noRecipesDiscoveredLabel.gameObject.SetActive(false);
            }
            else
            {
                subtitleLabel.SetText(UI.UISIDESCREENS.FABRICATORSIDESCREEN.NORECIPEDISCOVERED);
                noRecipesDiscoveredLabel.SetText(UI.UISIDESCREENS.FABRICATORSIDESCREEN.NORECIPEDISCOVERED_BODY);
                noRecipesDiscoveredLabel.gameObject.SetActive(true);
                LayoutElement component5 = buttonScrollContainer.GetComponent <LayoutElement>();
                Vector2       sizeDelta2 = noRecipesDiscoveredLabel.rectTransform.sizeDelta;
                component5.minHeight = sizeDelta2.y + 10f;
            }
            RefreshIngredientAvailabilityVis();
        }
    }
 private void ConfigureToolTip(ToolTip tooltip, BuildingDef def)
 {
     tooltip.ClearMultiStringTooltip();
     tooltip.AddMultiStringTooltip(def.Name, buildingToolTipSettings.BuildButtonName);
     tooltip.AddMultiStringTooltip(def.Effect, buildingToolTipSettings.BuildButtonDescription);
 }
 private void RefreshToggle(ToggleInfo info)
 {
     if (info != null && !((UnityEngine.Object)info.toggle == (UnityEngine.Object)null))
     {
         UserData    userData = info.userData as UserData;
         BuildingDef def      = userData.def;
         TechItem    techItem = Db.Get().TechItems.TryGet(def.PrefabID);
         bool        flag     = DebugHandler.InstantBuildMode || techItem == null || techItem.IsComplete();
         bool        flag2    = flag || techItem == null || techItem.parentTech.ArePrerequisitesComplete();
         KToggle     toggle   = info.toggle;
         if (toggle.gameObject.activeSelf != flag2)
         {
             toggle.gameObject.SetActive(flag2);
         }
         if (!((UnityEngine.Object)toggle.bgImage == (UnityEngine.Object)null))
         {
             Image  image  = toggle.bgImage.GetComponentsInChildren <Image>()[1];
             Sprite sprite = image.sprite = def.GetUISprite("ui", false);
             image.SetNativeSize();
             image.rectTransform().sizeDelta /= 4f;
             ToolTip component = toggle.gameObject.GetComponent <ToolTip>();
             component.ClearMultiStringTooltip();
             string text   = def.Name;
             string effect = def.Effect;
             if (def.HotKey != Action.NumActions)
             {
                 text = GameUtil.AppendHotkeyString(text, def.HotKey);
             }
             component.AddMultiStringTooltip(text, buildingToolTipSettings.BuildButtonName);
             component.AddMultiStringTooltip(effect, buildingToolTipSettings.BuildButtonDescription);
             LocText componentInChildren = toggle.GetComponentInChildren <LocText>();
             if ((UnityEngine.Object)componentInChildren != (UnityEngine.Object)null)
             {
                 componentInChildren.text = def.Name;
             }
             PlanScreen.RequirementsState requirementsState = BuildMenu.Instance.BuildableState(def);
             ImageToggleState.State       state             = (requirementsState == PlanScreen.RequirementsState.Complete) ? ImageToggleState.State.Inactive : ImageToggleState.State.Disabled;
             state = ((!((UnityEngine.Object)def == (UnityEngine.Object)selectedBuilding) || (requirementsState != PlanScreen.RequirementsState.Complete && !DebugHandler.InstantBuildMode)) ? ((requirementsState == PlanScreen.RequirementsState.Complete || DebugHandler.InstantBuildMode) ? ImageToggleState.State.Inactive : ImageToggleState.State.Disabled) : ImageToggleState.State.Active);
             if ((UnityEngine.Object)def == (UnityEngine.Object)selectedBuilding && state == ImageToggleState.State.Disabled)
             {
                 state = ImageToggleState.State.DisabledActive;
             }
             else if (state == ImageToggleState.State.Disabled)
             {
                 state = ImageToggleState.State.Disabled;
             }
             toggle.GetComponent <ImageToggleState>().SetState(state);
             Material material;
             Color    color;
             if (requirementsState == PlanScreen.RequirementsState.Complete || DebugHandler.InstantBuildMode)
             {
                 material = defaultUIMaterial;
                 color    = Color.white;
             }
             else
             {
                 material = desaturatedUIMaterial;
                 Color color2;
                 if (flag)
                 {
                     color2 = new Color(1f, 1f, 1f, 0.6f);
                 }
                 else
                 {
                     Color color4 = image.color = new Color(1f, 1f, 1f, 0.15f);
                     color2 = color4;
                 }
                 color = color2;
             }
             if ((UnityEngine.Object)image.material != (UnityEngine.Object)material)
             {
                 image.material = material;
                 image.color    = color;
             }
             Image fgImage = toggle.gameObject.GetComponent <KToggle>().fgImage;
             fgImage.gameObject.SetActive(false);
             if (!flag)
             {
                 fgImage.sprite = Overlay_NeedTech;
                 fgImage.gameObject.SetActive(true);
                 string newString = string.Format(UI.PRODUCTINFO_REQUIRESRESEARCHDESC, techItem.parentTech.Name);
                 component.AddMultiStringTooltip("\n", buildingToolTipSettings.ResearchRequirement);
                 component.AddMultiStringTooltip(newString, buildingToolTipSettings.ResearchRequirement);
             }
             else if (requirementsState != PlanScreen.RequirementsState.Complete)
             {
                 fgImage.gameObject.SetActive(false);
                 component.AddMultiStringTooltip("\n", buildingToolTipSettings.ResearchRequirement);
                 string newString2 = UI.PRODUCTINFO_MISSINGRESOURCES_HOVER;
                 component.AddMultiStringTooltip(newString2, buildingToolTipSettings.ResearchRequirement);
                 foreach (Recipe.Ingredient ingredient in def.CraftRecipe.Ingredients)
                 {
                     string newString3 = string.Format("{0}{1}: {2}", "• ", ingredient.tag.ProperName(), GameUtil.GetFormattedMass(ingredient.amount, GameUtil.TimeSlice.None, GameUtil.MetricMassFormat.UseThreshold, true, "{0:0.#}"));
                     component.AddMultiStringTooltip(newString3, buildingToolTipSettings.ResearchRequirement);
                 }
                 component.AddMultiStringTooltip(string.Empty, buildingToolTipSettings.ResearchRequirement);
             }
         }
     }
 }