Beispiel #1
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();
        }
        /// <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();
                }
            }
        }
        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();
            }
        }
Beispiel #4
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();
    }
Beispiel #5
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();
        }
        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();
        }
Beispiel #7
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();
         }
     }
 }
        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();
        }
    public virtual void UpdateHoverElements(List <KSelectable> hover_objects)
    {
        HoverTextScreen instance        = HoverTextScreen.Instance;
        HoverTextDrawer hoverTextDrawer = instance.BeginDrawing();

        hoverTextDrawer.BeginShadowBar(false);
        DrawTitle(instance, hoverTextDrawer);
        DrawInstructions(HoverTextScreen.Instance, hoverTextDrawer);
        hoverTextDrawer.EndShadowBar();
        hoverTextDrawer.EndDrawing();
    }
        private void ItemCard(HoverTextDrawer hoverTextDrawer, KSelectable kselectable3, bool selected)
        {
            hoverTextDrawer.BeginShadowBar(selected);

            ItemCardBasic(hoverTextDrawer, kselectable3);
            ItemCardDisease(hoverTextDrawer, kselectable3);
            ItemCardStatus(hoverTextDrawer, kselectable3);
            ItemCardThermal(hoverTextDrawer, kselectable3);
            ItemCardLightingForChore(hoverTextDrawer, kselectable3);

            hoverTextDrawer.EndShadowBar();
        }
        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();
        }
    public override void UpdateHoverElements(List <KSelectable> hover_objects)
    {
        HoverTextScreen instance        = HoverTextScreen.Instance;
        HoverTextDrawer hoverTextDrawer = instance.BeginDrawing();

        hoverTextDrawer.BeginShadowBar(false);
        DrawTitle(instance, hoverTextDrawer);
        DrawInstructions(HoverTextScreen.Instance, hoverTextDrawer);
        hoverTextDrawer.EndShadowBar();
        if (hover_objects != null)
        {
            foreach (KSelectable hover_object in hover_objects)
            {
                if ((Object)hover_object.GetComponent <AttackableBase>() != (Object)null)
                {
                    hoverTextDrawer.BeginShadowBar(false);
                    hoverTextDrawer.DrawText(hover_object.GetProperName().ToUpper(), Styles_Title.Standard);
                    hoverTextDrawer.EndShadowBar();
                    break;
                }
            }
        }
        hoverTextDrawer.EndDrawing();
    }
Beispiel #13
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();
        }
Beispiel #15
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);
        }
Beispiel #16
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();
         }
     }
 }
Beispiel #17
0
    public override void UpdateHoverElements(List <KSelectable> selected)
    {
        ToolParameterMenu toolParameterMenu = ToolMenu.Instance.toolParameterMenu;
        string            lastEnabledFilter = toolParameterMenu.GetLastEnabledFilter();
        HoverTextScreen   instance          = HoverTextScreen.Instance;
        HoverTextDrawer   hoverTextDrawer   = instance.BeginDrawing();

        hoverTextDrawer.BeginShadowBar(false);
        DrawTitle(instance, hoverTextDrawer);
        DrawInstructions(HoverTextScreen.Instance, hoverTextDrawer);
        if (lastEnabledFilter != null && lastEnabledFilter != lastUpdatedFilter)
        {
            ConfigureTitle(instance);
        }
        hoverTextDrawer.EndShadowBar();
        hoverTextDrawer.EndDrawing();
    }
Beispiel #18
0
        private static void DrawUnreachableCard(SelectToolHoverTextCard instance, List <KSelectable> overlayValidHoverObjects)
        {
            if (overlayValidHoverObjects.Count > 0)
            {
                StatusItem unreachable = Db.Get().MiscStatusItems.PickupableUnreachable;

                if (overlayValidHoverObjects.Any(x => x.HasStatusItem(unreachable)))
                {
                    HoverTextDrawer drawer = HoverTextScreen.Instance.drawer;

                    drawer.BeginShadowBar();
                    drawer.DrawIcon(unreachable.sprite.sprite, instance.Styles_BodyText.Standard.textColor, 18, -6);
                    drawer.AddIndent(8);
                    drawer.DrawText(unreachable.Name.ToUpper(), instance.Styles_Title.Standard);
                    drawer.EndShadowBar();
                }
            }
        }
        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();
        }
    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();
        }
Beispiel #22
0
        public override void UpdateHoverElements(List <KSelectable> selected)
        {
            HoverTextScreen screen = HoverTextScreen.Instance;
            Sprite          dash   = screen.GetSprite("dash");

            HoverTextDrawer txt = screen.BeginDrawing();

            txt.BeginShadowBar();

            string title = Input.GetKey(KeyCode.LeftShift)
                ? SandboxConduitToolStrings.HOVER_TEXT_TITLE_CLEAR
                : SandboxConduitToolStrings.HOVER_TEXT_TITLE_INJECT;

            txt.DrawText(title.ToUpper(), ToolTitleTextStyle);

            DrawInstructions(screen, txt);

            txt.EndShadowBar();
            txt.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();
        }
        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 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();
        }
        private void MiscCard(HoverTextDrawer hoverTextDrawer)
        {
            CellSelectionObject cellSelectionObject = this.cellSelectionObject;
            bool flag12 = cellSelectionObject != null && cellSelectionObject.mouseCell == cellSelectionObject.alternateSelectionObject.mouseCell;

            if (flag12)
            {
                __this.currentSelectedSelectableIndex = __this.recentNumberOfDisplayedSelectables - 1;
            }
            hoverTextDrawer.BeginShadowBar(flag12);

            MiscCardElement(hoverTextDrawer);
            MiscCardDisease(hoverTextDrawer);
            MiscCardElementCategory(hoverTextDrawer);
            MiscCardMass(hoverTextDrawer);
            MiscCardTemperature(hoverTextDrawer);
            MiscCardExposedToSpace(hoverTextDrawer);
            MiscCardEntombedItem(hoverTextDrawer);
            MiscCardOxyRock(hoverTextDrawer);

            hoverTextDrawer.EndShadowBar();
        }
Beispiel #27
0
 public override void UpdateHoverElements(List <KSelectable> selected)
 {
     if (!((Object)ToolMenu.Instance.PriorityScreen == (Object)null))
     {
         HoverTextScreen instance        = HoverTextScreen.Instance;
         HoverTextDrawer hoverTextDrawer = instance.BeginDrawing();
         hoverTextDrawer.BeginShadowBar(false);
         DrawTitle(instance, hoverTextDrawer);
         DrawInstructions(HoverTextScreen.Instance, hoverTextDrawer);
         hoverTextDrawer.NewLine(26);
         HoverTextDrawer hoverTextDrawer2     = hoverTextDrawer;
         string          format               = UI.TOOLS.PRIORITIZE.SPECIFIC_PRIORITY;
         PrioritySetting lastSelectedPriority = ToolMenu.Instance.PriorityScreen.GetLastSelectedPriority();
         hoverTextDrawer2.DrawText(string.Format(format, lastSelectedPriority.priority_value.ToString()), Styles_Title.Standard);
         ToolParameterMenu toolParameterMenu = ToolMenu.Instance.toolParameterMenu;
         string            lastEnabledFilter = toolParameterMenu.GetLastEnabledFilter();
         if (lastEnabledFilter != null && lastEnabledFilter != "ALL")
         {
             ConfigureTitle(instance);
         }
         hoverTextDrawer.EndShadowBar();
         hoverTextDrawer.EndDrawing();
     }
 }
        private void RoomCard(HoverTextDrawer hoverTextDrawer)
        {
            CavityInfo cavityForCell = Game.Instance.roomProber.GetCavityForCell(cellPos);

            if (cavityForCell == null)
            {
                return;
            }

            Room     room     = cavityForCell.room;
            RoomType roomType = room?.roomType;

            hoverTextDrawer.BeginShadowBar(false);

            string roomTypeName = roomType?.Name ?? UI.OVERLAYS.ROOMS.NOROOM.HEADER;

            hoverTextDrawer.DrawText(roomTypeName, __this.Styles_BodyText.Standard);

            if (room != null)
            {
                string roomEffect   = RoomDetails.EFFECT.resolve_string_function.Invoke(room);
                string roomAssignee = RoomDetails.ASSIGNED_TO.resolve_string_function.Invoke(room);
                string roomCriteria = RoomConstraints.RoomCriteriaString(room);
                string roomEffects  = RoomDetails.EFFECTS.resolve_string_function.Invoke(room);

                if (roomEffect != "")
                {
                    hoverTextDrawer.NewLine(26);
                    hoverTextDrawer.DrawText(roomEffect, __this.Styles_BodyText.Standard);
                }

                if (roomAssignee != "" && roomType != Db.Get().RoomTypes.Neutral)
                {
                    hoverTextDrawer.NewLine(26);
                    hoverTextDrawer.DrawText(roomAssignee, __this.Styles_BodyText.Standard);
                }

                hoverTextDrawer.NewLine(22);
                hoverTextDrawer.DrawText(RoomDetails.RoomDetailString(room), __this.Styles_BodyText.Standard);

                if (roomCriteria != "")
                {
                    hoverTextDrawer.NewLine(26);
                    hoverTextDrawer.DrawText(roomCriteria, __this.Styles_BodyText.Standard);
                }
                if (roomEffects != "")
                {
                    hoverTextDrawer.NewLine(26);
                    hoverTextDrawer.DrawText(roomEffects, __this.Styles_BodyText.Standard);
                }
            }
            else
            {
                string roomNA      = UI.OVERLAYS.ROOMS.NOROOM.DESC;
                int    maxRoomSize = TuningData <RoomProber.Tuning> .Get().maxRoomSize;

                if (cavityForCell.numCells > maxRoomSize)
                {
                    roomNA = roomNA + "\n" + string.Format(UI.OVERLAYS.ROOMS.NOROOM.TOO_BIG, cavityForCell.numCells, maxRoomSize);
                }
                hoverTextDrawer.NewLine(26);
                hoverTextDrawer.DrawText(roomNA, __this.Styles_BodyText.Standard);
            }
            hoverTextDrawer.EndShadowBar();
        }
            private static void DrawerHelper(SelectToolHoverTextCard inst, int cell, HoverTextDrawer drawer)
            {
                // Cell position info
                drawer.BeginShadowBar();
                var pos = Grid.CellToPos(cell);

                drawer.DrawText("POSITION", inst.Styles_Title.Standard);
                drawer.NewLine();
                drawer.DrawText($"({pos.x}, {pos.y})", inst.Styles_BodyText.Standard);
                drawer.NewLine();
                drawer.DrawText($"Cell {cell}", inst.Styles_BodyText.Standard);
                drawer.EndShadowBar();

                // Counts
                drawer.BeginShadowBar();
                drawer.DrawText("COUNT", inst.Styles_Title.Standard);
                drawer.NewLine();
                var p     = Grid.Objects[cell, (int)ObjectLayer.Pickupables];
                var count = 0;

                while (p != null && p.GetComponent <Pickupable>() is Pickupable p2)
                {
                    ++count;
                    p = p2.objectLayerListItem?.nextItem?.gameObject;
                }

                drawer.DrawText($"Pickupables: {count}", inst.Styles_BodyText.Standard);
                drawer.EndShadowBar();

                // Element info
                drawer.BeginShadowBar();
                var element = Grid.Element[cell];

                drawer.DrawText("ELEMENT", inst.Styles_Title.Standard);
                drawer.NewLine();
                drawer.DrawText($"Name: {element.name}", inst.Styles_BodyText.Standard);
                drawer.NewLine();
                var hardnessStr = GameUtil.GetHardnessString(element);

                if (hardnessStr == ELEMENTS.HARDNESS.NA)
                {
                    hardnessStr = "Not Solid";
                }

                drawer.DrawText($"Hardness: {hardnessStr}", inst.Styles_BodyText.Standard);

                // element.HasTransitionDown doesn't exist :c
                if (element.lowTempTransitionTarget != 0 && element.lowTempTransitionTarget != SimHashes.Unobtanium &&
                    element.lowTempTransition != null && element.lowTempTransition != element)
                {
                    drawer.NewLine();
                    drawer.DrawText(
                        $"Transition down to {element.lowTempTransition.name} at {Math.Round(GameUtil.GetTemperatureConvertedFromKelvin(element.lowTemp, GameUtil.temperatureUnit), 2)}{GameUtil.GetTemperatureUnitSuffix()}",
                        inst.Styles_BodyText.Standard
                        );
                }

                if (element.HasTransitionUp)
                {
                    drawer.NewLine();
                    drawer.DrawText(
                        $"Transition up to {element.highTempTransition.name} at {Math.Round(GameUtil.GetTemperatureConvertedFromKelvin(element.highTemp, GameUtil.temperatureUnit), 2)}{GameUtil.GetTemperatureUnitSuffix()}",
                        inst.Styles_BodyText.Standard
                        );
                }

                drawer.NewLine();
                drawer.DrawText(
                    $"Specific Heat Capacity: {GameUtil.GetFormattedSHC(element.specificHeatCapacity)}",
                    inst.Styles_BodyText.Standard
                    );

                drawer.NewLine();
                drawer.DrawText(
                    $"Thermal Conductivity: {GameUtil.GetThermalConductivityString(element)}",
                    inst.Styles_BodyText.Standard
                    );

                drawer.EndShadowBar();
            }
        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_USE_ACTION_CLICK, Styles_Instruction.Standard);
            drawer.AddIndent(8);

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

            if (BlueprintsState.HasBlueprints())
            {
                if (BlueprintsState.SelectedFolder.BlueprintCount > 0)
                {
                    drawer.DrawText(string.Format(BlueprintsStrings.STRING_BLUEPRINTS_USE_CYCLEFOLDERS, UI.FormatAsHotkey("[" + GameUtil.GetActionString(Integration.BlueprintsCycleFoldersNextAction.GetKAction()) + "]"), UI.FormatAsHotkey("[" + GameUtil.GetActionString(Integration.BlueprintsCycleFoldersPrevAction.GetKAction()) + "]")), Styles_Instruction.Standard);
                    drawer.NewLine(20);

                    drawer.DrawText(string.Format(BlueprintsStrings.STRING_BLUEPRINTS_USE_CYCLEBLUEPRINTS, UI.FormatAsHotkey("[" + GameUtil.GetActionString(Integration.BlueprintsCycleBlueprintsNextAction.GetKAction()) + "]"), UI.FormatAsHotkey("[" + GameUtil.GetActionString(Integration.BlueprintsCycleBlueprintsPrevAction.GetKAction()) + "]")), Styles_Instruction.Standard);
                    drawer.NewLine(32);

                    drawer.DrawText(string.Format(BlueprintsStrings.STRING_BLUEPRINTS_USE_FOLDERBLUEPRINT, UI.FormatAsHotkey("[" + GameUtil.GetActionString(Integration.BlueprintsCreateFolderAction.GetKAction()) + "]")), Styles_Instruction.Standard);
                    drawer.NewLine(20);

                    drawer.DrawText(string.Format(BlueprintsStrings.STRING_BLUEPRINTS_USE_NAMEBLUEPRINT, UI.FormatAsHotkey("[" + GameUtil.GetActionString(Integration.BlueprintsRenameAction.GetKAction()) + "]")), Styles_Instruction.Standard);
                    drawer.NewLine(20);

                    drawer.DrawText(string.Format(BlueprintsStrings.STRING_BLUEPRINTS_USE_DELETEBLUEPRINT, UI.FormatAsHotkey("[" + GameUtil.GetActionString(Integration.BlueprintsDeleteAction.GetKAction()) + "]")), Styles_Instruction.Standard);

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

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

                else
                {
                    drawer.DrawText(string.Format(BlueprintsStrings.STRING_BLUEPRINTS_USE_FOLDEREMPTY, BlueprintsState.SelectedFolder.Name), Styles_Instruction.Standard);
                }
            }

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

            drawer.EndShadowBar();
            drawer.EndDrawing();
        }