Beispiel #1
0
        void DrawSkinNameText(SkinInfo selectedSkin)
        {
            if (!Main.TextAPI.IsEnabled)
            {
                return;
            }

            PlayerInfo localInfo = Main.Palette.LocalInfo;

            float    scale    = Main.Settings.paletteScale;
            Vector2D labelPos = Main.Settings.paletteScreenPos + new Vector2D(0, 0.06 * 2 * scale); // TODO FIX: needs to move relatively with the scale of the elements below it, but it doesn't...

            if (localInfo.ApplyColor)
            {
                labelPos += new Vector2D(0, 0.08); // this needs fixing too
            }
            const double TextScaleOffset = 1.8;

            if (skinLabel == null)
            {
                skinLabelSB = new StringBuilder(64).Append(selectedSkin.Name);

                skinLabelShadow = new HudAPIv2.HUDMessage(skinLabelSB, labelPos, Scale: TextScaleOffset, HideHud: true, Blend: BlendTypeEnum.PostPP);
                skinLabel       = new HudAPIv2.HUDMessage(skinLabelSB, labelPos, Scale: TextScaleOffset, HideHud: true, Blend: BlendTypeEnum.PostPP);

                skinLabelShadow.InitialColor = Color.Black;
                skinLabel.InitialColor       = Color.White;

                skinLabelUpdate = true;
            }

            if (skinLabelUpdate)
            {
                skinLabelUpdate = false;

                skinLabelSB.Clear().Append(selectedSkin.Name);

                skinLabel.Origin       = labelPos;
                skinLabelShadow.Origin = labelPos;

                skinLabel.Scale       = scale * TextScaleOffset;
                skinLabelShadow.Scale = scale * TextScaleOffset;

                Vector2D textLen = skinLabel.GetTextLength();
                skinLabel.Offset       = new Vector2D(textLen.X * -0.5, 0);                // centered
                skinLabelShadow.Offset = skinLabel.Offset + new Vector2D(0.0015, -0.0015); // centered + small offset
            }

            if (!skinLabelVisible)
            {
                skinLabelVisible        = true;
                skinLabel.Visible       = true;
                skinLabelShadow.Visible = true;
            }

            drawSkinLabel = true;
        }
Beispiel #2
0
            private void UpdateMessage()
            {
                if (Message != null)
                {
                    Vector2D length;

                    hudMessage.Message = Message;
                    length             = hudMessage.GetTextLength();
                    ScaledTextSize     = length;
                    TextSize           = Utilities.Abs(Instance.GetPixelPos(ScaledTextSize));
                    GetAlignmentOffset();
                }
            }
Beispiel #3
0
        void DrawText()
        {
            if (hidden || !Main.TextAPI.IsEnabled)
            {
                return;
            }

            if (text == null)
            {
                text = new HudAPIv2.HUDMessage(new StringBuilder(MyTexts.GetString(Text)), TextPosition, Scale: TextScale, Shadowing: true, Blend: BlendTypeEnum.PostPP);

                Vector2D textSize = text.GetTextLength();
                text.Offset = new Vector2D(-textSize.X, textSize.Y); // pivot top-right
            }

            text.Visible = true;

            // enable input reading for hiding the text
            SetUpdateMethods(UpdateFlags.UPDATE_INPUT, true);
        }
Beispiel #4
0
        private void UpdateLCD()
        {
            if (Background == null)
            {
                Background = new HudAPIv2.BillBoardHUDMessage(
                    MyStringId.GetOrCompute("SquareIgnoreDepth"),
                    Position,
                    BackgroundColorObject,
                    Scale: 1.05, // .05 is for padding
                    HideHud: !NoHideHud,
                    Blend: BlendTypeEnum.PostPP);
            }
            if (Message == null)
            {
                Message = new HudAPIv2.HUDMessage(
                    text,
                    Position,
                    Scale: Scale,
                    HideHud: !NoHideHud,
                    Blend: BlendTypeEnum.PostPP,
                    Font: Font);
            }

            needsUpdate = false;
            textCache   = surface.GetText();
            text.Clear();
            text.Append(ColorObject);
            text.Append(textCache);
            Background.Visible = HasBackground;
            if (HasBackground)
            {
                var ln = Message.GetTextLength();
                Background.Offset = ln / 2d;
                Background.Width  = (float)ln.X;
                Background.Height = (float)ln.Y;
            }
        }
Beispiel #5
0
 private void InitHudElements()
 {
     if (TextAPI == null)
     {
         return;
     }
     if (!TextAPI.Heartbeat)
     {
         return;
     }
     if (HudInit)
     {
         return;
     }
     if (Instructions == null)
     {
         Instructions         = new HudAPIv2.HUDMessage();
         Instructions.Scale   = 1.5d;
         Instructions.Visible = false;
     }
     if (Notification == null)
     {
         Notification         = new HudAPIv2.HUDMessage();
         Notification.Visible = false;
         Notification.Scale   = 1.5d;
         Notification.Origin  = new Vector2D(-0.2, 1.0);
         Notification.Message = CanActivateHud;
         V_CanActivateHud     = Notification.GetTextLength();
         Notification.Message = HudActivated;
         V_HudActivated       = Notification.GetTextLength();
         Instructions.Origin  = Notification.Origin;
         Instructions.Offset  = new Vector2D(0, V_CanActivateHud.Y);
     }
     if (Distance == null)
     {
         Distance         = new HudAPIv2.HUDMessage();
         Distance.Visible = false;
     }
     if (CenterDot == null)
     {
         CenterDot          = new HudAPIv2.BillBoardHUDMessage(WHITEDOT, Vector2D.Zero, Color.Blue);
         CenterDot.Options |= HudAPIv2.Options.Shadowing | HudAPIv2.Options.Fixed;
         CenterDot.Scale    = 0.0012d;
         CenterDot.Visible  = false;
     }
     if (TargetDot == null)
     {
         TargetDot          = new HudAPIv2.BillBoardHUDMessage(WHITEDOT, Vector2D.Zero, Color.Orange);
         TargetDot.Options |= HudAPIv2.Options.Shadowing | HudAPIv2.Options.Fixed;
         TargetDot.Scale    = 0.0012d;
         TargetDot.Visible  = false;
     }
     if (TrackingDot == null)
     {
         TrackingDot          = new HudAPIv2.BillBoardHUDMessage(WHITEDOT, Vector2D.Zero, Color.White);
         TrackingDot.Options |= HudAPIv2.Options.Shadowing | HudAPIv2.Options.Fixed;
         TrackingDot.Scale    = 0.0008d;
         TrackingDot.Visible  = false;
     }
     if (AlignmentDot == null)
     {
         AlignmentDot          = new HudAPIv2.BillBoardHUDMessage(WHITEDOT, Vector2D.Zero, Color.Red);
         AlignmentDot.Options |= HudAPIv2.Options.Shadowing | HudAPIv2.Options.Fixed;
         AlignmentDot.Scale    = 0.0012d;
         AlignmentDot.Visible  = false;
     }
     HudInit = true;
 }