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);
     }
 }
 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);
     }
 }
Beispiel #3
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;
            }
        }
    }