private void SetImageToggleState(KToggle toggle, ImageToggleState.State state)
    {
        switch (state)
        {
        case ImageToggleState.State.Active:
            toggle.GetComponent <ImageToggleState>().SetActive();
            toggle.gameObject.GetComponentInChildrenOnly <Image>().material = defaultMaterial;
            break;

        case ImageToggleState.State.Inactive:
            toggle.GetComponent <ImageToggleState>().SetInactive();
            toggle.gameObject.GetComponentInChildrenOnly <Image>().material = defaultMaterial;
            break;

        case ImageToggleState.State.Disabled:
            toggle.GetComponent <ImageToggleState>().SetDisabled();
            toggle.gameObject.GetComponentInChildrenOnly <Image>().material = desaturatedMaterial;
            break;

        case ImageToggleState.State.DisabledActive:
            toggle.GetComponent <ImageToggleState>().SetDisabledActive();
            toggle.gameObject.GetComponentInChildrenOnly <Image>().material = desaturatedMaterial;
            break;
        }
    }
Пример #2
0
 public void SelectDeliverable()
 {
     if ((UnityEngine.Object)controller != (UnityEngine.Object)null)
     {
         controller.AddDeliverable(stats);
     }
     if (MusicManager.instance.SongIsPlaying("Music_SelectDuplicant"))
     {
         MusicManager.instance.SetSongParameter("Music_SelectDuplicant", "songSection", 1f, true);
     }
     selectButton.GetComponent <ImageToggleState>().SetActive();
     selectButton.ClearOnClick();
     selectButton.onClick += delegate
     {
         DeselectDeliverable();
         if (MusicManager.instance.SongIsPlaying("Music_SelectDuplicant"))
         {
             MusicManager.instance.SetSongParameter("Music_SelectDuplicant", "songSection", 0f, true);
         }
     };
     selectedBorder.SetActive(true);
     titleBar.color = selectedTitleColor;
     animController.Play("cheer_pre", KAnim.PlayMode.Once, 1f, 0f);
     animController.Play("cheer_loop", KAnim.PlayMode.Loop, 1f, 0f);
 }
    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);
    }
Пример #4
0
    protected override void UpdateButtonStates(bool isDefault)
    {
        base.UpdateButtonStates(isDefault);
        ToolTip component = defaultButton.GetComponent <ToolTip>();

        component.SetSimpleTooltip((!isDefault) ? UI.UISIDESCREENS.ACCESS_CONTROL_SIDE_SCREEN.SET_TO_DEFAULT : UI.UISIDESCREENS.ACCESS_CONTROL_SIDE_SCREEN.SET_TO_CUSTOM);
        defaultControls.SetActive(isDefault);
        customControls.SetActive(!isDefault);
    }
Пример #5
0
    private void SetMaterialTint(KToggle toggle, bool disabled)
    {
        SwapUIAnimationController component = toggle.GetComponent <SwapUIAnimationController>();

        if ((UnityEngine.Object)component != (UnityEngine.Object)null)
        {
            component.SetState(!disabled);
        }
    }
Пример #6
0
 private void SetToggleBGImage(KToggle toggle, Tag elem)
 {
     if ((Object)toggle == (Object)selectedToggle)
     {
         toggle.GetComponentsInChildren <Image>()[1].material = GlobalResources.Instance().AnimUIMaterial;
         toggle.GetComponent <ImageToggleState>().SetActive();
     }
     else if (WorldInventory.Instance.GetAmount(elem) >= activeMass || DebugHandler.InstantBuildMode || Game.Instance.SandboxModeActive)
     {
         toggle.GetComponentsInChildren <Image>()[1].material = GlobalResources.Instance().AnimUIMaterial;
         toggle.GetComponentsInChildren <Image>()[1].color    = Color.white;
         toggle.GetComponent <ImageToggleState>().SetInactive();
     }
     else
     {
         toggle.GetComponentsInChildren <Image>()[1].material = GlobalResources.Instance().AnimMaterialUIDesaturated;
         toggle.GetComponentsInChildren <Image>()[1].color    = new Color(1f, 1f, 1f, 0.6f);
         if (!AllowInsufficientMaterialBuild())
         {
             toggle.GetComponent <ImageToggleState>().SetDisabled();
         }
     }
 }
    protected virtual void UpdateButtonStates(bool isDefault)
    {
        ToolTip component  = leftButton.GetComponent <ToolTip>();
        ToolTip component2 = rightButton.GetComponent <ToolTip>();

        if (isUpDown)
        {
            component.SetSimpleTooltip((!leftButton.isOn) ? UI.UISIDESCREENS.ACCESS_CONTROL_SIDE_SCREEN.GO_UP_DISABLED : UI.UISIDESCREENS.ACCESS_CONTROL_SIDE_SCREEN.GO_UP_ENABLED);
            component2.SetSimpleTooltip((!rightButton.isOn) ? UI.UISIDESCREENS.ACCESS_CONTROL_SIDE_SCREEN.GO_DOWN_DISABLED : UI.UISIDESCREENS.ACCESS_CONTROL_SIDE_SCREEN.GO_DOWN_ENABLED);
        }
        else
        {
            component.SetSimpleTooltip((!leftButton.isOn) ? UI.UISIDESCREENS.ACCESS_CONTROL_SIDE_SCREEN.GO_LEFT_DISABLED : UI.UISIDESCREENS.ACCESS_CONTROL_SIDE_SCREEN.GO_LEFT_ENABLED);
            component2.SetSimpleTooltip((!rightButton.isOn) ? UI.UISIDESCREENS.ACCESS_CONTROL_SIDE_SCREEN.GO_RIGHT_DISABLED : UI.UISIDESCREENS.ACCESS_CONTROL_SIDE_SCREEN.GO_RIGHT_ENABLED);
        }
    }
 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);
             }
         }
     }
 }
    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();
        }
    }
Пример #10
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);
             }
         }
     }
 }
    protected override void OnPrefabInit()
    {
        base.OnPrefabInit();
        Instance = this;
        CodexCache.Init();
        ScheduledUIInstantiation component = GameScreenManager.Instance.ssOverlayCanvas.GetComponent <ScheduledUIInstantiation>();

        instantiator.Instantiate();
        jobsScreen        = instantiator.GetComponentInChildren <JobsTableScreen>(true);
        consumablesScreen = instantiator.GetComponentInChildren <ConsumablesTableScreen>(true);
        vitalsScreen      = instantiator.GetComponentInChildren <VitalsTableScreen>(true);
        starmapScreen     = component.GetInstantiatedObject <StarmapScreen>();
        codexScreen       = instantiator.GetComponentInChildren <CodexScreen>(true);
        scheduleScreen    = instantiator.GetComponentInChildren <ScheduleScreen>(true);
        skillsScreen      = component.GetInstantiatedObject <SkillsScreen>();
        Subscribe(Game.Instance.gameObject, 288942073, OnUIClear);
        consumablesInfo            = new ToggleInfo(UI.CONSUMABLES, "OverviewUI_consumables_icon", null, Action.ManageConsumables, UI.TOOLTIPS.MANAGEMENTMENU_CONSUMABLES, string.Empty);
        vitalsInfo                 = new ToggleInfo(UI.VITALS, "OverviewUI_vitals_icon", null, Action.ManageVitals, UI.TOOLTIPS.MANAGEMENTMENU_VITALS, string.Empty);
        reportsInfo                = new ToggleInfo(UI.REPORT, "OverviewUI_reports_icon", null, Action.ManageReport, UI.TOOLTIPS.MANAGEMENTMENU_DAILYREPORT, string.Empty);
        reportsInfo.prefabOverride = smallPrefab;
        researchInfo               = new ToggleInfo(UI.RESEARCH, "OverviewUI_research_nav_icon", null, Action.ManageResearch, UI.TOOLTIPS.MANAGEMENTMENU_RESEARCH, string.Empty);
        jobsInfo    = new ToggleInfo(UI.JOBS, "OverviewUI_priority_icon", null, Action.ManagePriorities, UI.TOOLTIPS.MANAGEMENTMENU_JOBS, string.Empty);
        skillsInfo  = new ToggleInfo(UI.SKILLS, "OverviewUI_jobs_icon", null, Action.ManageSkills, UI.TOOLTIPS.MANAGEMENTMENU_SKILLS, string.Empty);
        starmapInfo = new ToggleInfo(UI.STARMAP.MANAGEMENT_BUTTON, "OverviewUI_starmap_icon", null, Action.ManageStarmap, UI.TOOLTIPS.MANAGEMENTMENU_STARMAP, string.Empty);
        codexInfo   = new ToggleInfo(UI.CODEX.MANAGEMENT_BUTTON, "OverviewUI_database_icon", null, Action.ManageDatabase, UI.TOOLTIPS.MANAGEMENTMENU_CODEX, string.Empty);
        codexInfo.prefabOverride = smallPrefab;
        scheduleInfo             = new ToggleInfo(UI.SCHEDULE, "OverviewUI_schedule2_icon", null, Action.ManageSchedule, UI.TOOLTIPS.MANAGEMENTMENU_SCHEDULE, string.Empty);
        ScreenInfoMatch.Add(consumablesInfo, new ScreenData
        {
            screen     = consumablesScreen,
            tabIdx     = 3,
            toggleInfo = consumablesInfo
        });
        ScreenInfoMatch.Add(vitalsInfo, new ScreenData
        {
            screen     = vitalsScreen,
            tabIdx     = 2,
            toggleInfo = vitalsInfo
        });
        ScreenInfoMatch.Add(reportsInfo, new ScreenData
        {
            screen     = reportsScreen,
            tabIdx     = 4,
            toggleInfo = reportsInfo
        });
        ScreenInfoMatch.Add(jobsInfo, new ScreenData
        {
            screen     = jobsScreen,
            tabIdx     = 1,
            toggleInfo = jobsInfo
        });
        ScreenInfoMatch.Add(skillsInfo, new ScreenData
        {
            screen     = skillsScreen,
            tabIdx     = 0,
            toggleInfo = skillsInfo
        });
        ScreenInfoMatch.Add(codexInfo, new ScreenData
        {
            screen     = codexScreen,
            tabIdx     = 6,
            toggleInfo = codexInfo
        });
        ScreenInfoMatch.Add(scheduleInfo, new ScreenData
        {
            screen     = scheduleScreen,
            tabIdx     = 7,
            toggleInfo = scheduleInfo
        });
        ScreenInfoMatch.Add(starmapInfo, new ScreenData
        {
            screen     = starmapScreen,
            tabIdx     = 7,
            toggleInfo = starmapInfo
        });
        List <ToggleInfo> list = new List <ToggleInfo>();

        list.Add(vitalsInfo);
        list.Add(consumablesInfo);
        list.Add(scheduleInfo);
        list.Add(jobsInfo);
        list.Add(skillsInfo);
        list.Add(researchInfo);
        list.Add(starmapInfo);
        list.Add(reportsInfo);
        list.Add(codexInfo);
        Setup(list);
        base.onSelect           += OnButtonClick;
        PauseMenuButton.onClick += OnPauseMenuClicked;
        PauseMenuButton.transform.SetAsLastSibling();
        PauseMenuButton.GetComponent <ToolTip>().toolTip = GameUtil.ReplaceHotkeyString(UI.TOOLTIPS.MANAGEMENTMENU_PAUSEMENU, Action.Escape);
        Components.ResearchCenters.OnAdd    += CheckResearch;
        Components.ResearchCenters.OnRemove += CheckResearch;
        Components.RoleStations.OnAdd       += CheckSkills;
        Components.RoleStations.OnRemove    += CheckSkills;
        Game.Instance.Subscribe(-809948329, CheckResearch);
        Game.Instance.Subscribe(-809948329, CheckSkills);
        Components.Telescopes.OnAdd    += CheckStarmap;
        Components.Telescopes.OnRemove += CheckStarmap;
        skillsTooltipDisabled           = UI.TOOLTIPS.MANAGEMENTMENU_REQUIRES_SKILL_STATION;
        skillsTooltip           = GameUtil.ReplaceHotkeyString(UI.TOOLTIPS.MANAGEMENTMENU_SKILLS, Action.ManageSkills);
        researchTooltipDisabled = UI.TOOLTIPS.MANAGEMENTMENU_REQUIRES_RESEARCH;
        researchTooltip         = GameUtil.ReplaceHotkeyString(UI.TOOLTIPS.MANAGEMENTMENU_RESEARCH, Action.ManageResearch);
        starmapTooltipDisabled  = UI.TOOLTIPS.MANAGEMENTMENU_REQUIRES_TELESCOPE;
        starmapTooltip          = GameUtil.ReplaceHotkeyString(UI.TOOLTIPS.MANAGEMENTMENU_STARMAP, Action.ManageStarmap);
        CheckResearch(null);
        CheckSkills(null);
        CheckStarmap(null);
        researchInfo.toggle.soundPlayer.AcceptClickCondition = (() => ResearchAvailable() || activeScreen == ScreenInfoMatch[Instance.researchInfo]);
        KButton[] closeButtons = CloseButtons;
        foreach (KButton kButton in closeButtons)
        {
            kButton.onClick            += CloseAll;
            kButton.soundPlayer.Enabled = false;
        }
        foreach (KToggle toggle in toggles)
        {
            toggle.soundPlayer.toggle_widget_sound_events[0].PlaySound = false;
            toggle.soundPlayer.toggle_widget_sound_events[1].PlaySound = false;
        }
    }