Esempio n. 1
0
        /// <summary>
        /// Draws tool tips for selectable items in the sweep area.
        /// </summary>
        /// <param name="selected">The items which were found.</param>
        /// <param name="drawer">The renderer for hover card text.</param>
        private void DrawPickupText(IEnumerable <KSelectable> selected, HoverTextDrawer drawer)
        {
            var hoverInstance = HoverTextScreen.Instance;

            // For each pickupable object, show the type
            foreach (var obj in selected)
            {
                var cc = obj.GetComponent <Clearable>();
                var ec = obj.GetComponent <PrimaryElement>();
                // Ignore duplicants
                if (cc != null && cc.isClearable && ec != null && obj.GetComponent <
                        MinionIdentity>() == null)
                {
                    var element = ec.Element;
                    drawer.BeginShadowBar(false);
                    // Element name (uppercase)
                    drawer.DrawText(obj.GetProperName().ToUpper(), Styles_Title.Standard);
                    drawer.NewLine(26);
                    drawer.DrawIcon(hoverInstance.GetSprite("dash"), 18);
                    // Mass (kg, g, mg...)
                    drawer.DrawText(GameUtil.GetFormattedMass(ec.Mass), Styles_BodyText.
                                    Standard);
                    drawer.NewLine(26);
                    drawer.DrawIcon(hoverInstance.GetSprite("dash"), 18);
                    // Temperature
                    drawer.DrawText(GameUtil.GetFormattedTemperature(ec.Temperature),
                                    Styles_BodyText.Standard);
                    drawer.EndShadowBar();
                }
            }
        }
Esempio n. 2
0
        public override void UpdateHoverElements(List <KSelectable> hoveredObjects)
        {
            HoverTextScreen screenInstance = HoverTextScreen.Instance;
            HoverTextDrawer drawer         = screenInstance.BeginDrawing();

            drawer.BeginShadowBar(false);

            DrawTitle(screenInstance, drawer);
            drawer.NewLine(26);

            drawer.DrawIcon(screenInstance.GetSprite("icon_mouse_left"), 20);
            drawer.DrawText(UsingSnapshot ? "CLICK" : "DRAG", Styles_Instruction.Standard);
            drawer.AddIndent(8);

            drawer.DrawIcon(screenInstance.GetSprite("icon_mouse_right"), 20);
            drawer.DrawText("BACK", Styles_Instruction.Standard);

            if (UsingSnapshot)
            {
                drawer.NewLine(32);
                drawer.DrawText(BlueprintsAssets.BLUEPRINTS_STRING_DELETESNAPSHOT, Styles_Instruction.Standard);
            }

            drawer.EndShadowBar();
            drawer.EndDrawing();
        }
        private void HeatflowCard(HoverTextDrawer hoverTextDrawer)
        {
            if (!Grid.Solid[cellPos] && isVisible)
            {
                float thermalComfort  = GameUtil.GetThermalComfort(cellPos, 0f);
                float thermalComfort2 = GameUtil.GetThermalComfort(cellPos, -0.08368001f);
                float num2            = 0f;

                string text = String.Empty;

                if (thermalComfort2 * 0.001f > -0.278933346f - num2 && thermalComfort2 * 0.001f < 0.278933346f + num2)
                {
                    text = UI.OVERLAYS.HEATFLOW.NEUTRAL;
                }
                else if (thermalComfort2 <= ExternalTemperatureMonitor.GetExternalColdThreshold(null))
                {
                    text = UI.OVERLAYS.HEATFLOW.COOLING;
                }
                else if (thermalComfort2 >= ExternalTemperatureMonitor.GetExternalWarmThreshold(null))
                {
                    text = UI.OVERLAYS.HEATFLOW.HEATING;
                }
                float dtu_s = 1f * thermalComfort;
                text = text + " (" + GameUtil.GetFormattedHeatEnergyRate(dtu_s, GameUtil.HeatEnergyFormatterUnit.Automatic) + ")";
                hoverTextDrawer.BeginShadowBar(false);
                hoverTextDrawer.DrawText(UI.OVERLAYS.HEATFLOW.HOVERTITLE, __this.Styles_BodyText.Standard);
                hoverTextDrawer.NewLine(26);
                hoverTextDrawer.DrawText(text, __this.Styles_BodyText.Standard);
                hoverTextDrawer.EndShadowBar();
            }
        }
Esempio n. 4
0
        public override void UpdateHoverElements(List <KSelectable> hoveredObjects)
        {
            HoverTextScreen screenInstance = HoverTextScreen.Instance;
            HoverTextDrawer drawer         = screenInstance.BeginDrawing();

            drawer.BeginShadowBar(false);

            DrawTitle(screenInstance, drawer);
            drawer.NewLine(26);

            drawer.DrawIcon(screenInstance.GetSprite("icon_mouse_left"), 20);
            drawer.DrawText(UsingSnapshot ? Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_SNAPSHOT_ACTION_CLICK) : Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_CREATE_ACTION_DRAG), Styles_Instruction.Standard);
            drawer.AddIndent(8);

            drawer.DrawIcon(screenInstance.GetSprite("icon_mouse_right"), 20);
            drawer.DrawText(Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_SNAPSHOT_ACTION_BACK), Styles_Instruction.Standard);

            if (UsingSnapshot)
            {
                drawer.NewLine(32);
                drawer.DrawText(string.Format(Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_SNAPSHOT_NEWSNAPSHOT), BlueprintsAssets.BLUEPRINTS_KEYBIND_SNAPSHOT_NEWSNAPSHOT.GetStringFormatted()), Styles_Instruction.Standard);
            }

            drawer.EndShadowBar();
            drawer.EndDrawing();
        }
    public void ShowHoverTextOnHoveredItem(KSelectable hover_obj, HoverTextDrawer drawer, SelectToolHoverTextCard hover_text_card)
    {
        bool flag = false;

        foreach (Chore.Precondition.Context succeededContext in preconditionSnapshot.succeededContexts)
        {
            Chore.Precondition.Context current = succeededContext;
            if (current.chore.showAvailabilityInHoverText && !current.chore.target.isNull && !((UnityEngine.Object)current.chore.target.gameObject != (UnityEngine.Object)hover_obj.gameObject))
            {
                if (!flag)
                {
                    drawer.NewLine(26);
                    drawer.DrawText(DUPLICANTS.CHORES.PRECONDITIONS.HEADER.ToString().Replace("{Selected}", this.GetProperName()), hover_text_card.Styles_BodyText.Standard);
                    flag = true;
                }
                ShowHoverTextOnHoveredItem(current, hover_obj, drawer, hover_text_card);
            }
        }
        foreach (Chore.Precondition.Context failedContext in preconditionSnapshot.failedContexts)
        {
            Chore.Precondition.Context current2 = failedContext;
            if (current2.chore.showAvailabilityInHoverText && !current2.chore.target.isNull && !((UnityEngine.Object)current2.chore.target.gameObject != (UnityEngine.Object)hover_obj.gameObject))
            {
                if (!flag)
                {
                    drawer.NewLine(26);
                    drawer.DrawText(DUPLICANTS.CHORES.PRECONDITIONS.HEADER.ToString().Replace("{Selected}", this.GetProperName()), hover_text_card.Styles_BodyText.Standard);
                    flag = true;
                }
                ShowHoverTextOnHoveredItem(current2, hover_obj, drawer, hover_text_card);
            }
        }
    }
Esempio n. 6
0
 /// <summary>
 /// Draws tool tips for selectable items in the sweep area.
 /// </summary>
 /// <param name="selected">The items which were found.</param>
 /// <param name="drawer">The renderer for hover card text.</param>
 /// <param name="dash">The dash sprite.</param>
 private void DrawPickupText(IEnumerable <KSelectable> selected, HoverTextDrawer drawer,
                             Sprite dash)
 {
     // For each pickupable object, show the type
     foreach (var selectable in selected)
     {
         var cc = selectable.GetComponent <Clearable>();
         var ec = selectable.GetComponent <PrimaryElement>();
         // Ignore Duplicants
         if (cc != null && cc.isClearable && ec != null && selectable.GetComponent <
                 MinionIdentity>() == null)
         {
             drawer.BeginShadowBar(false);
             // Element name (uppercase)
             drawer.DrawText(GameUtil.GetUnitFormattedName(selectable.gameObject, true),
                             Styles_Title.Standard);
             drawer.NewLine();
             drawer.DrawIcon(dash);
             // Mass (kg, g, mg...)
             drawer.DrawText(GameUtil.GetFormattedMass(ec.Mass), Styles_Values.Property.
                             Standard);
             drawer.NewLine();
             drawer.DrawIcon(dash);
             // Temperature
             drawer.DrawText(GameUtil.GetFormattedTemperature(ec.Temperature),
                             Styles_BodyText.Standard);
             drawer.EndShadowBar();
         }
     }
 }
Esempio n. 7
0
        public override void UpdateHoverElements(List <KSelectable> hoveredObjects)
        {
            HoverTextScreen screenInstance = HoverTextScreen.Instance;
            HoverTextDrawer drawer         = screenInstance.BeginDrawing();

            drawer.BeginShadowBar();

            DrawTitle(screenInstance, drawer);
            drawer.NewLine();

            drawer.DrawIcon(screenInstance.GetSprite("icon_mouse_left"), 20);
            drawer.DrawText(UsingSnapshot ? BlueprintsStrings.STRING_BLUEPRINTS_SNAPSHOT_ACTION_CLICK : BlueprintsStrings.STRING_BLUEPRINTS_CREATE_ACTION_DRAG, Styles_Instruction.Standard);
            drawer.AddIndent(8);

            drawer.DrawIcon(screenInstance.GetSprite("icon_mouse_right"), 20);
            drawer.DrawText(BlueprintsStrings.STRING_BLUEPRINTS_SNAPSHOT_ACTION_BACK, Styles_Instruction.Standard);

            if (UsingSnapshot)
            {
                drawer.NewLine(32);
                drawer.DrawText(string.Format(BlueprintsStrings.STRING_BLUEPRINTS_SNAPSHOT_NEWSNAPSHOT, UI.FormatAsHotkey("[" + GameUtil.GetActionString(Integration.BlueprintsDeleteAction.GetKAction()) + "]")), Styles_Instruction.Standard);
            }

            drawer.EndShadowBar();
            drawer.EndDrawing();
        }
Esempio n. 8
0
    public override void UpdateHoverElements(List <KSelectable> selected)
    {
        HoverTextScreen instance        = HoverTextScreen.Instance;
        HoverTextDrawer hoverTextDrawer = instance.BeginDrawing();

        hoverTextDrawer.BeginShadowBar(false);
        switch (currentReqState)
        {
        case PlanScreen.RequirementsState.Materials:
        case PlanScreen.RequirementsState.Complete:
            hoverTextDrawer.DrawText(UI.TOOLTIPS.NOMATERIAL.text.ToUpper(), HoverTextStyleSettings[0]);
            hoverTextDrawer.NewLine(26);
            hoverTextDrawer.DrawText(UI.TOOLTIPS.SELECTAMATERIAL, HoverTextStyleSettings[1]);
            break;

        case PlanScreen.RequirementsState.Tech:
        {
            TechItem techItem   = Db.Get().TechItems.Get(currentDef.PrefabID);
            Tech     parentTech = techItem.parentTech;
            hoverTextDrawer.DrawText(string.Format(UI.PRODUCTINFO_RESEARCHREQUIRED, parentTech.Name).ToUpper(), HoverTextStyleSettings[0]);
            break;
        }
        }
        hoverTextDrawer.NewLine(26);
        hoverTextDrawer.DrawIcon(instance.GetSprite("icon_mouse_right"), 18);
        hoverTextDrawer.DrawText(backStr, Styles_Instruction.Standard);
        hoverTextDrawer.EndShadowBar();
        hoverTextDrawer.EndDrawing();
    }
        private void LogicCardPort(HoverTextDrawer hoverTextDrawer, string properName, LogicPorts ports, LogicPorts.Port port, bool isInput)
        {
            hoverTextDrawer.BeginShadowBar(false);

            LocString defaultName;
            int       portState;
            string    fmt;

            if (isInput)
            {
                defaultName = UI.LOGIC_PORTS.PORT_INPUT_DEFAULT_NAME;
                portState   = ports.GetInputValue(port.id);
                fmt         = UI.TOOLS.GENERIC.LOGIC_INPUT_HOVER_FMT;
            }
            else
            {
                defaultName = UI.LOGIC_PORTS.PORT_OUTPUT_DEFAULT_NAME;
                portState   = ports.GetOutputValue(port.id);
                fmt         = UI.TOOLS.GENERIC.LOGIC_OUTPUT_HOVER_FMT;
            }
            string desc = port.displayCustomName ? port.description : defaultName.text;

            hoverTextDrawer.DrawText(fmt.Replace("{Port}", desc.ToUpper()).Replace("{Name}", properName), __this.Styles_BodyText.Standard);
            hoverTextDrawer.NewLine(26);

            bool             portConnected = ports.IsPortConnected(port.id);
            TextStyleSetting textStyleSetting;

            if (portConnected)
            {
                textStyleSetting = ((portState == 1) ? __this.Styles_LogicActive.Selected : __this.Styles_LogicSignalInactive);
            }
            else
            {
                textStyleSetting = __this.Styles_LogicActive.Standard;
            }
            hoverTextDrawer.DrawIcon((portState == 1 && portConnected) ? __this.iconActiveAutomationPort : __this.iconDash, textStyleSetting.textColor, 18, 2);
            hoverTextDrawer.DrawText(port.activeDescription, textStyleSetting);
            hoverTextDrawer.NewLine(26);

            TextStyleSetting textStyleSetting2;

            if (portConnected)
            {
                textStyleSetting2 = ((portState == 0) ? __this.Styles_LogicStandby.Selected : __this.Styles_LogicSignalInactive);
            }
            else
            {
                textStyleSetting2 = __this.Styles_LogicStandby.Standard;
            }
            hoverTextDrawer.DrawIcon((portState == 0 && portConnected) ? __this.iconActiveAutomationPort : __this.iconDash, textStyleSetting2.textColor, 18, 2);
            hoverTextDrawer.DrawText(port.inactiveDescription, textStyleSetting2);
            hoverTextDrawer.EndShadowBar();
        }
    protected void DrawInstructions(HoverTextScreen screen, HoverTextDrawer drawer)
    {
        TextStyleSetting standard = Styles_Instruction.Standard;

        drawer.NewLine(26);
        drawer.DrawIcon(screen.GetSprite("icon_mouse_left"), 20);
        drawer.DrawText(ActionName, standard);
        drawer.AddIndent(8);
        drawer.DrawIcon(screen.GetSprite("icon_mouse_right"), 20);
        drawer.DrawText(backStr, standard);
    }
        private void DecorCard(HoverTextDrawer hoverTextDrawer)
        {
            float decorAtCell = GameUtil.GetDecorAtCell(cellPos);

            hoverTextDrawer.BeginShadowBar(false);
            hoverTextDrawer.DrawText(UI.OVERLAYS.DECOR.HOVERTITLE, __this.Styles_BodyText.Standard);
            hoverTextDrawer.NewLine(26);
            hoverTextDrawer.DrawText(UI.OVERLAYS.DECOR.TOTAL + GameUtil.GetFormattedDecor(decorAtCell, true), __this.Styles_BodyText.Standard);

            if (!Grid.Solid[cellPos] && isVisible)
            {
                DecorCardDetail(hoverTextDrawer);
            }
            hoverTextDrawer.EndShadowBar();
        }
        private void ItemCardStatus(HoverTextDrawer hoverTextDrawer, KSelectable kselectable3)
        {
            // 何故IEnumerable<Entry>を宣言してないのか???
            List <StatusItemGroup.Entry> entries = new List <StatusItemGroup.Entry>();

            foreach (StatusItemGroup.Entry entry in kselectable3.GetStatusItemGroup())
            {
                entries.Add(entry);
            }

            var a = entries.
                    Where((e) => __private_accessor.ShowStatusItemInCurrentOverlay(e.item)).
                    OrderBy((e) => e.category != null && e.category.Id != "Main" ? 0 : 1).
                    Take(SelectToolHoverTextCard.maxNumberOfDisplayedSelectableWarnings);

            foreach (StatusItemGroup.Entry entry in entries)
            {
                Sprite icon = entry.item.sprite?.sprite ?? __this.iconWarning;

                Color            color = __this.Styles_BodyText.Standard.textColor;
                TextStyleSetting style = __this.Styles_BodyText.Standard;
                if (__private_accessor.IsStatusItemWarning(entry))
                {
                    color = __this.HoverTextStyleSettings[1].textColor;
                    style = __this.HoverTextStyleSettings[1];
                }

                hoverTextDrawer.NewLine(26);
                hoverTextDrawer.DrawIcon(icon, color, 18, 2);
                hoverTextDrawer.DrawText(entry.GetName(), style);
            }
        }
 private void DrawKiloDTU(HoverTextDrawer hoverTextDrawer, float dtu)
 {
     if (CurrentMode == OverlayModes.Temperature.ID && dtu > 0.0f)
     {
         hoverTextDrawer.NewLine(26);
         hoverTextDrawer.DrawIcon(__this.iconDash, 18);
         hoverTextDrawer.DrawText(Mathf.Round(dtu / 100.0f) / 10.0f + "k DTU", __this.Styles_BodyText.Standard);
     }
 }
 private void MiscCardEntombedItem(HoverTextDrawer hoverTextDrawer)
 {
     if (Game.Instance.GetComponent <EntombedItemVisualizer>().IsEntombedItem(cellPos))
     {
         hoverTextDrawer.NewLine(26);
         hoverTextDrawer.DrawIcon(__this.iconDash, 18);
         hoverTextDrawer.DrawText(MISC.STATUSITEMS.BURIEDITEM.NAME, __this.Styles_BodyText.Standard);
     }
 }
 private void MiscCardExposedToSpace(HoverTextDrawer hoverTextDrawer)
 {
     if (CellSelectionObject.IsExposedToSpace(cellPos))
     {
         hoverTextDrawer.NewLine(26);
         hoverTextDrawer.DrawIcon(__this.iconDash, 18);
         hoverTextDrawer.DrawText(MISC.STATUSITEMS.SPACE.NAME, __this.Styles_BodyText.Standard);
     }
 }
 private void MiscCardDisease(HoverTextDrawer hoverTextDrawer)
 {
     if (Grid.DiseaseCount[cellPos] > 0 || modeIsDisease)
     {
         hoverTextDrawer.NewLine(26);
         hoverTextDrawer.DrawIcon(__this.iconDash, 18);
         hoverTextDrawer.DrawText(GameUtil.GetFormattedDisease(Grid.DiseaseIdx[cellPos], Grid.DiseaseCount[cellPos], true), __this.Styles_Values.Property.Standard);
     }
 }
        private void LogicCardGate(HoverTextDrawer hoverTextDrawer, string properName, LogicGate gates, LogicGateBase.PortId portId)
        {
            int  portValue     = gates.GetPortValue(portId);
            bool portConnected = gates.GetPortConnected(portId);

            LogicGate.LogicGateDescriptions.Description portDescription = gates.GetPortDescription(portId);
            hoverTextDrawer.BeginShadowBar(false);

            LocString fmt =
                portId == LogicGateBase.PortId.Output ?
                UI.TOOLS.GENERIC.LOGIC_MULTI_OUTPUT_HOVER_FMT :
                UI.TOOLS.GENERIC.LOGIC_MULTI_INPUT_HOVER_FMT;

            hoverTextDrawer.DrawText(fmt.Replace("{Port}", portDescription.name.ToUpper()).Replace("{Name}", properName), __this.Styles_BodyText.Standard);


            hoverTextDrawer.NewLine(26);
            TextStyleSetting textStyleSetting3;

            if (portConnected)
            {
                textStyleSetting3 = ((portValue == 1) ? __this.Styles_LogicActive.Selected : __this.Styles_LogicSignalInactive);
            }
            else
            {
                textStyleSetting3 = __this.Styles_LogicActive.Standard;
            }
            hoverTextDrawer.DrawIcon((portValue == 1 && portConnected) ? __this.iconActiveAutomationPort : __this.iconDash, textStyleSetting3.textColor, 18, 2);
            hoverTextDrawer.DrawText(portDescription.active, textStyleSetting3);
            hoverTextDrawer.NewLine(26);
            TextStyleSetting textStyleSetting4;

            if (portConnected)
            {
                textStyleSetting4 = ((portValue == 0) ? __this.Styles_LogicStandby.Selected : __this.Styles_LogicSignalInactive);
            }
            else
            {
                textStyleSetting4 = __this.Styles_LogicStandby.Standard;
            }
            hoverTextDrawer.DrawIcon((portValue == 0 && portConnected) ? __this.iconActiveAutomationPort : __this.iconDash, textStyleSetting4.textColor, 18, 2);
            hoverTextDrawer.DrawText(portDescription.inactive, textStyleSetting4);
            hoverTextDrawer.EndShadowBar();
        }
        private void ItemCardBasic(HoverTextDrawer hoverTextDrawer, KSelectable kselectable3)
        {
            PrimaryElement primaryElement = kselectable3.GetComponent <PrimaryElement>();
            string         text12         = GameUtil.GetUnitFormattedName(kselectable3.gameObject, true);

            if (primaryElement != null && kselectable3.GetComponent <Building>() != null)
            {
                text12 = StringFormatter.Replace(StringFormatter.Replace(UI.TOOLS.GENERIC.BUILDING_HOVER_NAME_FMT, "{Name}", text12), "{Element}", primaryElement.Element.nameUpperCase);
            }
            hoverTextDrawer.DrawText(text12, __this.Styles_BodyText.Standard);
        }
Esempio n. 19
0
        public override void UpdateHoverElements(List <KSelectable> hoveredObjects)
        {
            HoverTextScreen screenInstance = HoverTextScreen.Instance;
            HoverTextDrawer drawer         = screenInstance.BeginDrawing();

            drawer.BeginShadowBar(false);

            DrawTitle(screenInstance, drawer);
            drawer.NewLine(26);

            drawer.DrawIcon(screenInstance.GetSprite("icon_mouse_left"), 20);
            drawer.DrawText("DRAG", Styles_Instruction.Standard);
            drawer.AddIndent(8);

            drawer.DrawIcon(screenInstance.GetSprite("icon_mouse_right"), 20);
            drawer.DrawText("BACK", Styles_Instruction.Standard);

            drawer.EndShadowBar();
            drawer.EndDrawing();
        }
        private void MiscCardElementCategory(HoverTextDrawer hoverTextDrawer)
        {
            Element element = Grid.Element[cellPos];

            if (!element.IsVacuum)
            {
                hoverTextDrawer.NewLine(26);
                hoverTextDrawer.DrawIcon(__this.iconDash, 18);
                hoverTextDrawer.DrawText(ElementLoader.elements[(int)Grid.ElementIdx[cellPos]].GetMaterialCategoryTag().ProperName(), __this.Styles_BodyText.Standard);
            }
        }
        public override void UpdateHoverElements(List <KSelectable> hoveredObjects)
        {
            HoverTextScreen screenInstance = HoverTextScreen.Instance;
            HoverTextDrawer drawer         = screenInstance.BeginDrawing();

            drawer.BeginShadowBar();

            DrawTitle(screenInstance, drawer);
            drawer.NewLine();

            drawer.DrawIcon(screenInstance.GetSprite("icon_mouse_left"), 20);
            drawer.DrawText(BlueprintsStrings.STRING_BLUEPRINTS_CREATE_ACTION_DRAG, Styles_Instruction.Standard);
            drawer.AddIndent(8);

            drawer.DrawIcon(screenInstance.GetSprite("icon_mouse_right"), 20);
            drawer.DrawText(BlueprintsStrings.STRING_BLUEPRINTS_CREATE_ACTION_BACK, Styles_Instruction.Standard);

            drawer.EndShadowBar();
            drawer.EndDrawing();
        }
        // EffectorEntry
        private void DecorCardEntry(HoverTextDrawer hoverTextDrawer, EffectorEntry entry)
        {
            string text = string.Empty;

            if (entry.count > 1)
            {
                text = string.Format(UI.OVERLAYS.DECOR.COUNT, entry.count);
            }
            text = string.Format(UI.OVERLAYS.DECOR.ENTRY, GameUtil.GetFormattedDecor(entry.value, false), entry.name, text);

            hoverTextDrawer.DrawIcon(__this.iconDash, 18);
            hoverTextDrawer.DrawText(text, __this.Styles_BodyText.Standard);
        }
        private void LightingCard(HoverTextDrawer hoverTextDrawer)
        {
            if (!isVisible)
            {
                return;
            }

            string text = string.Concat(new string[]
            {
                "",
                string.Format(UI.OVERLAYS.LIGHTING.DESC, Grid.LightIntensity[cellPos]),
                " (",
                GameUtil.GetLightDescription(Grid.LightIntensity[cellPos]),
                ")"
            });

            hoverTextDrawer.BeginShadowBar(false);
            hoverTextDrawer.DrawText(UI.OVERLAYS.LIGHTING.HOVERTITLE, __this.Styles_BodyText.Standard);
            hoverTextDrawer.NewLine(26);
            hoverTextDrawer.DrawText(text, __this.Styles_BodyText.Standard);
            hoverTextDrawer.EndShadowBar();
        }
Esempio n. 24
0
    public override void UpdateHoverElements(List <KSelectable> selected)
    {
        int num = Grid.PosToCell(Camera.main.ScreenToWorldPoint(KInputManager.GetMousePos()));

        if (Grid.IsValidCell(num))
        {
            HoverTextScreen instance        = HoverTextScreen.Instance;
            HoverTextDrawer hoverTextDrawer = instance.BeginDrawing();
            hoverTextDrawer.BeginShadowBar(false);
            if (Grid.IsVisible(num))
            {
                DrawTitle(instance, hoverTextDrawer);
                DrawInstructions(HoverTextScreen.Instance, hoverTextDrawer);
                Element element = Grid.Element[num];
                bool    flag    = false;
                if (Grid.Solid[num] && Diggable.IsDiggable(num))
                {
                    flag = true;
                }
                if (flag)
                {
                    hoverTextDrawer.NewLine(26);
                    hoverTextDrawer.DrawText(element.nameUpperCase, Styles_Title.Standard);
                    hoverTextDrawer.NewLine(26);
                    hoverTextDrawer.DrawIcon(instance.GetSprite("dash"), 18);
                    hoverTextDrawer.DrawText(element.GetMaterialCategoryTag().ProperName(), Styles_BodyText.Standard);
                    hoverTextDrawer.NewLine(26);
                    hoverTextDrawer.DrawIcon(instance.GetSprite("dash"), 18);
                    string[] array = WorldInspector.MassStringsReadOnly(num);
                    hoverTextDrawer.DrawText(array[0], Styles_Values.Property.Standard);
                    hoverTextDrawer.DrawText(array[1], Styles_Values.Property_Decimal.Standard);
                    hoverTextDrawer.DrawText(array[2], Styles_Values.Property.Standard);
                    hoverTextDrawer.DrawText(array[3], Styles_Values.Property.Standard);
                    hoverTextDrawer.NewLine(26);
                    hoverTextDrawer.DrawIcon(instance.GetSprite("dash"), 18);
                    hoverTextDrawer.DrawText(GameUtil.GetHardnessString(Grid.Element[num], true), Styles_BodyText.Standard);
                }
            }
            else
            {
                hoverTextDrawer.DrawIcon(instance.GetSprite("iconWarning"), 18);
                hoverTextDrawer.DrawText(UI.TOOLS.GENERIC.UNKNOWN, Styles_BodyText.Standard);
            }
            hoverTextDrawer.EndShadowBar();
            hoverTextDrawer.EndDrawing();
        }
    }
        public override void UpdateHoverElements(List <KSelectable> hoveredObjects)
        {
            HoverTextScreen screenInstance = HoverTextScreen.Instance;
            HoverTextDrawer drawer         = screenInstance.BeginDrawing();

            drawer.BeginShadowBar(false);

            DrawTitle(screenInstance, drawer);
            drawer.NewLine(26);

            drawer.DrawIcon(screenInstance.GetSprite("icon_mouse_left"), 20);
            drawer.DrawText(Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_USE_ACTION_CLICK), Styles_Instruction.Standard);
            drawer.AddIndent(8);

            drawer.DrawIcon(screenInstance.GetSprite("icon_mouse_right"), 20);
            drawer.DrawText(Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_USE_ACTION_BACK), Styles_Instruction.Standard);
            drawer.NewLine(32);

            if (BlueprintsState.LoadedBlueprints.Count > 0)
            {
                drawer.DrawText(string.Format(Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_USE_CYCLEBLUEPRINTS), Utilities.GetKeyCodeString(BlueprintsAssets.BLUEPRINTS_KEYBIND_USE_CYCLELEFT), Utilities.GetKeyCodeString(BlueprintsAssets.BLUEPRINTS_KEYBIND_USE_CYCLERIGHT)), Styles_Instruction.Standard);
                drawer.NewLine(20);

                drawer.DrawText(string.Format(Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_USE_NAMEBLUEPRINT), Utilities.GetKeyCodeString(BlueprintsAssets.BLUEPRINTS_KEYBIND_USE_RENAME)), Styles_Instruction.Standard);
                drawer.NewLine(20);

                drawer.DrawText(string.Format(Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_USE_DELETEBLUEPRINT), Utilities.GetKeyCodeString(BlueprintsAssets.BLUEPRINTS_KEYBIND_USE_DELETE)), Styles_Instruction.Standard);

                if (PrefabErrorCount > 0)
                {
                    drawer.NewLine(32);
                    drawer.DrawIcon(screenInstance.GetSprite("iconWarning"), 18);
                    drawer.DrawText(string.Format(Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_USE_ERRORMESSAGE), PrefabErrorCount), Styles_Instruction.Selected);
                }

                drawer.NewLine(32);
                drawer.DrawText(string.Format(Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_USE_SELECTEDBLUEPRINT), BlueprintsState.SelectedBlueprint.FriendlyName, BlueprintsState.SelectedBlueprintIndex + 1, BlueprintsState.LoadedBlueprints.Count), Styles_Instruction.Standard);
            }

            else
            {
                drawer.DrawText(Strings.Get(BlueprintsStrings.STRING_BLUEPRINTS_USE_NOBLUEPRINTS), Styles_Instruction.Standard);
            }

            drawer.EndShadowBar();
            drawer.EndDrawing();
        }
 public void ShowHoverTextOnHoveredItem(Chore.Precondition.Context context, KSelectable hover_obj, HoverTextDrawer drawer, SelectToolHoverTextCard hover_text_card)
 {
     if (!context.chore.target.isNull && !((UnityEngine.Object)context.chore.target.gameObject != (UnityEngine.Object)hover_obj.gameObject))
     {
         drawer.NewLine(26);
         drawer.AddIndent(36);
         drawer.DrawText(context.chore.choreType.Name, hover_text_card.Styles_BodyText.Standard);
         if (!context.IsSuccess())
         {
             Chore.PreconditionInstance preconditionInstance = context.chore.GetPreconditions()[context.failedPreconditionId];
             string text = preconditionInstance.description;
             if (string.IsNullOrEmpty(text))
             {
                 text = preconditionInstance.id;
             }
             if ((UnityEngine.Object)context.chore.driver != (UnityEngine.Object)null)
             {
                 text = text.Replace("{Assignee}", context.chore.driver.GetProperName());
             }
             text = text.Replace("{Selected}", this.GetProperName());
             drawer.DrawText(" (" + text + ")", hover_text_card.Styles_BodyText.Standard);
         }
     }
 }
        private void MiscCardOxyRock(HoverTextDrawer hoverTextDrawer)
        {
            Element element = Grid.Element[cellPos];

            if (element.id == SimHashes.OxyRock)
            {
                float  num7        = Grid.AccumulatedFlow[cellPos] / 3f;
                string template    = BUILDING.STATUSITEMS.EMITTINGOXYGENAVG.NAME;
                string oxyflow_str = template.Replace("{FlowRate}", GameUtil.GetFormattedMass(num7, GameUtil.TimeSlice.PerSecond, GameUtil.MetricMassFormat.UseThreshold, true, "{0:0.#}"));
                hoverTextDrawer.NewLine(26);
                hoverTextDrawer.DrawIcon(__this.iconDash, 18);
                hoverTextDrawer.DrawText(oxyflow_str, __this.Styles_BodyText.Standard);
                if (num7 <= 0f)
                {
                    bool not_in_gas;
                    bool overpressure;
                    GameUtil.IsEmissionBlocked(cellPos, out not_in_gas, out overpressure);

                    string cause_str = null;
                    if (not_in_gas)
                    {
                        cause_str = MISC.STATUSITEMS.OXYROCK.NEIGHBORSBLOCKED.NAME;
                    }
                    else if (overpressure)
                    {
                        cause_str = MISC.STATUSITEMS.OXYROCK.OVERPRESSURE.NAME;
                    }
                    if (cause_str != null)
                    {
                        hoverTextDrawer.NewLine(26);
                        hoverTextDrawer.DrawIcon(__this.iconDash, 18);
                        hoverTextDrawer.DrawText(cause_str, __this.Styles_BodyText.Standard);
                    }
                }
            }
        }
        private void MiscCardMass(HoverTextDrawer hoverTextDrawer)
        {
            Element element = Grid.Element[cellPos];

            string[] array = WorldInspector.MassStringsReadOnly(cellPos);
            hoverTextDrawer.NewLine(26);
            hoverTextDrawer.DrawIcon(__this.iconDash, 18);
            // キャッシュ済みのGetBreathableString的なモノを出す。
            for (int m = 0; m < array.Length; m++)
            {
                if (m >= 3 || !element.IsVacuum)
                {
                    hoverTextDrawer.DrawText(array[m], __this.Styles_BodyText.Standard);
                }
            }
        }
Esempio n. 29
0
        /// <summary>
        /// Adds the coordinates and cell number to the select tool.
        /// </summary>
        private static HoverTextDrawer DrawCoordinates(HoverTextDrawer drawer,
                                                       HoverTextConfiguration instance)
        {
            int cell = Grid.PosToCell(Camera.main.ScreenToWorldPoint(
                                          KInputManager.GetMousePos()));

            if (Grid.IsValidCell(cell))
            {
                Grid.CellToXY(cell, out int x, out int y);
                drawer.BeginShadowBar();
                drawer.DrawText(string.Format(DebugNotIncludedStrings.UI.TOOLTIPS.DNI_CELL,
                                              cell, x, y), instance.Styles_BodyText.Standard);
                drawer.EndShadowBar();
            }

            return(drawer);
        }
Esempio n. 30
0
 public static void Postfix(SelectToolHoverTextCard __instance, List <KSelectable> hoverObjects)
 {
     foreach (KSelectable selectable in hoverObjects)
     {
         Notepad pad = selectable.gameObject.GetComponent <Notepad>();
         if (pad != null)
         {
             HoverTextScreen instance = HoverTextScreen.Instance;
             HoverTextDrawer hover    = instance.BeginDrawing();
             hover.BeginShadowBar();
             hover.DrawIcon(Assets.GetSprite("icon_category_furniture"), 20);
             hover.DrawText(pad.activateText, __instance.ToolTitleTextStyle);
             hover.EndShadowBar();
             hover.EndDrawing();
         }
     }
 }