예제 #1
0
 private void RefreshHat()
 {
     if (currentlySelectedMinion != null && !currentlySelectedMinion.IsNull())
     {
         List <IListableOption> list   = new List <IListableOption>();
         string         empty          = string.Empty;
         MinionIdentity minionIdentity = currentlySelectedMinion as MinionIdentity;
         if ((UnityEngine.Object)minionIdentity != (UnityEngine.Object)null)
         {
             MinionResume component = minionIdentity.GetComponent <MinionResume>();
             empty = ((!string.IsNullOrEmpty(component.TargetHat)) ? component.TargetHat : component.CurrentHat);
             foreach (KeyValuePair <string, bool> item in component.MasteryBySkillID)
             {
                 if (item.Value)
                 {
                     list.Add(new SkillListable(item.Key));
                 }
             }
             hatDropDown.Initialize(list, OnHatDropEntryClick, hatDropDownSort, hatDropEntryRefreshAction, false, currentlySelectedMinion);
         }
         else
         {
             StoredMinionIdentity storedMinionIdentity = currentlySelectedMinion as StoredMinionIdentity;
             empty = ((!string.IsNullOrEmpty(storedMinionIdentity.targetHat)) ? storedMinionIdentity.targetHat : storedMinionIdentity.currentHat);
         }
         hatDropDown.openButton.enabled = ((UnityEngine.Object)minionIdentity != (UnityEngine.Object)null);
         selectedHat.transform.Find("Arrow").gameObject.SetActive((UnityEngine.Object)minionIdentity != (UnityEngine.Object)null);
         selectedHat.sprite = Assets.GetSprite((!string.IsNullOrEmpty(empty)) ? empty : "hat_role_none");
     }
 }
예제 #2
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);
             }
         }
     }
 }
예제 #3
0
    private void RefreshBio()
    {
        MinionIdentity component = selectedTarget.GetComponent <MinionIdentity>();

        if (!(bool)component)
        {
            bioPanel.SetActive(false);
        }
        else
        {
            bioPanel.SetActive(true);
            bioPanel.GetComponent <CollapsibleDetailContentPanel>().HeaderLabel.text = UI.DETAILTABS.PERSONALITY.GROUPNAME_BIO;
            bioDrawer.BeginDrawing().NewLabel(DUPLICANTS.NAMETITLE + component.name).NewLabel((string)DUPLICANTS.ARRIVALTIME + ((float)GameClock.Instance.GetCycle() - component.arrivalTime) + " Cycles")
            .Tooltip(string.Format(DUPLICANTS.ARRIVALTIME_TOOLTIP, component.arrivalTime, component.name))
            .NewLabel(DUPLICANTS.GENDERTITLE + string.Format(Strings.Get($"STRINGS.DUPLICANTS.GENDER.{component.genderStringKey.ToUpper()}.NAME"), component.gender))
            .NewLabel(string.Format(Strings.Get($"STRINGS.DUPLICANTS.PERSONALITIES.{component.nameStringKey.ToUpper()}.DESC"), component.name))
            .Tooltip(string.Format(Strings.Get(string.Format("STRINGS.DUPLICANTS.DESC_TOOLTIP", component.nameStringKey.ToUpper())), component.name));
            MinionResume component2 = selectedTarget.GetComponent <MinionResume>();
            if ((Object)component2 != (Object)null && component2.AptitudeBySkillGroup.Count > 0)
            {
                bioDrawer.NewLabel(UI.DETAILTABS.PERSONALITY.RESUME.APTITUDES.NAME + "\n").Tooltip(string.Format(UI.DETAILTABS.PERSONALITY.RESUME.APTITUDES.TOOLTIP, selectedTarget.name));
                foreach (KeyValuePair <HashedString, float> item in component2.AptitudeBySkillGroup)
                {
                    if (item.Value != 0f)
                    {
                        SkillGroup skillGroup = Db.Get().SkillGroups.Get(item.Key);
                        bioDrawer.NewLabel("  • " + skillGroup.Name).Tooltip(string.Format(DUPLICANTS.ROLES.GROUPS.APTITUDE_DESCRIPTION, skillGroup.Name, item.Value));
                    }
                }
            }
            bioDrawer.EndDrawing();
        }
    }
예제 #4
0
 public void Sim1000ms(float dt)
 {
     if (!((UnityEngine.Object) this == (UnityEngine.Object)null))
     {
         if ((UnityEngine.Object)navigator == (UnityEngine.Object)null)
         {
             navigator = GetComponent <Navigator>();
         }
         if (!((UnityEngine.Object)navigator != (UnityEngine.Object)null) || navigator.IsMoving())
         {
             if ((UnityEngine.Object)choreDriver == (UnityEngine.Object)null)
             {
                 choreDriver = GetComponent <ChoreDriver>();
             }
             if ((UnityEngine.Object)choreDriver != (UnityEngine.Object)null)
             {
                 Chore currentChore = choreDriver.GetCurrentChore();
                 if (currentChore != null && currentChore is FetchAreaChore)
                 {
                     MinionResume component = GetComponent <MinionResume>();
                     if ((UnityEngine.Object)component != (UnityEngine.Object)null)
                     {
                         component.AddExperienceWithAptitude(Db.Get().SkillGroups.Hauling.Id, dt, SKILLS.ALL_DAY_EXPERIENCE);
                     }
                 }
             }
         }
     }
 }
예제 #5
0
    private void SortByExperience()
    {
        SelectSortToggle(experienceSortingToggle);
        List <SkillMinionWidget> list = minionWidgets;

        list.Sort(delegate(SkillMinionWidget a, SkillMinionWidget b)
        {
            MinionIdentity minionIdentity  = a.minion as MinionIdentity;
            MinionIdentity minionIdentity2 = b.minion as MinionIdentity;
            if ((UnityEngine.Object)minionIdentity == (UnityEngine.Object)null && (UnityEngine.Object)minionIdentity2 == (UnityEngine.Object)null)
            {
                return(0);
            }
            if ((UnityEngine.Object)minionIdentity == (UnityEngine.Object)null)
            {
                return(-1);
            }
            if ((UnityEngine.Object)minionIdentity2 == (UnityEngine.Object)null)
            {
                return(1);
            }
            MinionResume component  = minionIdentity.GetComponent <MinionResume>();
            MinionResume component2 = minionIdentity2.GetComponent <MinionResume>();
            float num   = (float)(component.AvailableSkillpoints / (component.TotalSkillPointsGained + 1));
            float value = (float)(component2.AvailableSkillpoints / (component2.TotalSkillPointsGained + 1));
            return(num.CompareTo(value));
        });
        ReorderEntries(list, sortReversed);
    }
    private void UpdateSkillPointAvailableStatusItem(object data = null)
    {
        IEnumerator enumerator = Components.MinionResumes.GetEnumerator();

        try
        {
            while (enumerator.MoveNext())
            {
                MinionResume minionResume = (MinionResume)enumerator.Current;
                if (minionResume.TotalSkillPointsGained - minionResume.SkillsMastered > 0)
                {
                    if (skillPointAvailableStatusItem == Guid.Empty)
                    {
                        skillPointAvailableStatusItem = GetComponent <KSelectable>().AddStatusItem(Db.Get().BuildingStatusItems.SkillPointsAvailable, null);
                    }
                    return;
                }
            }
        }
        finally
        {
            IDisposable disposable;
            if ((disposable = (enumerator as IDisposable)) != null)
            {
                disposable.Dispose();
            }
        }
        GetComponent <KSelectable>().RemoveStatusItem(Db.Get().BuildingStatusItems.SkillPointsAvailable, false);
        skillPointAvailableStatusItem = Guid.Empty;
    }
예제 #7
0
    private void SortByMorale()
    {
        SelectSortToggle(moraleSortingToggle);
        List <SkillMinionWidget> list = minionWidgets;

        list.Sort(delegate(SkillMinionWidget a, SkillMinionWidget b)
        {
            MinionIdentity minionIdentity  = a.minion as MinionIdentity;
            MinionIdentity minionIdentity2 = b.minion as MinionIdentity;
            if ((UnityEngine.Object)minionIdentity == (UnityEngine.Object)null && (UnityEngine.Object)minionIdentity2 == (UnityEngine.Object)null)
            {
                return(0);
            }
            if ((UnityEngine.Object)minionIdentity == (UnityEngine.Object)null)
            {
                return(-1);
            }
            if ((UnityEngine.Object)minionIdentity2 == (UnityEngine.Object)null)
            {
                return(1);
            }
            MinionResume component               = minionIdentity.GetComponent <MinionResume>();
            MinionResume component2              = minionIdentity2.GetComponent <MinionResume>();
            AttributeInstance attributeInstance  = Db.Get().Attributes.QualityOfLife.Lookup(component);
            AttributeInstance attributeInstance2 = Db.Get().Attributes.QualityOfLifeExpectation.Lookup(component);
            AttributeInstance attributeInstance3 = Db.Get().Attributes.QualityOfLife.Lookup(component2);
            AttributeInstance attributeInstance4 = Db.Get().Attributes.QualityOfLifeExpectation.Lookup(component2);
            float num   = attributeInstance.GetTotalValue() / attributeInstance2.GetTotalValue();
            float value = attributeInstance3.GetTotalValue() / attributeInstance4.GetTotalValue();
            return(num.CompareTo(value));
        });
        ReorderEntries(list, sortReversed);
    }
 public void SetActiveResearch(Tech tech, bool clearQueue = false)
 {
     if (clearQueue)
     {
         queuedTech.Clear();
     }
     activeResearch = null;
     if (tech != null)
     {
         if (queuedTech.Count == 0)
         {
             AddTechToQueue(tech);
         }
         if (queuedTech.Count > 0)
         {
             queuedTech.Sort((TechInstance x, TechInstance y) => x.tech.tier.CompareTo(y.tech.tier));
             activeResearch = queuedTech[0];
         }
     }
     else
     {
         queuedTech.Clear();
     }
     Trigger(-1914338957, queuedTech);
     CheckBuyResearch();
     CheckResearchBuildings(null);
     if (activeResearch != null)
     {
         if (activeResearch.tech.costsByResearchTypeID.Count > 1)
         {
             if (!MinionResume.AnyMinionHasPerk(Db.Get().SkillPerks.AllowAdvancedResearch.Id))
             {
                 notifier.Remove(NoResearcherRole);
                 notifier.Add(NoResearcherRole, string.Empty);
             }
         }
         else
         {
             notifier.Remove(NoResearcherRole);
         }
         if (activeResearch.tech.costsByResearchTypeID.Count > 2)
         {
             if (!MinionResume.AnyMinionHasPerk(Db.Get().SkillPerks.AllowInterstellarResearch.Id))
             {
                 notifier.Remove(NoResearcherRole);
                 notifier.Add(NoResearcherRole, string.Empty);
             }
         }
         else
         {
             notifier.Remove(NoResearcherRole);
         }
     }
     else
     {
         notifier.Remove(NoResearcherRole);
     }
 }
    public void ApplyAptitudes(GameObject go)
    {
        MinionResume component = go.GetComponent <MinionResume>();

        foreach (KeyValuePair <SkillGroup, float> skillAptitude in skillAptitudes)
        {
            component.SetAptitude(skillAptitude.Key.Id, skillAptitude.Value);
        }
    }
예제 #10
0
 public override void OnCleanUp()
 {
     modifiers = null;
     panel     = null;
     resume    = null;
     target    = null;
     instance  = null;
     base.OnCleanUp();
 }
예제 #11
0
    public override HashedString GetWorkPstAnim(Worker worker, bool successfully_completed)
    {
        MinionResume component = worker.GetComponent <MinionResume>();

        if ((Object)GetComponent <Building>() != (Object)null && (Object)component != (Object)null && component.CurrentHat != null)
        {
            return(hatWorkPstAnim);
        }
        return(normalWorkPstAnim);
    }
예제 #12
0
    public override HashedString[] GetWorkAnims(Worker worker)
    {
        MinionResume component = worker.GetComponent <MinionResume>();

        if ((Object)GetComponent <Building>() != (Object)null && (Object)component != (Object)null && component.CurrentHat != null)
        {
            return(hatWorkAnims);
        }
        return(normalWorkAnims);
    }
예제 #13
0
    public override HashedString[] GetWorkAnims(Worker worker)
    {
        bool         flag      = worker.GetSMI <EatChore.StatesInstance>()?.UseSalt() ?? false;
        MinionResume component = worker.GetComponent <MinionResume>();

        if ((Object)component != (Object)null && component.CurrentHat != null)
        {
            return((!flag) ? hatWorkAnims : saltHatWorkAnims);
        }
        return((!flag) ? normalWorkAnims : saltWorkAnims);
    }
예제 #14
0
 public static bool AnyOtherMinionHasPerk(string perk, MinionResume me)
 {
     foreach (MinionResume item in Components.MinionResumes.Items)
     {
         if (!((UnityEngine.Object)item == (UnityEngine.Object)me) && item.HasPerk(perk))
         {
             return(true);
         }
     }
     return(false);
 }
예제 #15
0
    public override HashedString GetWorkPstAnim(Worker worker, bool successfully_completed)
    {
        bool         flag      = worker.GetSMI <EatChore.StatesInstance>()?.UseSalt() ?? false;
        MinionResume component = worker.GetComponent <MinionResume>();

        if ((Object)component != (Object)null && component.CurrentHat != null)
        {
            return((!flag) ? hatWorkPstAnim : saltHatWorkPstAnim);
        }
        return((!flag) ? normalWorkPstAnim : saltWorkPstAnim);
    }
 public bool IsDoctorAvailable(GameObject target)
 {
     if (!string.IsNullOrEmpty(doctor_workable.requiredSkillPerk))
     {
         MinionResume component = target.GetComponent <MinionResume>();
         if (!MinionResume.AnyOtherMinionHasPerk(doctor_workable.requiredSkillPerk, component))
         {
             return(false);
         }
     }
     return(true);
 }
 public int GetTotalSkillpoints()
 {
     if ((Object)GetTargetGameObject().GetComponent <MinionIdentity>() != (Object)null)
     {
         return(GetTargetGameObject().GetComponent <MinionResume>().TotalSkillPointsGained);
     }
     if ((Object)GetTargetGameObject().GetComponent <StoredMinionIdentity>() != (Object)null)
     {
         return(MinionResume.CalculateTotalSkillPointsGained(GetTargetGameObject().GetComponent <StoredMinionIdentity>().TotalExperienceGained));
     }
     Debug.LogError("Could not get minion skill points time");
     return(-1);
 }
예제 #18
0
    protected override void OnCompleteWork(Worker worker)
    {
        Status       artist_skill = Status.Ugly;
        MinionResume component    = worker.GetComponent <MinionResume>();

        if ((UnityEngine.Object)component != (UnityEngine.Object)null)
        {
            if (component.HasPerk(Db.Get().SkillPerks.CanArtGreat.Id))
            {
                artist_skill = Status.Great;
            }
            else if (component.HasPerk(Db.Get().SkillPerks.CanArtOkay.Id))
            {
                artist_skill = Status.Okay;
            }
        }
        List <Stage> potential_stages = new List <Stage>();

        stages.ForEach(delegate(Stage item)
        {
            potential_stages.Add(item);
        });
        potential_stages.RemoveAll((Stage x) => x.statusItem > artist_skill || x.id == "Default");
        potential_stages.Sort((Stage x, Stage y) => y.statusItem.CompareTo(x.statusItem));
        Status highest_status = potential_stages[0].statusItem;

        potential_stages.RemoveAll((Stage x) => x.statusItem < highest_status);
        potential_stages.Shuffle();
        SetStage(potential_stages[0].id, false);
        if (potential_stages[0].cheerOnComplete)
        {
            new EmoteChore(worker.GetComponent <ChoreProvider>(), Db.Get().ChoreTypes.EmoteHighPriority, "anim_cheer_kanim", new HashedString[3]
            {
                "cheer_pre",
                "cheer_loop",
                "cheer_pst"
            }, null);
        }
        else
        {
            new EmoteChore(worker.GetComponent <ChoreProvider>(), Db.Get().ChoreTypes.EmoteHighPriority, "anim_disappointed_kanim", new HashedString[3]
            {
                "disappointed_pre",
                "disappointed_loop",
                "disappointed_pst"
            }, null);
        }
        shouldShowSkillPerkStatusItem = false;
        UpdateStatusItem(null);
        Prioritizable.RemoveRef(base.gameObject);
    }
 public static float GetTrueDurability(this Durability @this, MinionResume resume = null)
 {
     if (isEquipped.Get(@this))
     {
         float delta = GameClock.Instance.GetTimeInCycles() - @this.TimeEquipped;
         delta *= @this.durabilityLossPerCycle * difficultySettingMod.Get(@this);
         if (resume != null && resume.HasPerk(Db.Get().SkillPerks.ExosuitDurability.Id))
         {
             delta *= 1f - EQUIPMENT.SUITS.SUIT_DURABILITY_SKILL_BONUS;
         }
         return(Mathf.Clamp01(durability.Get(@this) + delta));
     }
     return(durability.Get(@this));
 }
예제 #20
0
    protected override void OnCompleteWork(Worker worker)
    {
        base.OnCompleteWork(worker);
        assignable.Unassign();
        MinionResume component = worker.GetComponent <MinionResume>();

        if ((Object)component != (Object)null)
        {
            component.ResetSkillLevels(true);
            component.SetHats(component.CurrentHat, null);
            component.ApplyTargetHat();
            notification = new Notification(MISC.NOTIFICATIONS.RESETSKILL.NAME, NotificationType.Good, HashedString.Invalid, (List <Notification> notificationList, object data) => MISC.NOTIFICATIONS.RESETSKILL.TOOLTIP + notificationList.ReduceMessages(false), null, true, 0f, null, null, null);
            worker.GetComponent <Notifier>().Add(notification, string.Empty);
        }
    }
예제 #21
0
    private void CopyMinion(MinionIdentity src_id, StoredMinionIdentity dest_id)
    {
        dest_id.storedName      = src_id.name;
        dest_id.nameStringKey   = src_id.nameStringKey;
        dest_id.gender          = src_id.gender;
        dest_id.genderStringKey = src_id.genderStringKey;
        dest_id.arrivalTime     = src_id.arrivalTime;
        dest_id.voiceIdx        = src_id.voiceIdx;
        dest_id.bodyData        = src_id.bodyData;
        Traits component = src_id.GetComponent <Traits>();

        dest_id.traitIDs = new List <string>(component.GetTraitIds());
        dest_id.assignableProxy.Set(src_id.assignableProxy.Get());
        dest_id.assignableProxy.Get().SetTarget(dest_id, dest_id.gameObject);
        Accessorizer component2 = src_id.GetComponent <Accessorizer>();

        dest_id.accessories = component2.GetAccessories();
        ConsumableConsumer component3 = src_id.GetComponent <ConsumableConsumer>();

        if (component3.forbiddenTags != null)
        {
            dest_id.forbiddenTags = new List <Tag>(component3.forbiddenTags);
        }
        MinionResume component4 = src_id.GetComponent <MinionResume>();

        dest_id.MasteryBySkillID      = component4.MasteryBySkillID;
        dest_id.AptitudeBySkillGroup  = component4.AptitudeBySkillGroup;
        dest_id.TotalExperienceGained = component4.TotalExperienceGained;
        dest_id.currentHat            = component4.CurrentHat;
        dest_id.targetHat             = component4.TargetHat;
        ChoreConsumer component5 = src_id.GetComponent <ChoreConsumer>();

        dest_id.choreGroupPriorities = component5.GetChoreGroupPriorities();
        AttributeLevels component6 = src_id.GetComponent <AttributeLevels>();

        component6.OnSerializing();
        dest_id.attributeLevels = new List <AttributeLevels.LevelSaveLoad>(component6.SaveLoadLevels);
        StoreModifiers(src_id, dest_id);
        Schedulable component7 = src_id.GetComponent <Schedulable>();
        Schedule    schedule   = component7.GetSchedule();

        if (schedule != null)
        {
            schedule.Unassign(component7);
            Schedulable component8 = dest_id.GetComponent <Schedulable>();
            schedule.Assign(component8);
        }
    }
    private static void RefreshHat(IAssignableIdentity identityObject, KBatchedAnimController controller)
    {
        string         hat_id         = string.Empty;
        MinionIdentity minionIdentity = identityObject as MinionIdentity;

        if ((UnityEngine.Object)minionIdentity != (UnityEngine.Object)null)
        {
            MinionResume component = minionIdentity.GetComponent <MinionResume>();
            hat_id = component.CurrentHat;
        }
        else if ((UnityEngine.Object)(identityObject as StoredMinionIdentity) != (UnityEngine.Object)null)
        {
            hat_id = (identityObject as StoredMinionIdentity).currentHat;
        }
        MinionResume.ApplyHat(hat_id, controller);
    }
예제 #23
0
    public void OnPointerDown(PointerEventData eventData)
    {
        MinionIdentity minionIdentity = skillsScreen.CurrentlySelectedMinion as MinionIdentity;
        MinionResume   component      = minionIdentity.GetComponent <MinionResume>();

        MinionResume.SkillMasteryConditions[] skillMasteryConditions = component.GetSkillMasteryConditions(skillID);
        bool flag = component.CanMasterSkill(skillMasteryConditions);

        if ((UnityEngine.Object)component != (UnityEngine.Object)null && !component.HasMasteredSkill(skillID) && flag)
        {
            KFMOD.PlayOneShot(GlobalAssets.GetSound("HUD_Click", false));
        }
        else
        {
            KFMOD.PlayOneShot(GlobalAssets.GetSound("Negative", false));
        }
    }
예제 #24
0
        protected override void OnCompleteWork(Worker worker)
        {
            Status       scientist_skill = Status.Ugly;
            MinionResume component       = worker.GetComponent <MinionResume>();

            if (component != null)
            {
                if (component.HasPerk(Db.Get().SkillPerks.AllowInterstellarResearch.Id))
                {
                    scientist_skill = Status.Great;
                }
                else if (component.HasPerk(Db.Get().SkillPerks.CanStudyWorldObjects.Id))
                {
                    scientist_skill = Status.Okay;
                }
            }

            List <Stage> potential_stages = new List <Stage>();

            potential_stages = stages.FindAll(s => s.statusItem.Equals(scientist_skill));
            potential_stages.Shuffle();
            SetStage(potential_stages[0].id, false);

            if (potential_stages[0].cheerOnComplete)
            {
                EmoteChore emoteChore1 = new EmoteChore(worker.GetComponent <ChoreProvider>(), Db.Get().ChoreTypes.EmoteHighPriority, "anim_cheer_kanim", new HashedString[3]
                {
                    "cheer_pre",
                    "cheer_loop",
                    "cheer_pst"
                }, null);
            }
            else
            {
                EmoteChore emoteChore2 = new EmoteChore(worker.GetComponent <ChoreProvider>(), Db.Get().ChoreTypes.EmoteHighPriority, "anim_disappointed_kanim", new HashedString[3]
                {
                    "disappointed_pre",
                    "disappointed_loop",
                    "disappointed_pst"
                }, null);
            }

            shouldShowSkillPerkStatusItem = false;
            UpdateStatusItem(null);
            Prioritizable.RemoveRef(gameObject);
        }
예제 #25
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 void OnRolesUpdated(object data)
 {
     if (activeResearch != null && activeResearch.tech.costsByResearchTypeID.Count > 1)
     {
         if (!MinionResume.AnyMinionHasPerk(Db.Get().SkillPerks.AllowAdvancedResearch.Id))
         {
             notifier.Add(NoResearcherRole, string.Empty);
         }
         else
         {
             notifier.Remove(NoResearcherRole);
         }
     }
     else
     {
         notifier.Remove(NoResearcherRole);
     }
 }
예제 #27
0
    protected virtual void UpdateStatusItem(object data = null)
    {
        KSelectable component = GetComponent <KSelectable>();

        if (!((UnityEngine.Object)component == (UnityEngine.Object)null) && !string.IsNullOrEmpty(requiredSkillPerk))
        {
            bool flag = MinionResume.AnyMinionHasPerk(requiredSkillPerk);
            if (!flag && workStatusItemHandle == Guid.Empty)
            {
                workStatusItemHandle = component.AddStatusItem(Db.Get().BuildingStatusItems.ColonyLacksRequiredSkillPerk, requiredSkillPerk);
            }
            else if (flag && workStatusItemHandle != Guid.Empty)
            {
                component.RemoveStatusItem(workStatusItemHandle, false);
                workStatusItemHandle = Guid.Empty;
            }
        }
    }
예제 #28
0
    private List <MinionMetricsData> GetMinionMetrics()
    {
        List <MinionMetricsData> list = new List <MinionMetricsData>();

        foreach (MinionIdentity item in Components.LiveMinionIdentities.Items)
        {
            if (!((UnityEngine.Object)item == (UnityEngine.Object)null))
            {
                Modifiers component = item.gameObject.GetComponent <Modifiers>();
                Amounts   amounts   = component.amounts;
                List <MinionAttrFloatData> list2 = new List <MinionAttrFloatData>(amounts.Count);
                foreach (AmountInstance item2 in amounts)
                {
                    float value = item2.value;
                    if (!float.IsNaN(value) && !float.IsInfinity(value))
                    {
                        list2.Add(new MinionAttrFloatData
                        {
                            Name  = item2.modifier.Id,
                            Value = item2.value
                        });
                    }
                }
                MinionResume  component2            = item.gameObject.GetComponent <MinionResume>();
                float         totalExperienceGained = component2.TotalExperienceGained;
                List <string> list3 = new List <string>();
                foreach (KeyValuePair <string, bool> item3 in component2.MasteryBySkillID)
                {
                    if (item3.Value)
                    {
                        list3.Add(item3.Key);
                    }
                }
                list.Add(new MinionMetricsData
                {
                    Name                  = item.name,
                    Modifiers             = list2,
                    TotalExperienceGained = totalExperienceGained,
                    Skills                = list3
                });
            }
        }
        return(list);
    }
    private void RefreshResume()
    {
        MinionResume component = selectedTarget.GetComponent <MinionResume>();

        if (!(bool)component)
        {
            resumePanel.SetActive(false);
        }
        else
        {
            resumePanel.SetActive(true);
            resumePanel.GetComponent <CollapsibleDetailContentPanel>().HeaderLabel.text = string.Format(UI.DETAILTABS.PERSONALITY.GROUPNAME_RESUME, selectedTarget.name.ToUpper());
            resumeDrawer.BeginDrawing();
            List <Skill> list = new List <Skill>();
            foreach (KeyValuePair <string, bool> item2 in component.MasteryBySkillID)
            {
                if (item2.Value)
                {
                    Skill item = Db.Get().Skills.Get(item2.Key);
                    list.Add(item);
                }
            }
            resumeDrawer.NewLabel(UI.DETAILTABS.PERSONALITY.RESUME.MASTERED_SKILLS).Tooltip(UI.DETAILTABS.PERSONALITY.RESUME.MASTERED_SKILLS_TOOLTIP);
            if (list.Count == 0)
            {
                resumeDrawer.NewLabel("  • " + UI.DETAILTABS.PERSONALITY.RESUME.NO_MASTERED_SKILLS.NAME).Tooltip(string.Format(UI.DETAILTABS.PERSONALITY.RESUME.NO_MASTERED_SKILLS.TOOLTIP, selectedTarget.name));
            }
            else
            {
                foreach (Skill item3 in list)
                {
                    string text = string.Empty;
                    foreach (SkillPerk perk in item3.perks)
                    {
                        text = text + "  • " + perk.Name + "\n";
                    }
                    resumeDrawer.NewLabel("  • " + item3.Name).Tooltip(item3.description + "\n" + text);
                }
            }
            resumeDrawer.EndDrawing();
        }
    }
예제 #30
0
    public void OnPointerClick(PointerEventData eventData)
    {
        MinionIdentity minionIdentity = skillsScreen.CurrentlySelectedMinion as MinionIdentity;

        if ((UnityEngine.Object)minionIdentity != (UnityEngine.Object)null)
        {
            MinionResume component = minionIdentity.GetComponent <MinionResume>();
            if (DebugHandler.InstantBuildMode && component.AvailableSkillpoints < 1)
            {
                component.ForceAddSkillPoint();
            }
            MinionResume.SkillMasteryConditions[] skillMasteryConditions = component.GetSkillMasteryConditions(skillID);
            bool flag = component.CanMasterSkill(skillMasteryConditions);
            if ((UnityEngine.Object)component != (UnityEngine.Object)null && !component.HasMasteredSkill(skillID) && flag)
            {
                component.MasterSkill(skillID);
                skillsScreen.RefreshAll();
            }
        }
    }