public override void GetSummary(RichText builder, GlyphFormat nameFormat, GlyphFormat valueFormat)
            {
                builder.Add(MyTexts.GetString(MySpaceTexts.TerminalTab_Info_ShipName), nameFormat);
                builder.Add(" ", nameFormat);

                builder.Add(GridName ?? MyTexts.TrySubstitute("None"), valueFormat);
                builder.Add("\n", valueFormat);

                if (GridName != null)
                {
                    var buf = block.textBuffer;

                    builder.Add(MyTexts.GetString(MySpaceTexts.TerminalTab_Info_Blocks), nameFormat);
                    builder.Add(" ", nameFormat);

                    buf.Clear();
                    buf.Append(BlocksBuilt);
                    buf.Append(" / ");
                    buf.Append(TotalBlocks);

                    builder.Add(buf, valueFormat);

                    buf.Clear();
                    buf.Append(" (");
                    buf.AppendFormat("{0:G5}", PctComplete);
                    buf.Append("%)\n");
                    builder.Add(buf, nameFormat);
                }
            }
示例#2
0
            public override void GetSummary(RichText builder, GlyphFormat nameFormat, GlyphFormat valueFormat)
            {
                var buf = block.textBuffer;

                // Fill
                builder.Add(MyTexts.TrySubstitute("Gas"), nameFormat);
                builder.Add(": ", nameFormat);

                builder.Add($"{Fill:G6} / {Capacity:G6} L ", valueFormat);

                buf.Clear();
                buf.Append('(');
                buf.Append(Math.Round(FillRatio * 100d, 2));
                buf.Append("%)\n");
                builder.Add(buf, nameFormat);

                // Stockpile status
                builder.Add(MyTexts.GetString(MySpaceTexts.BlockPropertyTitle_Stockpile), nameFormat);
                builder.Add(": ", nameFormat);

                builder.Add(Stockpile ? MyTexts.GetString(MySpaceTexts.HudInfoOn) : MyTexts.GetString(MySpaceTexts.HudInfoOff), valueFormat);
                builder.Add("\n");

                // Auto refil enabled/disabled
                builder.Add(MyTexts.GetString(MySpaceTexts.BlockPropertyTitle_AutoRefill), nameFormat);
                builder.Add(": ", nameFormat);

                builder.Add(AutoRefillBottles ? MyTexts.GetString(MySpaceTexts.HudInfoOn) : MyTexts.GetString(MySpaceTexts.HudInfoOff), valueFormat);
                builder.Add("\n");
            }
示例#3
0
            public override void GetSummary(RichText builder, GlyphFormat nameFormat, GlyphFormat valueFormat)
            {
                builder.Add(MyTexts.TrySubstitute("Detected"), nameFormat);
                builder.Add(": ", nameFormat);

                builder.Add(MyTexts.TrySubstitute(IsEntityDetected.ToString()), valueFormat);
            }
示例#4
0
            public override void GetSummary(RichText builder, GlyphFormat nameFormat, GlyphFormat valueFormat)
            {
                var buf = block.textBuffer;

                builder.Add(MyTexts.GetString(MySpaceTexts.BlockPropertiesText_Effectiveness), nameFormat);
                builder.Add(" ", nameFormat);

                buf.Clear();
                buf.Append(Math.Round(ThrustEffectiveness * 100f, 2));
                buf.Append("%\n");
                builder.Add(buf, valueFormat);

                builder.Add(MyTexts.GetString(MySpaceTexts.BlockPropertyTitle_ThrustOverride), nameFormat);
                builder.Add(": ", nameFormat);

                if (Override > 0f)
                {
                    buf.Clear();
                    TerminalUtilities.GetForceDisplay(Override * ThrustEffectiveness, buf);
                    buf.Append('\n');

                    builder.Add(buf, valueFormat);
                }
                else
                {
                    builder.Add(MyTexts.TrySubstitute("Disabled"), valueFormat);
                }
            }
示例#5
0
            public override void GetSummary(RichText builder, GlyphFormat nameFormat, GlyphFormat valueFormat)
            {
                builder.Add(MyTexts.TrySubstitute(block.SubtypeId.UsesSubtype(TBlockSubtypes.Suspension) ? "Wheel" : "Head"), nameFormat);
                builder.Add(": ", nameFormat);

                builder.Add(GetLocalizedAttachStatus(), valueFormat);
                builder.Add("\n", valueFormat);
            }
示例#6
0
            public override void GetSummary(RichText builder, GlyphFormat nameFormat, GlyphFormat valueFormat)
            {
                if (IsPowerSink || IsPowerProducer) // not functional, but powered
                {
                    var buf = block.textBuffer;

                    if (functionalBlock != null) // functional w/ measurable power input/output
                    {
                        builder.Add(MyTexts.GetString(MySpaceTexts.BlockPropertyTitle_GyroPower), nameFormat);
                        builder.Add(": ", nameFormat);

                        // Functional status (on/off)
                        builder.Add(MyTexts.GetString(Enabled.Value ? MySpaceTexts.SwitchText_On : MySpaceTexts.SwitchText_Off), valueFormat);
                        builder.Add(" ", valueFormat);

                        // Power input/output
                        buf.Clear();
                        buf.Append('(');
                        GetPowerDisplay(Input, Output, buf);
                        buf.Append(")\n");

                        builder.Add(buf, nameFormat);
                    }
                    else // not functional
                    {
                        builder.Add(MyTexts.GetString(MySpaceTexts.BlockPropertyTitle_GyroPower), nameFormat);
                        builder.Add(": ", nameFormat);

                        buf.Clear();
                        GetPowerDisplay(Input, Output, buf);
                        buf.Append('\n');

                        builder.Add(buf, valueFormat);
                    }

                    // Max in/out
                    builder.Add(MyTexts.TrySubstitute("Max Power"), nameFormat);
                    builder.Add(": ", nameFormat);

                    buf.Clear();
                    GetPowerDisplay(MaxInput, MaxOutput, buf);
                    buf.Append('\n');

                    builder.Add(buf, valueFormat);
                }
                else if (functionalBlock != null) // not a sink or producer, but functional
                {
                    builder.Add(MyTexts.GetString(MySpaceTexts.BlockPropertyTitle_GyroPower), nameFormat);
                    builder.Add(": ", nameFormat);

                    // Functional status (on/off)
                    builder.Add(MyTexts.GetString(Enabled.Value ? MySpaceTexts.SwitchText_On : MySpaceTexts.SwitchText_Off), valueFormat);
                    builder.Add(" \n", valueFormat);
                }
            }
示例#7
0
            /// <summary>
            /// Gets actions for blocks implementing IMyMechanicalConnectionBlock.
            /// </summary>
            public static void GetMechActions(PropertyBlock block, List <BlockMemberBase> members)
            {
                List <IMyTerminalAction> terminalActions = new List <IMyTerminalAction>();

                block.TBlock.GetActions(terminalActions);

                members.Add(GetBlockAction(
                                // Name
                                MyTexts.GetString(MySpaceTexts.BlockActionTitle_Attach),
                                // Status
                                x =>
                {
                    x.Clear();
                    x.Append('(');
                    x.Append(block.MechConnection.GetLocalizedAttachStatus());
                    x.Append(')');
                },
                                block.MechConnection.AttachHead, block));
                members.Add(GetBlockAction(
                                MyTexts.GetString(MySpaceTexts.BlockActionTitle_Detach), null,
                                block.MechConnection.DetachHead, block));

                foreach (IMyTerminalAction tAction in terminalActions)
                {
                    if (tAction.IsEnabled(block.TBlock) && tAction.Id.StartsWith("Add"))
                    {
                        members.Add(GetBlockAction(
                                        MyTexts.TrySubstitute(tAction.Name.ToString()), null,
                                        () => tAction.Apply(block.TBlock), block));
                    }
                }

                if (block.SubtypeId.UsesSubtype(TBlockSubtypes.Piston))
                {
                    members.Add(GetBlockAction(
                                    MyTexts.GetString(MySpaceTexts.BlockActionTitle_Reverse), null,
                                    block.Piston.Reverse, block));
                }
                else if (block.SubtypeId.UsesSubtype(TBlockSubtypes.Rotor))
                {
                    members.Add(GetBlockAction(
                                    MyTexts.GetString(MySpaceTexts.BlockActionTitle_Reverse), null,
                                    block.Rotor.Reverse, block));
                }
            }
示例#8
0
            public override void GetSummary(RichText builder, GlyphFormat nameFormat, GlyphFormat valueFormat)
            {
                var buf = block.textBuffer;

                builder.Add(MyTexts.GetString(MySpaceTexts.TerminalControlPanel_TimerDelay), nameFormat);
                builder.Add(": ", nameFormat);

                buf.Clear();
                buf.Append(Math.Truncate(Delay));
                buf.Append("s\n");
                builder.Add(buf, valueFormat);

                builder.Add(MyTexts.GetString(MySpaceTexts.BlockPropertyTitle_Silent), nameFormat);
                builder.Add(": ", nameFormat);

                builder.Add(MyTexts.TrySubstitute(Silent.ToString()), valueFormat);
                builder.Add("\n", valueFormat);
            }
            public override void GetSummary(RichText builder, GlyphFormat nameFormat, GlyphFormat valueFormat)
            {
                builder.Add(MyTexts.TrySubstitute("Name"), nameFormat);
                builder.Add(": ", nameFormat);

                nameBuilder.Clear();
                nameBuilder.AppendSubstringMax(CustomName, MaxStringLength);
                builder.Add(nameBuilder, valueFormat);
                builder.Add("\n", valueFormat);

                if (groupString.Length > 0)
                {
                    builder.Add(MyTexts.TrySubstitute("Groups"), nameFormat);
                    builder.Add(": ", nameFormat);

                    builder.Add(groupString, valueFormat);
                    builder.Add('\n');
                }
            }
 /// <summary>
 /// Returns antenna status as a localized string.
 /// </summary>
 public string GetLocalizedAntennaStatus() =>
 MyTexts.TrySubstitute(Status.ToString());
示例#11
0
 /// <summary>
 /// Gets actions for blocks implementing IMyDoor.
 /// </summary>
 public static void GetDoorActions(PropertyBlock block, List <BlockMemberBase> members)
 {
     members.Add(GetBlockAction(
                     MyTexts.TrySubstitute("Open / Close"), null,
                     block.Door.ToggleDoor, block));
 }
示例#12
0
 /// <summary>
 /// Returns vent status as a localized string.
 /// </summary>
 public string GetLocalizedVentStatus() =>
 (block.Power.Enabled != null && block.Power.Enabled.Value) ? MyTexts.TrySubstitute(Status.ToString()) : MyTexts.GetString(MySpaceTexts.SwitchText_Off);
 /// <summary>
 /// Returns the jump drive's status as a localized string.
 /// </summary>
 public string GetLocalizedDriveStatus() =>
 (Charge == Capacity && Status == MyJumpDriveStatus.Charging) ? MyTexts.TrySubstitute(MyJumpDriveStatus.Ready.ToString()) : MyTexts.TrySubstitute(Status.ToString());