Exemple #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>
 /// <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();
         }
     }
 }
        /// <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();
                }
            }
        }
        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);
            }
        }
    }
Exemple #5
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();
        }
Exemple #6
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();
    }
Exemple #7
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 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();
        }
        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();
            }
        }
        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);
            }
        }
Exemple #11
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();
        }
    }
 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 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 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 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 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 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);
            }
        }
    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);
    }
        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("CLICK", Styles_Instruction.Standard);
            drawer.AddIndent(8);

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

            if (BlueprintsState.LoadedBlueprints.Count > 0)
            {
                drawer.DrawText(BlueprintsAssets.BLUEPRINTS_STRING_CYCLEBLUEPRINTS, Styles_Instruction.Standard);
                drawer.NewLine(20);

                drawer.DrawText(BlueprintsAssets.BLUEPRINTS_STRING_RENAMEBLUEPRINT, Styles_Instruction.Standard);
                drawer.NewLine(20);

                drawer.DrawText(BlueprintsAssets.BLUEPRINTS_STRING_DELETEBLUEPRINT, Styles_Instruction.Standard);
                drawer.NewLine(32);

                drawer.DrawText("Selected \"" + BlueprintsState.SelectedBlueprint.FriendlyName + "\"    (" + (BlueprintsState.SelectedBlueprintIndex + 1) + "/" + BlueprintsState.LoadedBlueprints.Count + ")", Styles_Instruction.Standard);
            }

            else
            {
                drawer.DrawText("No blueprints loaded!", Styles_Instruction.Standard);
            }

            drawer.EndShadowBar();
            drawer.EndDrawing();
        }
        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 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);
                }
            }
        }
        private void ItemCardThermal(HoverTextDrawer hoverTextDrawer, KSelectable kselectable3)
        {
            if (kselectable3.GetComponent <Constructable>())
            {
                return;
            }
            if (CurrentMode != OverlayModes.None.ID && CurrentMode != OverlayModes.Temperature.ID)
            {
                return;
            }
            // None か Temperatureオーバーレイでのみ表示

            PrimaryElement primaryElement = kselectable3.GetComponent <PrimaryElement>();
            float          temp           = 0f;
            float          dtu            = -1f;
            bool           flag10         = CurrentMode == OverlayModes.Temperature.ID && Game.Instance.temperatureOverlayMode != Game.TemperatureOverlayModes.HeatFlow;

            if (flag10 && primaryElement)
            {
                temp = primaryElement.Temperature;
                dtu  = temp * primaryElement.Element.specificHeatCapacity * primaryElement.Mass;
            }
            else if (kselectable3.GetComponent <Building>() && primaryElement)
            {
                temp = primaryElement.Temperature;
                dtu  = temp * primaryElement.Element.specificHeatCapacity * primaryElement.Mass;
            }
            else if (kselectable3.GetComponent <CellSelectionObject>() != null)
            {
                CellSelectionObject obj = kselectable3.GetComponent <CellSelectionObject>();
                temp = obj.temperature;
                dtu  = temp * obj.element.specificHeatCapacity * obj.Mass;
            }
            else
            {
                return;
            }

            hoverTextDrawer.NewLine(26);
            hoverTextDrawer.DrawIcon(__this.iconDash, 18);
            hoverTextDrawer.DrawText(GameUtil.GetFormattedTemperature(temp, GameUtil.TimeSlice.None, GameUtil.TemperatureInterpretation.Absolute, true, false), __this.Styles_BodyText.Standard);

            DrawKiloDTU(hoverTextDrawer, dtu);
        }
    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);
            DrawTitle(HoverTextScreen.Instance, hoverTextDrawer);
            DrawInstructions(HoverTextScreen.Instance, hoverTextDrawer);
            if (!MoveToLocationTool.Instance.CanMoveTo(num))
            {
                hoverTextDrawer.NewLine(26);
                hoverTextDrawer.DrawText(UI.TOOLS.MOVETOLOCATION.UNREACHABLE, HoverTextStyleSettings[1]);
            }
            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("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();
        }
        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();
        }
Exemple #27
0
            public static void Postfix(HoverTextConfiguration __instance,
                                       HoverTextDrawer drawer)
            {
                if (__instance == null)
                {
                    return;
                }
                if (!(__instance is BuildToolHoverTextCard))
                {
                    return;
                }
                BuildToolHoverTextCard hover_text_card
                    = (BuildToolHoverTextCard)__instance;

                if (hover_text_card.currentDef == null)
                {
                    return;
                }
                if (hover_text_card.currentDef.BuildingComplete == null)
                {
                    return;
                }

                ZTransporter possible_ztransport = hover_text_card.currentDef.BuildingComplete.GetComponent <ZTransporter>();

                if (possible_ztransport != null)
                {
                    drawer.NewLine(26);  // All the cool kids are doing it -SB
                    drawer.AddIndent(8); // I LEARNED IT FROM WATCHING [Klei] -SB
                    int x, y;

                    var pos   = KInputManager.GetMousePos();
                    var point = Camera.main.ScreenToWorldPoint(pos);
                    var cell  = Grid.PosToCell(point);
                    Grid.CellToXY(cell, out x, out y);

                    var coords_string = STRINGS.ZTRANSPORT.STATUSITEMS.ZCOORDINATES.NAME.Replace("{X}", x.ToString()).Replace("{Y}", y.ToString());
                    drawer.DrawText(coords_string,
                                    hover_text_card.Styles_Instruction.Standard);
                }
            }
        private void ItemCardDisease(HoverTextDrawer hoverTextDrawer, KSelectable selectable)
        {
            if (!modeIsDisease)
            {
                return;
            }

            PrimaryElement primaryElement = selectable.GetComponent <PrimaryElement>();

            string text13 = UI.OVERLAYS.DISEASE.NO_DISEASE;

            if (primaryElement != null && primaryElement.DiseaseIdx != 255)
            {
                text13 = GameUtil.GetFormattedDisease(primaryElement.DiseaseIdx, primaryElement.DiseaseCount, true);
            }
            Storage storage = selectable.GetComponent <Storage>();

            if (storage != null && storage.showInUI)
            {
                foreach (GameObject item in storage.items)
                {
                    if (item == null)
                    {
                        continue;
                    }
                    PrimaryElement itemElement = item.GetComponent <PrimaryElement>();
                    if (itemElement.DiseaseIdx != 255)
                    {
                        text13 += string.Format(
                            UI.OVERLAYS.DISEASE.CONTAINER_FORMAT,
                            item.GetComponent <KSelectable>().GetProperName(),
                            GameUtil.GetFormattedDisease(itemElement.DiseaseIdx, itemElement.DiseaseCount, true)
                            );
                    }
                }
            }
            hoverTextDrawer.NewLine(26);
            hoverTextDrawer.DrawIcon(__this.iconDash, 18);
            hoverTextDrawer.DrawText(text13, __this.Styles_Values.Property.Standard);
        }
        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();
        }
        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();
        }