public void SetTitle(int selectedTabIndex)
 {
     UpdateCodexButton();
     if ((UnityEngine.Object)TabTitle != (UnityEngine.Object)null)
     {
         TabTitle.SetTitle(target.GetProperName());
         MinionIdentity minionIdentity = null;
         StorageLocker  x = null;
         if ((UnityEngine.Object)target != (UnityEngine.Object)null)
         {
             minionIdentity = target.gameObject.GetComponent <MinionIdentity>();
             x = target.gameObject.GetComponent <StorageLocker>();
         }
         if ((UnityEngine.Object)minionIdentity != (UnityEngine.Object)null)
         {
             TabTitle.SetSubText(minionIdentity.GetComponent <MinionResume>().GetSkillsSubtitle(), string.Empty);
             TabTitle.SetUserEditable(true);
         }
         else if ((UnityEngine.Object)x != (UnityEngine.Object)null)
         {
             TabTitle.SetSubText(string.Empty, string.Empty);
             TabTitle.SetUserEditable(true);
         }
         else
         {
             TabTitle.SetSubText(string.Empty, string.Empty);
             TabTitle.SetUserEditable(false);
         }
     }
 }
예제 #2
0
        static void Postfix(int selectedTabIndex, DetailsScreen __instance, EditableTitleBar ___TabTitle)
        {
            GameObject target = __instance.target;
            KPrefabID  prefab = target?.GetComponent <KPrefabID>();

            if (prefab != null && prefab.HasTag(GameTags.Creature))
            {
                ___TabTitle.SetUserEditable(true);

                string properName = UI.StripLinkFormatting(target.GetProperName());

                ___TabTitle.SetTitle(properName);
                ___TabTitle.SetSubText("");

                string originalProperName = TagManager.GetProperName(prefab.PrefabTag, stripLink: true);
                if (properName != originalProperName)
                {
                    ___TabTitle.SetSubText(originalProperName);
                }
            }
        }
예제 #3
0
    public void Setup(Schedule schedule, Dictionary <string, ColorStyleSetting> paintStyles, Action <ScheduleScreenEntry, float> onPaintDragged)
    {
        this.schedule        = schedule;
        base.gameObject.name = "Schedule_" + schedule.name;
        title.SetTitle(schedule.name);
        title.OnNameChanged += OnNameChanged;
        blockButtonContainer.Setup(delegate(float f)
        {
            onPaintDragged(this, f);
        });
        int num = 0;

        blockButtons = new List <ScheduleBlockButton>();
        List <ScheduleBlock> blocks = schedule.GetBlocks();
        int count = blocks.Count;

        foreach (ScheduleBlock block in schedule.GetBlocks())
        {
            ScheduleBlockButton scheduleBlockButton = Util.KInstantiateUI <ScheduleBlockButton>(blockButtonPrefab.gameObject, blockButtonContainer.gameObject, true);
            scheduleBlockButton.Setup(num++, paintStyles, count);
            scheduleBlockButton.SetBlockTypes(block.allowed_types);
            blockButtons.Add(scheduleBlockButton);
        }
        minionWidgets     = new List <ScheduleMinionWidget>();
        blankMinionWidget = Util.KInstantiateUI <ScheduleMinionWidget>(minionWidgetPrefab.gameObject, minionWidgetContainer, false);
        blankMinionWidget.SetupBlank(schedule);
        RebuildMinionWidgets();
        RefreshNotes();
        RefreshAlarmButton();
        optionsButton.onClick += OnOptionsClicked;
        HierarchyReferences component = optionsPanel.GetComponent <HierarchyReferences>();
        MultiToggle         reference = component.GetReference <MultiToggle>("AlarmButton");

        reference.onClick = (System.Action)Delegate.Combine(reference.onClick, new System.Action(OnAlarmClicked));
        component.GetReference <KButton>("ResetButton").onClick  += OnResetClicked;
        component.GetReference <KButton>("DeleteButton").onClick += OnDeleteClicked;
        schedule.onChanged = (Action <Schedule>)Delegate.Combine(schedule.onChanged, new Action <Schedule>(OnScheduleChanged));
    }
예제 #4
0
    private void SetInfoText()
    {
        traitEntries.ForEach(delegate(GameObject tl)
        {
            UnityEngine.Object.Destroy(tl.gameObject);
        });
        traitEntries.Clear();
        characterNameTitle.SetTitle(stats.Name);
        for (int i = 1; i < stats.Traits.Count; i++)
        {
            Trait   trait    = stats.Traits[i];
            LocText locText  = (!trait.PositiveTrait) ? badTrait : goodTrait;
            LocText locText2 = Util.KInstantiateUI <LocText>(locText.gameObject, locText.transform.parent.gameObject, false);
            locText2.gameObject.SetActive(true);
            locText2.text  = stats.Traits[i].Name;
            locText2.color = ((!trait.PositiveTrait) ? Constants.NEGATIVE_COLOR : Constants.POSITIVE_COLOR);
            locText2.GetComponent <ToolTip>().SetSimpleTooltip(trait.description);
            for (int num = 0; num < trait.SelfModifiers.Count; num++)
            {
                GameObject gameObject = Util.KInstantiateUI(attributeLabelTrait.gameObject, locText.transform.parent.gameObject, false);
                gameObject.SetActive(true);
                LocText componentInChildren = gameObject.GetComponentInChildren <LocText>();
                string  format = (!(trait.SelfModifiers[num].Value > 0f)) ? UI.CHARACTERCONTAINER_ATTRIBUTEMODIFIER_DECREASED : UI.CHARACTERCONTAINER_ATTRIBUTEMODIFIER_INCREASED;
                componentInChildren.text = string.Format(format, Strings.Get("STRINGS.DUPLICANTS.ATTRIBUTES." + trait.SelfModifiers[num].AttributeId.ToUpper() + ".NAME"));
                if (!(trait.SelfModifiers[num].AttributeId == "GermResistance"))
                {
                    goto IL_01bd;
                }
                goto IL_01bd;
IL_01bd:
                Klei.AI.Attribute attribute = Db.Get().Attributes.Get(trait.SelfModifiers[num].AttributeId);
                string text  = attribute.Description;
                string text2 = text;
                text = text2 + "\n\n" + Strings.Get("STRINGS.DUPLICANTS.ATTRIBUTES." + trait.SelfModifiers[num].AttributeId.ToUpper() + ".NAME") + ": " + trait.SelfModifiers[num].GetFormattedString(null);
                List <AttributeConverter> convertersForAttribute = Db.Get().AttributeConverters.GetConvertersForAttribute(attribute);
                for (int j = 0; j < convertersForAttribute.Count; j++)
                {
                    string text3 = convertersForAttribute[j].DescriptionFromAttribute(convertersForAttribute[j].multiplier * trait.SelfModifiers[num].Value, null);
                    if (text3 != string.Empty)
                    {
                        text = text + "\n    • " + text3;
                    }
                }
                componentInChildren.GetComponent <ToolTip>().SetSimpleTooltip(text);
                traitEntries.Add(gameObject);
            }
            if (trait.disabledChoreGroups != null)
            {
                GameObject gameObject2 = Util.KInstantiateUI(attributeLabelTrait.gameObject, locText.transform.parent.gameObject, false);
                gameObject2.SetActive(true);
                LocText componentInChildren2 = gameObject2.GetComponentInChildren <LocText>();
                componentInChildren2.text = trait.GetDisabledChoresString(false);
                string text4 = string.Empty;
                string text5 = string.Empty;
                for (int k = 0; k < trait.disabledChoreGroups.Length; k++)
                {
                    if (k > 0)
                    {
                        text4 += ", ";
                        text5 += "\n";
                    }
                    text4 += trait.disabledChoreGroups[k].Name;
                    text5 += trait.disabledChoreGroups[k].description;
                }
                componentInChildren2.GetComponent <ToolTip>().SetSimpleTooltip(string.Format(DUPLICANTS.TRAITS.CANNOT_DO_TASK_TOOLTIP, text4, text5));
                traitEntries.Add(gameObject2);
            }
            if (trait.ignoredEffects != null && trait.ignoredEffects.Length > 0)
            {
                GameObject gameObject3 = Util.KInstantiateUI(attributeLabelTrait.gameObject, locText.transform.parent.gameObject, false);
                gameObject3.SetActive(true);
                LocText componentInChildren3 = gameObject3.GetComponentInChildren <LocText>();
                componentInChildren3.text = trait.GetIgnoredEffectsString(false);
                string text6 = string.Empty;
                string text7 = string.Empty;
                for (int l = 0; l < trait.ignoredEffects.Length; l++)
                {
                    if (l > 0)
                    {
                        text6 += ", ";
                        text7 += "\n";
                    }
                    text6 += Strings.Get("STRINGS.DUPLICANTS.MODIFIERS." + trait.ignoredEffects[l].ToUpper() + ".NAME");
                    text7 += Strings.Get("STRINGS.DUPLICANTS.MODIFIERS." + trait.ignoredEffects[l].ToUpper() + ".CAUSE");
                }
                componentInChildren3.GetComponent <ToolTip>().SetSimpleTooltip(string.Format(DUPLICANTS.TRAITS.IGNORED_EFFECTS_TOOLTIP, text6, text7));
                traitEntries.Add(gameObject3);
            }
            if (Strings.TryGet("STRINGS.DUPLICANTS.TRAITS." + trait.Id.ToUpper() + ".SHORT_DESC", out StringEntry result))
            {
                GameObject gameObject4 = Util.KInstantiateUI(attributeLabelTrait.gameObject, locText.transform.parent.gameObject, false);
                gameObject4.SetActive(true);
                LocText componentInChildren4 = gameObject4.GetComponentInChildren <LocText>();
                componentInChildren4.text = result.String;
                componentInChildren4.GetComponent <ToolTip>().SetSimpleTooltip(Strings.Get("STRINGS.DUPLICANTS.TRAITS." + trait.Id.ToUpper() + ".SHORT_DESC_TOOLTIP"));
                traitEntries.Add(gameObject4);
            }
            traitEntries.Add(locText2.gameObject);
        }
        aptitudeEntries.ForEach(delegate(GameObject al)
        {
            UnityEngine.Object.Destroy(al.gameObject);
        });
        aptitudeEntries.Clear();
        expectationLabels.ForEach(delegate(LocText el)
        {
            UnityEngine.Object.Destroy(el.gameObject);
        });
        expectationLabels.Clear();
        foreach (KeyValuePair <SkillGroup, float> skillAptitude in stats.skillAptitudes)
        {
            if (skillAptitude.Value != 0f)
            {
                SkillGroup skillGroup = Db.Get().SkillGroups.Get(skillAptitude.Key.IdHash);
                if (skillGroup == null)
                {
                    Debug.LogWarningFormat("Role group not found for aptitude: {0}", skillAptitude.Key);
                }
                else
                {
                    GameObject gameObject5 = Util.KInstantiateUI(aptitudeEntry.gameObject, aptitudeEntry.transform.parent.gameObject, false);
                    LocText    locText3    = Util.KInstantiateUI <LocText>(aptitudeLabel.gameObject, gameObject5, false);
                    locText3.gameObject.SetActive(true);
                    locText3.text = skillGroup.Name;
                    string empty = string.Empty;
                    if (skillGroup.choreGroupID != string.Empty)
                    {
                        ChoreGroup choreGroup = Db.Get().ChoreGroups.Get(skillGroup.choreGroupID);
                        empty = string.Format(DUPLICANTS.ROLES.GROUPS.APTITUDE_DESCRIPTION_CHOREGROUP, skillGroup.Name, DUPLICANTSTATS.APTITUDE_BONUS, choreGroup.description);
                    }
                    else
                    {
                        empty = string.Format(DUPLICANTS.ROLES.GROUPS.APTITUDE_DESCRIPTION, skillGroup.Name, DUPLICANTSTATS.APTITUDE_BONUS);
                    }
                    locText3.GetComponent <ToolTip>().SetSimpleTooltip(empty);
                    float   num2     = (float)DUPLICANTSTATS.APTITUDE_ATTRIBUTE_BONUSES[stats.skillAptitudes.Count - 1];
                    LocText locText4 = Util.KInstantiateUI <LocText>(attributeLabelAptitude.gameObject, gameObject5, false);
                    locText4.gameObject.SetActive(true);
                    locText4.text = "+" + num2 + " " + skillAptitude.Key.relevantAttributes[0].Name;
                    string text8 = skillAptitude.Key.relevantAttributes[0].Description;
                    string text2 = text8;
                    text8 = text2 + "\n\n" + skillAptitude.Key.relevantAttributes[0].Name + ": +" + DUPLICANTSTATS.APTITUDE_ATTRIBUTE_BONUSES[stats.skillAptitudes.Count - 1];
                    List <AttributeConverter> convertersForAttribute2 = Db.Get().AttributeConverters.GetConvertersForAttribute(skillAptitude.Key.relevantAttributes[0]);
                    for (int m = 0; m < convertersForAttribute2.Count; m++)
                    {
                        text8 = text8 + "\n    • " + convertersForAttribute2[m].DescriptionFromAttribute(convertersForAttribute2[m].multiplier * num2, null);
                    }
                    locText4.GetComponent <ToolTip>().SetSimpleTooltip(text8);
                    gameObject5.gameObject.SetActive(true);
                    aptitudeEntries.Add(gameObject5);
                }
            }
        }
        if (stats.stressTrait != null)
        {
            LocText locText5 = Util.KInstantiateUI <LocText>(expectationRight.gameObject, expectationRight.transform.parent.gameObject, false);
            locText5.gameObject.SetActive(true);
            locText5.text = string.Format(UI.CHARACTERCONTAINER_STRESSTRAIT, stats.stressTrait.Name);
            locText5.GetComponent <ToolTip>().SetSimpleTooltip(stats.stressTrait.GetTooltip());
            expectationLabels.Add(locText5);
        }
        if (stats.congenitaltrait != null)
        {
            LocText locText6 = Util.KInstantiateUI <LocText>(expectationRight.gameObject, expectationRight.transform.parent.gameObject, false);
            locText6.gameObject.SetActive(true);
            locText6.text = string.Format(UI.CHARACTERCONTAINER_CONGENITALTRAIT, stats.congenitaltrait.Name);
            locText6.GetComponent <ToolTip>().SetSimpleTooltip(stats.congenitaltrait.GetTooltip());
            expectationLabels.Add(locText6);
        }
        description.text = stats.personality.description;
    }