public static Rect HideFillableBar(Rect rect, float fillPercent, Texture2D fillTex, Texture2D bgTex, bool doBorder)
 {
     if (!BlindResearch.CanSeeProgress(fillPercent))
     {
         fillPercent = 0;
     }
     return(Widgets.FillableBar(rect, fillPercent, fillTex, bgTex, doBorder));
 }
        public static void RemoveRandomResearch()
        {
            if (!BlindResearch.Active())
            {
                return;
            }

            List <ScenPart> list = (List <ScenPart>)partsInfo.GetValue(Find.Scenario);

            list.RemoveAll(p => p is ScenPart_RandomResearch);
        }
        public static void MakeResearchRandom()
        {
            if (BlindResearch.Active())
            {
                return;
            }

            List <ScenPart> list = (List <ScenPart>)partsInfo.GetValue(Find.Scenario);

            list.Add(ScenarioMaker.MakeScenPart(ScenPartDefOf.RandomResearch));
        }
        public static void Postfix(MainTabWindow_Research __instance, ref ResearchProjectDef ___selectedProject)
        {
            if (BlindResearch.CanSeeCurrent())
            {
                return;
            }

            ___selectedProject = null;
            //__instance.selectedProject = null;
            SetCurTab.Invoke(__instance, new object[] { ResearchTabDefOf.Main });
            //__instance.CurTab = ResearchTabDefOf.Main;
        }
 public static Rect DrawCancelButton(Rect rect)
 {
     if (BlindResearch.Active() &&
         BlindResearch.SelectedResearch() == Find.ResearchManager.currentProj &&
         BlindResearch.CanSeeCurrent())
     {
         Rect iconRect = rect.ContractedBy(2);
         iconRect.width = iconRect.height;
         if (Widgets.ButtonImage(iconRect, ContentFinder <Texture2D> .Get("UI/Designators/Cancel")))
         {
             Find.ResearchManager.currentProj = null;
         }
     }
     return(rect);
 }
Пример #6
0
        public static bool HideButtonText(Rect rect, string label, bool drawBackground, bool doMouseoverSound, bool active)
        {
            bool result = false;

            if (BlindResearch.CanChangeTo(BlindResearch.SelectedResearch()))
            {
                result = Widgets.ButtonText(rect, label, drawBackground, doMouseoverSound, active);
            }
            else
            {
                if (rect.height > 30)               //Debug buttons are 30, aeh, so don't draw this for them.
                //Same as 'in-progress'
                {
                    Widgets.DrawHighlight(rect);
                }
            }

            return(result);
        }
Пример #7
0
        public static void Postfix(ResearchManager __instance, bool __state)
        {
            if (!__state && BlindResearch.CanSeeProgress(__instance.currentProj?.ProgressPercent ?? 0))
            {
                RemoveLetter();

                int msg = msgNum++;
                if (msgNum == msgCount)
                {
                    msgNum = 0;
                }
                string letter = "TD.ResearchKnown".Translate(__instance.currentProj.LabelCap);
                string text   = $"TD.ResearchKnownMsg{msg}".Translate(__instance.currentProj.LabelCap) +
                                "\n\n" + "TD.ResearchKnownDesc".Translate() +
                                "\n\n" + __instance.currentProj.LabelCap + ": " + __instance.currentProj.description;

                lastLetter = LetterMaker.MakeLetter(letter, text, LetterDefOf.NeutralEvent);
                Find.LetterStack.ReceiveLetter(lastLetter);
            }
        }
Пример #8
0
        public override AlertReport GetReport()
        {
            if (Find.AnyPlayerHomeMap == null ||
                Find.ResearchManager.currentProj != null ||
                !BlindResearch.Active())
            {
                return(false);
            }

            foreach (Map map in Find.Maps)
            {
                if (map.IsPlayerHome && map.listerBuildings.ColonistsHaveResearchBench())
                {
                    return(!Find.ResearchManager.AnyProjectIsAvailable &&
                           DefDatabase <ResearchProjectDef> .AllDefsListForReading.Any(x => !x.IsFinished));
                }
            }

            return(false);
        }
 public static float HideProgressApparent(float progress)
 {
     return(BlindResearch.CanSeeCurrent() ? progress : 0);
 }
 public static string InProgessString(string inProgress)
 {
     return(BlindResearch.CanSeeCurrent() ? inProgress : "");
 }
 public static Color ReplaceColor(Color activeTex)
 {
     return(BlindResearch.CanSeeCurrent() ? activeTex : TexUI.AvailResearchColor);
 }
Пример #12
0
 public static void Prefix(ResearchManager __instance, ref bool __state)
 {
     __state = BlindResearch.CanSeeProgress(__instance.currentProj?.ProgressPercent ?? 0);
 }